-
Notifications
You must be signed in to change notification settings - Fork 4
feat: added react wrapper for payment methods management #8
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
Changes from all commits
814e812
26a0def
3e06056
65801eb
4232609
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,7 @@ | |
| let make = (~children, ~hyper: Promise.t<OrcaJs.switchInstance>, ~options: JSON.t) => { | ||
| let paymentMethodsManagementElementOptions = | ||
| options->Context.paymentMethodsManagementElementsOptionObjMapper | ||
| let (switchState, setSwitchState) = React.useState(() => | ||
| Context.defaultPaymentMethodsManagementSwitchContext | ||
| ) | ||
| let (switchState, setSwitchState) = React.useState(() => Context.defaultSwitchContext) | ||
| let (elementsState, setElementsState) = React.useState(() => | ||
| Context.defaultPaymentMethodsManagementElementsContext | ||
| ) | ||
|
|
@@ -21,9 +19,15 @@ let make = (~children, ~hyper: Promise.t<OrcaJs.switchInstance>, ~options: JSON. | |
| create: orcaElementsConfig.create, | ||
| } | ||
|
|
||
| let switchValClone: Context.paymentMethodsManagementSwitchContextType = { | ||
| let switchValClone: Context.switchContextType = { | ||
| confirmPayment: switchInstance.confirmPayment, | ||
| confirmCardPayment: switchInstance.confirmCardPayment, | ||
| retrievePaymentIntent: switchInstance.retrievePaymentIntent, | ||
| clientSecret: "", | ||
| paymentRequest: switchInstance.paymentRequest, | ||
| ephemeralKey: paymentMethodsManagementElementOptions.ephemeralKey, | ||
| completeUpdateIntent: switchInstance.completeUpdateIntent, | ||
| initiateUpdateIntent: switchInstance.initiateUpdateIntent, | ||
| confirmTokenization: switchInstance.confirmTokenization, | ||
|
Comment on lines
+22
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On testing this i found out that even though we have client secret value but its not needed or consumed anywhere since its provided in element options and not from the switch context, so we do not need to add the ephemeral key here since its not needed |
||
| } | ||
| setSwitchState(_ => switchValClone) | ||
| setElementsState(_ => newElemValues) | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to add
ephemeralKey: ""in defaultSwitchContext?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and tested this so we do not need the switch context to have this value since its not needed and used
cc: @ArushKapoorJuspay