@hmcts/ccpay-web-component 6.2.1-beta01 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/case-transactions/case-transactions.component.mjs +42 -4
- package/fesm2022/hmcts-ccpay-web-component.mjs +40 -2
- package/fesm2022/hmcts-ccpay-web-component.mjs.map +1 -1
- package/lib/components/case-transactions/case-transactions.component.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2152,6 +2152,9 @@ class CaseTransactionsComponent {
|
|
|
2152
2152
|
this.calculateAmounts();
|
|
2153
2153
|
this.calculateOrderFeesAmounts();
|
|
2154
2154
|
this.calculateRefundAmount();
|
|
2155
|
+
this.calculateAmountDueTo();
|
|
2156
|
+
this.calculateOverpayment();
|
|
2157
|
+
this.validateAmountDueTo();
|
|
2155
2158
|
if (this.isFromServiceRequestPage) {
|
|
2156
2159
|
this.OrderslistService.getSelectedOrderRefId().subscribe((data) => this.orderRef = data);
|
|
2157
2160
|
this.goToOrderViewDetailSection(this.orderRef);
|
|
@@ -2176,6 +2179,9 @@ class CaseTransactionsComponent {
|
|
|
2176
2179
|
this.paymentGroups = paymentGroups['payment_groups'];
|
|
2177
2180
|
this.calculateAmounts();
|
|
2178
2181
|
this.calculateOrderFeesAmounts();
|
|
2182
|
+
this.calculateAmountDueTo();
|
|
2183
|
+
this.calculateOverpayment();
|
|
2184
|
+
this.validateAmountDueTo();
|
|
2179
2185
|
this.totalRefundAmount = this.calculateRefundAmount();
|
|
2180
2186
|
this.paymentViewService.getPartyDetails(this.ccdCaseNumber).subscribe(response => {
|
|
2181
2187
|
this.cpoDetails = JSON.parse(response).content;
|
|
@@ -2452,6 +2458,40 @@ class CaseTransactionsComponent {
|
|
|
2452
2458
|
this.totalRemissions = remissionsTotal;
|
|
2453
2459
|
});
|
|
2454
2460
|
}
|
|
2461
|
+
isThereRemissions() {
|
|
2462
|
+
let result = false;
|
|
2463
|
+
this.paymentGroups.forEach(paymentGroup => {
|
|
2464
|
+
if (paymentGroup.remissions != null && paymentGroup.remissions.length > 0) {
|
|
2465
|
+
result = true;
|
|
2466
|
+
}
|
|
2467
|
+
});
|
|
2468
|
+
return result;
|
|
2469
|
+
}
|
|
2470
|
+
calculateOverpayment() {
|
|
2471
|
+
if (this.isThereRemissions()) {
|
|
2472
|
+
let newValue = this.totalPayments - (this.orderFeesTotal - this.totalRemissions);
|
|
2473
|
+
if (newValue > 0) {
|
|
2474
|
+
this.overPaymentAmount = newValue;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
calculateAmountDueTo() {
|
|
2479
|
+
if (this.isThereRemissions()) {
|
|
2480
|
+
let newValue = this.totalPayments - (this.orderFeesTotal - this.totalRemissions);
|
|
2481
|
+
if (newValue <= 0) {
|
|
2482
|
+
this.clAmountDue = Math.abs(newValue);
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
validateAmountDueTo() {
|
|
2487
|
+
// if there is an overPayment there is not need to add due to amount.
|
|
2488
|
+
if (this.overPaymentAmount > 0) {
|
|
2489
|
+
this.clAmountDue = 0;
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
canItCalculateAmountDueForRemission() {
|
|
2493
|
+
return (this.overPaymentAmount < 0);
|
|
2494
|
+
}
|
|
2455
2495
|
calculateRefundAmount() {
|
|
2456
2496
|
if (!this.isTurnOff) {
|
|
2457
2497
|
let isNewPaymentGroup = false;
|
|
@@ -2707,7 +2747,6 @@ class CaseTransactionsComponent {
|
|
|
2707
2747
|
else {
|
|
2708
2748
|
return false;
|
|
2709
2749
|
}
|
|
2710
|
-
;
|
|
2711
2750
|
}
|
|
2712
2751
|
}
|
|
2713
2752
|
chkIssueRefundBtnEnable(payment) {
|
|
@@ -2745,7 +2784,6 @@ class CaseTransactionsComponent {
|
|
|
2745
2784
|
else {
|
|
2746
2785
|
return false;
|
|
2747
2786
|
}
|
|
2748
|
-
;
|
|
2749
2787
|
}
|
|
2750
2788
|
}
|
|
2751
2789
|
check4AllowedRoles2AccessRefund = () => {
|