FINERACT-1724-9: Fixing the retrieval of loan charge details with including the loanId as well

This commit is contained in:
Arnold Galovics
2022-10-21 11:21:21 +02:00
committed by Arnold Gálovics
parent 3cd4db8209
commit d1f3ffe490
2 changed files with 26 additions and 2 deletions
@@ -147,6 +147,29 @@ public class ClientLoanIntegrationTest {
applyForLoanApplicationWithExternalId(this.requestSpec, responseSpec403, clientID, loanProductID, "12,000.00", externalId);
}
@Test
public void testAddingLoanChargeIncludesLoanIdInTheResponse() {
// given
loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
Integer loanProductId = createLoanProduct(false, NONE);
Integer collateralId = CollateralManagementHelper.createCollateralProduct(this.requestSpec, this.responseSpec);
Integer clientCollateralId = CollateralManagementHelper.createClientCollateral(this.requestSpec, this.responseSpec,
String.valueOf(clientId), collateralId);
List<HashMap> collaterals = List.of(collaterals(clientCollateralId, BigDecimal.ONE));
Integer chargeId = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
List<HashMap> charges = List.of(charges(chargeId, "1", null));
// when
Integer loanId = applyForLoanApplication(clientId, loanProductId, charges, null, "12,000.00", collaterals);
// then
List<HashMap> loanCharges = loanTransactionHelper.getLoanCharges(loanId);
Integer loanChargeId = (Integer) loanCharges.get(0).get("id");
HashMap loanChargeDetail = loanTransactionHelper.getLoanCharge(loanId, loanChargeId);
assertEquals(loanId, loanChargeDetail.get("loanId"));
}
@Test
public void testLoanCharges_DISBURSEMENT_FEE() {
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);