diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java index 54c097b0b..2725a38fa 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/AccountingScenarioIntegrationTest.java @@ -86,7 +86,8 @@ public class AccountingScenarioIntegrationTest { final Account expenseAccount = this.accountHelper.createExpenseAccount(); final Account overpaymentAccount = this.accountHelper.createLiabilityAccount(); - final Integer loanProductID = createLoanProduct(assetAccount, incomeAccount, expenseAccount, overpaymentAccount); + final Integer loanProductID = createLoanProductWithUpfrontAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount, + overpaymentAccount); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING); final Integer loanID = applyForLoanApplication(clientID, loanProductID); @@ -181,12 +182,13 @@ public class AccountingScenarioIntegrationTest { System.out.println("Repayment 5 Done ......"); } - private Integer createLoanProduct(final Account... accounts) { + private Integer createLoanProductWithUpfrontAccrualAccountingEnabled(final Account... accounts) { System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------"); final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth() .withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth() .withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths() - .withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsAccrualBased(accounts).build(null); + .withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleUpfrontAccrual(accounts) + .build(null); return this.loanTransactionHelper.getLoanProductId(loanProductJSON); } diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java index 301ca7ebf..c886773f4 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java @@ -30,7 +30,8 @@ public class LoanProductTestBuilder { // private static final String RBI_INDIA_STRATEGY ="4"; private static final String NONE = "1"; private static final String CASH_BASED = "2"; - private static final String ACCRUAL_BASED = "3"; + private static final String ACCRUAL_PERIODIC = "3"; + private static final String ACCRUAL_UPFRONT = "4"; private String nameOfLoanProduct = Utils.randomNameGenerator("LOAN_PRODUCT_", 6); private String shortName = Utils.randomNameGenerator("", 4); @@ -81,7 +82,7 @@ public class LoanProductTestBuilder { map.put("minPrincipal", this.minPrincipal); map.put("maxPrincipal", this.maxPrincipal); - if (this.accountingRule.equals(ACCRUAL_BASED)) { + if (this.accountingRule.equals(ACCRUAL_UPFRONT) || this.accountingRule.equals(ACCRUAL_PERIODIC)) { map.putAll(getAccountMappingForAccrualBased()); } else if (this.accountingRule.equals(CASH_BASED)) { map.putAll(getAccountMappingForCashBased()); @@ -195,8 +196,14 @@ public class LoanProductTestBuilder { return this; } - public LoanProductTestBuilder withAccountingRuleAsAccrualBased(final Account[] account_list) { - this.accountingRule = ACCRUAL_BASED; + public LoanProductTestBuilder withAccountingRuleUpfrontAccrual(final Account[] account_list) { + this.accountingRule = ACCRUAL_UPFRONT; + this.accountList = account_list; + return this; + } + + public LoanProductTestBuilder withAccountingRulePeriodicAccrual(final Account[] account_list) { + this.accountingRule = ACCRUAL_PERIODIC; this.accountList = account_list; return this; }