Skip to content

Commit

Permalink
feat: onDidSetShippingContact event on authorization & paymentMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
huextrat committed Mar 7, 2023
1 parent 8a47f4c commit 77754a7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ios/ApplePayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
didAuthorizePayment payment: PKPayment,
handler completion: @escaping (PKPaymentAuthorizationResult) -> Void
) {
if (self.hasLegacyApplePayListeners) {
// Legacy, remove when useApplePay hook is removed
let contact = payment.shippingContact
if ((contact) != nil) {
sendEvent(withName: "onDidSetShippingContact", body: ["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact!)])
}
}
applePaymentMethodFlowCanBeCanceled = false

if (platformPayUsesDeprecatedTokenFlow) {
Expand Down Expand Up @@ -165,6 +172,13 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
paymentInformation: PKPayment,
completion: @escaping STPIntentClientSecretCompletionBlock
) {
if (self.hasLegacyApplePayListeners) {
// Legacy, remove when useApplePay hook is removed
let contact = paymentInformation.shippingContact
if ((contact) != nil) {
sendEvent(withName: "onDidSetShippingContact", body: ["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact!)])
}
}
if let clientSecret = self.confirmApplePayPaymentClientSecret {
completion(clientSecret, nil)
} else if let clientSecret = self.confirmApplePaySetupClientSecret {
Expand Down

0 comments on commit 77754a7

Please sign in to comment.