Commit 5e134039 by Nilu

S30819045 # Client - Incoming Issues (raised by Client) #Errors occurred

parent 5f4ccb8b
...@@ -32,6 +32,7 @@ public class ApplyCouponFP extends SaveFP ...@@ -32,6 +32,7 @@ public class ApplyCouponFP extends SaveFP
HttpServletRequest request = submission.getRequest(); HttpServletRequest request = submission.getRequest();
ObjectTransaction objTran = process.getTransaction(); ObjectTransaction objTran = process.getTransaction();
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam"); HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
Boolean firstTime = request.getAttribute("firstTime") != null ? (Boolean) request.getAttribute("firstTime") : Boolean.FALSE;
LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1, "Inside ApplyCouponFP for ", hiringTeam ); LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1, "Inside ApplyCouponFP for ", hiringTeam );
...@@ -41,6 +42,11 @@ public class ApplyCouponFP extends SaveFP ...@@ -41,6 +42,11 @@ public class ApplyCouponFP extends SaveFP
return RedisplayResult.getInstance(); return RedisplayResult.getInstance();
} }
if(firstTime && hiringTeam.isTrue(hiringTeam.getIsPPJ()))
{
hiringTeam.setIsPPJ(null);
}
Coupon coupon = StripeUtils.retrieveCoupon(hiringTeam.getCouponCode()); Coupon coupon = StripeUtils.retrieveCoupon(hiringTeam.getCouponCode());
StripeCoupon[] stripeCoupons = StripeCoupon.SearchByAll() StripeCoupon[] stripeCoupons = StripeCoupon.SearchByAll()
.andCouponCode(new EqualsFilter<>(hiringTeam.getCouponCode())) .andCouponCode(new EqualsFilter<>(hiringTeam.getCouponCode()))
......
...@@ -56,7 +56,7 @@ public class SaveCompanyFP extends SaveFP ...@@ -56,7 +56,7 @@ public class SaveCompanyFP extends SaveFP
} }
else else
{ {
if(hiringTeam.getPaymentPlan() != null) if(hiringTeam.getPaymentPlan() != null && subscription != null)
{ {
StripeUtils.cancelSubscription(subscription, true); StripeUtils.cancelSubscription(subscription, true);
......
...@@ -67,6 +67,15 @@ public class SavePaymentPlanFP extends SaveFP ...@@ -67,6 +67,15 @@ public class SavePaymentPlanFP extends SaveFP
} }
} }
// Payment plan value might get set if apply coupon button is clicked after selecting a plan, and before saving plan.
// After that if PPJ is selected, need to reset plan to null - as no subscription is made at this point - S30819045
if(hiringTeam.isTrue(hiringTeam.getIsPPJ()) && subscription == null && hiringTeam.getPaymentPlan() != null)
{
hiringTeam.setPaymentPlan(null);
hiringTeam.setMaxCap(0);
hiringTeam.setHasCap(false);
}
// When Subscribe and Save selected // When Subscribe and Save selected
if(CollectionUtils.equals(hiringTeam.getIsPPJ(), Boolean.FALSE) && (firstTime || savePlan)) if(CollectionUtils.equals(hiringTeam.getIsPPJ(), Boolean.FALSE) && (firstTime || savePlan))
{ {
......
...@@ -164,7 +164,7 @@ public class HiringTeam extends BaseHiringTeam ...@@ -164,7 +164,7 @@ public class HiringTeam extends BaseHiringTeam
{ {
if(getManageOwnBilling()) if(getManageOwnBilling())
{ {
return getPaymentPlan() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits())); return getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits()));
} }
return getBilledByTeam().canCreateJob(); return getBilledByTeam().canCreateJob();
...@@ -265,7 +265,7 @@ public class HiringTeam extends BaseHiringTeam ...@@ -265,7 +265,7 @@ public class HiringTeam extends BaseHiringTeam
{ {
if(getManageOwnBilling()) if(getManageOwnBilling())
{ {
return getCardID() != null && getIsPPJ() != null && (getIsPPJ() || (!getIsPPJ() && getPaymentPlan() != null)); return getCardID() != null && getIsPPJ() != null && (getIsPPJ() || (!getIsPPJ() && getPaymentPlan() != null && getStripeSubscription() != null));
} }
return getBilledByTeam().hasBillingSetup(); return getBilledByTeam().hasBillingSetup();
...@@ -276,7 +276,7 @@ public class HiringTeam extends BaseHiringTeam ...@@ -276,7 +276,7 @@ public class HiringTeam extends BaseHiringTeam
{ {
if(getManageOwnBilling()) if(getManageOwnBilling())
{ {
return isTrue(isPPJ()) || ( isFalse(isPPJ()) && getPaymentPlan() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits()))); return isTrue(isPPJ()) || ( isFalse(isPPJ()) && getPaymentPlan() != null && getStripeSubscription() != null && (getAvailableCredits() > getUsedCredits() || !getHasCap() || (getHasCap() && getMaxCap() > getUsedCredits())));
} }
return getBilledByTeam().allowJobCreation(); return getBilledByTeam().allowJobCreation();
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company"); Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page"); String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page");
String nextPage = WebUtils.getSamePageInRenderMode(request, (hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getPaymentPlan() == null)) ? "ManagePlan" : "Billing"); String nextPage = WebUtils.getSamePageInRenderMode(request, (hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getStripeSubscription() == null)) ? "ManagePlan" : "Billing");
String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard"); String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard");
%> %>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<% <%
RoleType userRole = companyUser.getRoleForHiringTeam(hiringTeam); RoleType userRole = companyUser.getRoleForHiringTeam(hiringTeam);
if((hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getPaymentPlan() == null) || isAssumedUser) && hiringTeam.getManageOwnBilling()) if((hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getStripeSubscription() == null) || isAssumedUser) && hiringTeam.getManageOwnBilling())
{ {
%> %>
<li class="<%= tabNumber == "2" ? "active" : ""%>"> <li class="<%= tabNumber == "2" ? "active" : ""%>">
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<h1 class="page-title">Review Job <h1 class="page-title">Review Job
<% <%
if(billingTeam.getPaymentPlan() != null) if(billingTeam.getStripeSubscription() != null && billingTeam.getPaymentPlan() != null)
{ {
Integer activeCount = billingTeam.getUsedCredits(); Integer activeCount = billingTeam.getUsedCredits();
Integer totCount = billingTeam.getAvailableCredits(); Integer totCount = billingTeam.getAvailableCredits();
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
} }
String currencyFormat = Utils.getCurrencyFormat(hiringTeam); String currencyFormat = Utils.getCurrencyFormat(hiringTeam);
boolean firstTime = hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getPaymentPlan() == null); boolean firstTime = hiringTeam.getIsPPJ() == null || (!hiringTeam.getIsPPJ() && hiringTeam.getStripeSubscription() == null);
String samePage = WebUtils.getSamePageInRenderMode(request, "ManagePlan"); String samePage = WebUtils.getSamePageInRenderMode(request, "ManagePlan");
String nextPage = firstTime ? homePage : samePage; String nextPage = firstTime ? homePage : samePage;
%> %>
...@@ -198,6 +198,7 @@ ...@@ -198,6 +198,7 @@
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="CouponCode" placeholder="Coupon Code" cssClass="form-control" /> <oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="CouponCode" placeholder="Coupon Code" cssClass="form-control" />
<oneit:button value="APPLY" name="applyCoupon" cssClass="btn btn-input-inside" <oneit:button value="APPLY" name="applyCoupon" cssClass="btn btn-input-inside"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", samePage) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", samePage)
.mapEntry ("firstTime", firstTime)
.mapEntry ("restartProcess", Boolean.TRUE) .mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap()) .mapEntry ("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam")) .mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
...@@ -379,7 +380,7 @@ ...@@ -379,7 +380,7 @@
<oneit:button skin="link" value=" " name="savePlan" cssClass="btn select-btn" style="display:none;" <oneit:button skin="link" value=" " name="savePlan" cssClass="btn select-btn" style="display:none;"
requestAttribs="<%= CollectionUtils.EMPTY_MAP%>" /> requestAttribs="<%= CollectionUtils.EMPTY_MAP%>" />
<% <%
if(isSelectedPlan) if(isSelectedPlan && hiringTeam.getStripeSubscription() != null)
{ {
%> %>
<span class="btn active-btn">Active</span> <span class="btn active-btn">Active</span>
......
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
<% <%
} }
else if(billingTeam.getIsPPJ() == null || (!billingTeam.getIsPPJ() && billingTeam.getPaymentPlan() == null)) else if(billingTeam.getIsPPJ() == null || (!billingTeam.getIsPPJ() && billingTeam.getStripeSubscription() == null))
{ {
%> %>
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
else else
{ {
%> %>
<p>Please select a payment plan before creating jobs</p> <p>Please <%= billingTeam.getPaymentPlan() == null ? "select a" : "save your"%> payment plan before creating jobs</p>
<div class="create-y-f-job"> <div class="create-y-f-job">
<oneit:button value=" " name="gotoPage" skin="link" <oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ManagePlan").toMap())) requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ManagePlan").toMap()))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment