FINERACT-2463: Allow undo of Fixed Deposit transactions#5590
FINERACT-2463: Allow undo of Fixed Deposit transactions#5590AshharAhmadKhan wants to merge 1 commit intoapache:developfrom
Conversation
|
@AshharAhmadKhan Please review the failing test cases! |
857ff33 to
e1bbb7f
Compare
|
The failing Root cause: After undoing an interest transaction, the DB column Fix: Added a null check in the test assertion so that a null The service implementation, routing fix, and journal entry logic are all unchanged. |
|
@adamsaghy went through the changes again to see if I missed anything and I came out with notihng. Please let me know if there is anything else needed. |
| return this; | ||
| } | ||
|
|
||
| // TODO: Rewrite to use fineract-client instead! |
There was a problem hiding this comment.
Please use Fineract-client-feign for testing!
There was a problem hiding this comment.
Do you need any help how to rewrite this to use fineract-client-feign?
adamsaghy
left a comment
There was a problem hiding this comment.
Please see my concerns around testing.
| * Delete the Liability transfer account | ||
| */ | ||
| @Test | ||
| public void testFixedDepositAccountUndoTransaction() { |
There was a problem hiding this comment.
Please check whether transaction was reverted, balances are correct and journal entries are correct.
e1bbb7f to
7bad2f6
Compare
|
@adamsaghy thanks for the review! For the test I switched it to CASH_BASED accounting and added all three checks you mentioned — transaction marked as reversed, totalInterestPosted going back to zero, and the reversal journal entries (opposite signs on the same date). For the feign point I had a look at the generated FixedDepositAccountApi and it only exposes handleCommands4 which hits the account level endpoint and takes a single accountId. The undo transaction endpoint needs both accountId and transactionId so there is no matching method in the generated client. I also noticed RecurringDepositAccountHelper.undoTransactionForRecurringDeposit follows the same raw HTTP pattern for the same reason, so this is consistent with the existing deposit helper approach. I have added a comment in the helper explaining the gap. Happy to extend the generated client if you would prefer that approach though. |
|
7bad2f6 to
259cc66
Compare
|
@adamsaghy the failure on |
|
Would either of you mind triggering the runs when you get a chance? |
adamsaghy
left a comment
There was a problem hiding this comment.
Please use fineract-client-feign only in the integration tests.
Let me know if you need any help with that.
259cc66 to
689126b
Compare
|
@adamsaghy thanks for pushing on this, you were right. I was looking at
|
If a field is missing, we should add it to the swagger definition and it will be generated in the fineract-client automatically. |
a54521d to
5f10b35
Compare
|
@adamsaghy done — added |
5f10b35 to
7e2cd28
Compare
|
@adamsaghy just pushed a fix for the API backward compatibility failure. The new |
Description
Fixed Deposit accounts had an undo transaction endpoint that was silently broken in two ways. The API resource was calling
undoSavingsAccountTransactionon the command builder, which setentityName = "SAVINGSACCOUNT"— meaning every undo request was routed to the regular savings handler, completely bypassing the Fixed Deposit command handler that already existed and was correctly wired. On top of that,undoFDTransactionin the service layer was an unconditional stub that always threwDepositAccountTransactionNotAllowedException, so even if routing had been correct, nothing would have worked.This PR fixes both issues and makes undo transactions fully functional for Fixed Deposit accounts.
CommandWrapperBuilder.java— Added the missingundoFixedDepositAccountTransaction()builder method, correctly settingentityName = "FIXEDDEPOSITACCOUNT"andactionName = "UNDOTRANSACTION".FixedDepositAccountTransactionsApiResource.java— Fixed the routing bug by calling the new FD-specific builder method instead of the savings one.DepositAccountWritePlatformServiceJpaRepositoryImpl.java— Replaced the throw stub with a full implementation adapted fromundoRDTransaction, with FD-specific adjustments:FixedDepositAccountcast,isTransactionsAllowed()status check for ACTIVE and MATURED states, 7-parampostInterestsignature, andupdateMaturityDateAndAmountinstead of RD-specific schedule calls.FixedDepositAccountHelper.java— AddedgetFixedDepositTransactions()andundoFixedDepositTransaction()helper methods following the existing deprecated helper pattern.FixedDepositTest.java— AddedtestFixedDepositAccountUndoTransactioncovering the full flow: create client, open and activate FD account, post interest, undo the interest transaction, asserttotalInterestPostedreturns to zero.Checklist