Skip to content

FINERACT-2690: Fix undo account transfer to resolve and scope by tran… - #6136

Open
Samer-Melhem-FOO wants to merge 2 commits into
apache:developfrom
foodeveloper:cherry-pick/FINERACT-2690-fix-undo-account-transfer
Open

Samer-Melhem-FOO wants to merge 2 commits into
apache:developfrom
foodeveloper:cherry-pick/FINERACT-2690-fix-undo-account-transfer

Conversation

@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor

AccountTransfersWritePlatformServiceImpl.undo() had two related defects, discovered while testing the undo-account-transfer capability added in FINERACT-2604 and extended in FINERACT-2613:

  1. Wrong lookup table. The endpoint's path id was resolved against m_account_transfer_details, but AccountTransfersReadPlatformServiceImpl.retrieveOne (which backs the transfer read/list APIs) queries by m_account_transfer_transaction.id. These are two
    independent, unrelated id sequences that drift apart over time, so a caller undoing a transfer they can clearly see via the list/read endpoints could get a 404.
  2. Over-reversal on recurring transfers. undo() reversed every AccountTransferTransaction tied to the resolved AccountTransferDetails record, rather than only the single transaction the caller asked to undo. This incorrectly reversed every execution of a
    recurring transfer (e.g. a standing instruction) sharing one details row across many runs.

This PR fixes undo() to resolve and scope by m_account_transfer_transaction id instead, for both the savings-to-loan and savings-to-savings paths, so:

  • the id passed to undo matches what the read/list APIs actually expose, and
  • only the specific transaction requested is reversed, leaving sibling executions of a recurring transfer untouched.

It also adds the missing UNDO_ACCOUNTTRANSFER permission (entityName=ACCOUNTTRANSFER, actionName=UNDO) via a new Liquibase changelog part — the command handler was already wired to check this permission, but no matching m_permission row was ever shipped, so
the command failed permission validation before reaching the (buggy) logic above.

@Samer-Melhem-FOO
Samer-Melhem-FOO force-pushed the cherry-pick/FINERACT-2690-fix-undo-account-transfer branch from b920603 to 3c0a655 Compare July 16, 2026 08:30
@Aman-Mittal
Aman-Mittal requested a review from adamsaghy July 23, 2026 11:23
@Aman-Mittal Aman-Mittal added Needs Functional Review PRs which pass build and have no obvious technical problems, but need functional review. java Pull requests that update Java code labels Jul 23, 2026
@adamsaghy

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO Please rebase this PR.

adamsaghy
adamsaghy previously approved these changes Aug 3, 2026

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor Author

Rebased onto latest develop. Also had to renumber the new changelog part from 0242 to 0244 to avoid colliding with 0242/0243 that landed on develop in the meantime.

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

hey @Samer-Melhem-FOO please resolve conflicts and rebase, thanks!

@Samer-Melhem-FOO
Samer-Melhem-FOO force-pushed the cherry-pick/FINERACT-2690-fix-undo-account-transfer branch from 3ed0064 to 00f650e Compare August 7, 2026 10:36
@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor Author

Rebased onto latest develop and resolved the conflict in changelog-tenant.xml (renumbered the new changelog part to 0245 to avoid colliding with 0244_add_payment_detail_to_account_transfer_transaction.xml). Ready for another look.

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

hey @adamsaghy please review this when you get a chance, thanks!

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

Hey @Samer-Melhem-FOO please rebase to latest upstream andd resolve changelog conflicts.

@Samer-Melhem-FOO
Samer-Melhem-FOO force-pushed the cherry-pick/FINERACT-2690-fix-undo-account-transfer branch from 00f650e to 9f3b524 Compare August 12, 2026 08:26
@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor Author

Rebased onto latest develop and resolved the changelog conflict — 0245_add_undo_accounttransfer_permission.xml was renumbered to 0248 since 0245-0247 were already taken upstream. Force-pushed.

@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor Author

FYI @AshharAhmadKhan @adamsaghy

