FINERACT-2098: Currency data needed in loan transaction for UI

This commit is contained in:
Jose Alberto Hernandez
2024-07-03 09:54:28 +02:00
committed by Adam Saghy
parent b482fbd447
commit f17a0965db
6 changed files with 68 additions and 19 deletions
@@ -44,6 +44,26 @@ final class LoansApiResourceSwagger {
public Double approvalAmount;
@Schema(example = "200.000000")
public Double netDisbursalAmount;
public GetLoanCurrency currency;
}
public static final class GetLoanCurrency {
private GetLoanCurrency() {}
@Schema(example = "UGX")
public String code;
@Schema(example = "Uganda Shilling")
public String name;
@Schema(example = "2")
public Integer decimalPlaces;
@Schema(example = "USh")
public String displaySymbol;
@Schema(example = "currency.UGX")
public String nameCode;
@Schema(example = "Uganda Shilling (USh)")
public String displayLabel;
}
@Schema(description = "GetLoansTemplateResponse")
@@ -539,7 +539,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
@Override
public LoanApprovalData retrieveApprovalTemplate(final Long loanId) {
final Loan loan = this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId, true);
return new LoanApprovalData(loan.getProposedPrincipal(), DateUtils.getBusinessLocalDate(), loan.getNetDisbursalAmount());
final ApplicationCurrency appCurrency = applicationCurrencyRepository.findOneWithNotFoundDetection(loan.getCurrency());
return new LoanApprovalData(loan.getProposedPrincipal(), DateUtils.getBusinessLocalDate(), loan.getNetDisbursalAmount(),
appCurrency.toData());
}
@Override
@@ -550,11 +552,10 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
if (paymentDetailsRequired) {
paymentOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
}
final ApplicationCurrency appCurrency = applicationCurrencyRepository.findOneWithNotFoundDetection(loan.getCurrency());
return LoanTransactionData.loanTransactionDataForDisbursalTemplate(transactionType,
loan.getExpectedDisbursedOnLocalDateForTemplate(), loan.getDisburseAmountForTemplate(), loan.getNetDisbursalAmount(),
paymentOptions, loan.retriveLastEmiAmount(), loan.getNextPossibleRepaymentDateForRescheduling());
paymentOptions, loan.retriveLastEmiAmount(), loan.getNextPossibleRepaymentDateForRescheduling(), appCurrency.toData());
}
@Override