You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ad...@apache.org on 2023/09/21 16:43:24 UTC
[fineract] branch develop updated: FINERACT-1971: Align dates and dateformat in tests
This is an automated email from the ASF dual-hosted git repository.
adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 0927c8e1d FINERACT-1971: Align dates and dateformat in tests
0927c8e1d is described below
commit 0927c8e1d9a3fdf2e9b0fc45ade67cab2c4f08a1
Author: Adam Saghy <ad...@gmail.com>
AuthorDate: Thu Sep 21 11:30:59 2023 +0200
FINERACT-1971: Align dates and dateformat in tests
---
.../client/api/ClientsApiResourceSwagger.java | 2 +-
.../ClientLoanIntegrationTest.java | 750 +++++++++++----------
.../ClientSavingsIntegrationTest.java | 2 +-
.../SavingsAccountTransactionTest.java | 2 +-
...gsAccountTransactionsSearchIntegrationTest.java | 2 +-
.../SavingsAccountsExternalIdTest.java | 3 +-
.../integrationtests/SavingsAccountsTest.java | 2 +-
.../integrationtests/common/CenterDomain.java | 2 +-
.../integrationtests/common/CenterHelper.java | 2 +-
.../common/shares/DividendsIntegrationTests.java | 10 +-
.../shares/ShareAccountIntegrationTests.java | 52 +-
11 files changed, 425 insertions(+), 404 deletions(-)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java
index a8a237b11..017837f40 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResourceSwagger.java
@@ -402,7 +402,7 @@ final class ClientsApiResourceSwagger {
@Schema(example = "03 August 2021")
public String activationDate;
- @Schema(example = "dd MMM yyyy")
+ @Schema(example = "dd MMMM yyyy")
public String dateFormat;
@Schema(example = "en")
public String locale;
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
index 77c2ece77..75423a908 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
@@ -2541,204 +2541,210 @@ public class ClientLoanIntegrationTest {
*/
@Test
public void loanWithChargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
+ try {
+ GlobalConfigurationHelper.manageConfigurations(REQUEST_SPEC, RESPONSE_SPEC,
+ GlobalConfigurationHelper.ENABLE_AUTOGENERATED_EXTERNAL_ID, true);
+ final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
+ ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
- final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
- ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
-
- // Add charges with payment mode regular
- List<HashMap> charges = new ArrayList<>();
- Integer percentageDisbursementCharge = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
- ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
- addCharges(charges, percentageDisbursementCharge, "1", null);
-
- Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
- addCharges(charges, percentageSpecifiedDueDateCharge, "1", "29 September 2011");
+ // Add charges with payment mode regular
+ List<HashMap> charges = new ArrayList<>();
+ Integer percentageDisbursementCharge = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
+ ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
+ addCharges(charges, percentageDisbursementCharge, "1", null);
- Integer percentageInstallmentFee = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
- addCharges(charges, percentageInstallmentFee, "1", "29 September 2011");
+ Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
+ ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ addCharges(charges, percentageSpecifiedDueDateCharge, "1", "29 September 2011");
- final Account assetAccount = ACCOUNT_HELPER.createAssetAccount();
- final Account incomeAccount = ACCOUNT_HELPER.createIncomeAccount();
- final Account expenseAccount = ACCOUNT_HELPER.createExpenseAccount();
- final Account overpaymentAccount = ACCOUNT_HELPER.createLiabilityAccount();
+ Integer percentageInstallmentFee = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
+ ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ addCharges(charges, percentageInstallmentFee, "1", "29 September 2011");
- List<HashMap> collaterals = new ArrayList<>();
-
- final Integer collateralId = CollateralManagementHelper.createCollateralProduct(REQUEST_SPEC, RESPONSE_SPEC);
+ final Account assetAccount = ACCOUNT_HELPER.createAssetAccount();
+ final Account incomeAccount = ACCOUNT_HELPER.createIncomeAccount();
+ final Account expenseAccount = ACCOUNT_HELPER.createExpenseAccount();
+ final Account overpaymentAccount = ACCOUNT_HELPER.createLiabilityAccount();
- final Integer clientCollateralId = CollateralManagementHelper.createClientCollateral(REQUEST_SPEC, RESPONSE_SPEC,
- String.valueOf(clientID), collateralId);
- addCollaterals(collaterals, clientCollateralId, BigDecimal.valueOf(1));
+ List<HashMap> collaterals = new ArrayList<>();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
- final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00", collaterals);
- Assertions.assertNotNull(loanID);
- HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+ final Integer collateralId = CollateralManagementHelper.createCollateralProduct(REQUEST_SPEC, RESPONSE_SPEC);
- ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- verifyLoanRepaymentSchedule(loanSchedule);
+ final Integer clientCollateralId = CollateralManagementHelper.createClientCollateral(REQUEST_SPEC, RESPONSE_SPEC,
+ String.valueOf(clientID), collateralId);
+ addCollaterals(collaterals, clientCollateralId, BigDecimal.valueOf(1));
- List<HashMap> loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
- validateCharge(percentageDisbursementCharge, loanCharges, "1", "120.00", "0.0", "0.0");
- validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "120.00", "0.0", "0.0");
- validateCharge(percentageInstallmentFee, loanCharges, "1", "120.00", "0.0", "0.0");
-
- // check for disbursement fee
- HashMap disbursementDetail = loanSchedule.get(0);
- validateNumberForEqual("120.00", String.valueOf(disbursementDetail.get("feeChargesDue")));
-
- // check for charge at specified date and installment fee
- HashMap firstInstallment = loanSchedule.get(1);
- validateNumberForEqual("149.11", String.valueOf(firstInstallment.get("feeChargesDue")));
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount,
+ overpaymentAccount);
+ final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00", collaterals);
+ Assertions.assertNotNull(loanID);
+ HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- // check for installment fee
- HashMap secondInstallment = loanSchedule.get(2);
- validateNumberForEqual("29.70", String.valueOf(secondInstallment.get("feeChargesDue")));
+ ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ verifyLoanRepaymentSchedule(loanSchedule);
- LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan("20 September 2011", loanID);
- LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
- LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+ List<HashMap> loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
+ validateCharge(percentageDisbursementCharge, loanCharges, "1", "120.00", "0.0", "0.0");
+ validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "120.00", "0.0", "0.0");
+ validateCharge(percentageInstallmentFee, loanCharges, "1", "120.00", "0.0", "0.0");
- LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
- GlobalConfigurationHelper.manageConfigurations(REQUEST_SPEC, RESPONSE_SPEC,
- GlobalConfigurationHelper.ENABLE_AUTOGENERATED_EXTERNAL_ID, true);
- String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount("20 September 2011", loanID,
- JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
- LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+ // check for disbursement fee
+ HashMap disbursementDetail = loanSchedule.get(0);
+ validateNumberForEqual("120.00", String.valueOf(disbursementDetail.get("feeChargesDue")));
- ArrayList<HashMap> loanTransactionDetails = LOAN_TRANSACTION_HELPER.getLoanTransactionDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- validateAccrualTransactionForDisbursementCharge(loanTransactionDetails);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.parseFloat("120.00"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("12000.00"), JournalEntry.TransactionType.CREDIT),
- new JournalEntry(Float.parseFloat("12000.00"), JournalEntry.TransactionType.DEBIT) };
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
- JOURNAL_ENTRY_HELPER.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
- new JournalEntry(Float.parseFloat("120.00"), JournalEntry.TransactionType.CREDIT));
- loanCharges.clear();
- loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
- validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.0", "120.00", "0.0");
+ // check for charge at specified date and installment fee
+ HashMap firstInstallment = loanSchedule.get(1);
+ validateNumberForEqual("149.11", String.valueOf(firstInstallment.get("feeChargesDue")));
- LOG.info("-------------Make repayment 1-----------");
- LOAN_TRANSACTION_HELPER.makeRepayment("20 October 2011", Float.parseFloat("3300.60"), loanID);
- loanCharges.clear();
- loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
- validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.00", "120.00", "0.0");
- validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "120.0", "0.0");
- validateCharge(percentageInstallmentFee, loanCharges, "1", "90.89", "29.11", "0.0");
+ // check for installment fee
+ HashMap secondInstallment = loanSchedule.get(2);
+ validateNumberForEqual("29.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
- new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.CREDIT));
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan("20 September 2011", loanID);
+ LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+ LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- LOAN_TRANSACTION_HELPER.addChargesForLoan(loanID, LoanTransactionHelper
- .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
+ String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount("20 September 2011", loanID,
+ JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
+ LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- secondInstallment = loanSchedule.get(2);
- validateNumberForEqual("149.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- LOG.info("----------- Waive installment charge for 2nd installment ---------");
- LOAN_TRANSACTION_HELPER.waiveChargesForLoan(loanID, (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
- LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
- loanCharges.clear();
- loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
- validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70");
+ ArrayList<HashMap> loanTransactionDetails = LOAN_TRANSACTION_HELPER.getLoanTransactionDetails(REQUEST_SPEC, RESPONSE_SPEC,
+ loanID);
+ validateAccrualTransactionForDisbursementCharge(loanTransactionDetails);
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.parseFloat("120.00"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("12000.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.parseFloat("12000.00"), JournalEntry.TransactionType.DEBIT) };
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
+ new JournalEntry(Float.parseFloat("120.00"), JournalEntry.TransactionType.CREDIT));
+ loanCharges.clear();
+ loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
+ validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.0", "120.00", "0.0");
+
+ LOG.info("-------------Make repayment 1-----------");
+ LOAN_TRANSACTION_HELPER.makeRepayment("20 October 2011", Float.parseFloat("3300.60"), loanID);
+ loanCharges.clear();
+ loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
+ validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.00", "120.00", "0.0");
+ validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "120.0", "0.0");
+ validateCharge(percentageInstallmentFee, loanCharges, "1", "90.89", "29.11", "0.0");
+
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.CREDIT));
- /*
- * JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount( assetAccount, "20 September 2011", new
- * JournalEntry(Float.parseFloat("29.7"), JournalEntry.TransactionType.CREDIT));
- * JOURNAL_ENTRY_HELPER.checkJournalEntryForExpenseAccount (expenseAccount, "20 September 2011", new
- * JournalEntry(Float.parseFloat("29.7"), JournalEntry.TransactionType.DEBIT));
- */
+ LOAN_TRANSACTION_HELPER.addChargesForLoan(loanID, LoanTransactionHelper
+ .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- final String jobName = "Add Accrual Transactions";
+ secondInstallment = loanSchedule.get(2);
+ validateNumberForEqual("149.70", String.valueOf(secondInstallment.get("feeChargesDue")));
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
+ LOAN_TRANSACTION_HELPER.waiveChargesForLoan(loanID, (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
+ LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
+ loanCharges.clear();
+ loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
+ validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70");
- SCHEDULER_JOB_HELPER.executeAndAwaitJob(jobName);
+ /*
+ * JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount( assetAccount, "20 September 2011", new
+ * JournalEntry(Float.parseFloat("29.7"), JournalEntry.TransactionType.CREDIT));
+ * JOURNAL_ENTRY_HELPER.checkJournalEntryForExpenseAccount (expenseAccount, "20 September 2011", new
+ * JournalEntry(Float.parseFloat("29.7"), JournalEntry.TransactionType.DEBIT));
+ */
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- checkAccrualTransactions(loanSchedule, loanID);
+ final String jobName = "Add Accrual Transactions";
- LOG.info("----------Make repayment 2------------");
- LOAN_TRANSACTION_HELPER.makeRepayment("20 November 2011", Float.parseFloat("3271.49"), loanID);
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.parseFloat("3271.49"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("3271.49"), JournalEntry.TransactionType.CREDIT));
+ SCHEDULER_JOB_HELPER.executeAndAwaitJob(jobName);
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- secondInstallment = loanSchedule.get(2);
- validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ checkAccrualTransactions(loanSchedule, loanID);
- LOG.info("--------------Waive interest---------------");
- LOAN_TRANSACTION_HELPER.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
+ LOG.info("----------Make repayment 2------------");
+ LOAN_TRANSACTION_HELPER.makeRepayment("20 November 2011", Float.parseFloat("3271.49"), loanID);
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.parseFloat("3271.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("3271.49"), JournalEntry.TransactionType.CREDIT));
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- HashMap thirdInstallment = loanSchedule.get(3);
- validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ secondInstallment = loanSchedule.get(2);
+ validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
- new JournalEntry(Float.parseFloat("61.79"), JournalEntry.TransactionType.CREDIT));
- JOURNAL_ENTRY_HELPER.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
- new JournalEntry(Float.parseFloat("61.79"), JournalEntry.TransactionType.DEBIT));
+ LOG.info("--------------Waive interest---------------");
+ LOAN_TRANSACTION_HELPER.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
- Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- LOAN_TRANSACTION_HELPER.addChargesForLoan(loanID, LoanTransactionHelper
- .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
- loanCharges.clear();
- loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
- validateCharge(percentagePenaltySpecifiedDueDate, loanCharges, "1", "0.00", "120.0", "0.0");
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ HashMap thirdInstallment = loanSchedule.get(3);
+ validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- secondInstallment = loanSchedule.get(2);
- validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.parseFloat("61.79"), JournalEntry.TransactionType.CREDIT));
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
+ new JournalEntry(Float.parseFloat("61.79"), JournalEntry.TransactionType.DEBIT));
- // checking the journal entry as applied penalty has been collected
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
- new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.CREDIT));
+ Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(REQUEST_SPEC, RESPONSE_SPEC,
+ ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ LOAN_TRANSACTION_HELPER.addChargesForLoan(loanID, LoanTransactionHelper
+ .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
+ loanCharges.clear();
+ loanCharges = LOAN_TRANSACTION_HELPER.getLoanCharges(loanID);
+ validateCharge(percentagePenaltySpecifiedDueDate, loanCharges, "1", "0.00", "120.0", "0.0");
- LOG.info("----------Make repayment 3 advance------------");
- LOAN_TRANSACTION_HELPER.makeRepayment("20 November 2011", Float.parseFloat("3301.78"), loanID);
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.parseFloat("3301.78"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("3301.78"), JournalEntry.TransactionType.CREDIT));
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ secondInstallment = loanSchedule.get(2);
+ validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- LOAN_TRANSACTION_HELPER.addChargesForLoan(loanID, LoanTransactionHelper
- .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- HashMap fourthInstallment = loanSchedule.get(4);
- validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
- validateNumberForEqual("3240.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
+ // checking the journal entry as applied penalty has been collected
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("3300.60"), JournalEntry.TransactionType.CREDIT));
- LOG.info("----------Pay applied penalty ------------");
- LOAN_TRANSACTION_HELPER.makeRepayment("20 January 2012", Float.parseFloat("120"), loanID);
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
- new JournalEntry(Float.parseFloat("120"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("120"), JournalEntry.TransactionType.CREDIT));
- loanSchedule.clear();
- loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- fourthInstallment = loanSchedule.get(4);
- validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
- validateNumberForEqual("3120.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
+ LOG.info("----------Make repayment 3 advance------------");
+ LOAN_TRANSACTION_HELPER.makeRepayment("20 November 2011", Float.parseFloat("3301.78"), loanID);
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.parseFloat("3301.78"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("3301.78"), JournalEntry.TransactionType.CREDIT));
- LOG.info("----------Make repayment 4 ------------");
- LOAN_TRANSACTION_HELPER.makeRepayment("20 January 2012", Float.parseFloat("3120.58"), loanID);
- JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
- new JournalEntry(Float.parseFloat("3120.58"), JournalEntry.TransactionType.DEBIT),
- new JournalEntry(Float.parseFloat("3120.58"), JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.getLoanDetail(REQUEST_SPEC, RESPONSE_SPEC, loanID, "status");
- LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
+ LOAN_TRANSACTION_HELPER.addChargesForLoan(loanID, LoanTransactionHelper
+ .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ HashMap fourthInstallment = loanSchedule.get(4);
+ validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
+ validateNumberForEqual("3240.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
+
+ LOG.info("----------Pay applied penalty ------------");
+ LOAN_TRANSACTION_HELPER.makeRepayment("20 January 2012", Float.parseFloat("120"), loanID);
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.parseFloat("120"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("120"), JournalEntry.TransactionType.CREDIT));
+ loanSchedule.clear();
+ loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ fourthInstallment = loanSchedule.get(4);
+ validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
+ validateNumberForEqual("3120.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
+
+ LOG.info("----------Make repayment 4 ------------");
+ LOAN_TRANSACTION_HELPER.makeRepayment("20 January 2012", Float.parseFloat("3120.58"), loanID);
+ JOURNAL_ENTRY_HELPER.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.parseFloat("3120.58"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.parseFloat("3120.58"), JournalEntry.TransactionType.CREDIT));
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.getLoanDetail(REQUEST_SPEC, RESPONSE_SPEC, loanID, "status");
+ LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
+ } finally {
+ GlobalConfigurationHelper.manageConfigurations(REQUEST_SPEC, RESPONSE_SPEC,
+ GlobalConfigurationHelper.ENABLE_AUTOGENERATED_EXTERNAL_ID, false);
+ }
}
/***
@@ -3434,56 +3440,60 @@ public class ClientLoanIntegrationTest {
@Test
public void testInteroperationLoanRepaymentAPI() {
+ try {
+ DateFormat dateFormat = new SimpleDateFormat(DATETIME_PATTERN, Locale.US);
+ dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
+ GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", true);
+ Calendar startDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
+ startDate.add(Calendar.MONTH, -8);
+
+ Calendar firstRepaymentDate = (Calendar) startDate.clone();
+ firstRepaymentDate.add(Calendar.MONTH, 1);
+ firstRepaymentDate.add(Calendar.DAY_OF_MONTH,
+ firstRepaymentDate.getActualMaximum(Calendar.DAY_OF_MONTH) - Calendar.DAY_OF_MONTH);
+ String firstRepayment = dateFormat.format(firstRepaymentDate.getTime());
+
+ final String loanDisbursementDate = dateFormat.format(startDate.getTime());
+ final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
+ ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
+ final Integer loanProductID = createLoanProductWithInterestRecalculationAndCompoundingDetails(
+ LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY,
+ LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
+ LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
+ LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD,
+ LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, "12");
+
+ final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, loanDisbursementDate,
+ LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY, firstRepayment);
+
+ Assertions.assertNotNull(loanID);
+ HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- DateFormat dateFormat = new SimpleDateFormat(DATETIME_PATTERN, Locale.US);
- dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
- GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", true);
- Calendar startDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
- startDate.add(Calendar.MONTH, -8);
-
- Calendar firstRepaymentDate = (Calendar) startDate.clone();
- firstRepaymentDate.add(Calendar.MONTH, 1);
- firstRepaymentDate.add(Calendar.DAY_OF_MONTH, firstRepaymentDate.getActualMaximum(Calendar.DAY_OF_MONTH) - Calendar.DAY_OF_MONTH);
- String firstRepayment = dateFormat.format(firstRepaymentDate.getTime());
-
- final String loanDisbursementDate = dateFormat.format(startDate.getTime());
- final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
- ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
- final Integer loanProductID = createLoanProductWithInterestRecalculationAndCompoundingDetails(
- LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY,
- LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
- LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
- LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD,
- LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, "12");
-
- final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, loanDisbursementDate,
- LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY, firstRepayment);
-
- Assertions.assertNotNull(loanID);
- HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
-
- LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan(loanDisbursementDate, loanID);
- LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
- LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan(loanDisbursementDate, loanID);
+ LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+ LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
- String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount(loanDisbursementDate, loanID,
- JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
- LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
+ String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount(loanDisbursementDate, loanID,
+ JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
+ LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- Assertions.assertNotNull(loanSchedule);
- startDate.add(Calendar.DAY_OF_MONTH, 2);
- String loanFirstRepaymentDate = dateFormat.format(startDate.getTime());
+ ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ Assertions.assertNotNull(loanSchedule);
+ startDate.add(Calendar.DAY_OF_MONTH, 2);
+ String loanFirstRepaymentDate = dateFormat.format(startDate.getTime());
- Float earlyPayment = Float.parseFloat("3000");
- String accountNo = JsonPath.from(loanDetails).get("accountNo").toString();
+ Float earlyPayment = Float.parseFloat("3000");
+ String accountNo = JsonPath.from(loanDetails).get("accountNo").toString();
- HashMap loanRepayment = LOAN_TRANSACTION_HELPER.makeRepaymentWithAccountNo(loanFirstRepaymentDate, earlyPayment, accountNo);
- assertNotNull(loanRepayment);
+ HashMap loanRepayment = LOAN_TRANSACTION_HELPER.makeRepaymentWithAccountNo(loanFirstRepaymentDate, earlyPayment, accountNo);
+ assertNotNull(loanRepayment);
+ } finally {
+ GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", false);
+ }
}
@Test
@@ -4917,134 +4927,140 @@ public class ClientLoanIntegrationTest {
@Test
public void testLoanScheduleWithInterestRecalculationMakePrepaymentAfterRepayment() {
+ try {
+ DateFormat dateFormat = new SimpleDateFormat(DATETIME_PATTERN, Locale.US);
+ dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
+ GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", true);
+ Calendar startDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
+ Calendar currentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
+ startDate.add(Calendar.MONTH, -8);
+
+ Calendar firstRepaymentDate = (Calendar) startDate.clone();
+ firstRepaymentDate.add(Calendar.MONTH, 1);
+ firstRepaymentDate.add(Calendar.DAY_OF_MONTH,
+ firstRepaymentDate.getActualMaximum(Calendar.DAY_OF_MONTH) - Calendar.DAY_OF_MONTH);
+ String firstRepayment = dateFormat.format(firstRepaymentDate.getTime());
+
+ final String loanDisbursementDate = dateFormat.format(startDate.getTime());
+ final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
+ ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
+ final Integer loanProductID = createLoanProductWithInterestRecalculationAndCompoundingDetails(
+ LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY,
+ LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
+ LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
+ LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD,
+ LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, "12");
+
+ final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, loanDisbursementDate,
+ LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY, firstRepayment);
+
+ Assertions.assertNotNull(loanID);
+ HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- DateFormat dateFormat = new SimpleDateFormat(DATETIME_PATTERN, Locale.US);
- dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
- GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", true);
- Calendar startDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
- Calendar currentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
- startDate.add(Calendar.MONTH, -8);
-
- Calendar firstRepaymentDate = (Calendar) startDate.clone();
- firstRepaymentDate.add(Calendar.MONTH, 1);
- firstRepaymentDate.add(Calendar.DAY_OF_MONTH, firstRepaymentDate.getActualMaximum(Calendar.DAY_OF_MONTH) - Calendar.DAY_OF_MONTH);
- String firstRepayment = dateFormat.format(firstRepaymentDate.getTime());
-
- final String loanDisbursementDate = dateFormat.format(startDate.getTime());
- final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
- ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
- final Integer loanProductID = createLoanProductWithInterestRecalculationAndCompoundingDetails(
- LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY,
- LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
- LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
- LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD,
- LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, "12");
-
- final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, loanDisbursementDate,
- LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY, firstRepayment);
-
- Assertions.assertNotNull(loanID);
- HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
-
- LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan(loanDisbursementDate, loanID);
- LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
- LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
-
- LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
- String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount(loanDisbursementDate, loanID,
- JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
- LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan(loanDisbursementDate, loanID);
+ LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+ LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- Assertions.assertNotNull(loanSchedule);
- startDate.add(Calendar.DAY_OF_MONTH, 2);
- String loanFirstRepaymentDate = dateFormat.format(startDate.getTime());
- //
- Float earlyPayment = Float.parseFloat("3000");
- LOAN_TRANSACTION_HELPER.makeRepayment(loanFirstRepaymentDate, earlyPayment, loanID);
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
+ String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount(loanDisbursementDate, loanID,
+ JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
+ LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- HashMap prepayDetail = LOAN_TRANSACTION_HELPER.getPrepayAmount(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- String prepayAmount = String.valueOf(prepayDetail.get("amount"));
- String loanPrepaymentDate = dateFormat.format(currentDate.getTime());
- LOAN_TRANSACTION_HELPER.makeRepayment(loanPrepaymentDate, Float.parseFloat(prepayAmount), loanID);
- loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
- GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", false);
+ ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ Assertions.assertNotNull(loanSchedule);
+ startDate.add(Calendar.DAY_OF_MONTH, 2);
+ String loanFirstRepaymentDate = dateFormat.format(startDate.getTime());
+ //
+ Float earlyPayment = Float.parseFloat("3000");
+ LOAN_TRANSACTION_HELPER.makeRepayment(loanFirstRepaymentDate, earlyPayment, loanID);
+
+ HashMap prepayDetail = LOAN_TRANSACTION_HELPER.getPrepayAmount(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ String prepayAmount = String.valueOf(prepayDetail.get("amount"));
+ String loanPrepaymentDate = dateFormat.format(currentDate.getTime());
+ LOAN_TRANSACTION_HELPER.makeRepayment(loanPrepaymentDate, Float.parseFloat(prepayAmount), loanID);
+ loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
+ } finally {
+ GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", false);
+ }
}
@Test
public void testLoanScheduleWithInterestRecalculationMakeAdvancePaymentTillSettlement() {
+ try {
+ final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
+ final LoanTransactionHelper validationErrorHelper = new LoanTransactionHelper(REQUEST_SPEC, errorResponse);
+ DateFormat dateFormat = new SimpleDateFormat(DATETIME_PATTERN, Locale.US);
+ dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
+ GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", true);
+ Calendar startDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
+ Calendar currentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
+ startDate.add(Calendar.MONTH, -8);
+
+ Calendar firstRepaymentDate = (Calendar) startDate.clone();
+ firstRepaymentDate.add(Calendar.MONTH, 1);
+ firstRepaymentDate.add(Calendar.DAY_OF_MONTH,
+ firstRepaymentDate.getActualMaximum(Calendar.DAY_OF_MONTH) - Calendar.DAY_OF_MONTH);
+ String firstRepayment = dateFormat.format(firstRepaymentDate.getTime());
+
+ final String loanDisbursementDate = dateFormat.format(startDate.getTime());
+ final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
+ ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
+ final Integer loanProductID = createLoanProductWithInterestRecalculationAndCompoundingDetails(
+ LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY,
+ LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
+ LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
+ LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD,
+ LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, "12");
+
+ final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, loanDisbursementDate,
+ LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY, firstRepayment);
+
+ Assertions.assertNotNull(loanID);
+ HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
- final LoanTransactionHelper validationErrorHelper = new LoanTransactionHelper(REQUEST_SPEC, errorResponse);
- DateFormat dateFormat = new SimpleDateFormat(DATETIME_PATTERN, Locale.US);
- dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
- GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", true);
- Calendar startDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
- Calendar currentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
- startDate.add(Calendar.MONTH, -8);
-
- Calendar firstRepaymentDate = (Calendar) startDate.clone();
- firstRepaymentDate.add(Calendar.MONTH, 1);
- firstRepaymentDate.add(Calendar.DAY_OF_MONTH, firstRepaymentDate.getActualMaximum(Calendar.DAY_OF_MONTH) - Calendar.DAY_OF_MONTH);
- String firstRepayment = dateFormat.format(firstRepaymentDate.getTime());
-
- final String loanDisbursementDate = dateFormat.format(startDate.getTime());
- final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC);
- ClientHelper.verifyClientCreatedOnServer(REQUEST_SPEC, RESPONSE_SPEC, clientID);
- final Integer loanProductID = createLoanProductWithInterestRecalculationAndCompoundingDetails(
- LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY,
- LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
- LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
- LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD,
- LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, "12");
-
- final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, loanDisbursementDate,
- LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY, firstRepayment);
-
- Assertions.assertNotNull(loanID);
- HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
-
- LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan(loanDisbursementDate, loanID);
- LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
- LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
-
- LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
- String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount(loanDisbursementDate, loanID,
- JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
- LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan(loanDisbursementDate, loanID);
+ LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+ LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- Assertions.assertNotNull(loanSchedule);
- Calendar repaymentDate = (Calendar) firstRepaymentDate.clone();
- startDate.add(Calendar.DAY_OF_MONTH, 2);
- String loanFirstRepaymentDate = dateFormat.format(startDate.getTime());
- //
- Float earlyPayment = Float.parseFloat("3000");
- String retrieveDueDate = null;
- Float amount = null;
- LOAN_TRANSACTION_HELPER.makeRepayment(loanFirstRepaymentDate, earlyPayment, loanID);
- for (int i = 1; i < loanSchedule.size(); i++) {
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
+ String loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount(loanDisbursementDate, loanID,
+ JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
+ LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- retrieveDueDate = dateFormat.format(repaymentDate.getTime());
- amount = (Float) loanSchedule.get(i).get("principalOriginalDue") + (Float) loanSchedule.get(i).get("interestOriginalDue");
- if (currentDate.after(repaymentDate)) {
- LOAN_TRANSACTION_HELPER.makeRepayment(retrieveDueDate, amount, loanID);
- } else {
- break;
+ ArrayList<HashMap> loanSchedule = LOAN_TRANSACTION_HELPER.getLoanRepaymentSchedule(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ Assertions.assertNotNull(loanSchedule);
+ Calendar repaymentDate = (Calendar) firstRepaymentDate.clone();
+ startDate.add(Calendar.DAY_OF_MONTH, 2);
+ String loanFirstRepaymentDate = dateFormat.format(startDate.getTime());
+ //
+ Float earlyPayment = Float.parseFloat("3000");
+ String retrieveDueDate = null;
+ Float amount = null;
+ LOAN_TRANSACTION_HELPER.makeRepayment(loanFirstRepaymentDate, earlyPayment, loanID);
+ for (int i = 1; i < loanSchedule.size(); i++) {
+
+ retrieveDueDate = dateFormat.format(repaymentDate.getTime());
+ amount = (Float) loanSchedule.get(i).get("principalOriginalDue") + (Float) loanSchedule.get(i).get("interestOriginalDue");
+ if (currentDate.after(repaymentDate)) {
+ LOAN_TRANSACTION_HELPER.makeRepayment(retrieveDueDate, amount, loanID);
+ } else {
+ break;
+ }
+ repaymentDate.add(Calendar.MONTH, 1);
}
- repaymentDate.add(Calendar.MONTH, 1);
+ HashMap savingsAccountErrorData = validationErrorHelper.makeRepayment(retrieveDueDate, amount, loanID);
+ ArrayList<HashMap> error = (ArrayList<HashMap>) savingsAccountErrorData.get("errors");
+ assertEquals("error.msg.loan.transaction.cannot.be.a.future.date", error.get(0).get("userMessageGlobalisationCode"));
+ } finally {
+ GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", false);
}
- HashMap savingsAccountErrorData = validationErrorHelper.makeRepayment(retrieveDueDate, amount, loanID);
- ArrayList<HashMap> error = (ArrayList<HashMap>) savingsAccountErrorData.get("errors");
- assertEquals("error.msg.loan.transaction.cannot.be.a.future.date", error.get(0).get("userMessageGlobalisationCode"));
- GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(REQUEST_SPEC, RESPONSE_SPEC, "42", false);
}
@Test
@@ -5722,6 +5738,8 @@ public class ClientLoanIntegrationTest {
assertTrue(loanDetails.getStatus().getOverpaid());
} finally {
GlobalConfigurationHelper.updateIsBusinessDateEnabled(REQUEST_SPEC, RESPONSE_SPEC, Boolean.FALSE);
+ GlobalConfigurationHelper.manageConfigurations(REQUEST_SPEC, RESPONSE_SPEC,
+ GlobalConfigurationHelper.ENABLE_AUTOGENERATED_EXTERNAL_ID, false);
}
}
@@ -6256,65 +6274,69 @@ public class ClientLoanIntegrationTest {
.dateFormat(DATETIME_PATTERN).transactionDate("08 September 2022").locale("en").transactionAmount(3007.0));
} finally {
GlobalConfigurationHelper.updateIsBusinessDateEnabled(REQUEST_SPEC, RESPONSE_SPEC, Boolean.FALSE);
+ GlobalConfigurationHelper.updateIsAutomaticExternalIdGenerationEnabled(REQUEST_SPEC, RESPONSE_SPEC, false);
}
}
@Test
public void testCloseOpenMaturityDate() {
- GlobalConfigurationHelper.updateIsAutomaticExternalIdGenerationEnabled(REQUEST_SPEC, RESPONSE_SPEC, true);
- final Account assetAccount = ACCOUNT_HELPER.createAssetAccount();
- final Account incomeAccount = ACCOUNT_HELPER.createIncomeAccount();
- final Account expenseAccount = ACCOUNT_HELPER.createExpenseAccount();
- final Account overpaymentAccount = ACCOUNT_HELPER.createLiabilityAccount();
-
- final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingNoInterest(assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ try {
+ GlobalConfigurationHelper.updateIsAutomaticExternalIdGenerationEnabled(REQUEST_SPEC, RESPONSE_SPEC, true);
+ final Account assetAccount = ACCOUNT_HELPER.createAssetAccount();
+ final Account incomeAccount = ACCOUNT_HELPER.createIncomeAccount();
+ final Account expenseAccount = ACCOUNT_HELPER.createExpenseAccount();
+ final Account overpaymentAccount = ACCOUNT_HELPER.createLiabilityAccount();
- final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC, "01 January 2011");
+ final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingNoInterest(assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
- final Integer loanID = applyForLoanApplication(clientID, loanProductID);
+ final Integer clientID = ClientHelper.createClient(REQUEST_SPEC, RESPONSE_SPEC, "01 January 2011");
- HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
- LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+ final Integer loanID = applyForLoanApplication(clientID, loanProductID);
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan("02 September 2022", loanID);
- LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
- LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
+ HashMap<String, Object> loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(REQUEST_SPEC, RESPONSE_SPEC, loanID);
+ LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount("03 September 2022", loanID, "1000");
- LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.approveLoan("02 September 2022", loanID);
+ LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+ LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID);
- LocalDate expectedMaturityDate = loanDetails.getTimeline().getExpectedMaturityDate();
- LocalDate actualMaturityDate = loanDetails.getTimeline().getActualMaturityDate();
+ loanStatusHashMap = LOAN_TRANSACTION_HELPER.disburseLoanWithNetDisbursalAmount("03 September 2022", loanID, "1000");
+ LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- assertTrue(expectedMaturityDate.isEqual(actualMaturityDate));
+ GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID);
+ LocalDate expectedMaturityDate = loanDetails.getTimeline().getExpectedMaturityDate();
+ LocalDate actualMaturityDate = loanDetails.getTimeline().getActualMaturityDate();
- LOAN_TRANSACTION_HELPER.makeRepayment("04 September 2022", Float.parseFloat("500"), loanID);
- LOAN_TRANSACTION_HELPER.makeRepayment("05 September 2022", Float.parseFloat("700"), loanID);
+ assertTrue(expectedMaturityDate.isEqual(actualMaturityDate));
- loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID);
+ LOAN_TRANSACTION_HELPER.makeRepayment("04 September 2022", Float.parseFloat("500"), loanID);
+ LOAN_TRANSACTION_HELPER.makeRepayment("05 September 2022", Float.parseFloat("700"), loanID);
- expectedMaturityDate = loanDetails.getTimeline().getExpectedMaturityDate();
- actualMaturityDate = loanDetails.getTimeline().getActualMaturityDate();
+ loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID);
- assertNotNull(expectedMaturityDate);
- assertNull(actualMaturityDate);
+ expectedMaturityDate = loanDetails.getTimeline().getExpectedMaturityDate();
+ actualMaturityDate = loanDetails.getTimeline().getActualMaturityDate();
- LOAN_TRANSACTION_HELPER.reverseLoanTransaction((long) loanID, loanDetails.getTransactions().get(1).getId(),
- new PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN).transactionDate("04 September 2022")
- .transactionAmount(0.0).locale("en"));
+ assertNotNull(expectedMaturityDate);
+ assertNull(actualMaturityDate);
- loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID);
+ LOAN_TRANSACTION_HELPER.reverseLoanTransaction((long) loanID, loanDetails.getTransactions().get(1).getId(),
+ new PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN).transactionDate("04 September 2022")
+ .transactionAmount(0.0).locale("en"));
- expectedMaturityDate = loanDetails.getTimeline().getExpectedMaturityDate();
- actualMaturityDate = loanDetails.getTimeline().getActualMaturityDate();
+ loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID);
- assertNotNull(expectedMaturityDate);
- assertNotNull(actualMaturityDate);
+ expectedMaturityDate = loanDetails.getTimeline().getExpectedMaturityDate();
+ actualMaturityDate = loanDetails.getTimeline().getActualMaturityDate();
- assertTrue(expectedMaturityDate.isEqual(actualMaturityDate));
+ assertNotNull(expectedMaturityDate);
+ assertNotNull(actualMaturityDate);
+ assertTrue(expectedMaturityDate.isEqual(actualMaturityDate));
+ } finally {
+ GlobalConfigurationHelper.updateIsAutomaticExternalIdGenerationEnabled(REQUEST_SPEC, RESPONSE_SPEC, false);
+ }
}
@Test
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
index 8923bcefe..1deff5dee 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
@@ -2235,7 +2235,7 @@ public class ClientSavingsIntegrationTest {
Integer releaseTransactionId = this.savingsAccountHelper.releaseAmount(savingsId, holdTransactionId);
Date today = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(Utils.getZoneIdOfTenant()).toInstant());
String todayDate = today.toString();
- SimpleDateFormat dt1 = new SimpleDateFormat("dd MMM yyyy");
+ SimpleDateFormat dt1 = new SimpleDateFormat("dd MMMM yyyy");
todayDate = dt1.format(today).toString();
withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "300", todayDate,
CommonConstants.RESPONSE_RESOURCE_ID);
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionTest.java
index ad52b84b1..e5661ea8f 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionTest.java
@@ -50,7 +50,7 @@ import org.junit.jupiter.api.Test;
public class SavingsAccountTransactionTest {
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
- public static final String DEFAULT_DATE_FORMAT = "dd MMM yyyy";
+ public static final String DEFAULT_DATE_FORMAT = "dd MMMM yyyy";
final String startDateString = "03 June 2023";
final String depositDateString = "05 June 2023";
final String withdrawDateString = "10 June 2023";
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionsSearchIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionsSearchIntegrationTest.java
index 4be682d15..ca4c287fc 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionsSearchIntegrationTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountTransactionsSearchIntegrationTest.java
@@ -62,7 +62,7 @@ import org.springframework.data.domain.Sort;
public class SavingsAccountTransactionsSearchIntegrationTest {
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
- public static final String DEFAULT_DATE_FORMAT = "dd MMM yyyy";
+ public static final String DEFAULT_DATE_FORMAT = "dd MMMM yyyy";
public static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
final String startDate = "01 May 2023";
final String firstDepositDate = "05 May 2023";
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsExternalIdTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsExternalIdTest.java
index 8a068e2a7..8e22852d9 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsExternalIdTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsExternalIdTest.java
@@ -44,8 +44,7 @@ public class SavingsAccountsExternalIdTest extends IntegrationTest {
public static final String EXTERNAL_ID = UUID.randomUUID().toString();
private final String dateFormat = "dd MMMM yyyy";
private final String locale = "en";
- private final String formattedDate = LocalDate.now(ZoneId.systemDefault()).minusDays(5)
- .format(DateTimeFormatter.ofPattern("dd MMM yyyy"));
+ private final String formattedDate = LocalDate.now(ZoneId.systemDefault()).minusDays(5).format(DateTimeFormatter.ofPattern(dateFormat));
@Test
@Order(1)
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsTest.java
index c340785ae..6c8bfffbf 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsTest.java
@@ -42,7 +42,7 @@ public class SavingsAccountsTest extends IntegrationTest {
private static final Logger LOG = LoggerFactory.getLogger(SavingsAccountsTest.class);
private final String dateFormat = "dd MMMM yyyy";
private final String locale = "en";
- private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
+ private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
private final String formattedDate = simpleDateFormat.format(new Date());
private int savingId = 1;
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
index 5ec1af121..d882b733a 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterDomain.java
@@ -150,7 +150,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
if (active) {
map.put("active", "true");
map.put("locale", "en");
- map.put("dateFormat", "dd MMM yyyy");
+ map.put("dateFormat", "dd MMMM yyyy");
map.put("activationDate", activationDate);
} else {
map.put("active", "false");
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
index 413e64766..53bdfc758 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/CenterHelper.java
@@ -113,7 +113,7 @@ public final class CenterHelper {
if (activationDate != null) {
hm.put("active", true);
hm.put("locale", "en");
- hm.put("dateFormat", "dd MMM yyyy");
+ hm.put("dateFormat", "dd MMMM yyyy");
hm.put("activationDate", activationDate);
}
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java
index a4ecbc517..1c995beda 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java
@@ -58,7 +58,7 @@ public class DividendsIntegrationTests {
@SuppressWarnings("unchecked")
@Test
public void testCreateDividends() {
- DateFormat simple = new SimpleDateFormat("dd MMM yyyy");
+ DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
final Integer productId = createShareProduct();
ArrayList<Integer> shareAccounts = new ArrayList<>();
for (int i = 0; i < 5; i++) {
@@ -109,12 +109,12 @@ public class DividendsIntegrationTests {
Calendar cal = Calendar.getInstance();
cal.set(startdateList.get(0), startdateList.get(1) - 1, startdateList.get(2));
Date startDate = cal.getTime();
- Assertions.assertEquals("01 Jan 2015", simple.format(startDate));
+ Assertions.assertEquals("01 January 2015", simple.format(startDate));
List<Integer> enddateList = (List<Integer>) dividend.get("dividendPeriodEndDate");
cal = Calendar.getInstance();
cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2));
Date endDate = cal.getTime();
- Assertions.assertEquals("01 Apr 2016", simple.format(endDate));
+ Assertions.assertEquals("01 April 2016", simple.format(endDate));
Map<String, Object> dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec,
responseSpec);
@@ -151,12 +151,12 @@ public class DividendsIntegrationTests {
cal = Calendar.getInstance();
cal.set(startdateList.get(0), startdateList.get(1) - 1, startdateList.get(2));
startDate = cal.getTime();
- Assertions.assertEquals("01 Jan 2015", simple.format(startDate));
+ Assertions.assertEquals("01 January 2015", simple.format(startDate));
enddateList = (List<Integer>) dividend.get("dividendPeriodEndDate");
cal = Calendar.getInstance();
cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2));
endDate = cal.getTime();
- Assertions.assertEquals("01 Apr 2016", simple.format(endDate));
+ Assertions.assertEquals("01 April 2016", simple.format(endDate));
dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec, responseSpec);
Assertions.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords")));
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java
index ff84125de..4da6723df 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/shares/ShareAccountIntegrationTests.java
@@ -383,7 +383,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> shareAccountDataForUpdate = new HashMap<>();
shareAccountDataForUpdate.put("requestedShares", 30);
- shareAccountDataForUpdate.put("applicationDate", "02 Mar 2016");
+ shareAccountDataForUpdate.put("applicationDate", "02 March 2016");
shareAccountDataForUpdate.put("dateFormat", "dd MMMM yyyy");
shareAccountDataForUpdate.put("locale", "en_GB");
shareAccountDataForUpdate.put("charges", charges);
@@ -394,7 +394,7 @@ public class ShareAccountIntegrationTests {
List<Map<String, Object>> transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
Assertions.assertNotNull(transactions);
Assertions.assertEquals(2, transactions.size());
- DateFormat simple = new SimpleDateFormat("dd MMM yyyy");
+ DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
for (int i = 0; i < transactions.size(); i++) {
Map<String, Object> transaction = transactions.get(i);
Map<String, Object> transactionTypeMap = (Map<String, Object>) transaction.get("type");
@@ -409,7 +409,7 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("60.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice")));
- Assertions.assertEquals("02 Mar 2016", simple.format(date));
+ Assertions.assertEquals("02 March 2016", simple.format(date));
} else if (transactionType.equals("charge.payment")) {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
@@ -444,7 +444,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> approveMap = new HashMap<>();
approveMap.put("note", "Share Account Approval Note");
approveMap.put("dateFormat", "dd MMMM yyyy");
- approveMap.put("approvedDate", "01 Jan 2016");
+ approveMap.put("approvedDate", "01 January 2016");
approveMap.put("locale", "en");
String approve = new Gson().toJson(approveMap);
ShareAccountTransactionHelper.postCommand("approve", shareAccountId, approve, requestSpec, responseSpec);
@@ -456,7 +456,7 @@ public class ShareAccountIntegrationTests {
Calendar cal = Calendar.getInstance();
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
Date approvedDate = cal.getTime();
- Assertions.assertEquals("01 Jan 2016", simple.format(approvedDate));
+ Assertions.assertEquals("01 January 2016", simple.format(approvedDate));
// charges verification
chargesList = (List<Map<String, Object>>) shareAccountData.get("charges");
@@ -483,7 +483,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> activateMap = new HashMap<>();
activateMap.put("dateFormat", "dd MMMM yyyy");
- activateMap.put("activatedDate", "01 Jan 2016");
+ activateMap.put("activatedDate", "01 January 2016");
activateMap.put("locale", "en");
String activateJson = new Gson().toJson(activateMap);
ShareAccountTransactionHelper.postCommand("activate", shareAccountId, activateJson, requestSpec, responseSpec);
@@ -495,7 +495,7 @@ public class ShareAccountIntegrationTests {
cal = Calendar.getInstance();
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
Date activatedDate = cal.getTime();
- Assertions.assertEquals("01 Jan 2016", simple.format(activatedDate));
+ Assertions.assertEquals("01 January 2016", simple.format(activatedDate));
transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
Assertions.assertNotNull(transactions);
@@ -514,12 +514,12 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice")));
- Assertions.assertEquals("02 Mar 2016", simple.format(date));
+ Assertions.assertEquals("02 March 2016", simple.format(date));
} else if (transactionType.equals("charge.payment")) {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount")));
- Assertions.assertEquals("01 Jan 2016", simple.format(date));
+ Assertions.assertEquals("01 January 2016", simple.format(date));
}
}
@@ -552,7 +552,7 @@ public class ShareAccountIntegrationTests {
// apply additional shares
Map<String, Object> additionalSharesRequestMap = new HashMap<>();
- additionalSharesRequestMap.put("requestedDate", "01 Apr 2016");
+ additionalSharesRequestMap.put("requestedDate", "01 April 2016");
additionalSharesRequestMap.put("dateFormat", "dd MMMM yyyy");
additionalSharesRequestMap.put("locale", "en");
additionalSharesRequestMap.put("requestedShares", "15");
@@ -573,13 +573,13 @@ public class ShareAccountIntegrationTests {
Date date = cal.getTime();
String transactionType = (String) transactionTypeMap.get("code");
String transactionDate = simple.format(date);
- if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) {
+ if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 March 2016")) {
Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice")));
- } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) {
+ } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 April 2016")) {
addtionalSharesRequestId = String.valueOf(transaction.get("id"));
Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount")));
@@ -593,7 +593,7 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount")));
- Assertions.assertEquals("01 Jan 2016", transactionDate);
+ Assertions.assertEquals("01 January 2016", transactionDate);
}
}
@@ -648,13 +648,13 @@ public class ShareAccountIntegrationTests {
Date date = cal.getTime();
String transactionType = (String) transactionTypeMap.get("code");
String transactionDate = simple.format(date);
- if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) {
+ if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 March 2016")) {
Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice")));
- } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) {
+ } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 April 2016")) {
Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amountPaid")));
@@ -667,7 +667,7 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount")));
- Assertions.assertEquals("01 Jan 2016", transactionDate);
+ Assertions.assertEquals("01 January 2016", transactionDate);
}
}
@@ -843,13 +843,13 @@ public class ShareAccountIntegrationTests {
Date date = cal.getTime();
String transactionType = (String) transactionTypeMap.get("code");
String transactionDate = simple.format(date);
- if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) {
+ if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 March 2016")) {
Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice")));
- } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) {
+ } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 April 2016")) {
Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amountPaid")));
@@ -868,7 +868,7 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount")));
- Assertions.assertEquals("01 Jan 2016", transactionDate);
+ Assertions.assertEquals("01 January 2016", transactionDate);
}
}
@@ -921,13 +921,13 @@ public class ShareAccountIntegrationTests {
Date date = cal.getTime();
String transactionType = (String) transactionTypeMap.get("code");
String transactionDate = simple.format(date);
- if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 Mar 2016")) {
+ if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("02 March 2016")) {
Assertions.assertEquals("30", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("62.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("chargeAmount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("purchasedPrice")));
- } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 Apr 2016")) {
+ } else if (transactionType.equals("purchasedSharesType.purchased") && transactionDate.equals("01 April 2016")) {
Assertions.assertEquals("15", String.valueOf(transaction.get("numberOfShares")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("32.0", String.valueOf(transaction.get("amountPaid")));
@@ -953,7 +953,7 @@ public class ShareAccountIntegrationTests {
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amountPaid")));
Assertions.assertEquals("0", String.valueOf(transaction.get("chargeAmount")));
- Assertions.assertEquals("01 Jan 2016", transactionDate);
+ Assertions.assertEquals("01 January 2016", transactionDate);
}
}
// charges verification
@@ -990,16 +990,16 @@ public class ShareAccountIntegrationTests {
private Integer createShareAccount(final Integer clientId, final Integer productId, final Integer savingsAccountId) {
String josn = new ShareAccountHelper().withClientId(String.valueOf(clientId)).withProductId(String.valueOf(productId))
- .withExternalId("External1").withSavingsAccountId(String.valueOf(savingsAccountId)).withSubmittedDate("01 Jan 2016")
- .withApplicationDate("01 Jan 2016").withRequestedShares("25").build();
+ .withExternalId("External1").withSavingsAccountId(String.valueOf(savingsAccountId)).withSubmittedDate("01 January 2016")
+ .withApplicationDate("01 January 2016").withRequestedShares("25").build();
return ShareAccountTransactionHelper.createShareAccount(josn, requestSpec, responseSpec);
}
private Integer createShareAccount(final Integer clientId, final Integer productId, final Integer savingsAccountId,
List<Map<String, Object>> charges) {
String josn = new ShareAccountHelper().withClientId(String.valueOf(clientId)).withProductId(String.valueOf(productId))
- .withExternalId("External1").withSavingsAccountId(String.valueOf(savingsAccountId)).withSubmittedDate("01 Jan 2016")
- .withApplicationDate("01 Jan 2016").withRequestedShares("25").withCharges(charges).build();
+ .withExternalId("External1").withSavingsAccountId(String.valueOf(savingsAccountId)).withSubmittedDate("01 January 2016")
+ .withApplicationDate("01 January 2016").withRequestedShares("25").withCharges(charges).build();
return ShareAccountTransactionHelper.createShareAccount(josn, requestSpec, responseSpec);
}