adamsaghy commented on code in PR #5877:
URL: https://github.com/apache/fineract/pull/5877#discussion_r3380763831


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformServiceImpl.java:
##########
@@ -538,7 +538,12 @@ public CommandProcessingResult undo(JsonCommand command) {
                 transaction.reverse();
             });
         } else if (isLoanToSavingsAccountTransfer(fromAccountType, 
toAccountType)) {
-            throw new UnsupportedOperationException("Undo Loan to Savings 
Account Transfer is not implemented");
+            
accountTransferDetails.getAccountTransferTransactions().forEach(transaction -> {
+                
this.savingsAccountWritePlatformService.undoTransaction(transaction.getToSavingsTransaction().getSavingsAccount().getId(),
+                        transaction.getToSavingsTransaction().getId(), true);
+                
this.loanAccountDomainService.reverseTransfer(transaction.getFromLoanTransaction());

Review Comment:
   Please use 
   ```
   LoanAdjustmentParameter parameter = 
LoanAdjustmentParameter.builder().transactionAmount(BigDecimal.ZERO)
                           
.paymentDetail(paymentDetail).transactionDate(transaction.getToLoanTransaction().getTransactionDate())
                           
.txnExternalId(transaction.getToLoanTransaction().getExternalId()).reversalTxnExternalId(reversalTxnExternalId)
                           .noteText(null).build();
                   
this.loanAdjustmentService.adjustLoanTransaction(transaction.getToLoanTransaction().getLoan(),
                           transaction.getToLoanTransaction(), parameter, null, 
new HashMap<>());
   ```
   
   Which is more complete and thorough on reversal of loan transaction



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to