Commit d4ad4423 by Nilu

force user to set up billing and payment plan.

Fix issue with switching from subscription to PPJ back and forth
parent 3346a749
...@@ -254,4 +254,9 @@ public class HiringTeam extends BaseHiringTeam ...@@ -254,4 +254,9 @@ public class HiringTeam extends BaseHiringTeam
{ {
return CollectionUtils.equals(getPaymentPlan(), paymentPlan); return CollectionUtils.equals(getPaymentPlan(), paymentPlan);
} }
public boolean hasBillingSetup()
{
return getCardID() != null && getIsPPJ() != null && (getIsPPJ() || (!getIsPPJ() && getPaymentPlan() != null));
}
} }
\ No newline at end of file
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
Map<String, String[]> parameterMap = request.getParameterMap(); Map<String, String[]> parameterMap = request.getParameterMap();
Client selectedClient = null; Client selectedClient = null;
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
String clientPage = WebUtils.getSamePageInRenderMode(request, "Page"); String clientPage = WebUtils.getSamePageInRenderMode(request, "Page");
ClientSortOption clientSortOpt = (ClientSortOption) process.getAttribute("ClientSortOption"); ClientSortOption clientSortOpt = (ClientSortOption) process.getAttribute("ClientSortOption");
Client[] clients = (Client[]) process.getAttribute("Clients"); Client[] clients = (Client[]) process.getAttribute("Clients");
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
Map<String, String[]> parameterMap = request.getParameterMap(); Map<String, String[]> parameterMap = request.getParameterMap();
Client selectedClient = null; Client selectedClient = null;
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
String clientPage = WebUtils.getSamePageInRenderMode(request, "Page"); String clientPage = WebUtils.getSamePageInRenderMode(request, "Page");
ClientSortOption clientSortOpt = (ClientSortOption) process.getAttribute("ClientSortOption"); ClientSortOption clientSortOpt = (ClientSortOption) process.getAttribute("ClientSortOption");
Client[] clients = (Client[]) process.getAttribute("Clients"); Client[] clients = (Client[]) process.getAttribute("Clients");
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser); CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
HiringTeam hiringTeam = companyUser.getSelectedTeam(); HiringTeam hiringTeam = companyUser.getSelectedTeam();
if(!hiringTeam.showHasClientSupport()) if(!hiringTeam.showHasClientSupport() || !hiringTeam.hasBillingSetup())
{ {
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request)); response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
} }
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
SearchJob searchJob = (SearchJob) RunSearchExecutorFP.setupExecutor(request, SearchJob.REFERENCE_SearchJob, true); SearchJob searchJob = (SearchJob) RunSearchExecutorFP.setupExecutor(request, SearchJob.REFERENCE_SearchJob, true);
Job[] jobs = (Job[])process.getAttribute("jobs"); Job[] jobs = (Job[])process.getAttribute("jobs");
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
if(jobs == null) if(jobs == null)
{ {
jobs = (Job[]) searchJob.doSearch(); jobs = (Job[]) searchJob.doSearch();
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
PaymentPlan currentPlan = hiringTeam.getPaymentPlan(); PaymentPlan currentPlan = hiringTeam.getPaymentPlan();
boolean hasValidCoupon = hiringTeam.hasValidCoupon(); boolean hasValidCoupon = hiringTeam.hasValidCoupon();
if(!hiringTeam.isPPJ() && currentPlan != null) if(currentPlan != null && hiringTeam.getStripeSubscription() != null)
{ {
subscription = StripeUtils.retrieveSubscription(hiringTeam.getStripeSubscription()); subscription = StripeUtils.retrieveSubscription(hiringTeam.getStripeSubscription());
} }
...@@ -228,7 +228,20 @@ ...@@ -228,7 +228,20 @@
</div> </div>
<% <%
} }
// temp solution. SimpleAssocHandler sets null value for plan as it is not visible in the form when PPJ is selected.
// Problem occurs when shifting from PPJ to Subscription
if(hiringTeam.getPaymentPlan() != null)
{
String paymentPlanKey = WebUtils.getRadioSingleAssocKey(request, hiringTeam, HiringTeam.SINGLEREFERENCE_PaymentPlan);
String paymentPlanId = String.valueOf(hiringTeam.getPaymentPlan().getID().longID());
%>
<input type="radio" name="<%= paymentPlanKey %>" id="<%= paymentPlanId %>" class="hide" value="<%= paymentPlanId %>" checked/>
<%
}
%> %>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12 oneit-radio coupon-applied"> <div class="col-md-12 oneit-radio coupon-applied">
<div class="rectangle-5"> <div class="rectangle-5">
...@@ -277,7 +290,7 @@ ...@@ -277,7 +290,7 @@
<div class="manage-plan-row"> <div class="manage-plan-row">
<div class="radio"> <div class="radio">
<label class="plan-selection"> <label class="plan-selection">
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="IsPPJ" value="false"/> <oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="IsPPJ" value="false" onchange="<%= firstTime ? "return false;" : "changeSubscribe()" %>"/>
</label> </label>
</div> </div>
<oneit:button value=" " name="savePlan" cssClass="hide" id="saveSubscribe" <oneit:button value=" " name="savePlan" cssClass="hide" id="saveSubscribe"
...@@ -451,7 +464,6 @@ ...@@ -451,7 +464,6 @@
{ {
String planKey = WebUtils.getRadioSingleAssocKey(request, hiringTeam, HiringTeam.SINGLEREFERENCE_PaymentPlan); String planKey = WebUtils.getRadioSingleAssocKey(request, hiringTeam, HiringTeam.SINGLEREFERENCE_PaymentPlan);
String planId = String.valueOf(paymentPlan.getID().longID()); String planId = String.valueOf(paymentPlan.getID().longID());
%> %>
<input type="radio" name="<%= planKey %>" id="<%= planId %>" class="level_radio" value="<%= planId %>"/> <input type="radio" name="<%= planKey %>" id="<%= planId %>" class="level_radio" value="<%= planId %>"/>
<label for="<%= planId %>"> <label for="<%= planId %>">
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
Debug.assertion(hiringTeam != null, "Hiring Team is null in admin portal Manage Teammates"); Debug.assertion(hiringTeam != null, "Hiring Team is null in admin portal Manage Teammates");
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
if(inviteTeammate == null) if(inviteTeammate == null)
{ {
inviteTeammate = InviteTeammateNPO.createInviteTeammateNPO(objTran); inviteTeammate = InviteTeammateNPO.createInviteTeammateNPO(objTran);
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
HiringTeam hiringTeam = companyUser.getSelectedTeam(); HiringTeam hiringTeam = companyUser.getSelectedTeam();
SearchHome searchHome = (SearchHome) RunSearchExecutorFP.setupExecutor(request, SearchHome.REFERENCE_SearchHome, true); SearchHome searchHome = (SearchHome) RunSearchExecutorFP.setupExecutor(request, SearchHome.REFERENCE_SearchHome, true);
Job[] allJobs = (Job[])process.getAttribute("allJobs"); Job[] allJobs = (Job[])process.getAttribute("allJobs");
RoleType userRole = companyUser.getRoleForHiringTeam(hiringTeam);
searchHome.setHiringTeam(hiringTeam); searchHome.setHiringTeam(hiringTeam);
searchHome.setCompanyUser(companyUser); searchHome.setCompanyUser(companyUser);
...@@ -74,6 +75,7 @@ ...@@ -74,6 +75,7 @@
String jobsPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "Page").toMap()); String jobsPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "Page").toMap());
boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false; boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false;
boolean canCreateJob = Utils.allowJobCreation(hiringTeam); boolean canCreateJob = Utils.allowJobCreation(hiringTeam);
%> %>
<style> <style>
...@@ -226,15 +228,28 @@ ...@@ -226,15 +228,28 @@
<div class="modal-dialog welcome-pop-top"> <div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup"> <div class="modal-body main-welcome-popup">
<h2>You haven't set up billing yet!</h2> <h2>You haven't set up billing yet!</h2>
<p>Please set up billing details before creating jobs.</p> <%
<div class="create-y-f-job"> if(userRole == RoleType.STANDARD)
<oneit:button value=" " name="gotoPage" skin="link" {
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "Billing").toMap())) %>
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap()) <p>Please contact your Administrator to set up billing</p>
.toMap() %>"> <%
Setup Billing }
</oneit:button> else
</div> {
%>
<p>Please set up billing details before creating jobs.</p>
<div class="create-y-f-job">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "Billing").toMap()))
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
Setup Billing
</oneit:button>
</div>
<%
}
%>
</div> </div>
</div> </div>
</div> </div>
...@@ -251,15 +266,28 @@ ...@@ -251,15 +266,28 @@
<div class="modal-dialog welcome-pop-top"> <div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup"> <div class="modal-body main-welcome-popup">
<h2>You haven't set up a payment plan yet!</h2> <h2>You haven't set up a payment plan yet!</h2>
<p>Please select a payment plan before creating jobs</p> <%
<div class="create-y-f-job"> if(userRole == RoleType.STANDARD)
<oneit:button value=" " name="gotoPage" skin="link" {
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ManagePlan").toMap())) %>
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap()) <p>Please contact your Administrator to set up a plan</p>
.toMap() %>"> <%
Setup Payment Plan }
</oneit:button> else
</div> {
%>
<p>Please select a payment plan before creating jobs</p>
<div class="create-y-f-job">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", companyArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "ManagePlan").toMap()))
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
Setup Payment Plan
</oneit:button>
</div>
<%
}
%>
</div> </div>
</div> </div>
</div> </div>
......
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