@hmcts/ccpay-web-component 6.2.3-beta3 → 6.2.3-beta5
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 +8 -1
- package/esm2022/lib/components/payment-view/payment-view.component.mjs +51 -11
- package/esm2022/lib/components/service-request/service-request.component.mjs +61 -15
- package/esm2022/lib/interfaces/IRefundList.mjs +1 -1
- package/esm2022/lib/payment-lib.component.mjs +4 -1
- package/fesm2022/hmcts-ccpay-web-component.mjs +120 -24
- package/fesm2022/hmcts-ccpay-web-component.mjs.map +1 -1
- package/lib/components/payment-view/payment-view.component.d.ts +6 -0
- package/lib/components/service-request/service-request.component.d.ts +8 -2
- package/lib/interfaces/IRefundList.d.ts +1 -0
- package/lib/payment-lib.component.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2256,6 +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.balanceToBePaid = this.overPaymentAmount;
|
|
2259
2260
|
});
|
|
2260
2261
|
}
|
|
2261
2262
|
if (paymentGroup.remissions) {
|
|
@@ -2268,6 +2269,7 @@ class CaseTransactionsComponent {
|
|
|
2268
2269
|
paymentGroup.payments.forEach(payment => {
|
|
2269
2270
|
if (isFeeOverPaymentExist) {
|
|
2270
2271
|
this.overPaymentAmount = this.overPaymentAmount + payment.over_payment;
|
|
2272
|
+
this.paymentLibComponent.balanceToBePaid = this.overPaymentAmount;
|
|
2271
2273
|
}
|
|
2272
2274
|
if (payment.status.toUpperCase() === 'SUCCESS') {
|
|
2273
2275
|
this.orderTotalPayments = this.orderTotalPayments + payment.amount;
|
|
@@ -2459,6 +2461,7 @@ class CaseTransactionsComponent {
|
|
|
2459
2461
|
let newValue = this.totalPayments - (this.orderFeesTotal - this.totalRemissions);
|
|
2460
2462
|
if (newValue > 0) {
|
|
2461
2463
|
this.overPaymentAmount = newValue;
|
|
2464
|
+
this.paymentLibComponent.balanceToBePaid = this.overPaymentAmount;
|
|
2462
2465
|
}
|
|
2463
2466
|
}
|
|
2464
2467
|
}
|
|
@@ -2479,6 +2482,7 @@ class CaseTransactionsComponent {
|
|
|
2479
2482
|
calculateOverpaymentBaseOnAcceptedRefund() {
|
|
2480
2483
|
this.paymentGroups.forEach(paymentGroup => {
|
|
2481
2484
|
if (paymentGroup.refunds != null && paymentGroup.refunds.length > 0) {
|
|
2485
|
+
this.paymentLibComponent.refunds = paymentGroup.refunds;
|
|
2482
2486
|
paymentGroup.refunds.forEach(refund => {
|
|
2483
2487
|
if (refund.refund_status.name === 'Accepted') {
|
|
2484
2488
|
let newValue = this.overPaymentAmount - refund.amount;
|
|
@@ -2489,6 +2493,7 @@ class CaseTransactionsComponent {
|
|
|
2489
2493
|
this.overPaymentAmount = newValue;
|
|
2490
2494
|
}
|
|
2491
2495
|
}
|
|
2496
|
+
this.paymentLibComponent.balanceToBePaid = this.overPaymentAmount;
|
|
2492
2497
|
});
|
|
2493
2498
|
}
|
|
2494
2499
|
});
|
|
@@ -2660,6 +2665,8 @@ class CaseTransactionsComponent {
|
|
|
2660
2665
|
this.paymentLibComponent.paymentGroupReference = paymentGroup.paymentGroupReference;
|
|
2661
2666
|
this.paymentLibComponent.paymentReference = paymentGroup.paymentReference;
|
|
2662
2667
|
this.paymentLibComponent.viewName = 'payment-view';
|
|
2668
|
+
this.paymentLibComponent.paymentGroup = this.paymentGroup;
|
|
2669
|
+
this.paymentLibComponent.balanceToBePaid = this.overPaymentAmount;
|
|
2663
2670
|
}
|
|
2664
2671
|
goToPayementView(paymentGroupReference, paymentReference, paymentMethod) {
|
|
2665
2672
|
this.goToPaymentViewComponent({ paymentGroupReference, paymentReference, paymentMethod });
|
|
@@ -3040,24 +3047,70 @@ class ServiceRequestComponent {
|
|
|
3040
3047
|
if (this.chkIsIssueRefundBtnEnable(payment)) {
|
|
3041
3048
|
this.paymentViewService.getApportionPaymentDetails(payment.reference).subscribe(paymentGroup => {
|
|
3042
3049
|
paymentGroup.payments = paymentGroup.payments.filter(paymentGroupObj => paymentGroupObj['reference'].includes(payment.reference));
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
this.
|
|
3046
|
-
|
|
3047
|
-
this.viewCompStatus = 'overpayment';
|
|
3050
|
+
// No refund and no over payment
|
|
3051
|
+
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
3052
|
+
this.showIssueRefundPage(paymentGroup, payment);
|
|
3053
|
+
return;
|
|
3048
3054
|
}
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
this.
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3055
|
+
// No refund and over payment
|
|
3056
|
+
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
3057
|
+
this.showOverPayment(paymentGroup, payment);
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
// Refunds means and No over payment --> refunds accepted.
|
|
3061
|
+
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
3062
|
+
this.showIssueRefundPage(paymentGroup, payment);
|
|
3063
|
+
return;
|
|
3064
|
+
}
|
|
3065
|
+
// Refunds means and No over payment --> refunds in process or Rejected.
|
|
3066
|
+
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
3067
|
+
let refund = this.getRefundByFeeID(paymentGroup.fees.at(0).id.toString());
|
|
3068
|
+
if (refund.refund_status.name === 'Rejected') {
|
|
3069
|
+
this.showOverPayment(paymentGroup, payment);
|
|
3070
|
+
return;
|
|
3071
|
+
}
|
|
3072
|
+
// refunds in process Sent for approval,Approved
|
|
3073
|
+
this.showIssueRefundPage(paymentGroup, payment);
|
|
3074
|
+
return;
|
|
3056
3075
|
}
|
|
3057
3076
|
}, (error) => this.errorMessage = error);
|
|
3058
3077
|
}
|
|
3059
3078
|
}
|
|
3060
3079
|
}
|
|
3080
|
+
isAnyRefundsForThisCase() {
|
|
3081
|
+
return (this.paymentLibComponent.refunds != null) && (this.paymentLibComponent.refunds.length > 0);
|
|
3082
|
+
}
|
|
3083
|
+
showOverPayment(paymentgrp, payment) {
|
|
3084
|
+
this.viewStatus = '';
|
|
3085
|
+
this.payment = payment;
|
|
3086
|
+
this.paymentGroupList = paymentgrp;
|
|
3087
|
+
this.viewCompStatus = 'overpayment';
|
|
3088
|
+
}
|
|
3089
|
+
showIssueRefundPage(paymentgrp, payment) {
|
|
3090
|
+
this.viewStatus = 'issuerefund';
|
|
3091
|
+
this.viewCompStatus = '';
|
|
3092
|
+
this.paymentFees = paymentgrp.fees;
|
|
3093
|
+
this.payment = payment;
|
|
3094
|
+
this.paymentLibComponent.isFromServiceRequestPage = true;
|
|
3095
|
+
this.isRefundRemission = true;
|
|
3096
|
+
this.paymentGroup = paymentgrp;
|
|
3097
|
+
this.viewStatus = 'issuerefund';
|
|
3098
|
+
this.isRefundRemission = true;
|
|
3099
|
+
this.paymentLibComponent.isFromPaymentDetailPage = true;
|
|
3100
|
+
this.isFromPaymentDetailPage = true;
|
|
3101
|
+
this.isFromServiceRequestPage = false;
|
|
3102
|
+
}
|
|
3103
|
+
getBalanceToBePaid() {
|
|
3104
|
+
return this.paymentLibComponent.balanceToBePaid;
|
|
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
|
+
}
|
|
3061
3114
|
goToPayementView(paymentGroupReference, paymentReference, paymentMethod) {
|
|
3062
3115
|
this.goToPaymentViewComponent({ paymentGroupReference, paymentReference, paymentMethod });
|
|
3063
3116
|
}
|
|
@@ -3199,7 +3252,7 @@ class ServiceRequestComponent {
|
|
|
3199
3252
|
this.paymentGroupList.fees.forEach(fee => {
|
|
3200
3253
|
feesOverPayment += fee.over_payment;
|
|
3201
3254
|
});
|
|
3202
|
-
return feesOverPayment > 0 ? feesOverPayment : this.
|
|
3255
|
+
return feesOverPayment > 0 ? feesOverPayment : this.paymentLibComponent.balanceToBePaid;
|
|
3203
3256
|
}
|
|
3204
3257
|
getTemplateInstructionType(payment) {
|
|
3205
3258
|
if (payment == undefined || payment == null) {
|
|
@@ -4357,7 +4410,7 @@ class AddRemissionComponent {
|
|
|
4357
4410
|
return remission.overall_balance.toString();
|
|
4358
4411
|
}
|
|
4359
4412
|
else {
|
|
4360
|
-
return
|
|
4413
|
+
return this.paymentLibComponent.balanceToBePaid.toString();
|
|
4361
4414
|
}
|
|
4362
4415
|
}
|
|
4363
4416
|
return "undefined";
|
|
@@ -4654,7 +4707,7 @@ class PaymentViewComponent {
|
|
|
4654
4707
|
this.paymentGroup.fees.forEach(fee => {
|
|
4655
4708
|
feesOverPayment += fee.over_payment;
|
|
4656
4709
|
});
|
|
4657
|
-
return feesOverPayment > 0 ? feesOverPayment : this.
|
|
4710
|
+
return feesOverPayment > 0 ? feesOverPayment : this.paymentLibComponent.balanceToBePaid;
|
|
4658
4711
|
}
|
|
4659
4712
|
goToServiceRequestPage() {
|
|
4660
4713
|
this.paymentLibComponent.viewName = 'case-transactions';
|
|
@@ -4762,19 +4815,59 @@ class PaymentViewComponent {
|
|
|
4762
4815
|
issueRefund(paymentgrp) {
|
|
4763
4816
|
if (paymentgrp !== null && paymentgrp !== undefined) {
|
|
4764
4817
|
if (this.chkIsIssueRefundBtnEnable(paymentgrp.payments[0])) {
|
|
4765
|
-
|
|
4766
|
-
|
|
4818
|
+
// No refund and no over payment
|
|
4819
|
+
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
4820
|
+
this.showIssueRefundPage(paymentgrp);
|
|
4821
|
+
return;
|
|
4767
4822
|
}
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
this.
|
|
4771
|
-
|
|
4772
|
-
this.paymentLibComponent.isFromPaymentDetailPage = true;
|
|
4773
|
-
this.isFromPaymentDetailPage = true;
|
|
4774
|
-
this.isFromServiceRequestPage = false;
|
|
4823
|
+
// No refund and over payment
|
|
4824
|
+
if (!this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
4825
|
+
this.showOverPayment();
|
|
4826
|
+
return;
|
|
4775
4827
|
}
|
|
4828
|
+
// Refunds means and No over payment --> refunds accepted.
|
|
4829
|
+
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() == 0) {
|
|
4830
|
+
this.showIssueRefundPage(paymentgrp);
|
|
4831
|
+
return;
|
|
4832
|
+
}
|
|
4833
|
+
// Refunds means and No over payment --> refunds in process or Rejected.
|
|
4834
|
+
if (this.isAnyRefundsForThisCase() && this.getBalanceToBePaid() > 0) {
|
|
4835
|
+
let refund = this.getRefundByFeeID(this.paymentFees.at(0).id.toString());
|
|
4836
|
+
if (refund.refund_status.name === 'Rejected') {
|
|
4837
|
+
this.showOverPayment();
|
|
4838
|
+
return;
|
|
4839
|
+
}
|
|
4840
|
+
// refunds in process Sent for approval,Approved
|
|
4841
|
+
this.showIssueRefundPage(paymentgrp);
|
|
4842
|
+
return;
|
|
4843
|
+
}
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
}
|
|
4847
|
+
isAnyRefundsForThisCase() {
|
|
4848
|
+
return (this.paymentLibComponent.refunds != null) && (this.paymentLibComponent.refunds.length > 0);
|
|
4849
|
+
}
|
|
4850
|
+
showOverPayment() {
|
|
4851
|
+
this.viewCompStatus = 'overpayment';
|
|
4852
|
+
}
|
|
4853
|
+
showIssueRefundPage(paymentgrp) {
|
|
4854
|
+
this.paymentGroup = paymentgrp;
|
|
4855
|
+
this.viewStatus = 'issuerefund';
|
|
4856
|
+
this.isRefundRemission = true;
|
|
4857
|
+
this.paymentLibComponent.isFromPaymentDetailPage = true;
|
|
4858
|
+
this.isFromPaymentDetailPage = true;
|
|
4859
|
+
this.isFromServiceRequestPage = false;
|
|
4860
|
+
}
|
|
4861
|
+
getBalanceToBePaid() {
|
|
4862
|
+
return this.paymentLibComponent.balanceToBePaid;
|
|
4863
|
+
}
|
|
4864
|
+
getRefundByFeeID(feeCode) {
|
|
4865
|
+
for (const refund of this.paymentLibComponent.refunds) {
|
|
4866
|
+
if (refund.fee_ids === feeCode) {
|
|
4867
|
+
return refund;
|
|
4776
4868
|
}
|
|
4777
4869
|
}
|
|
4870
|
+
return null;
|
|
4778
4871
|
}
|
|
4779
4872
|
getRemissionByFeeCode(feeCode, remissions) {
|
|
4780
4873
|
if (remissions && remissions.length > 0) {
|
|
@@ -7485,6 +7578,9 @@ class PaymentLibComponent {
|
|
|
7485
7578
|
orderRemissionTotal = 0.00;
|
|
7486
7579
|
orderTotalPayments = 0.00;
|
|
7487
7580
|
orderPendingPayments = 0.00;
|
|
7581
|
+
paymentGroup;
|
|
7582
|
+
balanceToBePaid = 0.00;
|
|
7583
|
+
refunds;
|
|
7488
7584
|
constructor(paymentLibService, cd, OrderslistService) {
|
|
7489
7585
|
this.paymentLibService = paymentLibService;
|
|
7490
7586
|
this.cd = cd;
|