|
40 | 40 | import org.apache.fineract.client.models.LoanProductChargeData; |
41 | 41 | import org.apache.fineract.client.models.LoanProductPaymentAllocationRule; |
42 | 42 | import org.apache.fineract.client.models.PaymentAllocationOrder; |
| 43 | +import org.apache.fineract.client.models.PostClassificationToIncomeAccountMappings; |
43 | 44 | import org.apache.fineract.client.models.PostLoanProductsRequest; |
44 | 45 | import org.apache.fineract.client.models.PostLoanProductsResponse; |
45 | 46 | import org.apache.fineract.client.services.LoanProductsApi; |
@@ -3728,6 +3729,95 @@ public void initialize() throws Exception { |
3728 | 3729 | TestContext.INSTANCE.set( |
3729 | 3730 | TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADVANCED_CUSTOM_PAYMENT_ALLOCATION_PROGRESSIVE_LOAN_SCHEDULE_ZERO_CHARGE_OFF, |
3730 | 3731 | responseLoanProductsRequestAdvCustomPaymentAllocationProgressiveLoanScheduleZeroChargeOff); |
| 3732 | + |
| 3733 | + // LP2 with progressive loan schedule + horizontal + interest EMI + 360/30 |
| 3734 | + // + interest recalculation, buy down fees enabled |
| 3735 | + // + Classification income map |
| 3736 | + final String name140 = DefaultLoanProduct.LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES_CLASSIFICATION_INCOME_MAP |
| 3737 | + .getName(); |
| 3738 | + |
| 3739 | + List<PostClassificationToIncomeAccountMappings> buydownfeeClassificationToIncomeAccountMappings = new ArrayList<>(); |
| 3740 | + PostClassificationToIncomeAccountMappings classificationToIncomeAccountMappings = new PostClassificationToIncomeAccountMappings(); |
| 3741 | + classificationToIncomeAccountMappings.setClassificationCodeValueId(25L); |
| 3742 | + classificationToIncomeAccountMappings.setIncomeAccountId(10L); |
| 3743 | + buydownfeeClassificationToIncomeAccountMappings.add(classificationToIncomeAccountMappings); |
| 3744 | + |
| 3745 | + final PostLoanProductsRequest loanProductsRequestLP2ProgressiveAdvPaymentBuyDownFeesClassificationIncomeMap = loanProductsRequestFactory |
| 3746 | + .defaultLoanProductsRequestLP2BuyDownFees()// |
| 3747 | + .name(name140)// |
| 3748 | + .transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())// |
| 3749 | + .loanScheduleType("PROGRESSIVE") // |
| 3750 | + .isInterestRecalculationEnabled(true)// |
| 3751 | + .preClosureInterestCalculationStrategy(1)// |
| 3752 | + .rescheduleStrategyMethod(4)// |
| 3753 | + .interestRecalculationCompoundingMethod(0)// |
| 3754 | + .recalculationRestFrequencyType(2)// |
| 3755 | + .recalculationRestFrequencyInterval(1)// |
| 3756 | + .paymentAllocation(List.of(// |
| 3757 | + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // |
| 3758 | + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // |
| 3759 | + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // |
| 3760 | + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")))// |
| 3761 | + .buydownfeeClassificationToIncomeAccountMappings(buydownfeeClassificationToIncomeAccountMappings);// |
| 3762 | + |
| 3763 | + final Response<PostLoanProductsResponse> responseLoanProductsRequestLP2ProgressiveAdvPaymentBuyDownFeesClassificationIncomeMap = loanProductsApi |
| 3764 | + .createLoanProduct(loanProductsRequestLP2ProgressiveAdvPaymentBuyDownFeesClassificationIncomeMap).execute(); |
| 3765 | + TestContext.INSTANCE.set( |
| 3766 | + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_PROGRESSIVE_ADV_PYMNT_BUYDOWN_FEES_CLASSIFICATION_INCOME_MAP, |
| 3767 | + responseLoanProductsRequestLP2ProgressiveAdvPaymentBuyDownFeesClassificationIncomeMap); |
| 3768 | + |
| 3769 | + // LP2 with progressive loan schedule + horizontal + interest EMI + 360/30 + custom allocation capital |
| 3770 | + // adjustment |
| 3771 | + // + interest recalculation, preClosureInterestCalculationStrategy= till preclose, |
| 3772 | + // Frequency for recalculate Outstanding Principal: Daily, Frequency Interval for recalculation: 1 |
| 3773 | + // capitalized income enabled + income type - fee |
| 3774 | + // + Classification income map |
| 3775 | + final String name141 = DefaultLoanProduct.LP2_PROGRESSIVE_ADV_PMNT_ALLOCATION_CAPITALIZED_INCOME_ADJ_CUSTOM_ALLOC_CLASSIFICATION_INCOME_MAP |
| 3776 | + .getName(); |
| 3777 | + |
| 3778 | + List<PostClassificationToIncomeAccountMappings> capitalizedIncomeClassificationToIncomeAccountMappings = new ArrayList<>(); |
| 3779 | + PostClassificationToIncomeAccountMappings classificationToIncomeAccountMappingsCapitalizedIncome = new PostClassificationToIncomeAccountMappings(); |
| 3780 | + classificationToIncomeAccountMappingsCapitalizedIncome.setClassificationCodeValueId(24L); |
| 3781 | + classificationToIncomeAccountMappingsCapitalizedIncome.setIncomeAccountId(15L); |
| 3782 | + capitalizedIncomeClassificationToIncomeAccountMappings.add(classificationToIncomeAccountMappingsCapitalizedIncome); |
| 3783 | + |
| 3784 | + final PostLoanProductsRequest loanProductsRequestLP2ProgressiveAdvPaymAllocCapitaizedIncomeClassificationIncomeMap = loanProductsRequestFactory |
| 3785 | + .defaultLoanProductsRequestLP2EmiCapitalizedIncome()// |
| 3786 | + .name(name141)// |
| 3787 | + .daysInYearType(DaysInYearType.DAYS360.value)// |
| 3788 | + .daysInMonthType(DaysInMonthType.DAYS30.value)// |
| 3789 | + .isInterestRecalculationEnabled(true)// |
| 3790 | + .preClosureInterestCalculationStrategy(1)// |
| 3791 | + .rescheduleStrategyMethod(4)// |
| 3792 | + .interestRecalculationCompoundingMethod(0)// |
| 3793 | + .recalculationRestFrequencyType(2)// |
| 3794 | + .recalculationRestFrequencyInterval(1)// |
| 3795 | + .paymentAllocation(List.of(// |
| 3796 | + createPaymentAllocation("DEFAULT", "NEXT_INSTALLMENT"), // |
| 3797 | + createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), // |
| 3798 | + createPaymentAllocation("MERCHANT_ISSUED_REFUND", "REAMORTIZATION"), // |
| 3799 | + createPaymentAllocation("CAPITALIZED_INCOME_ADJUSTMENT", "NEXT_INSTALLMENT", |
| 3800 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PRINCIPAL, // |
| 3801 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_INTEREST, // |
| 3802 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_FEE, // |
| 3803 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PENALTY, // |
| 3804 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PRINCIPAL, // |
| 3805 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_INTEREST, // |
| 3806 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_FEE, // |
| 3807 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PENALTY, // |
| 3808 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PRINCIPAL, // |
| 3809 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_INTEREST, // |
| 3810 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_FEE, // |
| 3811 | + LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PENALTY), // |
| 3812 | + createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")))// |
| 3813 | + .capitalizedIncomeClassificationToIncomeAccountMappings(capitalizedIncomeClassificationToIncomeAccountMappings);// |
| 3814 | + |
| 3815 | + final Response<PostLoanProductsResponse> responseLoanProductsRequestLP2ProgressiveAdvPaymAllocCapitaizedIncomeClassificationIncomeMap = loanProductsApi |
| 3816 | + .createLoanProduct(loanProductsRequestLP2ProgressiveAdvPaymAllocCapitaizedIncomeClassificationIncomeMap).execute(); |
| 3817 | + |
| 3818 | + TestContext.INSTANCE.set( |
| 3819 | + TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_PROGRESSIVE_ADV_PMNT_ALLOCATION_CAPITALIZED_INCOME_ADJ_CUSTOM_ALLOC_CLASSIFICATION_INCOME_MAP, |
| 3820 | + responseLoanProductsRequestLP2ProgressiveAdvPaymAllocCapitaizedIncomeClassificationIncomeMap); |
3731 | 3821 | } |
3732 | 3822 |
|
3733 | 3823 | public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule, |
|
0 commit comments