wip retrieve loan schedule/repayment data
This commit is contained in:
@@ -97,11 +97,13 @@ public class LoansApiResource {
|
||||
.retrieveLoanAccountDetails(loanId);
|
||||
//LoanAccountData loanAccount = this.loanReadPlatformService.convertToData(loanBasicDetails);
|
||||
|
||||
|
||||
|
||||
Collection<LoanTransactionDatajpw> loanRepayments = this.loanReadPlatformService.retrieveLoanPayments(loanId);
|
||||
Collection<LoanRepaymentPeriodDatajpw> repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId);
|
||||
|
||||
LoanAccountSummaryData summary = this.loanReadPlatformService.retrieveSummary(loanBasicDetails.getPrincipal(), repaymentSchedule);
|
||||
LoanAccountSummaryData summary = this.loanReadPlatformService.retrieveSummary(loanBasicDetails.getPrincipal(), repaymentSchedule, loanRepayments);
|
||||
|
||||
Collection<LoanTransactionDatajpw> loanRepayments = this.loanReadPlatformService.retrieveLoanPayments(loanId);
|
||||
|
||||
LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, summary, repaymentSchedule, loanRepayments, null );
|
||||
|
||||
|
||||
+4
-3
@@ -17,11 +17,12 @@ public interface LoanReadPlatformService {
|
||||
|
||||
Collection<LoanRepaymentPeriodDatajpw> retrieveRepaymentSchedule(Long loanId);
|
||||
|
||||
LoanAccountSummaryData retrieveSummary(MoneyData principal,
|
||||
Collection<LoanRepaymentPeriodDatajpw> repaymentSchedule);
|
||||
|
||||
Collection<LoanTransactionDatajpw> retrieveLoanPayments(Long loanId);
|
||||
|
||||
LoanAccountSummaryData retrieveSummary(MoneyData principal,
|
||||
Collection<LoanRepaymentPeriodDatajpw> repaymentSchedule,
|
||||
Collection<LoanTransactionDatajpw> loanRepayments);
|
||||
|
||||
NewLoanData retrieveClientAndProductDetails(Long clientId, Long productId);
|
||||
|
||||
LoanTransactionData retrieveNewLoanRepaymentDetails(Long loanId);
|
||||
|
||||
+11
-2
@@ -115,7 +115,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
|
||||
@Override
|
||||
public LoanAccountSummaryData retrieveSummary(MoneyData principal,
|
||||
Collection<LoanRepaymentPeriodDatajpw> repaymentSchedule) {
|
||||
Collection<LoanRepaymentPeriodDatajpw> repaymentSchedule, Collection<LoanTransactionDatajpw> loanRepayments) {
|
||||
|
||||
CurrencyData currencyData = new CurrencyData(
|
||||
principal.getCurrencyCode(), principal.getDefaultName(),
|
||||
@@ -158,7 +158,16 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
}
|
||||
|
||||
totalInArrears = BigDecimal.TEN;
|
||||
totalWaived = BigDecimal.ONE;
|
||||
|
||||
|
||||
Long waiverType = (long) 4;
|
||||
for (LoanTransactionDatajpw loanRepayment : loanRepayments) {
|
||||
Long transactionType = loanRepayment.getTransactionType().getId();
|
||||
if (transactionType.equals(waiverType)) {
|
||||
totalWaived = totalWaived.add(loanRepayment.getTotal().getAmount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new LoanAccountSummaryData(MoneyData.of(currencyData,
|
||||
originalPrincipal), MoneyData.of(currencyData, principalPaid),
|
||||
|
||||
Reference in New Issue
Block a user