Skip to content

refactor(payment_methods): unify locker api function call#5863

Merged
likhinbopanna merged 5 commits intomainfrom
unify-locker-call
Sep 16, 2024
Merged

refactor(payment_methods): unify locker api function call#5863
likhinbopanna merged 5 commits intomainfrom
unify-locker-call

Conversation

@Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented Sep 11, 2024

Type of Change

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

Description

This PR performs below changes -

  • Creates a single method using which locker api can be called and deserialised to the given type.
  • Currently, if locker returns an Err, the error response is not JWE+JWS decrypted. Instead its logged directly. This new method calls the api and irrespective of whether locker responds with an OK response or Err response, JWE+JWS decryption happens on the locker response.
  • Sends x-tenant-id in the headers to locker

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?

To test, I failed the locker on purpose and received below error report in Hyperswitch which also includes JWE+JWS decrypted error message.

image

Sandbox testing - Basic sanity tests which also involves saving card in locker would suffice

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

@Chethan-rao Chethan-rao added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-payment-methods Area: Payment Methods C-refactor Category: Refactor labels Sep 11, 2024
@Chethan-rao Chethan-rao added this to the September 2024 Release milestone Sep 11, 2024
@Chethan-rao Chethan-rao self-assigned this Sep 11, 2024
@Chethan-rao Chethan-rao requested review from a team as code owners September 11, 2024 14:08
@semanticdiff-com
Copy link

semanticdiff-com bot commented Sep 11, 2024

Review changes with SemanticDiff.

Analyzed 6 of 6 files.

Overall, the semantic diff is 23% smaller than the GitHub diff.

Filename Status
✔️ crates/router/src/lib.rs Analyzed
✔️ crates/router/src/core/admin.rs 37.0% smaller
✔️ crates/router/src/core/errors.rs Analyzed
✔️ crates/router/src/core/payouts/helpers.rs Analyzed
✔️ crates/router/src/core/payment_methods/cards.rs 29.47% smaller
✔️ crates/router/src/core/payment_methods/transformers.rs Analyzed

@Chethan-rao Chethan-rao linked an issue Sep 11, 2024 that may be closed by this pull request
SanchithHegde
SanchithHegde previously approved these changes Sep 12, 2024
NishantJoshi00
NishantJoshi00 previously approved these changes Sep 12, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Sep 16, 2024
Merged via the queue into main with commit 4137d7b Sep 16, 2024
@likhinbopanna likhinbopanna deleted the unify-locker-call branch September 16, 2024 07:15
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-payment-methods Area: Payment Methods C-refactor Category: Refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] unify locker api function call

6 participants