alberto-art3ch commented on code in PR #5218:
URL: https://github.com/apache/fineract/pull/5218#discussion_r2631224626
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestRefundTest.java:
##########
@@ -1633,4 +1636,55 @@ public void verifyMerchantIssuedRefundInTwoPortion() {
Assertions.assertEquals(0.36,
Utils.getDoubleValue(loanDetails.getTotalOverpaid()));
});
}
+
+ @Test
+ public void allowToReprocessInterestRefundEvenIfNoTransactionWasChanged() {
+ runAt("1 February 2025", () -> {
+ Long loanProductId = getOrCreateLoanProduct();
+ Long loanId = applyAndApproveProgressiveLoan(client.getClientId(),
loanProductId, "1 January 2025", 100.0, 26.0, 6, null);
+ Assertions.assertNotNull(loanId);
+ disburseLoan(loanId, BigDecimal.valueOf(100.0), "1 January 2025");
+
+ final String transactionExternalId = UUID.randomUUID().toString();
+ final PostLoansLoanIdTransactionsResponse refundResponse =
loanTransactionHelper
+ .makeMerchantIssuedRefund(loanId, new
PostLoansLoanIdTransactionsRequest().dateFormat(DATETIME_PATTERN)
+ .transactionDate("1 February
2025").locale("en").transactionAmount(66.41).externalId(transactionExternalId).interestRefundCalculation(false));
+ Assertions.assertNotNull(refundResponse.getResourceId());
+
+ verifyTransactions(loanId, //
+ transaction(100.0, "Disbursement", "01 January 2025"), //
+ transaction(66.41, "Merchant Issued Refund", "01 February
2025") //
+ );
+
+ // Create manual interest refund via API
+ PostLoansLoanIdTransactionsResponse interestRefundResponse =
loanTransactionHelper.createManualInterestRefund(loanId,
refundResponse.getResourceId(),
+ "1 February 2025", 1.47, null);
+
+ verifyTransactions(loanId, //
+ transaction(100.0, "Disbursement", "01 January 2025"), //
+ transaction(66.41, "Merchant Issued Refund", "01 February
2025"), //
+ transaction(1.47, "Interest Refund", "01 February 2025") //
+ );
+
+ PostLoansLoanIdTransactionsResponse repaymentResponse =
loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "20 January 2025",
17.94);
+ loanTransactionHelper.makeLoanRepayment(loanId, "Repayment", "25
January 2025", 10.94);
+
+ verifyTransactions(loanId, //
+ transaction(100.0, "Disbursement", "01 January 2025"), //
+ transaction(17.94, "Repayment", "20 January 2025"), //
+ transaction(10.94, "Repayment", "25 January 2025"), //
+ transaction(66.41, "Merchant Issued Refund", "01 February
2025"), //
+ transaction(1.47, "Interest Refund", "01 February 2025") //
+ );
+
+ loanTransactionHelper.reverseLoanTransaction(loanId,
repaymentResponse.getResourceId(),
+ new
PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN)
+ .transactionDate("25 January
2021").transactionAmount(0.0).locale("en"));
Review Comment:
Resolved, thanks!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]