@stripe/stripe-react-native 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -5
- package/README.md +2 -2
- package/android/build.gradle +1 -2
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +6 -3
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +22 -7
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayFragment.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +10 -9
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +11 -4
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +27 -14
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +111 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetEvent.kt +28 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +178 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +67 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +3 -1
- package/ios/AddressSheet/AddressSheetUtils.swift +98 -0
- package/ios/AddressSheet/AddressSheetView.swift +131 -0
- package/ios/AddressSheet/AddressSheetViewManager.m +25 -0
- package/ios/AddressSheet/AddressSheetViewManager.swift +19 -0
- package/ios/ApplePayUtils.swift +1 -1
- package/ios/CardFieldView.swift +3 -3
- package/ios/FinancialConnections.swift +23 -22
- package/ios/Mappers.swift +10 -2
- package/ios/PaymentMethodFactory.swift +6 -7
- package/ios/PaymentSheetAppearance.swift +27 -26
- package/ios/{pushprovisioning → PushProvisioning}/AddToWalletButtonManager.m +0 -0
- package/ios/{pushprovisioning → PushProvisioning}/AddToWalletButtonManager.swift +0 -0
- package/ios/{pushprovisioning → PushProvisioning}/AddToWalletButtonView.swift +0 -0
- package/ios/{pushprovisioning → PushProvisioning}/PushProvisioningUtils.swift +0 -0
- package/ios/StripeSdk.m +5 -0
- package/ios/StripeSdk.swift +75 -27
- package/ios/Tests/AddressSheetUtilsTests.swift +279 -0
- package/jest/mock.js +2 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +2 -0
- package/lib/commonjs/components/AddressSheet.js.map +1 -0
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/FinancialConnections.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddressSheet.js +2 -0
- package/lib/module/components/AddressSheet.js.map +1 -0
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/FinancialConnections.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +1 -0
- package/lib/typescript/src/components/AddressSheet.d.ts +53 -0
- package/lib/typescript/src/functions.d.ts +6 -0
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts +6 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +6 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/types/Common.d.ts +12 -0
- package/lib/typescript/src/types/Errors.d.ts +4 -0
- package/lib/typescript/src/types/FinancialConnections.d.ts +2 -2
- package/lib/typescript/src/types/PaymentMethod.d.ts +2 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +24 -1
- package/lib/typescript/src/types/index.d.ts +3 -6
- package/package.json +1 -1
- package/src/NativeStripeSdk.tsx +1 -0
- package/src/components/AddressSheet.tsx +82 -0
- package/src/functions.ts +9 -0
- package/src/hooks/usePaymentSheet.tsx +14 -0
- package/src/hooks/useStripe.tsx +11 -0
- package/src/index.tsx +4 -1
- package/src/types/Common.ts +13 -0
- package/src/types/Errors.ts +5 -0
- package/src/types/FinancialConnections.ts +4 -4
- package/src/types/PaymentMethod.ts +2 -0
- package/src/types/PaymentSheet.ts +26 -1
- package/src/types/index.ts +5 -10
- package/stripe-react-native.podspec +6 -2
- package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/android.iml +0 -18
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -22
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -27
package/ios/CardFieldView.swift
CHANGED
|
@@ -9,7 +9,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
|
|
|
9
9
|
|
|
10
10
|
private var cardField = STPPaymentCardTextField()
|
|
11
11
|
|
|
12
|
-
public var cardParams:
|
|
12
|
+
public var cardParams: STPPaymentMethodParams? = nil
|
|
13
13
|
public var cardPostalCode: String? = nil
|
|
14
14
|
|
|
15
15
|
@objc var postalCodeEnabled: Bool = true {
|
|
@@ -144,7 +144,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
|
|
|
144
144
|
"expiryYear": textField.expirationYear,
|
|
145
145
|
"complete": textField.isValid,
|
|
146
146
|
"brand": Mappers.mapFromCardBrand(brand) ?? NSNull(),
|
|
147
|
-
"last4": textField.
|
|
147
|
+
"last4": textField.paymentMethodParams.card!.last4 ?? "",
|
|
148
148
|
"validExpiryDate": Mappers.mapFromCardValidationState(state: validExpiryDate),
|
|
149
149
|
"validCVC": Mappers.mapFromCardValidationState(state: validCVC),
|
|
150
150
|
"validNumber": Mappers.mapFromCardValidationState(state: validNumber)
|
|
@@ -159,7 +159,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
|
|
|
159
159
|
onCardChange!(cardData as [AnyHashable : Any])
|
|
160
160
|
}
|
|
161
161
|
if (textField.isValid) {
|
|
162
|
-
self.cardParams = textField.
|
|
162
|
+
self.cardParams = textField.paymentMethodParams
|
|
163
163
|
self.cardPostalCode = textField.postalCode
|
|
164
164
|
} else {
|
|
165
165
|
self.cardParams = nil
|
|
@@ -10,13 +10,14 @@ import StripeFinancialConnections
|
|
|
10
10
|
import Stripe
|
|
11
11
|
|
|
12
12
|
class FinancialConnections {
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
internal static func present(
|
|
15
15
|
withClientSecret: String,
|
|
16
|
+
returnURL: String? = nil,
|
|
16
17
|
resolve: @escaping RCTPromiseResolveBlock
|
|
17
18
|
) -> Void {
|
|
18
19
|
DispatchQueue.main.async {
|
|
19
|
-
FinancialConnectionsSheet(financialConnectionsSessionClientSecret: withClientSecret).present(
|
|
20
|
+
FinancialConnectionsSheet(financialConnectionsSessionClientSecret: withClientSecret, returnURL: returnURL).present(
|
|
20
21
|
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
21
22
|
completion: { result in
|
|
22
23
|
switch result {
|
|
@@ -30,13 +31,14 @@ class FinancialConnections {
|
|
|
30
31
|
})
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
|
|
34
35
|
internal static func presentForToken(
|
|
35
36
|
withClientSecret: String,
|
|
37
|
+
returnURL: String? = nil,
|
|
36
38
|
resolve: @escaping RCTPromiseResolveBlock
|
|
37
39
|
) -> Void {
|
|
38
40
|
DispatchQueue.main.async {
|
|
39
|
-
FinancialConnectionsSheet(financialConnectionsSessionClientSecret: withClientSecret).presentForToken(
|
|
41
|
+
FinancialConnectionsSheet(financialConnectionsSessionClientSecret: withClientSecret, returnURL: returnURL).presentForToken(
|
|
40
42
|
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
41
43
|
completion: { result in
|
|
42
44
|
switch result {
|
|
@@ -55,7 +57,7 @@ class FinancialConnections {
|
|
|
55
57
|
})
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
|
|
59
61
|
internal static func mapFromSessionResult(
|
|
60
62
|
_ session: StripeAPI.FinancialConnectionsSession
|
|
61
63
|
) -> NSDictionary {
|
|
@@ -66,7 +68,7 @@ class FinancialConnections {
|
|
|
66
68
|
"accounts": mapFromAccountsList(accounts: session.accounts)
|
|
67
69
|
]
|
|
68
70
|
}
|
|
69
|
-
|
|
71
|
+
|
|
70
72
|
internal static func mapFromTokenResult(
|
|
71
73
|
_ token: StripeAPI.BankAccountToken?
|
|
72
74
|
) -> NSDictionary {
|
|
@@ -79,7 +81,7 @@ class FinancialConnections {
|
|
|
79
81
|
"created": NSNull(), // Doesn't exist on StripeAPI.BankAccountToken
|
|
80
82
|
]
|
|
81
83
|
}
|
|
82
|
-
|
|
84
|
+
|
|
83
85
|
internal static func mapFromBankAccount(
|
|
84
86
|
bankAccount: StripeAPI.BankAccountToken.BankAccount?
|
|
85
87
|
) -> NSDictionary? {
|
|
@@ -100,12 +102,12 @@ class FinancialConnections {
|
|
|
100
102
|
"status": bankAccount.status.prefix(1).uppercased() + bankAccount.status.lowercased().dropFirst(), // stripe-ios returns a string, not STPBankAccountStatus
|
|
101
103
|
]
|
|
102
104
|
}
|
|
103
|
-
|
|
105
|
+
|
|
104
106
|
internal static func mapFromAccountsList(
|
|
105
107
|
accounts: StripeAPI.FinancialConnectionsSession.AccountList
|
|
106
108
|
) -> [[String: Any]] {
|
|
107
109
|
var result = [[String: Any]]()
|
|
108
|
-
|
|
110
|
+
|
|
109
111
|
for account in accounts.data {
|
|
110
112
|
result.append([
|
|
111
113
|
"id": account.id,
|
|
@@ -123,7 +125,7 @@ class FinancialConnections {
|
|
|
123
125
|
"supportedPaymentMethodTypes": account.supportedPaymentMethodTypes.map { mapFromSupportedPaymentMethodTypes($0) },
|
|
124
126
|
])
|
|
125
127
|
}
|
|
126
|
-
|
|
128
|
+
|
|
127
129
|
return result
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -133,13 +135,12 @@ class FinancialConnections {
|
|
|
133
135
|
guard let balance = balance else {
|
|
134
136
|
return nil
|
|
135
137
|
}
|
|
136
|
-
|
|
138
|
+
|
|
137
139
|
return [
|
|
138
140
|
"asOf": balance.asOf * 1000,
|
|
139
141
|
"type": mapFromBalanceType(balance.type),
|
|
140
|
-
|
|
141
|
-
"
|
|
142
|
-
"credit": ["used": NSNull()], // balance.credit?.used
|
|
142
|
+
"cash": ["available": balance.cash?.available],
|
|
143
|
+
"credit": ["used": balance.credit?.used],
|
|
143
144
|
"current": balance.current,
|
|
144
145
|
]
|
|
145
146
|
}
|
|
@@ -150,13 +151,13 @@ class FinancialConnections {
|
|
|
150
151
|
guard let balanceRefresh = balanceRefresh else {
|
|
151
152
|
return nil
|
|
152
153
|
}
|
|
153
|
-
|
|
154
|
+
|
|
154
155
|
return [
|
|
155
156
|
"status": mapFromBalanceRefreshStatus(balanceRefresh.status),
|
|
156
157
|
"lastAttemptedAt": balanceRefresh.lastAttemptedAt * 1000,
|
|
157
158
|
]
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
+
|
|
160
161
|
internal static func mapFromStatus( _ status: StripeAPI.FinancialConnectionsAccount.Status) -> String {
|
|
161
162
|
switch status {
|
|
162
163
|
case .active:
|
|
@@ -169,7 +170,7 @@ class FinancialConnections {
|
|
|
169
170
|
return "unparsable"
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
|
-
|
|
173
|
+
|
|
173
174
|
internal static func mapFromCategory( _ category: StripeAPI.FinancialConnectionsAccount.Category) -> String {
|
|
174
175
|
switch category {
|
|
175
176
|
case .cash:
|
|
@@ -184,7 +185,7 @@ class FinancialConnections {
|
|
|
184
185
|
return "unparsable"
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
|
-
|
|
188
|
+
|
|
188
189
|
internal static func mapFromSubcategory( _ subcategory: StripeAPI.FinancialConnectionsAccount.Subcategory) -> String {
|
|
189
190
|
switch subcategory {
|
|
190
191
|
case .savings:
|
|
@@ -203,7 +204,7 @@ class FinancialConnections {
|
|
|
203
204
|
return "unparsable"
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
|
|
207
|
+
|
|
207
208
|
internal static func mapFromPermission( _ permission: StripeAPI.FinancialConnectionsAccount.Permissions) -> String {
|
|
208
209
|
switch permission {
|
|
209
210
|
case .transactions:
|
|
@@ -220,7 +221,7 @@ class FinancialConnections {
|
|
|
220
221
|
return "unparsable"
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
|
|
224
|
+
|
|
224
225
|
internal static func mapFromSupportedPaymentMethodTypes( _ type: StripeAPI.FinancialConnectionsAccount.SupportedPaymentMethodTypes) -> String {
|
|
225
226
|
switch type {
|
|
226
227
|
case .usBankAccount:
|
|
@@ -231,7 +232,7 @@ class FinancialConnections {
|
|
|
231
232
|
return "unparsable"
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
|
-
|
|
235
|
+
|
|
235
236
|
internal static func mapFromBalanceType( _ type: StripeAPI.FinancialConnectionsAccount.Balance.ModelType) -> String {
|
|
236
237
|
switch type {
|
|
237
238
|
case .cash:
|
|
@@ -242,7 +243,7 @@ class FinancialConnections {
|
|
|
242
243
|
return "unparsable"
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
+
|
|
246
247
|
internal static func mapFromBalanceRefreshStatus( _ status: StripeAPI.FinancialConnectionsAccount.BalanceRefresh.Status) -> String {
|
|
247
248
|
switch status {
|
|
248
249
|
case .succeeded:
|
package/ios/Mappers.swift
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Stripe
|
|
2
|
+
import StripePaymentSheet
|
|
2
3
|
|
|
3
4
|
class Mappers {
|
|
4
5
|
class func createResult(_ key: String, _ value: NSDictionary?) -> NSDictionary {
|
|
@@ -53,7 +54,7 @@ class Mappers {
|
|
|
53
54
|
guard let bankAccount = bankAccount else {
|
|
54
55
|
return nil
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
|
|
57
58
|
let result: NSDictionary = [
|
|
58
59
|
"id": bankAccount.stripeID,
|
|
59
60
|
"bankName": bankAccount.bankName ?? NSNull(),
|
|
@@ -594,8 +595,11 @@ class Mappers {
|
|
|
594
595
|
"expMonth": paymentMethod.card?.expMonth ?? NSNull(),
|
|
595
596
|
"fingerprint": paymentMethod.card?.fingerprint ?? NSNull(),
|
|
596
597
|
"funding": paymentMethod.card?.funding ?? NSNull(),
|
|
597
|
-
"last4": paymentMethod.card?.last4 ?? NSNull()
|
|
598
|
+
"last4": paymentMethod.card?.last4 ?? NSNull(),
|
|
599
|
+
"preferredNetwork": paymentMethod.card?.networks?.preferred ?? NSNull(),
|
|
600
|
+
"availableNetworks": paymentMethod.card?.networks?.available ?? NSNull(),
|
|
598
601
|
]
|
|
602
|
+
|
|
599
603
|
let sepaDebit: NSDictionary = [
|
|
600
604
|
"bankCode": paymentMethod.sepaDebit?.bankCode ?? NSNull(),
|
|
601
605
|
"country": paymentMethod.sepaDebit?.country ?? NSNull(),
|
|
@@ -743,6 +747,10 @@ class Mappers {
|
|
|
743
747
|
return urlScheme + "://safepay"
|
|
744
748
|
}
|
|
745
749
|
|
|
750
|
+
class func mapToFinancialConnectionsReturnURL(urlScheme: String) -> String {
|
|
751
|
+
return urlScheme + "://financial_connections_redirect"
|
|
752
|
+
}
|
|
753
|
+
|
|
746
754
|
class func mapUICustomization(_ params: NSDictionary) -> STPThreeDSUICustomization {
|
|
747
755
|
let uiCustomization = STPThreeDSUICustomization()
|
|
748
756
|
if let labelSettings = params["label"] as? Dictionary<String, Any?> {
|
|
@@ -162,11 +162,7 @@ class PaymentMethodFactory {
|
|
|
162
162
|
return STPPaymentMethodParams(card: methodParams, billingDetails: billingDetailsParams, metadata: nil)
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
throw PaymentMethodError.cardPaymentMissingParams
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if cardFieldView?.cardParams != nil {
|
|
165
|
+
if let params = cardFieldView?.cardParams as? STPPaymentMethodParams {
|
|
170
166
|
if let postalCode = cardFieldView?.cardPostalCode{
|
|
171
167
|
if (billingDetailsParams == nil) {
|
|
172
168
|
let bd = STPPaymentMethodBillingDetails()
|
|
@@ -177,8 +173,10 @@ class PaymentMethodFactory {
|
|
|
177
173
|
billingDetailsParams?.address?.postalCode = postalCode
|
|
178
174
|
}
|
|
179
175
|
}
|
|
176
|
+
params.billingDetails = billingDetailsParams
|
|
177
|
+
return params
|
|
180
178
|
}
|
|
181
|
-
if cardFormView?.cardParams
|
|
179
|
+
if let params = cardFormView?.cardParams as? STPPaymentMethodCardParams {
|
|
182
180
|
if let address = cardFormView?.cardForm?.cardParams?.billingDetails?.address {
|
|
183
181
|
if (billingDetailsParams == nil) {
|
|
184
182
|
let bd = STPPaymentMethodBillingDetails()
|
|
@@ -191,9 +189,10 @@ class PaymentMethodFactory {
|
|
|
191
189
|
billingDetailsParams?.address?.country = address.country
|
|
192
190
|
}
|
|
193
191
|
}
|
|
192
|
+
return STPPaymentMethodParams(card: params, billingDetails: billingDetailsParams, metadata: nil)
|
|
194
193
|
}
|
|
195
194
|
|
|
196
|
-
|
|
195
|
+
throw PaymentMethodError.cardPaymentMissingParams
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Created by Charles Cruzan on 5/11/22.
|
|
6
6
|
//
|
|
7
|
-
import
|
|
7
|
+
import StripePaymentSheet
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
func
|
|
9
|
+
internal class PaymentSheetAppearance {
|
|
10
|
+
class func buildAppearanceFromParams(userParams: NSDictionary?) throws -> PaymentSheet.Appearance {
|
|
11
11
|
var appearance = PaymentSheet.Appearance()
|
|
12
|
+
guard let userParams = userParams else { return appearance }
|
|
12
13
|
|
|
13
14
|
if let fontParams = userParams[PaymentSheetAppearanceKeys.FONT] as? NSDictionary {
|
|
14
15
|
appearance.font = try buildFont(params: fontParams)
|
|
@@ -30,8 +31,8 @@ extension StripeSdk {
|
|
|
30
31
|
return appearance
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
private func buildFont(params: NSDictionary) throws ->
|
|
34
|
-
var font =
|
|
34
|
+
private class func buildFont(params: NSDictionary) throws -> PaymentSheet.Appearance.Font {
|
|
35
|
+
var font = PaymentSheet.Appearance.Font()
|
|
35
36
|
if let fontName = params[PaymentSheetAppearanceKeys.FAMILY] as? String {
|
|
36
37
|
guard let customFont = UIFont(name: fontName, size: UIFont.systemFontSize) else {
|
|
37
38
|
throw PaymentSheetAppearanceError.missingFont(fontName)
|
|
@@ -41,9 +42,9 @@ extension StripeSdk {
|
|
|
41
42
|
font.sizeScaleFactor = params[PaymentSheetAppearanceKeys.SCALE] as? CGFloat ?? PaymentSheet.Appearance.default.font.sizeScaleFactor
|
|
42
43
|
return font
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
private func buildColors(params: NSDictionary) throws ->
|
|
46
|
-
var colors =
|
|
45
|
+
|
|
46
|
+
private class func buildColors(params: NSDictionary) throws -> PaymentSheet.Appearance.Colors {
|
|
47
|
+
var colors = PaymentSheet.Appearance.Colors()
|
|
47
48
|
|
|
48
49
|
if (params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && params.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil ||
|
|
49
50
|
params.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil) {
|
|
@@ -53,25 +54,25 @@ extension StripeSdk {
|
|
|
53
54
|
let lightModeParams = params[PaymentSheetAppearanceKeys.LIGHT] as? NSDictionary ?? params
|
|
54
55
|
let darkModeParams = params[PaymentSheetAppearanceKeys.DARK] as? NSDictionary ?? params
|
|
55
56
|
|
|
56
|
-
colors.primary = try
|
|
57
|
-
colors.background = try
|
|
58
|
-
colors.componentBackground = try
|
|
59
|
-
colors.componentBorder = try
|
|
60
|
-
colors.componentDivider = try
|
|
61
|
-
colors.text = try
|
|
62
|
-
colors.textSecondary = try
|
|
63
|
-
colors.componentText = try
|
|
64
|
-
colors.componentPlaceholderText = try
|
|
65
|
-
colors.icon = try
|
|
66
|
-
colors.danger = try
|
|
57
|
+
colors.primary = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.PRIMARY, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.primary
|
|
58
|
+
colors.background = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.background
|
|
59
|
+
colors.componentBackground = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentBackground
|
|
60
|
+
colors.componentBorder = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_BORDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentBorder
|
|
61
|
+
colors.componentDivider = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_DIVIDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentDivider
|
|
62
|
+
colors.text = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.PRIMARY_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.text
|
|
63
|
+
colors.textSecondary = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.SECONDARY_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.textSecondary
|
|
64
|
+
colors.componentText = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentText
|
|
65
|
+
colors.componentPlaceholderText = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.PLACEHOLDER_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentPlaceholderText
|
|
66
|
+
colors.icon = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.ICON, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.icon
|
|
67
|
+
colors.danger = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.ERROR, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.danger
|
|
67
68
|
|
|
68
69
|
return colors
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
private func buildShadow(params: NSDictionary) throws -> PaymentSheet.Appearance.Shadow {
|
|
72
|
+
private class func buildShadow(params: NSDictionary) throws -> PaymentSheet.Appearance.Shadow {
|
|
72
73
|
var shadow = PaymentSheet.Appearance.Shadow()
|
|
73
74
|
|
|
74
|
-
if let color = try
|
|
75
|
+
if let color = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.SHADOW_COLOR, lightParams: params, darkParams: params) {
|
|
75
76
|
shadow.color = color
|
|
76
77
|
}
|
|
77
78
|
if let opacity = params[PaymentSheetAppearanceKeys.OPACITY] as? CGFloat {
|
|
@@ -89,7 +90,7 @@ extension StripeSdk {
|
|
|
89
90
|
return shadow
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
private func buildPrimaryButton(params: NSDictionary) throws -> PaymentSheet.Appearance.PrimaryButton {
|
|
93
|
+
private class func buildPrimaryButton(params: NSDictionary) throws -> PaymentSheet.Appearance.PrimaryButton {
|
|
93
94
|
var primaryButton = PaymentSheet.Appearance.PrimaryButton()
|
|
94
95
|
|
|
95
96
|
if let fontName = (params[PaymentSheetAppearanceKeys.FONT] as? NSDictionary)?[PaymentSheetAppearanceKeys.FAMILY] as? String {
|
|
@@ -118,15 +119,15 @@ extension StripeSdk {
|
|
|
118
119
|
let lightModeParams = colorParams[PaymentSheetAppearanceKeys.LIGHT] as? NSDictionary ?? colorParams
|
|
119
120
|
let darkModeParams = colorParams[PaymentSheetAppearanceKeys.DARK] as? NSDictionary ?? colorParams
|
|
120
121
|
|
|
121
|
-
primaryButton.backgroundColor = try
|
|
122
|
-
primaryButton.textColor = try
|
|
123
|
-
primaryButton.borderColor = try
|
|
122
|
+
primaryButton.backgroundColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams)
|
|
123
|
+
primaryButton.textColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.TEXT, lightParams: lightModeParams, darkParams: darkModeParams)
|
|
124
|
+
primaryButton.borderColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BORDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.primaryButton.borderColor
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
return primaryButton
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
private
|
|
130
|
+
private class func buildUserInterfaceStyleAwareColor(key: String, lightParams: NSDictionary, darkParams: NSDictionary) throws -> UIColor? {
|
|
130
131
|
guard let lightHexString = lightParams[key] as? String, let darkHexString = darkParams[key] as? String else {
|
|
131
132
|
return nil
|
|
132
133
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/ios/StripeSdk.m
CHANGED
|
@@ -92,6 +92,11 @@ RCT_EXTERN_METHOD(
|
|
|
92
92
|
rejecter: (RCTPromiseRejectBlock)reject
|
|
93
93
|
)
|
|
94
94
|
|
|
95
|
+
RCT_EXTERN_METHOD(
|
|
96
|
+
resetPaymentSheetCustomer:(RCTPromiseResolveBlock)resolve
|
|
97
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
98
|
+
)
|
|
99
|
+
|
|
95
100
|
RCT_EXTERN_METHOD(
|
|
96
101
|
confirmPayment:(NSString *)paymentIntentClientSecret
|
|
97
102
|
data:(NSDictionary *)data
|
package/ios/StripeSdk.swift
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PassKit
|
|
2
2
|
import Stripe
|
|
3
|
+
import StripePaymentSheet
|
|
3
4
|
import StripeFinancialConnections
|
|
4
5
|
|
|
5
6
|
@objc(StripeSdk)
|
|
@@ -59,6 +60,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
59
60
|
self.urlScheme = urlScheme
|
|
60
61
|
|
|
61
62
|
STPAPIClient.shared.publishableKey = publishableKey
|
|
63
|
+
StripeAPI.defaultPublishableKey = publishableKey
|
|
62
64
|
STPAPIClient.shared.stripeAccount = stripeAccountId
|
|
63
65
|
|
|
64
66
|
let name = RCTConvert.nsString(appInfo["name"]) ?? ""
|
|
@@ -76,10 +78,12 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
76
78
|
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
77
79
|
var configuration = PaymentSheet.Configuration()
|
|
78
80
|
self.paymentSheetFlowController = nil
|
|
81
|
+
|
|
82
|
+
configuration.primaryButtonLabel = params["primaryButtonLabel"] as? String
|
|
79
83
|
|
|
80
84
|
if let appearanceParams = params["appearance"] as? NSDictionary {
|
|
81
85
|
do {
|
|
82
|
-
configuration.appearance = try
|
|
86
|
+
configuration.appearance = try PaymentSheetAppearance.buildAppearanceFromParams(userParams: appearanceParams)
|
|
83
87
|
} catch {
|
|
84
88
|
resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
|
|
85
89
|
return
|
|
@@ -126,6 +130,12 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
}
|
|
133
|
+
|
|
134
|
+
if let defaultShippingDetails = params["defaultShippingDetails"] as? NSDictionary {
|
|
135
|
+
configuration.shippingDetails = {
|
|
136
|
+
return AddressSheetUtils.buildAddressDetails(params: defaultShippingDetails)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
129
139
|
|
|
130
140
|
if let customerId = params["customerId"] as? String {
|
|
131
141
|
if let customerEphemeralKeySecret = params["customerEphemeralKeySecret"] as? String {
|
|
@@ -218,6 +228,13 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
}
|
|
231
|
+
|
|
232
|
+
@objc(resetPaymentSheetCustomer:rejecter:)
|
|
233
|
+
func resetPaymentSheetCustomer(resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
234
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
235
|
+
PaymentSheet.resetCustomer()
|
|
236
|
+
resolve(nil)
|
|
237
|
+
}
|
|
221
238
|
|
|
222
239
|
@objc(presentPaymentSheet:rejecter:)
|
|
223
240
|
func presentPaymentSheet(resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
@@ -298,12 +315,17 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
298
315
|
return STPSetupIntentConfirmParams(clientSecret: setupIntentClientSecret, paymentMethodType: .USBankAccount)
|
|
299
316
|
} else {
|
|
300
317
|
let parameters = STPSetupIntentConfirmParams(clientSecret: setupIntentClientSecret)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
318
|
+
|
|
319
|
+
if let paymentMethodId = paymentMethodData?["paymentMethodId"] as? String {
|
|
320
|
+
parameters.paymentMethodID = paymentMethodId
|
|
321
|
+
} else {
|
|
322
|
+
let factory = PaymentMethodFactory.init(paymentMethodData: paymentMethodData, options: options, cardFieldView: cardFieldView, cardFormView: cardFormView)
|
|
323
|
+
do {
|
|
324
|
+
let paymentMethodParams = try factory.createParams(paymentMethodType: paymentMethodType)
|
|
325
|
+
parameters.paymentMethodParams = paymentMethodParams
|
|
326
|
+
} catch {
|
|
327
|
+
err = Errors.createError(ErrorType.Failed, error as NSError?)
|
|
328
|
+
}
|
|
307
329
|
}
|
|
308
330
|
|
|
309
331
|
return parameters
|
|
@@ -348,7 +370,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
348
370
|
resolve(Errors.createError(ErrorType.Failed, "You can use this method only after either onDidSetShippingMethod or onDidSetShippingContact events emitted"))
|
|
349
371
|
return
|
|
350
372
|
}
|
|
351
|
-
|
|
373
|
+
|
|
352
374
|
var paymentSummaryItems : [PKPaymentSummaryItem] = []
|
|
353
375
|
do {
|
|
354
376
|
paymentSummaryItems = try ApplePayUtils.buildPaymentSummaryItems(items: summaryItems as? [[String : Any]])
|
|
@@ -356,7 +378,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
356
378
|
resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
|
|
357
379
|
return
|
|
358
380
|
}
|
|
359
|
-
|
|
381
|
+
|
|
360
382
|
var shippingAddressErrors: [Error] = []
|
|
361
383
|
for item in errorAddressFields {
|
|
362
384
|
let field = item["field"] as! String
|
|
@@ -660,17 +682,22 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
660
682
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
661
683
|
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
662
684
|
) -> Void {
|
|
663
|
-
|
|
685
|
+
let address = params["address"] as? NSDictionary
|
|
686
|
+
let cardSourceParams = STPCardParams()
|
|
687
|
+
if let params = cardFieldView?.cardParams as? STPPaymentMethodParams {
|
|
688
|
+
cardSourceParams.number = params.card!.number
|
|
689
|
+
cardSourceParams.cvc = params.card!.cvc
|
|
690
|
+
cardSourceParams.expMonth = UInt(truncating: params.card!.expMonth ?? 0)
|
|
691
|
+
cardSourceParams.expYear = UInt(truncating: params.card!.expYear ?? 0)
|
|
692
|
+
} else if let params = cardFormView?.cardParams as? STPPaymentMethodCardParams {
|
|
693
|
+
cardSourceParams.number = params.number
|
|
694
|
+
cardSourceParams.cvc = params.cvc
|
|
695
|
+
cardSourceParams.expMonth = UInt(truncating: params.expMonth ?? 0)
|
|
696
|
+
cardSourceParams.expYear = UInt(truncating: params.expYear ?? 0)
|
|
697
|
+
} else {
|
|
664
698
|
resolve(Errors.createError(ErrorType.Failed, "Card details not complete"))
|
|
665
699
|
return
|
|
666
700
|
}
|
|
667
|
-
|
|
668
|
-
let address = params["address"] as? NSDictionary
|
|
669
|
-
let cardSourceParams = STPCardParams()
|
|
670
|
-
cardSourceParams.number = cardParams.number
|
|
671
|
-
cardSourceParams.cvc = cardParams.cvc
|
|
672
|
-
cardSourceParams.expMonth = UInt(truncating: cardParams.expMonth ?? 0)
|
|
673
|
-
cardSourceParams.expYear = UInt(truncating: cardParams.expYear ?? 0)
|
|
674
701
|
cardSourceParams.address = Mappers.mapToAddress(address: address)
|
|
675
702
|
cardSourceParams.name = params["name"] as? String
|
|
676
703
|
cardSourceParams.currency = params["currency"] as? String
|
|
@@ -746,10 +773,18 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
746
773
|
email: billingDetails["email"] as? String
|
|
747
774
|
)
|
|
748
775
|
|
|
776
|
+
let connectionsReturnURL: String?
|
|
777
|
+
if let urlScheme = urlScheme {
|
|
778
|
+
connectionsReturnURL = Mappers.mapToFinancialConnectionsReturnURL(urlScheme: urlScheme)
|
|
779
|
+
} else {
|
|
780
|
+
connectionsReturnURL = nil
|
|
781
|
+
}
|
|
782
|
+
|
|
749
783
|
if (isPaymentIntent) {
|
|
750
784
|
DispatchQueue.main.async {
|
|
751
785
|
STPBankAccountCollector().collectBankAccountForPayment(
|
|
752
786
|
clientSecret: clientSecret as String,
|
|
787
|
+
returnURL: connectionsReturnURL,
|
|
753
788
|
params: collectParams,
|
|
754
789
|
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
|
|
755
790
|
) { intent, error in
|
|
@@ -775,6 +810,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
775
810
|
DispatchQueue.main.async {
|
|
776
811
|
STPBankAccountCollector().collectBankAccountForSetup(
|
|
777
812
|
clientSecret: clientSecret as String,
|
|
813
|
+
returnURL: connectionsReturnURL,
|
|
778
814
|
params: collectParams,
|
|
779
815
|
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
|
|
780
816
|
) { intent, error in
|
|
@@ -816,7 +852,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
816
852
|
resolve(missingPaymentMethodError)
|
|
817
853
|
return
|
|
818
854
|
}
|
|
819
|
-
|
|
855
|
+
|
|
820
856
|
if (paymentMethodType == .FPX) {
|
|
821
857
|
let testOfflineBank = paymentMethodData?["testOfflineBank"] as? Bool
|
|
822
858
|
if (testOfflineBank == false || testOfflineBank == nil) {
|
|
@@ -833,7 +869,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
833
869
|
STPPaymentHandler.shared().confirmPayment(paymentIntentParams, with: self, completion: onCompleteConfirmPayment)
|
|
834
870
|
}
|
|
835
871
|
}
|
|
836
|
-
|
|
872
|
+
|
|
837
873
|
func getPaymentMethodType(
|
|
838
874
|
params: NSDictionary?
|
|
839
875
|
) -> (NSDictionary?, STPPaymentMethodType?) {
|
|
@@ -863,7 +899,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
863
899
|
return STPPaymentIntentParams(clientSecret: paymentIntentClientSecret, paymentMethodType: .USBankAccount)
|
|
864
900
|
} else {
|
|
865
901
|
guard let paymentMethodType = paymentMethodType else { return STPPaymentIntentParams(clientSecret: paymentIntentClientSecret) }
|
|
866
|
-
|
|
902
|
+
|
|
867
903
|
let paymentMethodId = paymentMethodData?["paymentMethodId"] as? String
|
|
868
904
|
let parameters = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret)
|
|
869
905
|
|
|
@@ -1009,7 +1045,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1009
1045
|
}
|
|
1010
1046
|
}
|
|
1011
1047
|
}
|
|
1012
|
-
|
|
1048
|
+
|
|
1013
1049
|
@objc(canAddCardToWallet:resolver:rejecter:)
|
|
1014
1050
|
func canAddCardToWallet(
|
|
1015
1051
|
params: NSDictionary,
|
|
@@ -1028,7 +1064,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1028
1064
|
"details": ["status": status?.rawValue],
|
|
1029
1065
|
])
|
|
1030
1066
|
}
|
|
1031
|
-
|
|
1067
|
+
|
|
1032
1068
|
@objc(isCardInWallet:resolver:rejecter:)
|
|
1033
1069
|
func isCardInWallet(
|
|
1034
1070
|
params: NSDictionary,
|
|
@@ -1041,7 +1077,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1041
1077
|
}
|
|
1042
1078
|
resolve(["isInWallet": PushProvisioningUtils.passExistsWith(last4: last4)])
|
|
1043
1079
|
}
|
|
1044
|
-
|
|
1080
|
+
|
|
1045
1081
|
@objc(collectBankAccountToken:resolver:rejecter:)
|
|
1046
1082
|
func collectBankAccountToken(
|
|
1047
1083
|
clientSecret: String,
|
|
@@ -1052,9 +1088,15 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1052
1088
|
resolve(Errors.MISSING_INIT_ERROR)
|
|
1053
1089
|
return
|
|
1054
1090
|
}
|
|
1055
|
-
|
|
1091
|
+
let returnURL: String?
|
|
1092
|
+
if let urlScheme = urlScheme {
|
|
1093
|
+
returnURL = Mappers.mapToFinancialConnectionsReturnURL(urlScheme: urlScheme)
|
|
1094
|
+
} else {
|
|
1095
|
+
returnURL = nil
|
|
1096
|
+
}
|
|
1097
|
+
FinancialConnections.presentForToken(withClientSecret: clientSecret, returnURL: returnURL, resolve: resolve)
|
|
1056
1098
|
}
|
|
1057
|
-
|
|
1099
|
+
|
|
1058
1100
|
@objc(collectFinancialConnectionsAccounts:resolver:rejecter:)
|
|
1059
1101
|
func collectFinancialConnectionsAccounts(
|
|
1060
1102
|
clientSecret: String,
|
|
@@ -1065,9 +1107,15 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1065
1107
|
resolve(Errors.MISSING_INIT_ERROR)
|
|
1066
1108
|
return
|
|
1067
1109
|
}
|
|
1068
|
-
|
|
1110
|
+
let returnURL: String?
|
|
1111
|
+
if let urlScheme = urlScheme {
|
|
1112
|
+
returnURL = Mappers.mapToFinancialConnectionsReturnURL(urlScheme: urlScheme)
|
|
1113
|
+
} else {
|
|
1114
|
+
returnURL = nil
|
|
1115
|
+
}
|
|
1116
|
+
FinancialConnections.present(withClientSecret: clientSecret, returnURL: returnURL, resolve: resolve)
|
|
1069
1117
|
}
|
|
1070
|
-
|
|
1118
|
+
|
|
1071
1119
|
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
|
|
1072
1120
|
confirmPaymentResolver?(Errors.createError(ErrorType.Canceled, "FPX Payment has been canceled"))
|
|
1073
1121
|
}
|