@hmcts/ccpay-web-component 6.5.21-beta2 → 6.5.21-beta3

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.
@@ -8099,16 +8099,14 @@ class PaymentLibComponent {
8099
8099
  * @returns {boolean} true if the over payment panel should be displayed, otherwise false.
8100
8100
  */
8101
8101
  shouldItDisplayOverPaymentPanel() {
8102
- let allRefundsRejected = this.refunds.filter(refund => refund.refund_status.name === 'Rejected');
8103
- let allRefundsAccepted = this.refunds.filter(refund => refund.refund_status.name === 'Accepted');
8104
- // all refunds have been rejected.
8105
- if (this.refunds.length === allRefundsRejected.length) {
8106
- return true;
8107
- }
8108
- // all refunds have been Accepted.
8109
- if (this.refunds.length === allRefundsAccepted.length) {
8110
- return true;
8102
+ // it means that all refunds are in the state of Accepted or Rejected
8103
+ const areAllRefundsRejectedAndAcceptedOnly = this.refunds.every(refund => refund.refund_status.name === 'Accepted' ||
8104
+ refund.refund_status.name === 'Rejected');
8105
+ // if any of the refunds is not Accepted or Rejected means that they are in process, hence not overpayment.
8106
+ if (!areAllRefundsRejectedAndAcceptedOnly) {
8107
+ return false;
8111
8108
  }
8109
+ return true;
8112
8110
  }
8113
8111
  /**
8114
8112
  * Rounds very small values to zero if they fall below a specified threshold.