Repository navigation
fix(payment-methods): pass on the Hyperswitch vault's refusal instead of reporting ready - #107
Open
Pradeep-kumar1202 wants to merge 1 commit into
Open
Pradeep-kumar1202 wants to merge 1 commit into
Pradeep-kumar1202 wants to merge 1 commit into
Conversation
… of reporting ready The vault's card fields are native only. Where they cannot run (an app built without them, an over-the-air update onto an older build, a form that stops), the vault's CardForm draws no field and calls onError with unsupported_configuration. The Hyperswitch adapter passed the vault no onError and reported ready whenever the form's ref existed, so the merchant got an empty form, "ready", and no error until a save. - The adapter passes the vault's error on to onError, with its code and message, and does not report ready when the vault refused. Fields report ready only after the form, so they stay quiet. - The form session keeps unsupported_configuration on every later tokenize(); any other failure stays tokenization_failed. - A save in flight when the form fails keeps its own result (unknown_outcome included), and the form stays failed instead of going back to ready. Tests: the session (the kept code, no other code carried through, a save in flight during a failure); the adapter with a refusing vault stand-in (onError once, never ready, a later save gives the same code and message) and with a running one (ready, no error). Takes effect with the vault release that has the native-only card fields; older vault versions never call onError, so nothing changes with them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Hyperswitch adapter of the payment-methods SDK now passes on the vault's refusal instead of reporting the form ready.
The vault's card fields are native only (#104 Android, #105 iOS). Where they cannot run, for example an app built without them, an over-the-air update onto an older build, or a form that stops, the vault's
CardFormdraws no field and callsonErrorwithunsupported_configuration. Before this change, the adapter passed the vault noonErrorand reported ready whenever the form's ref existed. The merchant got an empty form, "ready", and no error until a save.Changes
providers/hyperswitch/adapter.tsx: passes the vault's error on toonError, with its code and message, and doesn't report ready when the vault refused.core/formSession.ts:tokenize()keepsunsupported_configuration. Any other failure staystokenization_failed.unknown_outcomeincluded, and the form stays failed instead of going back to ready.Tests
onErrorfires once, ready never fires, and a later save gives the same code and message.Jest: 220 passed, 3 skipped.
tscand ESLint are clean.Release
This takes effect with the vault release that has the native-only card fields. Older vault versions never call
onError, so nothing changes with them.