-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Added "fingerprint" to the Card Model to sync with React-Native #1764
base: main
Are you sure you want to change the base?
Conversation
Solves issues: - flutter-stripe#707 - flutter-stripe#688 Resolves discussion: - flutter-stripe#691 Sync with issue: stripe/stripe-react-native#914
- stripe_platform_interface@10.2.0 - flutter_stripe_web@5.1.1 - flutter_stripe@10.1.2
After lots of testing I saw the "Type cast error String not Map<String, dynamic>" referred in issue: #1721. Was due to the CustomerSheet returning a PaymentMethod as well as an error. (To be precise, to the way the error was added to the response and as consequence handled) To reproduce this issue you had to call the "presentCustomerSheet()" select a card and click the "confirm" button. Then call it again and close it without selecting any new option. This would cause the response to have the previously selected option and would add the "Canceled" error as part of the response. Both on Android and IOS this situation was handled the same way. I read how other components manage this situation to see what was the preferred way of doing this. But realized that no other has this situation, as all prompt the user with a form (payment or otherwise) and if the user closes the form it will simple return a "Canceled" error, but no other info previously saved. This is the same when the "presentCustomerSheet()" is called for the first time, with no previous selection saved, and close the sheet either by clicking outside or in the "X" icon. This case would simple return and "StripeException" with the "Canceled" code. But in the "saved" selection case, it does not want to through an "StripeException" as the user may have discarded the sheet due to his "preferred" paymentMethod already being selected. So it returns a normal responses and adds the error "canceled" as an extra. In the normal errors, stripe creates a StripeException, that at the end create a "LocalizedErrorMessage" with the "json['code']" value. So that is what I decided to do, as thought it was the more consistent thing with the rest of the platform. This way it will resolve successfully and return the saved "preferred" paymentMethod, and if you access the error element in the response it will have the same structure and a normal error in an StripeException. Not sure if this explanation was necessary, sorry for the loooong text, ahhahah. But wanted to explain my decision. Hope it helps. :) |
There is an issue I can not solve, but not sure if it is the expected behavior. When you present the CustomerSheet, add a new Card and confirm, that card won't bring the "fingerprint". The card had to be added prior to this for it to bring the fingerprint back. You can solve this by calling But it does not seem to be the right flow. |
Added the fingerprint to the card model and tested it is working correctly.
Solves Issues:
Resolves discussion: