FINERACT-2048: Make amount and recurrence fields optional for Dues-based Standing Instructions#5895
Open
dr-fuch wants to merge 1 commit into
Open
FINERACT-2048: Make amount and recurrence fields optional for Dues-based Standing Instructions#5895dr-fuch wants to merge 1 commit into
dr-fuch wants to merge 1 commit into
Conversation
e941582 to
3c11c37
Compare
…sed Standing Instructions
3c11c37 to
a1e3dba
Compare
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
📋 Overview
This PR introduces significant improvements to the Standing Instructions (SI) module, specifically to support instructions based on loan dues (Dues-based instructions).
Previously, the system enforced fixed amounts and periodic recurrence for all types of instructions. These changes allow for more flexible automated loan repayments where the transaction amount and timing are dictated by the loan schedule rather than a fixed calendar.
🛠 Key Changes
1. API Constants & Error Handling
Added specific error codes in
StandingInstructionApiConstantsto provide granular feedback for invalid configurations and ensure data integrity:not.allowed.for.dues.instruction: Thrown when an amount is provided for a "Dues" type instruction (where the amount must be derived from the loan).as.per.dues.not.allowed.with.fixed.amount: Prevents "As Per Dues" recurrence when a fixed amount is defined.dues.not.allowed.for.account.transfer: Prevents Dues-based instructions for standard peer-to-peer account transfers.as.per.dues.not.allowed.for.account.transfer: Prevents Dues-based recurrence when the target is a Savings account.transfer.to.same.account.not.allowed: Ensures the source and destination accounts are different.account.transfer.is.not.allowed.for.loan.accounts&is.not.a.valid.loan.repayment: Validation for incorrect account type mappings.invalid.month.day.format: Handles incorrect formatting for recurrence date parameters.must.not.be.before.first.execution.date: EnsuresvalidTilldoesn't cut off the first scheduled run.must.be.before.existing.valid.till&cannot.be.before.last.run.date: Critical checks for maintaining consistency during instruction updates.2. Data Validation Layer
Heavily refactored
StandingInstructionDataValidatorto implement a Business Decision Matrix:instructionTypeisDUES.validateForUpdatenow performs cross-field validation between incoming changes and the current entity state.3. Domain & Entity Integrity
AccountTransferStandingInstructionto ensure consistency. Updating to "Dues" automatically clears fixed amounts and periodic recurrence fields (frequency,interval,monthDay) to prevent "data noise".java.util.Objects.equalsto handle transitions between null/non-null states, preventingNullPointerExceptions.@Getterfor cleaner, more readable code.🧪 Automated Testing
Introduced a robust unit test suite:
StandingInstructionDataValidatorTestusing Parameterized Tests and Nested Classes to cover:Checking
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.