@@ -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' ; 
2727
2828@Component ( { 
@@ -36,8 +36,8 @@ export class CreateLoanProductComponent implements OnInit {
3636  loanProductCurrencyStep : LoanProductCurrencyStepComponent ; 
3737  @ViewChild ( LoanProductInterestRefundStepComponent ,  {  static : true  } ) 
3838  loanProductInterestRefundStep : LoanProductInterestRefundStepComponent ; 
39-   @ViewChild ( LoanProductCapitalizedIncomeStepComponent ,  {  static : true  } ) 
40-   loanProductCapitalizedIncomeStep :  LoanProductCapitalizedIncomeStepComponent ; 
39+   @ViewChild ( LoanProductDeferredIncomeRecognitionStepComponent ,  {  static : true  } ) 
40+   loanProductDeferredIncomeRecognitionStep :  LoanProductDeferredIncomeRecognitionStepComponent ; 
4141  @ViewChild ( LoanProductTermsStepComponent ,  {  static : true  } )  loanProductTermsStep : LoanProductTermsStepComponent ; 
4242  @ViewChild ( LoanProductSettingsStepComponent ,  {  static : true  } ) 
4343  loanProductSettingsStep : LoanProductSettingsStepComponent ; 
@@ -56,8 +56,8 @@ export class CreateLoanProductComponent implements OnInit {
5656  advancedPaymentAllocations : AdvancedPaymentAllocation [ ]  =  [ ] ; 
5757  advancedCreditAllocations : AdvancedPaymentAllocation [ ]  =  [ ] ; 
5858
59-   capitalizedIncome :  CapitalizedIncome  |  null  =  null ; 
60-   loanIncomeCapitalizationForm : UntypedFormGroup ; 
59+   deferredIncomeRecognition :  DeferredIncomeRecognition  |  null  =  null ; 
60+   loanDeferredIncomeRecognitionForm : UntypedFormGroup ; 
6161
6262  /** 
6363   * @param  {ActivatedRoute } route Activated Route. 
@@ -114,18 +114,33 @@ export class CreateLoanProductComponent implements OnInit {
114114  advancePaymentStrategy ( value : string )  { 
115115    this . isAdvancedPaymentStrategy  =  LoanProducts . isAdvancedPaymentAllocationStrategy ( value ) ; 
116116    if  ( this . isAdvancedPaymentStrategy )  { 
117+       if  ( this . deferredIncomeRecognition  ==  null )  { 
118+         this . deferredIncomeRecognition  =  { } ; 
119+       } 
117120      if  ( this . loanProductsTemplate . enableIncomeCapitalization )  { 
118-         this . capitalizedIncome  =  { 
121+         this . deferredIncomeRecognition . capitalizedIncome  =  { 
119122          enableIncomeCapitalization : true , 
120123          capitalizedIncomeCalculationType : this . loanProductsTemplate . capitalizedIncomeCalculationTypeOptions [ 0 ] , 
121124          capitalizedIncomeStrategy : this . loanProductsTemplate . capitalizedIncomeStrategyOptions [ 0 ] , 
122125          capitalizedIncomeType : this . loanProductsTemplate . capitalizedIncomeTypeOptions [ 0 ] 
123126        } ; 
124127      }  else  { 
125-         this . capitalizedIncome  =  { 
128+         this . deferredIncomeRecognition . capitalizedIncome  =  { 
126129          enableIncomeCapitalization : false 
127130        } ; 
128131      } 
132+       if  ( this . loanProductsTemplate . enableBuyDownFee )  { 
133+         this . deferredIncomeRecognition . buyDownFee  =  { 
134+           enableBuyDownFee : true , 
135+           buyDownFeeCalculationType : this . loanProductsTemplate . buyDownFeeCalculationTypeOptions [ 0 ] , 
136+           buyDownFeeStrategy : this . loanProductsTemplate . buyDownFeeStrategyOptions [ 0 ] , 
137+           buyDownFeeIncomeType : this . loanProductsTemplate . buyDownFeeIncomeTypeOptions [ 0 ] 
138+         } ; 
139+       }  else  { 
140+         this . deferredIncomeRecognition . buyDownFee  =  { 
141+           enableBuyDownFee : false 
142+         } ; 
143+       } 
129144    } 
130145  } 
131146
@@ -147,14 +162,14 @@ export class CreateLoanProductComponent implements OnInit {
147162    this . supportedInterestRefundTypes  =  supportedInterestRefundTypes ; 
148163  } 
149164
150-   setCapitalizedIncome ( capitalizedIncome :  CapitalizedIncome ) : void   { 
165+   setDeferredIncomeRecognition ( deferredIncomeRecognition :  DeferredIncomeRecognition ) : void   { 
151166    if  ( this . isAdvancedPaymentStrategy )  { 
152-       this . capitalizedIncome  =  capitalizedIncome ; 
167+       this . deferredIncomeRecognition  =  deferredIncomeRecognition ; 
153168    } 
154169  } 
155170
156171  setViewChildForm ( viewChildForm : UntypedFormGroup ) : void   { 
157-     this . loanIncomeCapitalizationForm  =  viewChildForm ; 
172+     this . loanDeferredIncomeRecognitionForm  =  viewChildForm ; 
158173  } 
159174
160175  get  loanProductSettingsForm ( )  { 
@@ -172,7 +187,7 @@ export class CreateLoanProductComponent implements OnInit {
172187        this . loanProductCurrencyForm . valid  && 
173188        this . loanProductTermsForm . valid  && 
174189        this . loanProductSettingsForm . valid  && 
175-         this . loanIncomeCapitalizationForm . valid  && 
190+         this . loanDeferredIncomeRecognitionForm . valid  && 
176191        this . loanProductAccountingForm . valid 
177192      ) ; 
178193    }  else  { 
@@ -199,12 +214,24 @@ export class CreateLoanProductComponent implements OnInit {
199214      loanProduct [ 'paymentAllocation' ]  =  this . paymentAllocation ; 
200215      loanProduct [ 'creditAllocation' ]  =  this . creditAllocation ; 
201216      loanProduct [ 'supportedInterestRefundTypes' ]  =  this . supportedInterestRefundTypes ; 
202-       if  ( this . capitalizedIncome  !=  null )  { 
203-         loanProduct [ 'enableIncomeCapitalization' ]  =  this . capitalizedIncome . enableIncomeCapitalization ; 
204-         if  ( this . capitalizedIncome . enableIncomeCapitalization )  { 
205-           loanProduct [ 'capitalizedIncomeCalculationType' ]  =  this . capitalizedIncome . capitalizedIncomeCalculationType ; 
206-           loanProduct [ 'capitalizedIncomeStrategy' ]  =  this . capitalizedIncome . capitalizedIncomeStrategy ; 
207-           loanProduct [ 'capitalizedIncomeType' ]  =  this . capitalizedIncome . capitalizedIncomeType ; 
217+       if  ( this . deferredIncomeRecognition . capitalizedIncome  !=  null )  { 
218+         loanProduct [ 'enableIncomeCapitalization' ]  = 
219+           this . deferredIncomeRecognition . capitalizedIncome . enableIncomeCapitalization ; 
220+         if  ( this . deferredIncomeRecognition . capitalizedIncome . enableIncomeCapitalization )  { 
221+           loanProduct [ 'capitalizedIncomeCalculationType' ]  = 
222+             this . deferredIncomeRecognition . capitalizedIncome . capitalizedIncomeCalculationType ; 
223+           loanProduct [ 'capitalizedIncomeStrategy' ]  = 
224+             this . deferredIncomeRecognition . capitalizedIncome . capitalizedIncomeStrategy ; 
225+           loanProduct [ 'capitalizedIncomeType' ]  =  this . deferredIncomeRecognition . capitalizedIncome . capitalizedIncomeType ; 
226+         } 
227+       } 
228+       if  ( this . deferredIncomeRecognition . buyDownFee  !=  null )  { 
229+         loanProduct [ 'enableBuyDownFee' ]  =  this . deferredIncomeRecognition . buyDownFee . enableBuyDownFee ; 
230+         if  ( this . deferredIncomeRecognition . buyDownFee . enableBuyDownFee )  { 
231+           loanProduct [ 'buyDownFeeCalculationType' ]  = 
232+             this . deferredIncomeRecognition . buyDownFee . buyDownFeeCalculationType ; 
233+           loanProduct [ 'buyDownFeeStrategy' ]  =  this . deferredIncomeRecognition . buyDownFee . buyDownFeeStrategy ; 
234+           loanProduct [ 'buyDownFeeIncomeType' ]  =  this . deferredIncomeRecognition . buyDownFee . buyDownFeeIncomeType ; 
208235        } 
209236      } 
210237    } 
0 commit comments