MIFOSX-2129:Submitting Collection sheet for zero repayments create an entry in Loan trasaction page

This commit is contained in:
sachinkulkarni12
2015-07-29 11:13:58 +05:30
parent befd953fcf
commit 3757e2b689
2 changed files with 16 additions and 14 deletions
@@ -81,8 +81,9 @@ public final class CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer ex
if (paymentDetail == null) {
detail = this.paymentDetailAssembler.fetchPaymentDetail(loanTransactionElement);
}
loanRepaymentTransactions[i] = new SingleRepaymentCommand(loanId, transactionAmount, transactionDate, detail);
if(transactionAmount != null && transactionAmount.intValue() > 0){
loanRepaymentTransactions[i] = new SingleRepaymentCommand(loanId, transactionAmount, transactionDate, detail);
}
}
}
}
@@ -794,18 +794,19 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
List<Long> transactionIds = new ArrayList<>();
boolean isAccountTransfer = false;
for (final SingleRepaymentCommand singleLoanRepaymentCommand : repaymentCommand) {
final Loan loan = this.loanAssembler.assembleFrom(singleLoanRepaymentCommand.getLoanId());
final PaymentDetail paymentDetail = singleLoanRepaymentCommand.getPaymentDetail();
if (paymentDetail != null && paymentDetail.getId() == null) {
this.paymentDetailWritePlatformService.persistPaymentDetail(paymentDetail);
}
final CommandProcessingResultBuilder commandProcessingResultBuilder = new CommandProcessingResultBuilder();
LoanTransaction loanTransaction = this.loanAccountDomainService.makeRepayment(loan, commandProcessingResultBuilder,
bulkRepaymentCommand.getTransactionDate(), singleLoanRepaymentCommand.getTransactionAmount(), paymentDetail,
bulkRepaymentCommand.getNote(), null, isRecoveryRepayment, isAccountTransfer);
transactionIds.add(loanTransaction.getId());
}
if(singleLoanRepaymentCommand != null){
final Loan loan = this.loanAssembler.assembleFrom(singleLoanRepaymentCommand.getLoanId());
final PaymentDetail paymentDetail = singleLoanRepaymentCommand.getPaymentDetail();
if (paymentDetail != null && paymentDetail.getId() == null) {
this.paymentDetailWritePlatformService.persistPaymentDetail(paymentDetail);
}
final CommandProcessingResultBuilder commandProcessingResultBuilder = new CommandProcessingResultBuilder();
LoanTransaction loanTransaction = this.loanAccountDomainService.makeRepayment(loan, commandProcessingResultBuilder,
bulkRepaymentCommand.getTransactionDate(), singleLoanRepaymentCommand.getTransactionAmount(), paymentDetail,
bulkRepaymentCommand.getNote(), null, isRecoveryRepayment, isAccountTransfer);
transactionIds.add(loanTransaction.getId());
}
}
changes.put("loanTransactions", transactionIds);
return changes;
}