digipay-utility-payment 0.0.20 → 0.0.21

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.
Binary file
@@ -2431,6 +2431,24 @@ class BillWorkflowComponent {
2431
2431
  };
2432
2432
  }
2433
2433
  }
2434
+ if (isAmountField) {
2435
+ const billAmount = this.getBillAmount();
2436
+ if (billAmount !== null) {
2437
+ customValidators = {
2438
+ ...customValidators,
2439
+ billAmountMax: {
2440
+ expression: (control) => {
2441
+ const enteredAmount = this.parseFormAmount(control?.value);
2442
+ if (enteredAmount === null) {
2443
+ return true;
2444
+ }
2445
+ return enteredAmount <= billAmount;
2446
+ },
2447
+ message: () => this.translationService.translate("COMMON_LABEL_AMOUNT_MUST_NOT_EXCEED_BILL_AMOUNT"),
2448
+ },
2449
+ };
2450
+ }
2451
+ }
2434
2452
  const validations = field?.field_validation || [];
2435
2453
  const normalizedFieldType = this.normalizeFieldType(field?.field_type);
2436
2454
  const normalizedValidations = this.normalizeValidations(validations);
@@ -2518,6 +2536,23 @@ class BillWorkflowComponent {
2518
2536
  }
2519
2537
  return null;
2520
2538
  }
2539
+ getBillAmount() {
2540
+ const billAmount = Number(this.getSelectedBill()?.bill_amount);
2541
+ if (isNaN(billAmount) || billAmount <= 0) {
2542
+ return null;
2543
+ }
2544
+ return billAmount;
2545
+ }
2546
+ parseFormAmount(value) {
2547
+ if (value === null || value === undefined || value === "") {
2548
+ return null;
2549
+ }
2550
+ const amount = typeof value === "number" ? value : parseFloat(String(value));
2551
+ return isNaN(amount) ? null : amount;
2552
+ }
2553
+ getSelectedBill() {
2554
+ return this.allWorkflowData?.selectedBill ?? this.selectedBill ?? null;
2555
+ }
2521
2556
  ngOnDestroy() {
2522
2557
  this.destroy$.next(true);
2523
2558
  this.destroy$.unsubscribe();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "digipay-utility-payment",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.0.0",
6
6
  "@angular/core": "^20.0.0",