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
{
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 @@
Map<String, String[]> parameterMap = request.getParameterMap();
Client selectedClient = null;
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
String clientPage = WebUtils.getSamePageInRenderMode(request, "Page");
ClientSortOption clientSortOpt = (ClientSortOption) process.getAttribute("ClientSortOption");
Client[] clients = (Client[]) process.getAttribute("Clients");
......
......@@ -13,6 +13,11 @@
Map<String, String[]> parameterMap = request.getParameterMap();
Client selectedClient = null;
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
String clientPage = WebUtils.getSamePageInRenderMode(request, "Page");
ClientSortOption clientSortOpt = (ClientSortOption) process.getAttribute("ClientSortOption");
Client[] clients = (Client[]) process.getAttribute("Clients");
......
......@@ -11,7 +11,7 @@
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
HiringTeam hiringTeam = companyUser.getSelectedTeam();
if(!hiringTeam.showHasClientSupport())
if(!hiringTeam.showHasClientSupport() || !hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
......
......@@ -21,6 +21,11 @@
SearchJob searchJob = (SearchJob) RunSearchExecutorFP.setupExecutor(request, SearchJob.REFERENCE_SearchJob, true);
Job[] jobs = (Job[])process.getAttribute("jobs");
if(!hiringTeam.hasBillingSetup())
{
response.sendRedirect(WebUtils.getArticleByShortCut(transaction, WebUtils.ADMIN_HOME).getLink(request));
}
if(jobs == null)
{
jobs = (Job[]) searchJob.doSearch();
......
......@@ -32,7 +32,7 @@
PaymentPlan currentPlan = hiringTeam.getPaymentPlan();
boolean hasValidCoupon = hiringTeam.hasValidCoupon();
if(!hiringTeam.isPPJ() && currentPlan != null)
if(currentPlan != null && hiringTeam.getStripeSubscription() != null)
{
subscription = StripeUtils.retrieveSubscription(hiringTeam.getStripeSubscription());
}
......@@ -228,7 +228,20 @@
</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="col-md-12 oneit-radio coupon-applied">
<div class="rectangle-5">
......@@ -277,7 +290,7 @@
<div class="manage-plan-row">
<div class="radio">
<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>
</div>
<oneit:button value=" " name="savePlan" cssClass="hide" id="saveSubscribe"
......@@ -451,7 +464,6 @@
{
String planKey = WebUtils.getRadioSingleAssocKey(request, hiringTeam, HiringTeam.SINGLEREFERENCE_PaymentPlan);
String planId = String.valueOf(paymentPlan.getID().longID());
%>
<input type="radio" name="<%= planKey %>" id="<%= planId %>" class="level_radio" value="<%= planId %>"/>
<label for="<%= planId %>">
......
......@@ -24,6 +24,11 @@
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)
{
inviteTeammate = InviteTeammateNPO.createInviteTeammateNPO(objTran);
......
......@@ -48,6 +48,7 @@
HiringTeam hiringTeam = companyUser.getSelectedTeam();
SearchHome searchHome = (SearchHome) RunSearchExecutorFP.setupExecutor(request, SearchHome.REFERENCE_SearchHome, true);
Job[] allJobs = (Job[])process.getAttribute("allJobs");
RoleType userRole = companyUser.getRoleForHiringTeam(hiringTeam);
searchHome.setHiringTeam(hiringTeam);
searchHome.setCompanyUser(companyUser);
......@@ -74,6 +75,7 @@
String jobsPage = jobsArticle.getLink(request, CollectionUtils.mapEntry("cms.rm", "Page").toMap());
boolean firstTime = request.getParameter("firstTime") != null ? Boolean.parseBoolean(request.getParameter("firstTime")) : false;
boolean canCreateJob = Utils.allowJobCreation(hiringTeam);
%>
<style>
......@@ -226,15 +228,28 @@
<div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup">
<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">
<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>
<%
if(userRole == RoleType.STANDARD)
{
%>
<p>Please contact your Administrator to set up billing</p>
<%
}
else
{
%>
<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>
......@@ -251,15 +266,28 @@
<div class="modal-dialog welcome-pop-top">
<div class="modal-body main-welcome-popup">
<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">
<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>
<%
if(userRole == RoleType.STANDARD)
{
%>
<p>Please contact your Administrator to set up a plan</p>
<%
}
else
{
%>
<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>
......
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