adamsaghy commented on code in PR #4783:
URL: https://github.com/apache/fineract/pull/4783#discussion_r2155234770
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountTransfersWritePlatformServiceImpl.java:
##########
@@ -208,6 +211,37 @@ public CommandProcessingResult create(final JsonCommand
command) {
return builder.build();
}
+ @Transactional
+ @Override
+ public CommandProcessingResult adjust(JsonCommand command) {
+
+ final Long accountTransferId = command.entityId();
+
+ Optional<AccountTransferTransaction> optAccountTransfer =
this.accountTransferRepository.findById(accountTransferId);
+ if (!optAccountTransfer.isPresent()) {
+ throw new
GeneralPlatformDomainRuleException("error.msg.accounttransfer.was.not.found",
"Account transfer was not found");
+ }
+ final boolean backdatedTxnsAllowedTill =
this.configurationDomainService.retrievePivotDateConfig();
+
+ AccountTransferTransaction accountTransfer = optAccountTransfer.get();
+ if (accountTransfer.getToSavingsTransaction() != null) {
+ log.info("Reverse savings transfer to {} {}",
accountTransfer.getToSavingsTransaction().getSavingsAccount().getAccountNumber(),
+ accountTransfer.getToSavingsTransaction().getId());
+
savingsAccountDomainService.reverseTransfer(accountTransfer.getToSavingsTransaction(),
backdatedTxnsAllowedTill);
+ }
+ if (accountTransfer.getFromSavingsTransaction() != null) {
+ log.info("Reverse savings transfer from {} {}",
+
accountTransfer.getFromSavingsTransaction().getSavingsAccount().getAccountNumber(),
+ accountTransfer.getFromSavingsTransaction().getId());
+
savingsAccountDomainService.reverseTransfer(accountTransfer.getFromSavingsTransaction(),
backdatedTxnsAllowedTill);
+ }
+
+ accountTransfer.reverse();
Review Comment:
why to reverse if it got adjusted?
--
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]