Merge pull request #1447 from sachinkulkarni12/MIFOSX-2129

MIFOSX-2129:Submitting Collection sheet for zero repayments create an entry in Loan trasaction page
This commit is contained in:
Vishwas Babu A J
2015-07-31 19:22:07 -07:00
2 changed files with 16 additions and 14 deletions
@@ -81,11 +81,12 @@ public final class CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer ex
if (paymentDetail == null) { if (paymentDetail == null) {
detail = this.paymentDetailAssembler.fetchPaymentDetail(loanTransactionElement); detail = this.paymentDetailAssembler.fetchPaymentDetail(loanTransactionElement);
} }
if(transactionAmount != null && transactionAmount.intValue() > 0){
loanRepaymentTransactions[i] = new SingleRepaymentCommand(loanId, transactionAmount, transactionDate, detail); loanRepaymentTransactions[i] = new SingleRepaymentCommand(loanId, transactionAmount, transactionDate, detail);
} }
} }
} }
}
return new CollectionSheetBulkRepaymentCommand(note, transactionDate, loanRepaymentTransactions); return new CollectionSheetBulkRepaymentCommand(note, transactionDate, loanRepaymentTransactions);
} }
@@ -794,6 +794,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
List<Long> transactionIds = new ArrayList<>(); List<Long> transactionIds = new ArrayList<>();
boolean isAccountTransfer = false; boolean isAccountTransfer = false;
for (final SingleRepaymentCommand singleLoanRepaymentCommand : repaymentCommand) { for (final SingleRepaymentCommand singleLoanRepaymentCommand : repaymentCommand) {
if(singleLoanRepaymentCommand != null){
final Loan loan = this.loanAssembler.assembleFrom(singleLoanRepaymentCommand.getLoanId()); final Loan loan = this.loanAssembler.assembleFrom(singleLoanRepaymentCommand.getLoanId());
final PaymentDetail paymentDetail = singleLoanRepaymentCommand.getPaymentDetail(); final PaymentDetail paymentDetail = singleLoanRepaymentCommand.getPaymentDetail();
if (paymentDetail != null && paymentDetail.getId() == null) { if (paymentDetail != null && paymentDetail.getId() == null) {
@@ -804,7 +805,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
bulkRepaymentCommand.getTransactionDate(), singleLoanRepaymentCommand.getTransactionAmount(), paymentDetail, bulkRepaymentCommand.getTransactionDate(), singleLoanRepaymentCommand.getTransactionAmount(), paymentDetail,
bulkRepaymentCommand.getNote(), null, isRecoveryRepayment, isAccountTransfer); bulkRepaymentCommand.getNote(), null, isRecoveryRepayment, isAccountTransfer);
transactionIds.add(loanTransaction.getId()); transactionIds.add(loanTransaction.getId());
}
} }
changes.put("loanTransactions", transactionIds); changes.put("loanTransactions", transactionIds);
return changes; return changes;