Merge pull request #896 from lingalamadhukar/MIFOSX-1166

MIFOSX-281 Add template for recovery payments
This commit is contained in:
Vishwas Babu A J
2014-05-06 18:25:26 +05:30
5 changed files with 24 additions and 0 deletions
@@ -92,6 +92,8 @@ public class LoanTransactionsApiResource {
transactionData = this.loanReadPlatformService.retrieveDisbursalTemplate(loanId, true);
} else if(is(commandParam, "disburseToSavings")){
transactionData = this.loanReadPlatformService.retrieveDisbursalTemplate(loanId, false);
} else if(is(commandParam, "recoverypayment")){
transactionData = this.loanReadPlatformService.retrieveRecoveryPaymentTemplate(loanId);
}
else {
throw new UnrecognizedQueryParamException("command", commandParam);
@@ -767,6 +767,10 @@ public class Loan extends AbstractPersistable<Long> {
}
return amount.getAmount();
}
public BigDecimal getTotalWrittenOff() {
return this.summary.getTotalWrittenOff();
}
/**
* @param calculationType
@@ -282,4 +282,8 @@ public final class LoanSummary {
public BigDecimal getTotalPrincipalRepaid() {
return this.totalPrincipalRepaid;
}
public BigDecimal getTotalWrittenOff() {
return this.totalWrittenOff;
}
}
@@ -80,4 +80,6 @@ public interface LoanReadPlatformService {
Collection<LoanTermVariationsData> retrieveLoanTermVariations(Long loanId, Integer termType);
Collection<LoanScheduleAccrualData> retriveScheduleAccrualData();
LoanTransactionData retrieveRecoveryPaymentTemplate(Long loanId);
}
@@ -1377,4 +1377,16 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
}
@Override
public LoanTransactionData retrieveRecoveryPaymentTemplate(Long loanId) {
final Loan loan = this.loanRepository.findOne(loanId);
if (loan == null) { throw new LoanNotFoundException(loanId); }
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.RECOVERY_REPAYMENT);
final Collection<CodeValueData> paymentOptions = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
return new LoanTransactionData(null, null, null, transactionType, null, null, null, loan.getTotalWrittenOff(), null, null, null,
null, null, paymentOptions, null, null, null);
}
}