Commit 875cd680 by Nilu

PPJ discounts and payments

parent 08b9f5b8
......@@ -25,7 +25,6 @@ import performa.orm.Company;
import performa.orm.CompanyUser;
import performa.orm.HiringTeam;
import performa.orm.Job;
import performa.orm.types.AssessmentType;
import performa.orm.types.JobStatus;
import performa.utils.StripeUtils;
......@@ -67,7 +66,7 @@ public class MakePaymentFP extends SaveFP
try
{
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("description", "Charges of creating job");
chargeParams.put("customer", hiringTeam.getStripeReference());
......
......@@ -12,6 +12,7 @@ import oneit.utils.DateDiff;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException;
import performa.orm.types.AssessmentType;
import performa.utils.StripeUtils;
......@@ -177,4 +178,11 @@ public class HiringTeam extends BaseHiringTeam
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;
public class PaymentPlan extends BasePaymentPlan
{
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
public PaymentPlan ()
......
......@@ -18,10 +18,7 @@
String nextPage = WebUtils.getSamePageInRenderMode(request, (fromJob ? "Page" : WebUtils.VIEW_APPLICANTS));
HiringTeam hiringTeam = job.getHiringTeam();
HiringTeam billlingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam();
Integer activeCount = billlingTeam.getUsedCredits();
Integer totCount = billlingTeam.getAvailableCredits();
Integer remCount = (totCount - activeCount) > 0 ? (totCount - activeCount) : 0;
HiringTeam billingTeam = hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam();
%>
<script>
function copyToClipboard() {
......@@ -76,7 +73,17 @@
<oneit:button value="<%= "Go to Job" + (fromJob ? "s" : "")%>" name="gotoPage" cssClass="btn btn-primary largeBtn"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>'/>
</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 class="job-desc-box">
......
......@@ -364,7 +364,10 @@
{
%>
<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())
......
......@@ -168,11 +168,18 @@
</div>
<div class="manage-plan-payplan">
<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>
<%
if(hasValidCoupon)
{
%>
<div class="per-job-amount-past">
was <oneit:toString value="<%= PaymentPlan.PER_PER_JOB_AMOUNT %>" mode="CurrencyDollarsOnly"/> per job
</div>
<%
}
%>
</div>
<div class="clearboth"></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