Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): add max_amount validation in payment flows #4645

Merged
merged 2 commits into from
May 15, 2024

Conversation

sai-harsha-vardhan
Copy link
Contributor

@sai-harsha-vardhan sai-harsha-vardhan commented May 14, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

add max_amount validation in payment flows
add max amount validation in payments create, confirm and update flow to throw an error if amount sent it more than 999999999

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Tested Manually

  1. Pass amount greater than 999999999 in payments create with confirm = false
    image

  2. Pass amount greater than 999999999 in payments create with confirm = true
    image

  3. Pass amount greater than 999999999 in payments update
    image

  4. Pass amount greater than 999999999 in payments confirm
    image

  5. Any amount less than or equal to 999999999 should work without any error

image image image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@sai-harsha-vardhan sai-harsha-vardhan added A-core Area: Core flows C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels May 14, 2024
@sai-harsha-vardhan sai-harsha-vardhan added this to the May 2024 Release milestone May 14, 2024
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this May 14, 2024
@sai-harsha-vardhan sai-harsha-vardhan requested a review from a team as a code owner May 14, 2024 19:24
match amount {
api_models::payments::Amount::Value(value) => {
//max_amount allowed is 999999999 in minor units
utils::when(value.get() > 999999999, || {
Copy link
Member

Choose a reason for hiding this comment

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

can you move this to a constant, we can make use of the same const value in all other places as well

@sai-harsha-vardhan sai-harsha-vardhan requested a review from a team as a code owner May 15, 2024 09:34
@likhinbopanna likhinbopanna added this pull request to the merge queue May 15, 2024
@likhinbopanna likhinbopanna removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label May 15, 2024
Merged via the queue into main with commit df865d7 May 15, 2024
9 of 12 checks passed
@likhinbopanna likhinbopanna deleted the add-max-amount-validation-payments-flow branch May 15, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants