Skip to content
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

handle apple pay errors #228

Merged
merged 4 commits into from
May 21, 2021
Merged

handle apple pay errors #228

merged 4 commits into from
May 21, 2021

Conversation

arekkubaczkowski
Copy link
Collaborator

resolve #148

@arekkubaczkowski arekkubaczkowski changed the title handle apple pay errors WIP: handle apple pay errors May 17, 2021
@thorsten-stripe
Copy link
Contributor

@arekkubaczkowski the approach looks good to me, and I works fine for me within the onShippingContactSelected handler, however it does not work for me in the onShippingMethodSelected handler.

@arekkubaczkowski arekkubaczkowski changed the title WIP: handle apple pay errors handle apple pay errors May 20, 2021
@@ -256,8 +256,12 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
paymentSummaryItems.append(PKPaymentSummaryItem(label: label, amount: amount, type: type))
}
}
let shippingAddressErrors = Mappers.mapAddressFields(errorAddressFields).map {
PKPaymentRequest.paymentShippingAddressInvalidError(withKey: $0, localizedDescription: $0 + " field error")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allow folks to overwrite with their own error message. Maybe we can do

handler: (
      summaryItems: ApplePay.CartSummaryItem[],
      errorAddressFields?: Array<{ field: ApplePay.AddressFields; message?: string; }>
    ) => Promise<{
      error?: StripeError<ApplePayError>;
    }>

Wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

Copy link
Contributor

@thorsten-stripe thorsten-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@arekkubaczkowski arekkubaczkowski merged commit 14709da into master May 21, 2021
@arekkubaczkowski arekkubaczkowski deleted the feat/apple-pay-errors branch May 21, 2021 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Displaying errors in apple pay sheet.
2 participants