diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java index 1bd533ca2..33b3f78a2 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java @@ -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); + } } } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 54b48aaae..f024187e1 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -794,18 +794,19 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf List 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; }