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