@adamsaghy

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO Can you please review the failing checks?

@adamsaghy

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO Please rebase and fix the failing checks

@adamsaghy

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO Are you planning to finish this PR?

@Samer-Melhem-FOO
Samer-Melhem-FOO force-pushed the cherry-pick/FINERACT-2690-fix-undo-account-transfer branch from 9f3b524 to 3e93ba9 Compare September 4, 2026 13:55
@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor Author

@adamsaghy Rebased onto latest develop (renumbered the new changelog part from 0248 to 0254 to avoid colliding with 0248-0253 that landed upstream in the meantime) and fixed the actual CI failure: AccountTransferOverdraftTest.preserveTransferLinkWhenBackdatedDepositRecalculatesOverdraft() was calling undo() with the create-command's resourceId (m_account_transfer_details.id) — the old, buggy id space this PR's fix stops accepting. Updated it to use the transfer-transaction id instead, which is what undo() now correctly requires. Force-pushed, ready for another look.

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO please check the failing logs

1 similar comment
@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO please check the failing logs

@adamsaghy

Copy link
Copy Markdown
Contributor

@Samer-Melhem-FOO Please rebase and check failing checks.

…saction id

undo() resolved the path id against m_account_transfer_details, but the
transfer read/list APIs expose m_account_transfer_transaction.id instead -
two independent id sequences that drift apart, so undo could 404 on a
transfer a caller could clearly see. It also reversed every transaction
tied to the resolved details record instead of only the one requested,
over-reversing recurring transfers (e.g. standing instructions) that share
one details row across many executions. Fixed for both the savings-to-loan
(FINERACT-2604) and savings-to-savings (FINERACT-2613) paths.

Also adds the missing UNDO_ACCOUNTTRANSFER permission (entityName=
ACCOUNTTRANSFER, actionName=UNDO) referenced by the command wiring, which
had no matching m_permission row and so failed permission validation.
@Samer-Melhem-FOO
Samer-Melhem-FOO force-pushed the cherry-pick/FINERACT-2690-fix-undo-account-transfer branch from 3e93ba9 to eb0211e Compare September 22, 2026 05:34
@Samer-Melhem-FOO

Copy link
Copy Markdown
Contributor Author

@adamsaghy Rebased onto the latest develop and force-pushed. The rebase was conflict-free this time, and 0254_add_undo_accounttransfer_permission.xml is still free upstream, so no renumbering was needed.

I also pushed a second commit that was missing: AccountTransferOverdraftTest.preserveTransferLinkWhenBackdatedDepositRecalculatesOverdraft() was still calling undo with the create-command's resourceId (an m_account_transfer_details.id) instead of the transfer-transaction id this PR's fix requires. It now passes withdrawal.getTransfer().getId(), which the savings transactions mapper populates from m_account_transfer_transaction.id — the same key space AccountTransfersReadPlatformServiceImpl.retrieveOne looks up (where att.id = ?). It passed before only because both id sequences coincide in a fresh test database.

On the two failing checks in the previous run: both looked like CI infrastructure rather than this PR.

  • E2E Tests (Shard 9 of 20) — the fineract container never became healthy (curl … localhost:8443 returned SSL_ERROR_SYSCALL through all 30 retries), and the gradle invocation also hit Failed to load eclipse groovy formatter: java.lang.IllegalArgumentException: 502 at https://download.eclipse.org/eclipse/updates/4.29/…/com.sun.jna_5.13.0.jar.
  • regression-safety — ended with The runner has received a shutdown signal … The operation was canceled. before it got to the changelog checks.

All 85 other checks were green, including every MariaDB integration shard. Locally on the rebased branch, :fineract-provider:compileJava and :integration-tests:compileTestJava both build clean and spotlessJavaCheck reports no violations in the touched files. Hopefully this run comes back green — happy to dig in if anything real shows up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code Needs Functional Review PRs which pass build and have no obvious technical problems, but need functional review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants