Skip to content

Commit

Permalink
fix issue with incorrect payment request values never resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
charliecruzan-stripe committed Oct 24, 2022
1 parent b74891e commit ffabbb0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions ios/StripeSdk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -528,17 +528,20 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap

applePaymentMethodFlowCanBeCanceled = true
createNativePayPaymentMethodResolver = resolve
applePaymentAuthorizationController = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest)
applePaymentAuthorizationController?.delegate = self
DispatchQueue.main.async {
let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
vc.present(
self.applePaymentAuthorizationController!,
animated: true,
completion: nil
)
}

self.applePaymentAuthorizationController = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest)
if let applePaymentAuthorizationController = self.applePaymentAuthorizationController {
applePaymentAuthorizationController.delegate = self
DispatchQueue.main.async {
let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
vc.present(
applePaymentAuthorizationController,
animated: true,
completion: nil
)
}
} else {
resolve(Errors.createError(ErrorType.Failed, "Invalid in-app payment request. Search the iOS logs for `NSUnderlyingError` to get more information."))
}
}

@objc(dismissApplePay:rejecter:)
Expand Down

0 comments on commit ffabbb0

Please sign in to comment.