FINERACT-1981: Fix interest refund transaction with zero amount

This commit is contained in:
Janos Meszaros
2024-11-22 17:11:15 +01:00
committed by Adam Saghy
parent e95b3ff25c
commit 34b165aa0e
4 changed files with 47 additions and 5 deletions
@@ -1108,6 +1108,35 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
});
}
@Test
public void verifyNoEmptyInterestRefundTransaction() {
runAt("1 January 2021", () -> {
PostLoanProductsResponse loanProduct = loanProductHelper
.createLoanProduct(create4IProgressive().daysInMonthType(DaysInMonthType.ACTUAL) //
.daysInYearType(DaysInYearType.ACTUAL) //
.multiDisburseLoan(true)//
.disallowExpectedDisbursements(true)//
.maxTrancheCount(2)//
.addSupportedInterestRefundTypesItem(SupportedInterestRefundTypesItem.PAYOUT_REFUND) //
.addSupportedInterestRefundTypesItem(SupportedInterestRefundTypesItem.MERCHANT_ISSUED_REFUND) //
.recalculationRestFrequencyType(RecalculationRestFrequencyType.DAILY) //
);
Long loanId = applyAndApproveProgressiveLoan(client.getClientId(), loanProduct.getResourceId(), "1 January 2021", 1000.0, 9.9,
12, null);
Assertions.assertNotNull(loanId);
disburseLoan(loanId, BigDecimal.valueOf(1000), "1 January 2021");
loanTransactionHelper.makeLoanRepayment("MerchantIssuedRefund", "1 January 2021", 1000F, loanId.intValue());
logLoanTransactions(loanId);
verifyTransactions(loanId, //
transaction(1000.0, "Disbursement", "01 January 2021"), //
transaction(1000.0, "Merchant Issued Refund", "01 January 2021") //
);
logLoanTransactions(loanId);
});
}
@Test
public void verifyUC18S2() {
AtomicReference<Long> loanIdRef = new AtomicReference<>();