Revert "Merge branch 'develop' into openmf_develop" This reverts commit 6005dd0c11c2e1fca511c45494600851bedd6a20, reversing changes made to fc96989bc20f9ee4745e97bc07fb2daac289c549.
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/5ed50615 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/5ed50615 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/5ed50615 Branch: refs/heads/develop Commit: 5ed506156bd7d750ef4238a2c3418ce0636bda04 Parents: 6ecbd28 Author: Nazeer Hussain Shaik <[email protected]> Authored: Wed Mar 9 15:59:01 2016 +0530 Committer: Nazeer Hussain Shaik <[email protected]> Committed: Wed Mar 9 15:59:01 2016 +0530 ---------------------------------------------------------------------- .../AccountingScenarioIntegrationTest.java | 6 +- .../integrationtests/FixedDepositTest.java | 331 +++------------- .../LoanReschedulingWithinCenterTest.java | 392 ------------------- .../integrationtests/RecurringDepositTest.java | 206 +--------- .../SchedulerJobsTestResults.java | 3 +- .../integrationtests/common/CalendarHelper.java | 41 -- .../fixeddeposit/FixedDepositAccountHelper.java | 85 ++-- .../fixeddeposit/FixedDepositProductHelper.java | 264 ++----------- .../RecurringDepositAccountHelper.java | 74 +++- .../RecurringDepositProductHelper.java | 262 ++----------- .../api/GlobalConfigurationApiConstant.java | 6 +- .../data/GlobalConfigurationDataValidator.java | 7 - .../data/GlobalConfigurationPropertyData.java | 10 +- .../domain/ConfigurationDomainService.java | 7 - .../domain/ConfigurationDomainServiceJpa.java | 22 -- .../domain/GlobalConfigurationProperty.java | 21 +- .../ConfigurationReadPlatformServiceImpl.java | 8 +- .../data/CalendarHistoryDataWrapper.java | 61 --- .../portfolio/calendar/domain/Calendar.java | 21 +- ...arWritePlatformServiceJpaRepositoryImpl.java | 14 +- .../InterestRateChartApiConstants.java | 10 +- .../data/InterestRateChartData.java | 65 ++- .../data/InterestRateChartDataValidator.java | 21 +- .../InterestRateChartSlabDataValidator.java | 69 +--- .../domain/InterestRateChart.java | 83 +--- .../domain/InterestRateChartFields.java | 34 +- .../domain/InterestRateChartSlabComparator.java | 92 ----- .../domain/InterestRateChartSlabFields.java | 148 +------ .../service/InterestRateChartAssembler.java | 30 +- ...nterestRateChartReadPlatformServiceImpl.java | 27 +- .../loanaccount/data/ScheduleGeneratorDTO.java | 18 +- .../portfolio/loanaccount/domain/Loan.java | 26 +- .../domain/LoanAccountDomainServiceJpa.java | 72 ++-- .../domain/DefaultScheduledDateGenerator.java | 25 +- .../domain/LoanApplicationTerms.java | 43 +- .../service/LoanScheduleAssembler.java | 4 +- ...onWritePlatformServiceJpaRepositoryImpl.java | 2 +- .../loanaccount/service/LoanAssembler.java | 47 ++- .../service/LoanReadPlatformServiceImpl.java | 32 +- .../service/LoanSchedularServiceImpl.java | 1 - .../loanaccount/service/LoanUtilService.java | 86 +--- ...anWritePlatformServiceJpaRepositoryImpl.java | 42 +- .../DepositAccountInterestRateChartData.java | 67 ++-- .../domain/DepositAccountDomainServiceJpa.java | 60 +-- .../domain/DepositAccountInterestRateChart.java | 5 - .../savings/domain/DepositProductAssembler.java | 28 +- .../savings/domain/FixedDepositProduct.java | 2 +- .../savings/domain/RecurringDepositAccount.java | 34 +- ...nterestRateChartReadPlatformServiceImpl.java | 40 +- .../V291__organisation_start_date_config.sql | 2 - .../V292__update_organisation_start_date.sql | 1 - ..._interest_rate_chart_support_for_amounts.sql | 13 - ...ttype_application_forDisbursement_charge.sql | 1 - 53 files changed, 564 insertions(+), 2507 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5ed50615/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java index 0e40d74..ef020bc 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java @@ -521,7 +521,6 @@ public class AccountingScenarioIntegrationTest { System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------"); FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec); final String fixedDepositProductJSON = fixedDepositProductHelper // - .withPeriodRangeChart()// .withAccountingRuleAsCashBased(accounts).build(validFrom, validTo); return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec); } @@ -530,7 +529,7 @@ public class AccountingScenarioIntegrationTest { final String validTo, final String submittedOnDate, final String penalInterestType) { System.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------"); final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) // - .withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType); + .withSubmittedOnDate(submittedOnDate).build(clientID, productID, validFrom, validTo, penalInterestType); return this.fixedDepositAccountHelper .applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec); } @@ -539,7 +538,6 @@ public class AccountingScenarioIntegrationTest { System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------"); RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec); final String recurringDepositProductJSON = recurringDepositProductHelper // - .withPeriodRangeChart()// .withAccountingRuleAsCashBased(accounts).build(validFrom, validTo); return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec); } @@ -550,7 +548,7 @@ public class AccountingScenarioIntegrationTest { final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec) // .withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate) - .build(clientID, productID, penalInterestType); + .build(clientID, productID, validFrom, validTo, penalInterestType); return this.recurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, this.requestSpec, this.responseSpec); } http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5ed50615/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java index fa638bc..3d6a4ef 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FixedDepositTest.java @@ -114,8 +114,8 @@ public class FixedDepositTest { } /*** - * Test case for Fixed Deposit Account premature closure with transaction - * type withdrawal and Cash Based accounting enabled + * Test case for Fixed Deposit Account premature closure with + * transaction type withdrawal and Cash Based accounting enabled */ @Test public void testFixedDepositAccountWithPrematureClosureTypeWithdrawal() { @@ -123,7 +123,7 @@ public class FixedDepositTest { this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec); - + /*** * Create GL Accounts for product account mapping */ @@ -170,8 +170,8 @@ public class FixedDepositTest { /*** * Apply for FD account with created product and verify status */ - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -189,11 +189,11 @@ public class FixedDepositTest { */ fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE); FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap); - + HashMap accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float depositAmount = (Float) accountSummary.get("totalDeposits"); - + /*** * Verify journal entries posted for initial deposit transaction which * happened at activation time @@ -214,7 +214,7 @@ public class FixedDepositTest { */ Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId); Assert.assertNotNull(transactionIdForPostInterest); - + accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted"); @@ -252,165 +252,6 @@ public class FixedDepositTest { JournalEntry.TransactionType.DEBIT)); } - - @Test - public void testFixedDepositAccountWithPeriodInterestRateChart() { - final String chartToUse = "period"; - final String depositAmount = "10000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithPeriodInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "period"; - final String depositAmount = "2000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithPeriodInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "period"; - final String depositAmount = "10000"; - final String depositPeriod = "18"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithAmountInterestRateChart() { - final String chartToUse = "amount"; - final String depositAmount = "10000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithAmountInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "amount"; - final String depositAmount = "5000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(5.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithAmountInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "amount"; - final String depositAmount = "10000"; - final String depositPeriod = "26"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithPeriodAndAmountInterestRateChart() { - final String chartToUse = "period_amount"; - final String depositAmount = "10000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithPeriodAndAmountInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "period_amount"; - final String depositAmount = "5000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithPeriodAndAmountInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "period_amount"; - final String depositAmount = "10000"; - final String depositPeriod = "20"; - final Float interestRate = new Float(9.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithAmountAndPeriodInterestRateChart() { - final String chartToUse = "amount_period"; - final String depositAmount = "10000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(8.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithAmountAndPeriodInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "amount_period"; - final String depositAmount = "5000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testFixedDepositAccountWithAmountAndPeriodInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "amount_period"; - final String depositAmount = "10000"; - final String depositPeriod = "6"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - private void testFixedDepositAccountForInterestRate(final String chartToUse, final String depositAmount, final String depositPeriod, - final Float interestRate) { - this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec); - this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); - this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec); - - final String VALID_FROM = "01 March 2014"; - final String VALID_TO = "01 March 2016"; - - final String SUBMITTED_ON_DATE = "01 March 2015"; - final String APPROVED_ON_DATE = "01 March 2015"; - final String ACTIVATION_DATE = "01 March 2015"; - - Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); - - /*** - * Create FD product with CashBased accounting enabled - */ - final String accountingRule = NONE; - Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule, chartToUse); - Assert.assertNotNull(fixedDepositProductId); - - /*** - * Apply for FD account with created product and verify status - */ - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM, depositAmount, depositPeriod); - Assert.assertNotNull(fixedDepositAccountId); - - HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, - this.responseSpec, fixedDepositAccountId.toString()); - FixedDepositAccountStatusChecker.verifyFixedDepositIsPending(fixedDepositAccountStatusHashMap); - - /*** - * Approve the FD account and verify whether account is approved - */ - fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.approveFixedDeposit(fixedDepositAccountId, APPROVED_ON_DATE); - FixedDepositAccountStatusChecker.verifyFixedDepositIsApproved(fixedDepositAccountStatusHashMap); - - /*** - * Activate the FD Account and verify whether account is activated - */ - fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE); - FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap); - - HashMap accountSummary = this.fixedDepositAccountHelper.getFixedDepositDetails(fixedDepositAccountId); - - Assert.assertEquals(interestRate, accountSummary.get("nominalAnnualInterestRate")); - } /*** * Test case for FD Account premature closure with transaction transfers to @@ -422,7 +263,7 @@ public class FixedDepositTest { this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); this.fixedDepositAccountHelper = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec); - + /*** * Create GL Accounts for product account mapping */ @@ -454,7 +295,7 @@ public class FixedDepositTest { todaysDate.add(Calendar.DATE, numberOfDaysLeft); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); - + Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); Assert.assertNotNull(clientId); @@ -485,8 +326,8 @@ public class FixedDepositTest { incomeAccount, expenseAccount); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -502,7 +343,7 @@ public class FixedDepositTest { HashMap accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float depositAmount = (Float) accountSummary.get("totalDeposits"); - + /*** * Verify journal entries posted for initial deposit transaction which * happened at activation time @@ -534,10 +375,10 @@ public class FixedDepositTest { final JournalEntry[] liablilityAccountEntry = { new JournalEntry(totalInterestPosted, JournalEntry.TransactionType.CREDIT) }; this.journalEntryHelper.checkJournalEntryForAssetAccount(expenseAccount, INTEREST_POSTED_DATE, expenseAccountEntry); this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, INTEREST_POSTED_DATE, liablilityAccountEntry); - + HashMap savingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId); Float balanceBefore = (Float) savingsSummaryBefore.get("accountBalance"); - + /*** * Retrieve mapped financial account for liability transfer */ @@ -571,7 +412,7 @@ public class FixedDepositTest { this.journalEntryHelper.checkJournalEntryForAssetAccount(financialAccount, CLOSED_ON_DATE, new JournalEntry(prematurityAmount, JournalEntry.TransactionType.DEBIT), new JournalEntry(prematurityAmount, JournalEntry.TransactionType.CREDIT)); - + HashMap savingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); Float balanceAfter = (Float) savingsSummaryAfter.get("accountBalance"); Float expectedSavingsBalance = balanceBefore + prematurityAmount; @@ -581,8 +422,8 @@ public class FixedDepositTest { } /*** - * Test case for Fixed Deposit Account premature closure with transaction - * type ReInvest and Cash Based accounting enabled + * Test case for Fixed Deposit Account premature closure with + * transaction type ReInvest and Cash Based accounting enabled */ @Test public void testFixedDepositAccountWithPrematureClosureTypeReinvest() { @@ -618,7 +459,7 @@ public class FixedDepositTest { final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime()); final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime()); final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); - + Integer currentDate = new Integer(currentDateFormat.format(todaysDate.getTime())); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; @@ -637,8 +478,8 @@ public class FixedDepositTest { incomeAccount, expenseAccount); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -650,11 +491,11 @@ public class FixedDepositTest { fixedDepositAccountStatusHashMap = this.fixedDepositAccountHelper.activateFixedDeposit(fixedDepositAccountId, ACTIVATION_DATE); FixedDepositAccountStatusChecker.verifyFixedDepositIsActive(fixedDepositAccountStatusHashMap); - + HashMap accountSummary = this.fixedDepositAccountHelper.getFixedDepositSummary(fixedDepositAccountId); Float depositAmount = (Float) accountSummary.get("totalDeposits"); - + /*** * Verify journal entries posted for initial deposit transaction which * happened at activation time @@ -723,8 +564,8 @@ public class FixedDepositTest { HashMap fixedDepositProductData = this.fixedDepositProductHelper.retrieveFixedDepositProductById(this.requestSpec, this.responseSpec, fixedDepositProductId.toString()); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); todaysDate.add(Calendar.DATE, -1); @@ -762,8 +603,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -805,8 +646,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -846,8 +687,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -885,8 +726,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -928,8 +769,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -998,8 +839,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1075,8 +916,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -1179,8 +1020,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1287,8 +1128,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - TILL_PREMATURE_WITHDRAWAL); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL); Assert.assertNotNull(fixedDepositAccountId); HashMap fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec, @@ -1399,8 +1240,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - TILL_PREMATURE_WITHDRAWAL); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, TILL_PREMATURE_WITHDRAWAL); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1511,8 +1352,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1580,7 +1421,7 @@ public class FixedDepositTest { final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime()); final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime()); - System.out.println("Submitted Date:" + SUBMITTED_ON_DATE); + System.out.println("Submitted Date:"+SUBMITTED_ON_DATE); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); Assert.assertNotNull(clientId); @@ -1588,8 +1429,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1668,8 +1509,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1752,8 +1593,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1837,8 +1678,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -1919,8 +1760,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -2001,8 +1842,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -2082,8 +1923,8 @@ public class FixedDepositTest { Integer fixedDepositProductId = createFixedDepositProduct(VALID_FROM, VALID_TO, accountingRule); Assert.assertNotNull(fixedDepositProductId); - Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), SUBMITTED_ON_DATE, - WHOLE_TERM); + Integer fixedDepositAccountId = applyForFixedDepositApplication(clientId.toString(), fixedDepositProductId.toString(), VALID_FROM, + VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM); Assert.assertNotNull(fixedDepositAccountId); HashMap modificationsHashMap = this.fixedDepositAccountHelper.updateInterestCalculationConfigForFixedDeposit(clientId.toString(), @@ -2134,58 +1975,16 @@ public class FixedDepositTest { } else if (accountingRule.equals(NONE)) { fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsNone(); } - final String fixedDepositProductJSON = fixedDepositProductHelper.withPeriodRangeChart() // - .build(validFrom, validTo); - return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec); - } - - private Integer createFixedDepositProduct(final String validFrom, final String validTo, final String accountingRule, - final String chartToBePicked, Account... accounts) { - System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------"); - FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec); - if (accountingRule.equals(CASH_BASED)) { - fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsCashBased(accounts); - } else if (accountingRule.equals(NONE)) { - fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsNone(); - } - switch (chartToBePicked) { - case "period": - fixedDepositProductHelper = fixedDepositProductHelper.withPeriodRangeChart(); - break; - case "amount": - fixedDepositProductHelper = fixedDepositProductHelper.withAmountRangeChart(); - break; - case "period_amount": - fixedDepositProductHelper = fixedDepositProductHelper.withPeriodAndAmountRangeChart(); - break; - case "amount_period": - fixedDepositProductHelper = fixedDepositProductHelper.withAmountAndPeriodRangeChart(); - break; - default: - break; - } - final String fixedDepositProductJSON = fixedDepositProductHelper // .build(validFrom, validTo); return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec); } - private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate, - final String penalInterestType) { + private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String validFrom, + final String validTo, final String submittedOnDate, final String penalInterestType) { System.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------"); final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) // - .withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType); - return this.fixedDepositAccountHelper - .applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec); - } - - private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate, - final String penalInterestType, final String depositAmount, final String depositPeriod) { - System.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------"); - final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) - // - .withSubmittedOnDate(submittedOnDate).withDepositPeriod(depositPeriod).withDepositAmount(depositAmount) - .build(clientID, productID, penalInterestType); + .withSubmittedOnDate(submittedOnDate).build(clientID, productID, validFrom, validTo, penalInterestType); return this.fixedDepositAccountHelper .applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec); } http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5ed50615/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java deleted file mode 100644 index a825bcb..0000000 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/LoanReschedulingWithinCenterTest.java +++ /dev/null @@ -1,392 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.integrationtests; - - -import static org.junit.Assert.assertEquals; - -import java.sql.Timestamp; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.apache.fineract.integrationtests.common.CalendarHelper; -import org.apache.fineract.integrationtests.common.CenterDomain; -import org.apache.fineract.integrationtests.common.CenterHelper; -import org.apache.fineract.integrationtests.common.ClientHelper; -import org.apache.fineract.integrationtests.common.GroupHelper; -import org.apache.fineract.integrationtests.common.OfficeHelper; -import org.apache.fineract.integrationtests.common.Utils; -import org.apache.fineract.integrationtests.common.accounting.Account; -import org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder; -import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder; -import org.apache.fineract.integrationtests.common.loans.LoanStatusChecker; -import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; -import org.apache.fineract.integrationtests.common.organisation.StaffHelper; - -import com.google.gson.Gson; -import com.jayway.restassured.builder.RequestSpecBuilder; -import com.jayway.restassured.builder.ResponseSpecBuilder; -import com.jayway.restassured.http.ContentType; -import com.jayway.restassured.specification.RequestSpecification; -import com.jayway.restassured.specification.ResponseSpecification; - -public class LoanReschedulingWithinCenterTest { - - private RequestSpecification requestSpec; - private ResponseSpecification responseSpec; - private LoanTransactionHelper loanTransactionHelper; - private ResponseSpecification generalResponseSpec; - private LoanApplicationApprovalTest loanApplicationApprovalTest; - - @Before - public void setup() { - Utils.initializeRESTAssured(); - this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); - this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); - this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); - this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); - this.loanApplicationApprovalTest = new LoanApplicationApprovalTest(); - this.generalResponseSpec = new ResponseSpecBuilder().build(); - } - - @SuppressWarnings("rawtypes") - @Test - public void testCenterReschedulingLoansWithInterestRecalculationEnabled() { - - Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007"); - String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime()); - String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - int staffId = StaffHelper.createStaff(requestSpec, responseSpec); - int[] groupMembers = generateGroupMembers(1, officeId); - final String centerActivationDate = "01 July 2007"; - Integer centerId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, centerActivationDate, requestSpec, - responseSpec); - CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec); - Integer groupId = groupMembers[0]; - Assert.assertNotNull(center); - Assert.assertTrue(center.getStaffId() == staffId); - Assert.assertTrue(center.isActive() == true); - - Integer calendarId = createCalendarMeeting(centerId); - - Integer clientId = createClient(officeId); - - associateClientsToGroup(groupId, clientId); - - DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); - dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); - Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant()); - today.add(Calendar.DAY_OF_MONTH, -14); - // CREATE A LOAN PRODUCT - final String disbursalDate = dateFormat.format(today.getTime()); - final String recalculationRestFrequencyDate = "01 January 2012"; - final boolean isMultiTrancheLoan = false; - - // CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION - final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY, - LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE, - LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS, - LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate, - LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan); - - // APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION - final Integer loanId = applyForLoanApplicationForInterestRecalculation(clientId, groupId, calendarId, loanProductID, disbursalDate, - recalculationRestFrequencyDate, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), null); - - // Test for loan account is created - Assert.assertNotNull(loanId); - HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId); - - // Test for loan account is created, can be approved - this.loanTransactionHelper.approveLoan(disbursalDate, loanId); - loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId); - LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); - - // Test for loan account approved can be disbursed - this.loanTransactionHelper.disburseLoan(disbursalDate, loanId); - loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanId); - LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); - - System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------"); - Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); - todaysdate.add(Calendar.DAY_OF_MONTH, 14); - String oldMeetingDate = dateFormat.format(todaysdate.getTime()); - todaysdate.add(Calendar.DAY_OF_MONTH, 1); - final String centerMeetingNewStartDate = dateFormat.format(todaysdate.getTime()); - CalendarHelper.updateMeetingCalendarForCenter(this.requestSpec, this.responseSpec, centerId, calendarId.toString(), oldMeetingDate, - centerMeetingNewStartDate); - - ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanId); - // VERIFY RESCHEDULED DATE - ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate"); - assertEquals(getDateAsArray(todaysdate, 0), dueDateLoanSchedule); - - // VERIFY THE INTEREST - Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue"); - assertEquals(String.valueOf(interestDue), "90.82"); - - } - - private void associateClientsToGroup(Integer groupId, Integer clientId) { - // Associate client to the group - GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupId.toString(), clientId.toString()); - GroupHelper.verifyGroupMembers(this.requestSpec, this.responseSpec, groupId, clientId); - } - - private Integer createClient(Integer officeId) { - // CREATE CLIENT - final String clientActivationDate = "01 July 2014"; - Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, clientActivationDate, officeId.toString()); - ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientId); - return clientId; - } - - private Integer createCalendarMeeting(Integer centerId) { - DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); - dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); - Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant()); - final String startDate = dateFormat.format(today.getTime()); - final String frequency = "2"; // 2:Weekly - final String interval = "2"; // Every one week - final Integer repeatsOnDay = today.get(Calendar.DAY_OF_WEEK) - 1; - - Integer calendarId = CalendarHelper.createMeetingForGroup(this.requestSpec, this.responseSpec, centerId, startDate, frequency, - interval, repeatsOnDay.toString()); - System.out.println("calendarId " + calendarId); - return calendarId; - } - - @SuppressWarnings("rawtypes") - @Test - public void testCenterReschedulingMultiTrancheLoansWithInterestRecalculationEnabled() { - - Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007"); - String name = "TestFullCreation" + new Timestamp(new java.util.Date().getTime()); - String externalId = Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - int staffId = StaffHelper.createStaff(requestSpec, responseSpec); - int[] groupMembers = generateGroupMembers(1, officeId); - final String centerActivationDate = "01 July 2007"; - Integer centerId = CenterHelper.createCenter(name, officeId, externalId, staffId, groupMembers, centerActivationDate, requestSpec, - responseSpec); - CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec); - Integer groupId = groupMembers[0]; - Assert.assertNotNull(center); - Assert.assertTrue(center.getStaffId() == staffId); - Assert.assertTrue(center.isActive() == true); - - Integer calendarId = createCalendarMeeting(centerId); - - Integer clientId = createClient(officeId); - - associateClientsToGroup(groupId, clientId); - - // CREATE A LOAN PRODUCT - DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); - dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); - Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant()); - today.add(Calendar.DAY_OF_MONTH, -14); - // CREATE A LOAN PRODUCT - final String approveDate = dateFormat.format(today.getTime()); - final String expectedDisbursementDate = dateFormat.format(today.getTime()); - final String disbursementDate = dateFormat.format(today.getTime()); - final String approvalAmount = "10000"; - final String recalculationRestFrequencyDate = "01 January 2012"; - final boolean isMultiTrancheLoan = true; - - // CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION - final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY, - LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE, - LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS, - LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate, - LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan); - - // CREATE TRANCHES - List<HashMap> createTranches = new ArrayList<>(); - createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail(disbursementDate, "5000")); - createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("25 June 2016", "5000")); - - // APPROVE TRANCHES - List<HashMap> approveTranches = new ArrayList<>(); - approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail(disbursementDate, "5000")); - approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("25 June 2016", "5000")); - - // APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION - final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientId, groupId, calendarId, loanProductID, - disbursementDate, recalculationRestFrequencyDate, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), - createTranches); - HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); - - // VALIDATE THE LOAN STATUS - LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap); - - System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------"); - loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount, - loanID, approveTranches); - - // VALIDATE THE LOAN IS APPROVED - LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap); - LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap); - - // DISBURSE A FIRST TRANCHE - this.loanTransactionHelper.disburseLoan(disbursementDate, loanID); - loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID); - - System.out.println("---------------------------------CHANGING GROUP MEETING DATE ------------------------------------------"); - Calendar todaysdate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); - todaysdate.add(Calendar.DAY_OF_MONTH, 14); - String oldMeetingDate = dateFormat.format(todaysdate.getTime()); - todaysdate.add(Calendar.DAY_OF_MONTH, 1); - final String centerMeetingNewStartDate = dateFormat.format(todaysdate.getTime()); - CalendarHelper.updateMeetingCalendarForCenter(this.requestSpec, this.responseSpec, centerId, calendarId.toString(), oldMeetingDate, - centerMeetingNewStartDate); - - ArrayList loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID); - // VERIFY RESCHEDULED DATE - ArrayList dueDateLoanSchedule = (ArrayList) ((HashMap) loanRepaymnetSchedule.get(2)).get("dueDate"); - assertEquals(getDateAsArray(todaysdate, 0), dueDateLoanSchedule); - - // VERIFY THE INTEREST - Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue"); - assertEquals(String.valueOf(interestDue), "41.05"); - - } - - private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy, - final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod, - final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval, - final String recalculationRestFrequencyDate, final String preCloseInterestCalculationStrategy, final Account[] accounts, - final boolean isMultiTrancheLoan) { - final String recalculationCompoundingFrequencyType = null; - final String recalculationCompoundingFrequencyInterval = null; - final String recalculationCompoundingFrequencyDate = null; - return createLoanProductWithInterestRecalculation(repaymentStrategy, interestRecalculationCompoundingMethod, - rescheduleStrategyMethod, recalculationRestFrequencyType, recalculationRestFrequencyInterval, - recalculationRestFrequencyDate, recalculationCompoundingFrequencyType, recalculationCompoundingFrequencyInterval, - recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan); - } - - private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy, - final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod, - final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval, - final String recalculationRestFrequencyDate, final String recalculationCompoundingFrequencyType, - final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate, - final String preCloseInterestCalculationStrategy, final Account[] accounts, final String chargeId, - boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan) { - System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------"); - LoanProductTestBuilder builder = new LoanProductTestBuilder() - .withPrincipal("10000.00") - .withNumberOfRepayments("12") - .withRepaymentAfterEvery("2") - .withRepaymentTypeAsWeek() - .withinterestRatePerPeriod("2") - .withInterestRateFrequencyTypeAsMonths() - .withTranches(isMultiTrancheLoan) - .withInterestCalculationPeriodTypeAsRepaymentPeriod(true) - .withRepaymentStrategy(repaymentStrategy) - .withInterestTypeAsDecliningBalance() - .withInterestRecalculationDetails(interestRecalculationCompoundingMethod, rescheduleStrategyMethod, - preCloseInterestCalculationStrategy) - .withInterestRecalculationRestFrequencyDetails(recalculationRestFrequencyType, recalculationRestFrequencyInterval, - recalculationRestFrequencyDate) - .withInterestRecalculationCompoundingFrequencyDetails(recalculationCompoundingFrequencyType, - recalculationCompoundingFrequencyInterval, recalculationCompoundingFrequencyDate); - if (accounts != null) { - builder = builder.withAccountingRulePeriodicAccrual(accounts); - } - - if (isArrearsBasedOnOriginalSchedule) builder = builder.withArrearsConfiguration(); - - final String loanProductJSON = builder.build(chargeId); - return this.loanTransactionHelper.getLoanProductId(loanProductJSON); - } - - @SuppressWarnings("rawtypes") - private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, Integer groupId, Integer calendarId, - final Integer loanProductID, final String disbursementDate, final String restStartDate, final String repaymentStrategy, - final List<HashMap> charges, List<HashMap> tranches) { - final String graceOnInterestPayment = null; - final String compoundingStartDate = null; - final String graceOnPrincipalPayment = null; - return applyForLoanApplicationForInterestRecalculation(clientID, groupId, calendarId, loanProductID, disbursementDate, - restStartDate, compoundingStartDate, repaymentStrategy, charges, graceOnInterestPayment, graceOnPrincipalPayment, tranches); - } - - @SuppressWarnings({ "rawtypes", "unused" }) - private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, Integer groupId, Integer calendarId, - final Integer loanProductID, final String disbursementDate, final String restStartDate, final String compoundingStartDate, - final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment, - final String graceOnPrincipalPayment, List<HashMap> tranches) { - System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------"); - final String loanApplicationJSON = new LoanApplicationTestBuilder() // - .withPrincipal("10000.00") // - .withLoanTermFrequency("24") // - .withLoanTermFrequencyAsWeeks() // - .withNumberOfRepayments("12") // - .withRepaymentEveryAfter("2") // - .withRepaymentFrequencyTypeAsWeeks() // - .withInterestRatePerPeriod("2").withLoanType("jlg") // - .withCalendarID(calendarId.toString()).withAmortizationTypeAsEqualInstallments() // - .withFixedEmiAmount("") // - .withTranches(tranches).withInterestTypeAsDecliningBalance() // - .withInterestCalculationPeriodTypeAsDays() // - .withInterestCalculationPeriodTypeAsDays() // - .withExpectedDisbursementDate(disbursementDate) // - .withSubmittedOnDate(disbursementDate) // - .withRestFrequencyDate(restStartDate)// - .withwithRepaymentStrategy(repaymentStrategy) // - .withCharges(charges)// - .build(clientID.toString(), groupId.toString(), loanProductID.toString(), null); - return this.loanTransactionHelper.getLoanId(loanApplicationJSON); - } - - private int[] generateGroupMembers(int size, int officeId) { - int[] groupMembers = new int[size]; - for (int i = 0; i < groupMembers.length; i++) { - final HashMap<String, String> map = new HashMap<>(); - map.put("officeId", "" + officeId); - map.put("name", Utils.randomStringGenerator("Group_Name_", 5)); - map.put("externalId", Utils.randomStringGenerator("ID_", 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")); - map.put("dateFormat", "dd MMMM yyyy"); - map.put("locale", "en"); - map.put("active", "true"); - map.put("activationDate", "04 March 2011"); - - groupMembers[i] = Utils.performServerPost(requestSpec, responseSpec, "/fineract-provider/api/v1/groups?" - + Utils.TENANT_IDENTIFIER, new Gson().toJson(map), "groupId"); - } - return groupMembers; - } - - private List getDateAsArray(Calendar date, int addPeriod) { - return getDateAsArray(date, addPeriod, Calendar.DAY_OF_MONTH); - } - - private List getDateAsArray(Calendar date, int addvalue, int type) { - date.add(type, addvalue); - return new ArrayList<>(Arrays.asList(date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH))); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5ed50615/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java index 1d52aec..b9fd152 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/RecurringDepositTest.java @@ -2496,169 +2496,6 @@ public class RecurringDepositTest { } - @Test - public void testRecurringDepositAccountWithPeriodInterestRateChart() { - final String chartToUse = "period"; - final String depositAmount = "1000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithPeriodInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "period"; - final String depositAmount = "10000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithPeriodInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "period"; - final String depositAmount = "1000"; - final String depositPeriod = "18"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithAmountInterestRateChart() { - final String chartToUse = "amount"; - final String depositAmount = "1000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(8.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithAmountInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "amount"; - final String depositAmount = "500"; - final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithAmountInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "amount"; - final String depositAmount = "500"; - final String depositPeriod = "10"; - final Float interestRate = new Float(5.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithPeriodAndAmountInterestRateChart() { - final String chartToUse = "period_amount"; - final String depositAmount = "1000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithPeriodAndAmountInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "period_amount"; - final String depositAmount = "400"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithPeriodAndAmountInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "period_amount"; - final String depositAmount = "1000"; - final String depositPeriod = "14"; - final Float interestRate = new Float(8.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithAmountAndPeriodInterestRateChart() { - final String chartToUse = "amount_period"; - final String depositAmount = "1000"; - final String depositPeriod = "12"; - final Float interestRate = new Float(8.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithAmountAndPeriodInterestRateChart_AMOUNT_VARIATION() { - final String chartToUse = "amount_period"; - final String depositAmount = "100"; - final String depositPeriod = "12"; - final Float interestRate = new Float(6.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - @Test - public void testRecurringDepositAccountWithAmountAndPeriodInterestRateChart_PERIOD_VARIATION() { - final String chartToUse = "amount_period"; - final String depositAmount = "1000"; - final String depositPeriod = "6"; - final Float interestRate = new Float(7.0); - testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate); - } - - private void testFixedDepositAccountForInterestRate(final String chartToUse, final String depositAmount, final String depositPeriod, - final Float interestRate) { - this.recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec); - this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); - this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec); - this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec); - - final String VALID_FROM = "01 March 2014"; - final String VALID_TO = "01 March 2016"; - - final String SUBMITTED_ON_DATE = "01 March 2015"; - final String APPROVED_ON_DATE = "01 March 2015"; - final String ACTIVATION_DATE = "01 March 2015"; - - Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - Assert.assertNotNull(clientId); - - /*** - * Create FD product with CashBased accounting enabled - */ - final String accountingRule = NONE; - Integer recurringDepositProductId = createRecurringDepositProduct(VALID_FROM, VALID_TO, accountingRule, chartToUse); - Assert.assertNotNull(recurringDepositProductId); - - /*** - * Apply for FD account with created product and verify status - */ - Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(), - VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, WHOLE_TERM, SUBMITTED_ON_DATE, depositAmount, depositPeriod); - Assert.assertNotNull(recurringDepositAccountId); - - HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount( - this.requestSpec, this.responseSpec, recurringDepositAccountId.toString()); - RecurringDepositAccountStatusChecker.verifyRecurringDepositIsPending(recurringDepositAccountStatusHashMap); - - /*** - * Approve the RD account and verify whether account is approved - */ - recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.approveRecurringDeposit(recurringDepositAccountId, - APPROVED_ON_DATE); - RecurringDepositAccountStatusChecker.verifyRecurringDepositIsApproved(recurringDepositAccountStatusHashMap); - - /*** - * Activate the RD Account and verify whether account is activated - */ - recurringDepositAccountStatusHashMap = this.recurringDepositAccountHelper.activateRecurringDeposit(recurringDepositAccountId, - ACTIVATION_DATE); - RecurringDepositAccountStatusChecker.verifyRecurringDepositIsActive(recurringDepositAccountStatusHashMap); - - HashMap recurringDepositAccountData = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, - this.responseSpec, recurringDepositAccountId); - - Assert.assertEquals(interestRate, recurringDepositAccountData.get("nominalAnnualInterestRate")); - } - private Integer createRecurringDepositProduct(final String validFrom, final String validTo, final String accountingRule, Account... accounts) { System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------"); @@ -2668,36 +2505,6 @@ public class RecurringDepositTest { } else if (accountingRule.equals(NONE)) { recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsNone(); } - final String recurringDepositProductJSON = recurringDepositProductHelper.withPeriodRangeChart().build(validFrom, validTo); - return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec); - } - - private Integer createRecurringDepositProduct(final String validFrom, final String validTo, final String accountingRule, - final String chartToBePicked, Account... accounts) { - System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------"); - RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec); - if (accountingRule.equals(CASH_BASED)) { - recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsCashBased(accounts); - } else if (accountingRule.equals(NONE)) { - recurringDepositProductHelper = recurringDepositProductHelper.withAccountingRuleAsNone(); - } - - switch (chartToBePicked) { - case "period": - recurringDepositProductHelper = recurringDepositProductHelper.withPeriodRangeChart(); - break; - case "amount": - recurringDepositProductHelper = recurringDepositProductHelper.withAmountRangeChart(); - break; - case "period_amount": - recurringDepositProductHelper = recurringDepositProductHelper.withPeriodAndAmountRangeChart(); - break; - case "amount_period": - recurringDepositProductHelper = recurringDepositProductHelper.withAmountAndPeriodRangeChart(); - break; - default: - break; - } final String recurringDepositProductJSON = recurringDepositProductHelper.build(validFrom, validTo); return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec); } @@ -2707,18 +2514,7 @@ public class RecurringDepositTest { System.out.println("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------"); final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec) .withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate) - .build(clientID, productID, penalInterestType); - return this.recurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, this.requestSpec, - this.responseSpec); - } - - private Integer applyForRecurringDepositApplication(final String clientID, final String productID, final String validFrom, - final String validTo, final String submittedOnDate, final String penalInterestType, final String expectedFirstDepositOnDate, - final String depositAmount, final String depositPeriod) { - System.out.println("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------"); - final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec) - .withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate) - .withDepositPeriod(depositPeriod).withMandatoryDepositAmount(depositAmount).build(clientID, productID, penalInterestType); + .build(clientID, productID, validFrom, validTo, penalInterestType); return this.recurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, this.requestSpec, this.responseSpec); } http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5ed50615/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java index cc6b3c8..985889a 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java @@ -892,7 +892,6 @@ public class SchedulerJobsTestResults { FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec); final String fixedDepositProductJSON = fixedDepositProductHelper // // .withAccountingRuleAsCashBased(accounts) - .withPeriodRangeChart()// .build(validFrom, validTo); return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec); } @@ -905,7 +904,7 @@ public class SchedulerJobsTestResults { // .withSubmittedOnDate(submittedOnDate).withSavings(savingsId).transferInterest(true) .withLockinPeriodFrequency("1", FixedDepositAccountHelper.DAYS) - .build(clientID, productID, penalInterestType); + .build(clientID, productID, validFrom, validTo, penalInterestType); return fixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec); } http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5ed50615/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java index e4bac93..0e9423b 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CalendarHelper.java @@ -32,8 +32,6 @@ public class CalendarHelper { private static final String BASE_URL = "/fineract-provider/api/v1/"; private static final String PARENT_ENTITY_NAME = "groups/"; private static final String ENITY_NAME = "/calendars"; - private static final String Center_Entity = "centers/"; - private static final String Edit_Calendar = "editcalendarbasedonmeetingdates/"; public static Integer createMeetingCalendarForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer groupId, final String startDate, final String frequency, final String interval, final String repeatsOnDay) { @@ -88,43 +86,4 @@ public class CalendarHelper { final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id"); assertEquals("ERROR IN CREATING THE CALENDAR", generatedCalendarId, responseCalendarId); } - - public static Integer createMeetingForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, - final Integer groupId, final String startDate, final String frequency, final String interval, final String repeatsOnDay) { - - System.out.println("---------------------------------CREATING A MEETING CALENDAR FOR THE GROUP------------------------------"); - - final String CALENDAR_RESOURCE_URL = BASE_URL + Center_Entity + groupId + ENITY_NAME + "?" + Utils.TENANT_IDENTIFIER; - - System.out.println(CALENDAR_RESOURCE_URL); - - return Utils.performServerPost(requestSpec, responseSpec, CALENDAR_RESOURCE_URL, - getTestCalendarAsJSON(frequency, interval, repeatsOnDay, startDate), "resourceId"); - } - - public static Integer updateMeetingCalendarForCenter(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, - Integer centerId, String calendarID, String oldDate, String startDate) { - - System.out.println("---------------------------------UPADATING A MEETING CALENDAR FOR THE CENTER------------------------------"); - - final String CALENDAR_RESOURCE_URL = BASE_URL + Center_Entity + centerId + ENITY_NAME + "/" + calendarID + "?" - + Utils.TENANT_IDENTIFIER; - - System.out.println(CALENDAR_RESOURCE_URL); - - return Utils.performServerPut(requestSpec, responseSpec, CALENDAR_RESOURCE_URL, getTestCalendarMeetingAsJSON(oldDate, startDate), - "resourceId"); - - } - - private static String getTestCalendarMeetingAsJSON(String oldDate, String startDate) { - final HashMap<String, String> map = new HashMap<>(); - map.put("dateFormat", "dd MMMM yyyy"); - map.put("locale", "en"); - map.put("newMeetingDate", startDate); - map.put("presentMeetingDate", oldDate); - map.put("reschedulebasedOnMeetingDates", "true"); - System.out.println("map : " + map); - return new Gson().toJson(map); - } } \ No newline at end of file
