Skip to content

FINERACT-2724: Allocate Cash - Adjust the error message when amount is not an integer - #6203

Open
rymghosn wants to merge 2 commits into
apache:developfrom
foodeveloper:port/CBS-284-allocate-cash-amount-error-message
Open

FINERACT-2724: Allocate Cash - Adjust the error message when amount is not an integer#6203
rymghosn wants to merge 2 commits into
apache:developfrom
foodeveloper:port/CBS-284-allocate-cash-amount-error-message

Conversation

@rymghosn

Copy link
Copy Markdown
Contributor

The teller cashier "allocate cash" endpoint (POST /tellers/{tellerId}/cashiers/{cashierId}/allocate) returned an unclear/generic error when
txnAmount was not a valid number, instead of a proper validation message.

Changes made:

  • CashierTransactionRequest.txnAmount (and its corresponding Swagger schema in TellerApiResourceSwagger) is changed from BigDecimal to String, so
    a malformed value reaches the deserializer instead of failing earlier at JSON-binding time.
  • TellerCommandFromApiJsonDeserializer now catches the parse failure when extracting txnAmount and raises a PlatformApiDataValidationException
    with a clear "Amount must be a number" message, reusing the existing validation.msg.invalid.decimal.format error code.
    This PR( https://issues.apache.org/jira/browse/FINERACT-2724 )

@rymghosn
rymghosn force-pushed the port/CBS-284-allocate-cash-amount-error-message branch from 7968a24 to b77a954 Compare July 30, 2026 15:11
…ash amount is not numeric

Signed-off-by: Rym.Ghosn <rym.ghosn@foo.mobi>
@rymghosn
rymghosn force-pushed the port/CBS-284-allocate-cash-amount-error-message branch from b77a954 to fc447ad Compare July 31, 2026 05:57

@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.

Kindly review my concerns.

…or via Jackson's exception mapper

Reviewer feedback on PR apache#6203 correctly flagged that changing txnAmount
from BigDecimal to String is a breaking API/Swagger change (and broke
run-api-backward-compatibility). Revert that DTO/Swagger change and the
now-unreachable try/catch in TellerCommandFromApiJsonDeserializer, and
instead teach HttpMessageNotReadableErrorController to recognize a
Jackson InvalidFormatException on a numeric field and return a clear,
field-specific "not a valid number" validation error. This fixes the
original unclear-error report without any breaking API change, and
applies to numeric fields platform-wide rather than just this endpoint.

Also fixes a spotless line-wrap violation introduced by the original
commit.

Signed-off-by: Rym.Ghosn <rym.ghosn@foo.mobi>
@rymghosn
rymghosn requested a review from adamsaghy August 4, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants