You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ma...@apache.org on 2022/05/27 10:09:37 UTC

[fineract] branch develop updated: FINERACT-1613:Savings Interest Posting Job

This is an automated email from the ASF dual-hosted git repository.

manojvm 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 f576c3f07 FINERACT-1613:Savings Interest Posting Job
     new 18a44d761 Merge pull request #2336 from logoutdhaval/fineract-1613
f576c3f07 is described below

commit f576c3f07f432ab345d024bc1d0ed234fd13f045
Author: logoutdhaval <dh...@fynarfin.io>
AuthorDate: Fri May 27 13:17:01 2022 +0530

    FINERACT-1613:Savings Interest Posting Job
---
 .../savings/data/SavingsAccountSummaryData.java    |  4 ++++
 .../service/SavingsSchedularInterestPoster.java    |  2 +-
 .../SavingsInterestPostingJobIntegrationTest.java  | 26 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

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<Void> {
                     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<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) transactionObj;
+        HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 48);
+        for (Map.Entry<String, Object> 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