@hmcts/ccpay-web-component 6.2.3-beta5 → 6.2.3-beta6
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/add-remission/add-remission.component.mjs +2 -2
- package/esm2022/lib/components/case-transactions/case-transactions.component.mjs +6 -6
- package/esm2022/lib/components/payment-view/payment-view.component.mjs +18 -17
- package/esm2022/lib/components/service-request/service-request.component.mjs +18 -17
- package/esm2022/lib/payment-lib.component.mjs +2 -2
- package/fesm2022/hmcts-ccpay-web-component.mjs +41 -39
- package/fesm2022/hmcts-ccpay-web-component.mjs.map +1 -1
- package/lib/components/payment-view/payment-view.component.d.ts +1 -2
- package/lib/components/service-request/service-request.component.d.ts +1 -2
- package/lib/payment-lib.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2256,7 +2256,7 @@ class CaseTransactionsComponent {
|
|
|
2256
2256
|
paymentGroup.fees.forEach(fee => {
|
|
2257
2257
|
this.orderFeesTotal = this.orderFeesTotal + fee.calculated_amount;
|
|
2258
2258
|
this.overPaymentAmount = this.overPaymentAmount + fee.over_payment;
|
|
2259
|
-
this.paymentLibComponent.
|
|
2259
|
+
this.paymentLibComponent.overPaymentAmount = this.overPaymentAmount;
|
|
2260
2260
|
});
|
|
2261
2261
|
}
|
|
2262
2262
|
if (paymentGroup.remissions) {
|
|
@@ -2269,7 +2269,7 @@ class CaseTransactionsComponent {
|
|
|
2269
2269
|
paymentGroup.payments.forEach(payment => {
|
|
2270
2270
|
if (isFeeOverPaymentExist) {
|
|
2271
2271
|
this.overPaymentAmount = this.overPaymentAmount + payment.over_payment;
|
|
2272
|
-
this.paymentLibComponent.
|
|
2272
|
+
this.paymentLibComponent.overPaymentAmount = this.overPaymentAmount;
|
|
2273
2273
|
}
|
|
2274
2274
|
if (payment.status.toUpperCase() === 'SUCCESS') {
|
|
2275
2275
|
this.orderTotalPayments = this.orderTotalPayments + payment.amount;
|
|
@@ -2461,7 +2461,7 @@ class CaseTransactionsComponent {
|
|
|
2461
2461
|
let newValue = this.totalPayments - (this.orderFeesTotal - this.totalRemissions);
|
|
2462
2462
|
if (newValue > 0) {
|
|
2463
2463
|
this.overPaymentAmount = newValue;
|
|
2464
|
-
this.paymentLibComponent.
|
|
2464
|
+
this.paymentLibComponent.overPaymentAmount = this.overPaymentAmount;
|
|
2465
2465
|
}
|
|
2466
2466
|
}
|
|
2467
2467
|
}
|
|
@@ -2493,7 +2493,7 @@ class CaseTransactionsComponent {
|
|
|
2493
2493
|
this.overPaymentAmount = newValue;
|
|
2494
2494
|
}
|
|
2495
2495
|
}
|
|
2496
|
-
this.paymentLibComponent.
|
|
2496
|
+
this.paymentLibComponent.overPaymentAmount = this.overPaymentAmount;
|
|
2497
2497
|
});
|
|
2498
2498
|
}
|
|
2499
2499
|
});
|
|
@@ -2666,7 +2666,7 @@ class CaseTransactionsComponent {
|
|
|
2666
2666
|
this.paymentLibComponent.paymentReference = paymentGroup.paymentReference;
|
|
2667
2667
|
this.paymentLibComponent.viewName = 'payment-view';
|
|
2668
2668
|
this.paymentLibComponent.paymentGroup = this.paymentGroup;
|
|
2669
|
-
this.paymentLibComponent.
|
|
2669
|
+
this.paymentLibComponent.overPaymentAmount = this.overPaymentAmount;
|
|
2670
2670
|
}
|
|
2671
2671
|
goToPayementView(paymentGroupReference, paymentReference, paymentMethod) {
|
|
2672
2672
|
this.goToPaymentViewComponent({ paymentGroupReference, paymentReference, paymentMethod });
|
|
@@ -3047,25 +3047,25 @@ class ServiceRequestComponent {
|
|
|
3047
3047
|
if (this.chkIsIssueRefundBtnEnable(payment)) {
|
|
3048
3048
|
this.paymentViewService.getApportionPaymentDetails(payment.reference).subscribe(paymentGroup => {
|
|
3049
3049
|
paymentGroup.payments = paymentGroup.payments.filter(paymentGroupObj => paymentGroupObj['reference'].includes(payment.reference));
|
|
3050
|
-
// No refund and no over payment
|
|
3050
|
+
// No refund and no over payment --> showIssueRefundPage()
|
|
3051
3051
|
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
3052
3052
|
this.showIssueRefundPage(paymentGroup, payment);
|
|
3053
3053
|
return;
|
|
3054
3054
|
}
|
|
3055
|
-
// No refund and over payment
|
|
3055
|
+
// No refund and over payment --> showOverPayment()
|
|
3056
3056
|
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
3057
3057
|
this.showOverPayment(paymentGroup, payment);
|
|
3058
3058
|
return;
|
|
3059
3059
|
}
|
|
3060
|
-
// Refunds
|
|
3060
|
+
// Refunds > 0 and overPayment == 0 ---> refunds accepted. showIssueRefundPage()
|
|
3061
3061
|
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
3062
3062
|
this.showIssueRefundPage(paymentGroup, payment);
|
|
3063
3063
|
return;
|
|
3064
3064
|
}
|
|
3065
|
-
// Refunds
|
|
3065
|
+
// Refunds > 0 and overPayment > 0 --> refunds in process or Rejected.
|
|
3066
3066
|
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
3067
|
-
|
|
3068
|
-
if (
|
|
3067
|
+
// rejected by fee refunds === refunds by fee it means that refund for the current fee is rejected.
|
|
3068
|
+
if (this.isTheCurrentRefundRejectedForTheFee(paymentGroup.fees.at(0).id.toString())) {
|
|
3069
3069
|
this.showOverPayment(paymentGroup, payment);
|
|
3070
3070
|
return;
|
|
3071
3071
|
}
|
|
@@ -3077,6 +3077,15 @@ class ServiceRequestComponent {
|
|
|
3077
3077
|
}
|
|
3078
3078
|
}
|
|
3079
3079
|
}
|
|
3080
|
+
isTheCurrentRefundRejectedForTheFee(feeCode) {
|
|
3081
|
+
let refundsByFee = this.paymentLibComponent.refunds.filter(refund => refund.fee_ids === feeCode);
|
|
3082
|
+
let refundsByFeeAndRejected = this.paymentLibComponent.refunds.filter(refund => refund.refund_status.name === 'Rejected');
|
|
3083
|
+
// Refunds > 0 and overPayment --> refunds in process or Rejected.
|
|
3084
|
+
if (refundsByFee.length === refundsByFeeAndRejected.length) {
|
|
3085
|
+
return true;
|
|
3086
|
+
}
|
|
3087
|
+
return false;
|
|
3088
|
+
}
|
|
3080
3089
|
isAnyRefundsForThisCase() {
|
|
3081
3090
|
return (this.paymentLibComponent.refunds != null) && (this.paymentLibComponent.refunds.length > 0);
|
|
3082
3091
|
}
|
|
@@ -3101,15 +3110,7 @@ class ServiceRequestComponent {
|
|
|
3101
3110
|
this.isFromServiceRequestPage = false;
|
|
3102
3111
|
}
|
|
3103
3112
|
getBalanceToBePaid() {
|
|
3104
|
-
return this.paymentLibComponent.
|
|
3105
|
-
}
|
|
3106
|
-
getRefundByFeeID(feeCode) {
|
|
3107
|
-
for (const refund of this.paymentLibComponent.refunds) {
|
|
3108
|
-
if (refund.fee_ids === feeCode) {
|
|
3109
|
-
return refund;
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
|
-
return null;
|
|
3113
|
+
return this.paymentLibComponent.overPaymentAmount;
|
|
3113
3114
|
}
|
|
3114
3115
|
goToPayementView(paymentGroupReference, paymentReference, paymentMethod) {
|
|
3115
3116
|
this.goToPaymentViewComponent({ paymentGroupReference, paymentReference, paymentMethod });
|
|
@@ -3252,7 +3253,7 @@ class ServiceRequestComponent {
|
|
|
3252
3253
|
this.paymentGroupList.fees.forEach(fee => {
|
|
3253
3254
|
feesOverPayment += fee.over_payment;
|
|
3254
3255
|
});
|
|
3255
|
-
return feesOverPayment > 0 ? feesOverPayment : this.paymentLibComponent.
|
|
3256
|
+
return feesOverPayment > 0 ? feesOverPayment : this.paymentLibComponent.overPaymentAmount;
|
|
3256
3257
|
}
|
|
3257
3258
|
getTemplateInstructionType(payment) {
|
|
3258
3259
|
if (payment == undefined || payment == null) {
|
|
@@ -4410,7 +4411,7 @@ class AddRemissionComponent {
|
|
|
4410
4411
|
return remission.overall_balance.toString();
|
|
4411
4412
|
}
|
|
4412
4413
|
else {
|
|
4413
|
-
return this.paymentLibComponent.
|
|
4414
|
+
return this.paymentLibComponent.overPaymentAmount.toString();
|
|
4414
4415
|
}
|
|
4415
4416
|
}
|
|
4416
4417
|
return "undefined";
|
|
@@ -4707,7 +4708,7 @@ class PaymentViewComponent {
|
|
|
4707
4708
|
this.paymentGroup.fees.forEach(fee => {
|
|
4708
4709
|
feesOverPayment += fee.over_payment;
|
|
4709
4710
|
});
|
|
4710
|
-
return feesOverPayment > 0 ? feesOverPayment : this.paymentLibComponent.
|
|
4711
|
+
return feesOverPayment > 0 ? feesOverPayment : this.paymentLibComponent.overPaymentAmount;
|
|
4711
4712
|
}
|
|
4712
4713
|
goToServiceRequestPage() {
|
|
4713
4714
|
this.paymentLibComponent.viewName = 'case-transactions';
|
|
@@ -4815,25 +4816,25 @@ class PaymentViewComponent {
|
|
|
4815
4816
|
issueRefund(paymentgrp) {
|
|
4816
4817
|
if (paymentgrp !== null && paymentgrp !== undefined) {
|
|
4817
4818
|
if (this.chkIsIssueRefundBtnEnable(paymentgrp.payments[0])) {
|
|
4818
|
-
// No refund and no over payment
|
|
4819
|
+
// No refund and no over payment --> showIssueRefundPage()
|
|
4819
4820
|
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
4820
4821
|
this.showIssueRefundPage(paymentgrp);
|
|
4821
4822
|
return;
|
|
4822
4823
|
}
|
|
4823
|
-
// No refund and over payment
|
|
4824
|
+
// No refund and over payment --> showOverPayment()
|
|
4824
4825
|
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
4825
4826
|
this.showOverPayment();
|
|
4826
4827
|
return;
|
|
4827
4828
|
}
|
|
4828
|
-
// Refunds
|
|
4829
|
+
// Refunds > 0 and overPayment == 0 ---> refunds accepted. showIssueRefundPage(s)
|
|
4829
4830
|
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
4830
4831
|
this.showIssueRefundPage(paymentgrp);
|
|
4831
4832
|
return;
|
|
4832
4833
|
}
|
|
4833
|
-
// Refunds
|
|
4834
|
+
// Refunds > 0 and overPayment > 0 --> refunds in process or Rejected.
|
|
4834
4835
|
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
4835
|
-
|
|
4836
|
-
if (
|
|
4836
|
+
// rejected by fee refunds === refunds by fee it means that refund for the current fee is rejected.
|
|
4837
|
+
if (this.isTheCurrentRefundRejectedForTheFee(this.paymentFees.at(0).id.toString())) {
|
|
4837
4838
|
this.showOverPayment();
|
|
4838
4839
|
return;
|
|
4839
4840
|
}
|
|
@@ -4844,6 +4845,15 @@ class PaymentViewComponent {
|
|
|
4844
4845
|
}
|
|
4845
4846
|
}
|
|
4846
4847
|
}
|
|
4848
|
+
isTheCurrentRefundRejectedForTheFee(feeCode) {
|
|
4849
|
+
let refundsByFee = this.paymentLibComponent.refunds.filter(refund => refund.fee_ids === feeCode);
|
|
4850
|
+
let refundsByFeeAndRejected = this.paymentLibComponent.refunds.filter(refund => refund.refund_status.name === 'Rejected');
|
|
4851
|
+
// Refunds > 0 and overPayment --> refunds in process or Rejected.
|
|
4852
|
+
if (refundsByFee.length === refundsByFeeAndRejected.length) {
|
|
4853
|
+
return true;
|
|
4854
|
+
}
|
|
4855
|
+
return false;
|
|
4856
|
+
}
|
|
4847
4857
|
isAnyRefundsForThisCase() {
|
|
4848
4858
|
return (this.paymentLibComponent.refunds != null) && (this.paymentLibComponent.refunds.length > 0);
|
|
4849
4859
|
}
|
|
@@ -4859,15 +4869,7 @@ class PaymentViewComponent {
|
|
|
4859
4869
|
this.isFromServiceRequestPage = false;
|
|
4860
4870
|
}
|
|
4861
4871
|
getBalanceToBePaid() {
|
|
4862
|
-
return this.paymentLibComponent.
|
|
4863
|
-
}
|
|
4864
|
-
getRefundByFeeID(feeCode) {
|
|
4865
|
-
for (const refund of this.paymentLibComponent.refunds) {
|
|
4866
|
-
if (refund.fee_ids === feeCode) {
|
|
4867
|
-
return refund;
|
|
4868
|
-
}
|
|
4869
|
-
}
|
|
4870
|
-
return null;
|
|
4872
|
+
return this.paymentLibComponent.overPaymentAmount;
|
|
4871
4873
|
}
|
|
4872
4874
|
getRemissionByFeeCode(feeCode, remissions) {
|
|
4873
4875
|
if (remissions && remissions.length > 0) {
|
|
@@ -7579,7 +7581,7 @@ class PaymentLibComponent {
|
|
|
7579
7581
|
orderTotalPayments = 0.00;
|
|
7580
7582
|
orderPendingPayments = 0.00;
|
|
7581
7583
|
paymentGroup;
|
|
7582
|
-
|
|
7584
|
+
overPaymentAmount = 0.00;
|
|
7583
7585
|
refunds;
|
|
7584
7586
|
constructor(paymentLibService, cd, OrderslistService) {
|
|
7585
7587
|
this.paymentLibService = paymentLibService;
|