FINERACT-1724-9: Fixing the retrieval of loan charge details with including the loanId as well
This commit is contained in:
committed by
Arnold Gálovics
parent
3cd4db8209
commit
d1f3ffe490
+3
-2
@@ -67,7 +67,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
|
|||||||
+ "lc.due_for_collection_as_of_date as dueAsOfDate, " + "lc.charge_calculation_enum as chargeCalculation, "
|
+ "lc.due_for_collection_as_of_date as dueAsOfDate, " + "lc.charge_calculation_enum as chargeCalculation, "
|
||||||
+ "lc.charge_payment_mode_enum as chargePaymentMode, " + "lc.is_paid_derived as paid, " + "lc.waived as waied, "
|
+ "lc.charge_payment_mode_enum as chargePaymentMode, " + "lc.is_paid_derived as paid, " + "lc.waived as waied, "
|
||||||
+ "lc.min_cap as minCap, lc.max_cap as maxCap, " + "lc.charge_amount_or_percentage as amountOrPercentage, "
|
+ "lc.min_cap as minCap, lc.max_cap as maxCap, " + "lc.charge_amount_or_percentage as amountOrPercentage, "
|
||||||
+ "c.currency_code as currencyCode, oc.name as currencyName, "
|
+ "lc.loan_id as loanId, c.currency_code as currencyCode, oc.name as currencyName, "
|
||||||
+ "date(coalesce(dd.disbursedon_date,dd.expected_disburse_date)) as disbursementDate, "
|
+ "date(coalesce(dd.disbursedon_date,dd.expected_disburse_date)) as disbursementDate, "
|
||||||
+ "oc.decimal_places as currencyDecimalPlaces, oc.currency_multiplesof as inMultiplesOf, oc.display_symbol as currencyDisplaySymbol, "
|
+ "oc.decimal_places as currencyDecimalPlaces, oc.currency_multiplesof as inMultiplesOf, oc.display_symbol as currencyDisplaySymbol, "
|
||||||
+ "oc.internationalized_name_code as currencyNameCode from m_charge c "
|
+ "oc.internationalized_name_code as currencyNameCode from m_charge c "
|
||||||
@@ -79,6 +79,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
|
|||||||
public LoanChargeData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
public LoanChargeData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
final Long id = rs.getLong("id");
|
final Long id = rs.getLong("id");
|
||||||
final Long chargeId = rs.getLong("chargeId");
|
final Long chargeId = rs.getLong("chargeId");
|
||||||
|
final Long loanId = rs.getLong("loanId");
|
||||||
final String name = rs.getString("name");
|
final String name = rs.getString("name");
|
||||||
final BigDecimal amount = rs.getBigDecimal("amountDue");
|
final BigDecimal amount = rs.getBigDecimal("amountDue");
|
||||||
final BigDecimal amountPaid = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "amountPaid");
|
final BigDecimal amountPaid = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "amountPaid");
|
||||||
@@ -125,7 +126,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
|
|||||||
|
|
||||||
return new LoanChargeData(id, chargeId, name, currency, amount, amountPaid, amountWaived, amountWrittenOff, amountOutstanding,
|
return new LoanChargeData(id, chargeId, name, currency, amount, amountPaid, amountWaived, amountWrittenOff, amountOutstanding,
|
||||||
chargeTimeType, submittedOnDate, dueAsOfDate, chargeCalculationType, percentageOf, amountPercentageAppliedTo, penalty,
|
chargeTimeType, submittedOnDate, dueAsOfDate, chargeCalculationType, percentageOf, amountPercentageAppliedTo, penalty,
|
||||||
paymentMode, paid, waived, null, minCap, maxCap, amountOrPercentage, null, externalId);
|
paymentMode, paid, waived, loanId, minCap, maxCap, amountOrPercentage, null, externalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
@@ -147,6 +147,29 @@ public class ClientLoanIntegrationTest {
|
|||||||
applyForLoanApplicationWithExternalId(this.requestSpec, responseSpec403, clientID, loanProductID, "12,000.00", externalId);
|
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
|
@Test
|
||||||
public void testLoanCharges_DISBURSEMENT_FEE() {
|
public void testLoanCharges_DISBURSEMENT_FEE() {
|
||||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||||
|
|||||||
Reference in New Issue
Block a user