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


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformServiceImpl.java:
##########
@@ -493,6 +498,48 @@ public AccountTransferDetails 
repayLoanWithTopup(AccountTransferDTO accountTrans
         return accountTransferDetails;
     }
 
+    @Override
+    public CommandProcessingResult undo(JsonCommand command) {
+        AccountTransferDetails accountTransferDetails = 
accountTransferDetailRepository.findById(command.entityId())
+                .orElseThrow(() -> new 
AccountTransferNotFoundException(command.entityId()));
+
+        final PaymentDetail paymentDetail = null;
+
+        PortfolioAccountType fromAccountType = 
accountTransferDetails.fromLoanAccount() != null ? PortfolioAccountType.LOAN
+                : accountTransferDetails.fromSavingsAccount() != null ? 
PortfolioAccountType.SAVINGS : throwUnsupported();
+
+        PortfolioAccountType toAccountType = 
accountTransferDetails.toLoanAccount() != null ? PortfolioAccountType.LOAN
+                : accountTransferDetails.toSavingsAccount() != null ? 
PortfolioAccountType.SAVINGS : throwUnsupported();
+
+        if (isSavingsToSavingsAccountTransfer(fromAccountType, toAccountType)) 
{
+            throw new UnsupportedOperationException("Undo Savings to Savings 
Account Transfer is not implemented");
+        } else if (isSavingsToLoanAccountTransfer(fromAccountType, 
toAccountType)) {
+            
accountTransferDetails.getAccountTransferTransactions().forEach(transaction -> {

Review Comment:
   Fair point



-- 
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