@@ -927,6 +927,11 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
927
927
resolver resolve: @escaping RCTPromiseResolveBlock ,
928
928
rejecter reject: @escaping RCTPromiseRejectBlock
929
929
) -> Void {
930
+ guard let apiClient = apiClient else {
931
+ resolve ( StripeSdk . MISSING_INIT_ERROR)
932
+ return
933
+ }
934
+
930
935
let amounts = params [ " amounts " ] as? NSArray
931
936
let descriptorCode = params [ " descriptorCode " ] as? String
932
937
@@ -941,14 +946,14 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
941
946
return
942
947
}
943
948
if ( isPaymentIntent) {
944
- STPAPIClient . shared . verifyPaymentIntentWithMicrodeposits (
949
+ apiClient . verifyPaymentIntentWithMicrodeposits (
945
950
clientSecret: clientSecret as String ,
946
951
firstAmount: amounts [ 0 ] as! Int ,
947
952
secondAmount: amounts [ 1 ] as! Int ,
948
953
completion: onCompletePaymentVerification
949
954
)
950
955
} else {
951
- STPAPIClient . shared . verifySetupIntentWithMicrodeposits (
956
+ apiClient . verifySetupIntentWithMicrodeposits (
952
957
clientSecret: clientSecret as String ,
953
958
firstAmount: amounts [ 0 ] as! Int ,
954
959
secondAmount: amounts [ 1 ] as! Int ,
@@ -957,13 +962,13 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
957
962
}
958
963
} else if let descriptorCode = descriptorCode {
959
964
if ( isPaymentIntent) {
960
- STPAPIClient . shared . verifyPaymentIntentWithMicrodeposits (
965
+ apiClient . verifyPaymentIntentWithMicrodeposits (
961
966
clientSecret: clientSecret as String ,
962
967
descriptorCode: descriptorCode,
963
968
completion: onCompletePaymentVerification
964
969
)
965
970
} else {
966
- STPAPIClient . shared . verifySetupIntentWithMicrodeposits (
971
+ apiClient . verifySetupIntentWithMicrodeposits (
967
972
clientSecret: clientSecret as String ,
968
973
descriptorCode: descriptorCode,
969
974
completion: onCompleteSetupVerification
0 commit comments