From 9c6bc90c848b910f2faf0216e7722a987d1d41a0 Mon Sep 17 00:00:00 2001 From: Adam Saghy Date: Wed, 24 Jul 2024 14:33:13 +0200 Subject: [PATCH] FINERACT-2107: Cumulative loan product creation fix --- .../create-loan-product/create-loan-product.component.ts | 6 +++++- .../edit-loan-product/edit-loan-product.component.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts index e85902f63..b3a11e353 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts @@ -154,7 +154,11 @@ export class CreateLoanProductComponent implements OnInit { loanProduct['dueDaysForRepaymentEvent'] = null; loanProduct['overDueDaysForRepaymentEvent'] = null; } - loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(loanProduct['supportedInterestRefundTypes']); + if (this.isAdvancedPaymentStrategy) { + loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(loanProduct['supportedInterestRefundTypes']); + } else { + delete loanProduct['supportedInterestRefundTypes']; + } delete loanProduct['useDueForRepaymentsConfigurations']; this.productsService.createLoanProduct(loanProduct) diff --git a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts index d485bd40e..c3dfae91f 100644 --- a/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts +++ b/src/app/products/loan-products/edit-loan-product/edit-loan-product.component.ts @@ -184,7 +184,11 @@ export class EditLoanProductComponent implements OnInit { loanProduct['dueDaysForRepaymentEvent'] = null; loanProduct['overDueDaysForRepaymentEvent'] = null; } - loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(loanProduct['supportedInterestRefundTypes']); + if (this.isAdvancedPaymentStrategy) { + loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(loanProduct['supportedInterestRefundTypes']); + } else { + delete loanProduct['supportedInterestRefundTypes']; + } delete loanProduct['useDueForRepaymentsConfigurations']; this.productsService.updateLoanProduct(this.loanProductAndTemplate.id, loanProduct)