onvalidatemerchant needs to account for failure#6
Open
zenenwjaimes wants to merge 1 commit intonorfolkmustard:masterfrom
Open
onvalidatemerchant needs to account for failure#6zenenwjaimes wants to merge 1 commit intonorfolkmustard:masterfrom
zenenwjaimes wants to merge 1 commit intonorfolkmustard:masterfrom
Conversation
Author
|
Sorry about the indentation, I'm not sure why it didn't indent properly. I'm using 4 spaces in vim. |
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.
I was wracking my brain over why my reject on the session callback function wasn't working on failed sessions. The failure function was not supplied in the ApplePayJS demo, which is fine but if you're new to Promises (as I am) you wonder why the only callback doesn't handle both success/failure. The ApplePay documentation for JS is pretty scarce even if you have access to the Developer Docs.
My main use case is Magento and having an ApplePay button on the product page. The user is expected to view a Product page and hit the ApplePay button and add the current product variation/selection to their cart and generate an order before sending off the paymentData to a payment gateway. With the ApplePay flow you are expected to have totals and shipping amounts so I was adding the product to the users cart after the session validation call but before completely rejecting/resolving the promise. I did not want to present the ApplePay sheet to the user in case the product was not available and I would be able to present the user with an error message.
Thank you for your work, it's been very helpful.