diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountSummaryData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountSummaryData.java index 2cb810b15..5452164cc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountSummaryData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountSummaryData.java @@ -121,6 +121,10 @@ public class SavingsAccountSummaryData implements Serializable { return this.availableBalance; } + public BigDecimal getAccountBalance() { + return accountBalance; + } + public BigDecimal getTotalOverdraftInterestDerived() { return this.totalOverdraftInterestDerived; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java index ae896230f..f70b6456f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java @@ -302,7 +302,7 @@ public class SavingsSchedularInterestPoster implements Callable { savingsAccountSummaryData.getTotalWithdrawals(), savingsAccountSummaryData.getTotalInterestEarned(), savingsAccountSummaryData.getTotalInterestPosted(), savingsAccountSummaryData.getTotalWithdrawalFees(), savingsAccountSummaryData.getTotalFeeCharge(), savingsAccountSummaryData.getTotalPenaltyCharge(), - savingsAccountSummaryData.getTotalAnnualFees(), savingsAccountSummaryData.getAvailableBalance(), + savingsAccountSummaryData.getTotalAnnualFees(), savingsAccountSummaryData.getAccountBalance(), savingsAccountSummaryData.getTotalOverdraftInterestDerived(), savingsAccountSummaryData.getTotalWithholdTax(), Date.from(savingsAccountSummaryData.getLastInterestCalculationDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()) .toInstant()), diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingJobIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingJobIntegrationTest.java index d92213c06..4a2925d7c 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingJobIntegrationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsInterestPostingJobIntegrationTest.java @@ -65,6 +65,32 @@ public class SavingsInterestPostingJobIntegrationTest { this.scheduleJobHelper = new SchedulerJobHelper(requestSpec); } + @Test + public void testSavingsBalanceCheckAfterDailyInterestPostingJob() { + // client activation, savings activation and 1st transaction date + final String startDate = "10 April 2022"; + final String jobName = "Post Interest For Savings"; + final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate); + Assertions.assertNotNull(clientID); + + final Integer savingsId = createSavingsAccountDailyPosting(clientID, startDate); + + this.savingsAccountHelper.depositToSavingsAccount(savingsId, "10000", startDate, CommonConstants.RESPONSE_RESOURCE_ID); + + /*** + * Runs Post interest posting job and verify the new account created with accounting configuration set as none + * is picked up by job + */ + this.scheduleJobHelper.executeAndAwaitJob(jobName); + Object transactionObj = this.savingsAccountHelper.getSavingsDetails(savingsId, "transactions"); + ArrayList> transactions = (ArrayList>) transactionObj; + HashMap interestPostingTransaction = transactions.get(transactions.size() - 48); + for (Map.Entry entry : interestPostingTransaction.entrySet()) { + LOG.info("{} - {}", entry.getKey(), entry.getValue().toString()); + } + assertEquals("10129.582", interestPostingTransaction.get("runningBalance").toString(), "Equality check for Balance"); + } + @Test public void testSavingsDailyInterestPostingJob() { // client activation, savings activation and 1st transaction date