FINERACT-2232: Loan account capitalized income transaction template

This commit is contained in:
Jose Alberto Hernandez
2025-04-24 11:48:10 +02:00
committed by Adam Saghy
parent 13c99f98ab
commit 205b39ddf0
11 changed files with 78 additions and 10 deletions
@@ -18,11 +18,15 @@
*/
package org.apache.fineract.integrationtests;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTemplateResponse;
import org.apache.fineract.client.models.PostClientsResponse;
import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.TransactionType;
@@ -86,4 +90,28 @@ public class LoanTransactionTest extends BaseLoanIntegrationTest {
});
}
@Test
public void testGetLoanTransactionTemplateForCapitalizedIncome() {
final PostClientsResponse client = clientHelper.createClient(ClientHelper.defaultClientCreationRequest());
final PostLoanProductsResponse loanProductsResponse = loanProductHelper.createLoanProduct(create4IProgressive());
final String loanExternalIdStr = UUID.randomUUID().toString();
final String command = "capitalizedIncome";
runAt("20 December 2024", () -> {
Long loanId = applyAndApproveProgressiveLoan(client.getClientId(), loanProductsResponse.getResourceId(), "20 December 2024",
430.0, 7.0, 6, (request) -> request.externalId(loanExternalIdStr));
disburseLoan(loanId, BigDecimal.valueOf(430), "20 December 2024");
final GetLoansLoanIdTransactionsTemplateResponse transactionTemplate = loanTransactionHelper.retrieveTransactionTemplate(loanId,
command, null, null, null);
assertNotNull(transactionTemplate);
assertEquals("loanTransactionType." + command, transactionTemplate.getType().getCode());
assertThat(transactionTemplate.getPaymentTypeOptions().size() > 0);
});
}
}