@@ -17,12 +17,12 @@ import { LoanProducts } from '../loan-products';
1717import {
1818 AdvancedPaymentAllocation ,
1919 AdvancedPaymentStrategy ,
20- CapitalizedIncome ,
20+ DeferredIncomeRecognition ,
2121 PaymentAllocation
2222} from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model' ;
2323import { Accounting } from 'app/core/utils/accounting' ;
2424import { StringEnumOptionData } from '../../../shared/models/option-data.model' ;
25- import { LoanProductCapitalizedIncomeStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-capitalized -income-step.component' ;
25+ import { LoanProductDeferredIncomeRecognitionStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-deferred -income-recognition -step.component' ;
2626import { UntypedFormGroup } from '@angular/forms' ;
2727import { MatStepper , MatStepperIcon , MatStep , MatStepLabel } from '@angular/material/stepper' ;
2828import { FaIconComponent } from '@fortawesome/angular-fontawesome' ;
@@ -50,7 +50,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
5050 StepperButtonsComponent ,
5151 LoanProductTermsStepComponent ,
5252 LoanProductChargesStepComponent ,
53- LoanProductCapitalizedIncomeStepComponent ,
53+ LoanProductDeferredIncomeRecognitionStepComponent ,
5454 LoanProductAccountingStepComponent ,
5555 LoanProductPreviewStepComponent
5656 ]
@@ -61,8 +61,8 @@ export class CreateLoanProductComponent implements OnInit {
6161 loanProductCurrencyStep : LoanProductCurrencyStepComponent ;
6262 @ViewChild ( LoanProductInterestRefundStepComponent , { static : true } )
6363 loanProductInterestRefundStep : LoanProductInterestRefundStepComponent ;
64- @ViewChild ( LoanProductCapitalizedIncomeStepComponent , { static : true } )
65- loanProductCapitalizedIncomeStep : LoanProductCapitalizedIncomeStepComponent ;
64+ @ViewChild ( LoanProductDeferredIncomeRecognitionStepComponent , { static : true } )
65+ loanProductDeferredIncomeRecognitionStep : LoanProductDeferredIncomeRecognitionStepComponent ;
6666 @ViewChild ( LoanProductTermsStepComponent , { static : true } ) loanProductTermsStep : LoanProductTermsStepComponent ;
6767 @ViewChild ( LoanProductSettingsStepComponent , { static : true } )
6868 loanProductSettingsStep : LoanProductSettingsStepComponent ;
@@ -81,8 +81,8 @@ export class CreateLoanProductComponent implements OnInit {
8181 advancedPaymentAllocations : AdvancedPaymentAllocation [ ] = [ ] ;
8282 advancedCreditAllocations : AdvancedPaymentAllocation [ ] = [ ] ;
8383
84- capitalizedIncome : CapitalizedIncome | null = null ;
85- loanIncomeCapitalizationForm : UntypedFormGroup ;
84+ deferredIncomeRecognition : DeferredIncomeRecognition | null = null ;
85+ loanDeferredIncomeRecognitionForm : UntypedFormGroup ;
8686
8787 /**
8888 * @param {ActivatedRoute } route Activated Route.
@@ -139,18 +139,33 @@ export class CreateLoanProductComponent implements OnInit {
139139 advancePaymentStrategy ( value : string ) {
140140 this . isAdvancedPaymentStrategy = LoanProducts . isAdvancedPaymentAllocationStrategy ( value ) ;
141141 if ( this . isAdvancedPaymentStrategy ) {
142+ if ( this . deferredIncomeRecognition == null ) {
143+ this . deferredIncomeRecognition = { } ;
144+ }
142145 if ( this . loanProductsTemplate . enableIncomeCapitalization ) {
143- this . capitalizedIncome = {
146+ this . deferredIncomeRecognition . capitalizedIncome = {
144147 enableIncomeCapitalization : true ,
145148 capitalizedIncomeCalculationType : this . loanProductsTemplate . capitalizedIncomeCalculationTypeOptions [ 0 ] ,
146149 capitalizedIncomeStrategy : this . loanProductsTemplate . capitalizedIncomeStrategyOptions [ 0 ] ,
147150 capitalizedIncomeType : this . loanProductsTemplate . capitalizedIncomeTypeOptions [ 0 ]
148151 } ;
149152 } else {
150- this . capitalizedIncome = {
153+ this . deferredIncomeRecognition . capitalizedIncome = {
151154 enableIncomeCapitalization : false
152155 } ;
153156 }
157+ if ( this . loanProductsTemplate . enableBuyDownFee ) {
158+ this . deferredIncomeRecognition . buyDownFee = {
159+ enableBuyDownFee : true ,
160+ buyDownFeeCalculationType : this . loanProductsTemplate . buyDownFeeCalculationTypeOptions [ 0 ] ,
161+ buyDownFeeStrategy : this . loanProductsTemplate . buyDownFeeStrategyOptions [ 0 ] ,
162+ buyDownFeeIncomeType : this . loanProductsTemplate . buyDownFeeIncomeTypeOptions [ 0 ]
163+ } ;
164+ } else {
165+ this . deferredIncomeRecognition . buyDownFee = {
166+ enableBuyDownFee : false
167+ } ;
168+ }
154169 }
155170 }
156171
@@ -172,14 +187,14 @@ export class CreateLoanProductComponent implements OnInit {
172187 this . supportedInterestRefundTypes = supportedInterestRefundTypes ;
173188 }
174189
175- setCapitalizedIncome ( capitalizedIncome : CapitalizedIncome ) : void {
190+ setDeferredIncomeRecognition ( deferredIncomeRecognition : DeferredIncomeRecognition ) : void {
176191 if ( this . isAdvancedPaymentStrategy ) {
177- this . capitalizedIncome = capitalizedIncome ;
192+ this . deferredIncomeRecognition = deferredIncomeRecognition ;
178193 }
179194 }
180195
181196 setViewChildForm ( viewChildForm : UntypedFormGroup ) : void {
182- this . loanIncomeCapitalizationForm = viewChildForm ;
197+ this . loanDeferredIncomeRecognitionForm = viewChildForm ;
183198 }
184199
185200 get loanProductSettingsForm ( ) {
@@ -197,7 +212,7 @@ export class CreateLoanProductComponent implements OnInit {
197212 this . loanProductCurrencyForm . valid &&
198213 this . loanProductTermsForm . valid &&
199214 this . loanProductSettingsForm . valid &&
200- this . loanIncomeCapitalizationForm . valid &&
215+ this . loanDeferredIncomeRecognitionForm . valid &&
201216 this . loanProductAccountingForm . valid
202217 ) ;
203218 } else {
@@ -224,12 +239,24 @@ export class CreateLoanProductComponent implements OnInit {
224239 loanProduct [ 'paymentAllocation' ] = this . paymentAllocation ;
225240 loanProduct [ 'creditAllocation' ] = this . creditAllocation ;
226241 loanProduct [ 'supportedInterestRefundTypes' ] = this . supportedInterestRefundTypes ;
227- if ( this . capitalizedIncome != null ) {
228- loanProduct [ 'enableIncomeCapitalization' ] = this . capitalizedIncome . enableIncomeCapitalization ;
229- if ( this . capitalizedIncome . enableIncomeCapitalization ) {
230- loanProduct [ 'capitalizedIncomeCalculationType' ] = this . capitalizedIncome . capitalizedIncomeCalculationType ;
231- loanProduct [ 'capitalizedIncomeStrategy' ] = this . capitalizedIncome . capitalizedIncomeStrategy ;
232- loanProduct [ 'capitalizedIncomeType' ] = this . capitalizedIncome . capitalizedIncomeType ;
242+ if ( this . deferredIncomeRecognition . capitalizedIncome != null ) {
243+ loanProduct [ 'enableIncomeCapitalization' ] =
244+ this . deferredIncomeRecognition . capitalizedIncome . enableIncomeCapitalization ;
245+ if ( this . deferredIncomeRecognition . capitalizedIncome . enableIncomeCapitalization ) {
246+ loanProduct [ 'capitalizedIncomeCalculationType' ] =
247+ this . deferredIncomeRecognition . capitalizedIncome . capitalizedIncomeCalculationType ;
248+ loanProduct [ 'capitalizedIncomeStrategy' ] =
249+ this . deferredIncomeRecognition . capitalizedIncome . capitalizedIncomeStrategy ;
250+ loanProduct [ 'capitalizedIncomeType' ] = this . deferredIncomeRecognition . capitalizedIncome . capitalizedIncomeType ;
251+ }
252+ }
253+ if ( this . deferredIncomeRecognition . buyDownFee != null ) {
254+ loanProduct [ 'enableBuyDownFee' ] = this . deferredIncomeRecognition . buyDownFee . enableBuyDownFee ;
255+ if ( this . deferredIncomeRecognition . buyDownFee . enableBuyDownFee ) {
256+ loanProduct [ 'buyDownFeeCalculationType' ] =
257+ this . deferredIncomeRecognition . buyDownFee . buyDownFeeCalculationType ;
258+ loanProduct [ 'buyDownFeeStrategy' ] = this . deferredIncomeRecognition . buyDownFee . buyDownFeeStrategy ;
259+ loanProduct [ 'buyDownFeeIncomeType' ] = this . deferredIncomeRecognition . buyDownFee . buyDownFeeIncomeType ;
233260 }
234261 }
235262 }
0 commit comments