Commit 875cd680 by Nilu

PPJ discounts and payments

parent 08b9f5b8
...@@ -25,7 +25,6 @@ import performa.orm.Company; ...@@ -25,7 +25,6 @@ import performa.orm.Company;
import performa.orm.CompanyUser; import performa.orm.CompanyUser;
import performa.orm.HiringTeam; import performa.orm.HiringTeam;
import performa.orm.Job; import performa.orm.Job;
import performa.orm.types.AssessmentType;
import performa.orm.types.JobStatus; import performa.orm.types.JobStatus;
import performa.utils.StripeUtils; import performa.utils.StripeUtils;
...@@ -67,7 +66,7 @@ public class MakePaymentFP extends SaveFP ...@@ -67,7 +66,7 @@ public class MakePaymentFP extends SaveFP
try try
{ {
Map<String, Object> chargeParams = new HashMap<>(); Map<String, Object> chargeParams = new HashMap<>();
chargeParams.put("amount", NullArith.intVal(NullArith.multiply(job.getAssessmentType() == AssessmentType.COMPREHENSIVE ? 499.0 : 399.0, 100, 0d))); chargeParams.put("amount", NullArith.intVal(NullArith.multiply(hiringTeam.getPPJAmount(job), 100, 0d)));
chargeParams.put("currency", "aud"); chargeParams.put("currency", "aud");
chargeParams.put("description", "Charges of creating job"); chargeParams.put("description", "Charges of creating job");
chargeParams.put("customer", hiringTeam.getStripeReference()); chargeParams.put("customer", hiringTeam.getStripeReference());
......
...@@ -12,6 +12,7 @@ import oneit.utils.DateDiff; ...@@ -12,6 +12,7 @@ import oneit.utils.DateDiff;
import oneit.utils.StringUtils; import oneit.utils.StringUtils;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException; import oneit.utils.parsers.FieldException;
import performa.orm.types.AssessmentType;
import performa.utils.StripeUtils; import performa.utils.StripeUtils;
...@@ -177,4 +178,11 @@ public class HiringTeam extends BaseHiringTeam ...@@ -177,4 +178,11 @@ public class HiringTeam extends BaseHiringTeam
return super.getWriteability_ManageOwnBilling(); return super.getWriteability_ManageOwnBilling();
} }
public Double getPPJAmount(Job job)
{
double amount = job != null ? (job.getAssessmentType() == AssessmentType.COMPREHENSIVE ? PaymentPlan.PER_PER_JOB_AMOUNT : PaymentPlan.PER_PER_JOB_EXPRESS) : PaymentPlan.PER_PER_JOB_AMOUNT;
return amount * (getCoupon() != null ? (100 - getCoupon().getPercentageOff()) * 0.01 : 1);
}
} }
\ No newline at end of file
...@@ -6,7 +6,8 @@ import oneit.utils.math.NullArith; ...@@ -6,7 +6,8 @@ import oneit.utils.math.NullArith;
public class PaymentPlan extends BasePaymentPlan public class PaymentPlan extends BasePaymentPlan
{ {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
public static final Double PER_PER_JOB_AMOUNT = 499D; public static final Double PER_PER_JOB_AMOUNT = 385D;
public static final Double PER_PER_JOB_EXPRESS = 285D;
// This constructor should not be called // This constructor should not be called
public PaymentPlan () public PaymentPlan ()
......
...@@ -17,11 +17,8 @@ ...@@ -17,11 +17,8 @@
boolean fromJob = request.getParameter("fromJob") != null ? Boolean.parseBoolean(request.getParameter("fromJob")) : false; boolean fromJob = request.getParameter("fromJob") != null ? Boolean.parseBoolean(request.getParameter("fromJob")) : false;
String nextPage = WebUtils.getSamePageInRenderMode(request, (fromJob ? "Page" : WebUtils.VIEW_APPLICANTS)); String nextPage = WebUtils.getSamePageInRenderMode(request, (fromJob ? "Page" : WebUtils.VIEW_APPLICANTS));
HiringTeam hiringTeam = job.getHiringTeam(); HiringTeam hiringTeam = job.getHiringTeam();
HiringTeam billlingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam(); HiringTeam billingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam();
Integer activeCount = billlingTeam.getUsedCredits();
Integer totCount = billlingTeam.getAvailableCredits();
Integer remCount = (totCount - activeCount) > 0 ? (totCount - activeCount) : 0;
%> %>
<script> <script>
function copyToClipboard() { function copyToClipboard() {
...@@ -76,7 +73,17 @@ ...@@ -76,7 +73,17 @@
<oneit:button value="<%= "Go to Job" + (fromJob ? "s" : "")%>" name="gotoPage" cssClass="btn btn-primary largeBtn" <oneit:button value="<%= "Go to Job" + (fromJob ? "s" : "")%>" name="gotoPage" cssClass="btn btn-primary largeBtn"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>'/> requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>'/>
</div> </div>
<div class="space-55">You have <%= remCount %> jobs remaining for this month.</div> <%
if(!billingTeam.isTrue(hiringTeam.getIsPPJ()))
{
Integer activeCount = billingTeam.getUsedCredits();
Integer totCount = billingTeam.getAvailableCredits();
Integer remCount = (totCount - activeCount) > 0 ? (totCount - activeCount) : 0;
%>
<div class="space-55">You have <%= remCount %> jobs remaining for this month.</div>
<%
}
%>
</div> </div>
<div class="job-desc-box"> <div class="job-desc-box">
......
...@@ -364,7 +364,10 @@ ...@@ -364,7 +364,10 @@
{ {
%> %>
<oneit:button value="Open this Job" name="savePayment" cssClass="btn btn-primary btn-green top-margin-25 largeBtn" <oneit:button value="Open this Job" name="savePayment" cssClass="btn btn-primary btn-green top-margin-25 largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", sharingPage).toMap() %>" /> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", sharingPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
.toMap() %>" />
<% <%
} }
else if(billlingTeam.canCreateJob()) else if(billlingTeam.canCreateJob())
......
...@@ -168,11 +168,18 @@ ...@@ -168,11 +168,18 @@
</div> </div>
<div class="manage-plan-payplan"> <div class="manage-plan-payplan">
<div class="per-job-amount"> <div class="per-job-amount">
<oneit:toString value="<%= PaymentPlan.PER_PER_JOB_AMOUNT %>" mode="CurrencyDollarsOnly"/>/ Job <oneit:toString value="<%= hiringTeam.getPPJAmount(null) %>" mode="CurrencyDollarsOnly"/>/ Job
</div>
<div class="per-job-amount-past">
was <oneit:toString value="<%= PaymentPlan.PER_PER_JOB_AMOUNT %>" mode="CurrencyDollarsOnly"/> per job
</div> </div>
<%
if(hasValidCoupon)
{
%>
<div class="per-job-amount-past">
was <oneit:toString value="<%= PaymentPlan.PER_PER_JOB_AMOUNT %>" mode="CurrencyDollarsOnly"/> per job
</div>
<%
}
%>
</div> </div>
<div class="clearboth"></div> <div class="clearboth"></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