You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/02/22 10:12:09 UTC

[GitHub] [fineract] avikganguly01 commented on a change in pull request #2046: Fineract 1510

avikganguly01 commented on a change in pull request #2046:
URL: https://github.com/apache/fineract/pull/2046#discussion_r811780665



##########
File path: integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
##########
@@ -2324,4 +2324,56 @@ public void testSavingsAccountWithdrawalChargesOnPaymentTypes() {
         HashMap summaryTwo = this.savingsAccountHelper.getSavingsSummary(savingsId);
         assertEquals(balanceAfterChargeTwo, summaryTwo.get("accountBalance"), "Verifying Balance after withdrawal charge two ");
     }
+
+    /**
+     * Test Transaction reversal feature, here a new reversal transaction is posted when a savings transaction is reversed
+     */
+
+    @Test
+    public void testAccountBalanceAfterSavingsTransactionReversalPosting() {
+        this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
+
+        final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
+        ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
+        ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
+        // Assertions.assertNotNull(clientID);
+        final String minBalanceForInterestCalculation = null;
+        final String minRequiredBalance = "0";
+        final String enforceMinRequiredBalance = "false";
+        final boolean allowOverdraft = true;
+        final String MINIMUM_OPENING_BALANCE = "0";
+
+        final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
+                minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
+        Assertions.assertNotNull(savingsProductID);
+
+        final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
+        Assertions.assertNotNull(savingsId);
+
+        HashMap savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
+        SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
+
+        savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
+        SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+
+        Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "500",
+                SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
+
+        this.savingsAccountHelper.reverseSavingsAccountTransaction(savingsId, depositTransactionId);
+
+        HashMap reversedDepositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
+
+        Assertions.assertTrue((Boolean) reversedDepositTransaction.get("reversed"));
+
+        HashMap reversalDepositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId+1);
+
+        Assertions.assertTrue((Boolean) reversalDepositTransaction.get("isReversal"));

Review comment:
       LGTM




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org