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: validate refund amount with amount_captured instead of amount #3120

Merged
merged 4 commits into from
Dec 13, 2023

Conversation

hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Dec 12, 2023

Type of Change

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

Description

Refund amount was being validated with amount field in payment_attempt.
In fact it should be validated with amount_captured field in payment_intent.
Because refund can only be made with amount that has already being captured.

Additional Changes

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

How did you test it?

Manual
Partially captured payment
Screenshot 2023-12-12 at 8 58 24 PM

Refund with refund_amount greater than amount_recieved(amount_captured)
Screenshot 2023-12-12 at 8 58 27 PM

Refund with refund_amount less than amount_recieved.
Screenshot 2023-12-12 at 8 58 36 PM

Screenshot 2023-12-13 at 3 46 17 PM

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
  • I added a CHANGELOG entry if applicable

@hrithikesh026 hrithikesh026 added the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Dec 12, 2023
@hrithikesh026 hrithikesh026 added this to the December 2023 Release milestone Dec 12, 2023
@hrithikesh026 hrithikesh026 self-assigned this Dec 12, 2023
@hrithikesh026 hrithikesh026 requested review from a team as code owners December 12, 2023 15:37
Narayanbhat166
Narayanbhat166 previously approved these changes Dec 13, 2023
@Gnanasundari24
Copy link
Contributor

@hrithikesh026 Can you add the same cases in postman aswell

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Dec 13, 2023
Merged via the queue into main with commit be13d15 Dec 13, 2023
12 of 14 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refund-amount-validation-with-amount-captured branch December 13, 2023 14:06
@SanchithHegde SanchithHegde added C-bug Category: Bug and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants