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(core): validate amount_to_capture in payment update #3830

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

hrithikesh026
Copy link
Contributor

Type of Change

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

Description

If capture method is automatic then amount must be equal to amount_to_capture, if amount_to_capture is sent in payment_create request.

This validation works in payments_create call but doesn't work as expected in payments_update call.

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?

Manual
Payment create with confirm false
Screenshot 2024-02-26 at 11 27 30 PM

Update payment amount (fails with validation error)
Screenshot 2024-02-26 at 11 26 28 PM

Send correct amount_to_capture field and update is successful
Screenshot 2024-02-26 at 11 27 01 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 C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Feb 26, 2024
@hrithikesh026 hrithikesh026 self-assigned this Feb 26, 2024
@hrithikesh026 hrithikesh026 requested a review from a team as a code owner February 26, 2024 18:09
@hrithikesh026 hrithikesh026 added this to the February 2024 Release milestone Feb 26, 2024
Narayanbhat166
Narayanbhat166 previously approved these changes Feb 27, 2024
@pixincreate
Copy link
Member

Your changes seems to affect other connectors (In CI, it is found to affect Stripe): https://github.com/juspay/hyperswitch/actions/runs/8053593266/job/21996336428?pr=3830.

@pixincreate
Copy link
Member

Also, can you please check the same for other connectors i.e., adyen, bluesnap, cybersource, checkout?

@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 27, 2024
@likhinbopanna likhinbopanna removed this pull request from the merge queue due to a manual request Feb 27, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 27, 2024
Merged via the queue into main with commit 04e9734 Feb 27, 2024
10 of 12 checks passed
@likhinbopanna likhinbopanna deleted the amount-to-capture-validation branch February 27, 2024 13:01
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Feb 27, 2024
pixincreate added a commit that referenced this pull request Feb 28, 2024
…stman-runner

* 'main' of github.com:juspay/hyperswitch: (22 commits)
  chore(version): 2024.02.28.0
  chore(postman): update Postman collection files
  fix(connector): [AUTHORIZEDOTNET] Fix status mapping (#3845)
  refactor(router): added logs health and deep health (#3780)
  feat(roles): Change list roles, get role and authorization info api to respond with groups (#3837)
  fix(core): validate amount_to_capture in payment update (#3830)
  refactor(connector): [Square] change error message from NotSupported to NotImplemented (#2875)
  feat(router): add connector mit related columns to the payment methods table (#3764)
  ci(postman): refactor NMI postman collection (#3805)
  refactor(connector): [Braintree] Mask PII data (#3759)
  refactor(connector): [Forte] Mask PII data (#3824)
  refactor(compatibility): added compatibility layer request logs (#3774)
  refactor(payment_methods): introduce `locker_id` column in `payment_methods` table (#3760)
  feat(connector): mask pii information in connector request and response for stripe, aci, adyen, airwallex  and authorizedotnet (#3678)
  chore(version): 2024.02.27.0
  fix(core): do not construct request if it is already available (#3826)
  refactor: incorporate `hyperswitch_interface` into router (#3669)
  feat: add unique constraint restriction for KV (#3723)
  feat(connector): [Payme] Add Void flow to Payme (#3817)
  refactor(connector): [Cybersource] Mask PII data  (#3786)
  ...
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.

5 participants