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:
+3
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-12
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user