Repository navigation
Conversation
… redemptions Assisted-By: Grok Bot
kccrcodes
force-pushed
the
FINERACT-3394
branch
from
December 6, 2026 15:59
2bda10a to
99af8b0
Compare
Contributor
Author
|
Re-signed the commit (now verified). Could a committer approve the workflow run when you have a moment? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes FINERACT-3394.
ShareAccountDataSerializer.validateRedeemRequestworks out how many shares are out of lock-in on the redeem date. It looped over the account's transactions and only counted a transaction iftransactionDate + lockinPeriod <= redeemDate. That rule is correct for purchases, but it was also applied to redemptions: an earlier redemption was only subtracted from the "can be redeemed" total once a full lock-in period had passed since that redemption. Until then, the shares it already took out were counted as still available, so they could be redeemed a second time out of shares that were still locked.Example: lock-in of 1 month, 100 shares bought on 1 Jan (unlocked from 1 Feb) and 100 on 1 Mar (locked until 1 Apr). Redeeming 100 on 15 Mar is allowed and uses up every unlocked share. Redeeming 50 more on 20 Mar was accepted, because the 15 Mar redemption wasn't subtracted (15 Mar + 1 month = 15 Apr, which is after 20 Mar). 50 of the 1 Mar shares were redeemed during lock-in.
Changes:
totalSharesCanBeRedeemed, whatever its age (unlocked purchases minus all prior redemptions).totalSharesPurchasedBeforeRedeemcheck is unchanged, including its handling of approved purchases and redemptions. Pending and rejected transactions are still ignored, becauseisPurchasTransaction()andisRedeemTransaction()already require APPROVED, and inactive transactions are still skipped byisActive().Added
ShareAccountRedeemLockinTest, a plain JUnit + Mockito unit test with realShareAccountTransactionobjects:secondRedemptionCannotDipIntoSharesStillInLockinreproduces the bug above and now fails withvalidation.msg.sharesaccount.cannot.be.redeemed.due.to.lockinperiod.firstRedemptionOfUnlockedSharesIsStillAllowedis the control: the first 100-share redemption on 20 Mar is still accepted.oldRedemptionIsStillSubtractedFromSharesThatCanBeRedeemedandremainingUnlockedSharesAfterOldRedemptionCanStillBeRedeemedcover a redemption more than one lock-in period old (50 shares on 1 Feb): redeeming 100 more on 20 Mar is refused, redeeming the remaining 50 is still allowed.Without the fix, the first of those four tests fails (
Expected PlatformApiDataValidationException to be thrown, but nothing was thrown) and the other three pass. With the fix, all four pass. I also ran the nearby share-account unit tests (ShareAccountDataSerializerTest,ShareAccountUndoApprovalAndRejectStatusTest,ShareAccountRepositoryWrapperTest); 32 tests in total, all passing. I didn't run the integration suite locally.Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.