@stripe/stripe-react-native 0.63.0 → 0.64.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/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +22 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +6 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +5 -5
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +2 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +43 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +5 -1
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +33 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +298 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +23 -0
- package/ios/AddressSheet/AddressSheetView.swift +9 -14
- package/ios/Mappers.swift +74 -0
- package/ios/PaymentMethodFactory.swift +19 -0
- package/ios/StripeSdk-Bridging-Header.h +1 -0
- package/ios/StripeSdk.mm +1 -1
- package/ios/StripeSdkImpl.swift +38 -10
- package/ios/StripeSwiftInterop.h +1 -0
- package/jest/mock.js +2 -0
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/connect/Components.js +1 -1
- package/lib/commonjs/connect/Components.js.map +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -1
- package/lib/commonjs/connect/NavigationBar.js +1 -1
- package/lib/commonjs/connect/NavigationBar.js.map +1 -1
- package/lib/commonjs/connect/testUtils.js +1 -1
- package/lib/commonjs/connect/testUtils.js.map +1 -1
- package/lib/commonjs/events.js +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/hooks/useOnramp.js +1 -1
- package/lib/commonjs/hooks/useOnramp.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +1 -1
- package/lib/commonjs/specs/NativeOnrampSdkModule.js +1 -1
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/Onramp.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/connect/Components.js +1 -1
- package/lib/module/connect/Components.js.map +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/module/connect/EmbeddedComponent.js +1 -1
- package/lib/module/connect/EmbeddedComponent.js.map +1 -1
- package/lib/module/connect/ModalCloseButton.js +1 -1
- package/lib/module/connect/ModalCloseButton.js.map +1 -1
- package/lib/module/connect/NavigationBar.js +1 -1
- package/lib/module/connect/NavigationBar.js.map +1 -1
- package/lib/module/connect/testUtils.js +1 -1
- package/lib/module/connect/testUtils.js.map +1 -1
- package/lib/module/events.js +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/hooks/useOnramp.js +1 -1
- package/lib/module/hooks/useOnramp.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeNavigationBar.js +1 -1
- package/lib/module/specs/NativeOnrampSdkModule.js +1 -1
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
- package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/Onramp.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/typescript/src/connect/testUtils.d.ts +4 -0
- package/lib/typescript/src/connect/testUtils.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts +2 -0
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +8 -3
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +1 -1
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/NextAction.d.ts +8 -1
- package/lib/typescript/src/types/NextAction.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +40 -1
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts +11 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts +10 -2
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/StripeProvider.tsx +1 -1
- package/src/connect/testUtils.ts +2 -0
- package/src/events.ts +9 -3
- package/src/functions.ts +1 -1
- package/src/hooks/useOnramp.tsx +38 -23
- package/src/specs/NativeOnrampSdkModule.ts +1 -1
- package/src/specs/NativeStripeSdkModule.ts +3 -1
- package/src/types/NextAction.ts +9 -0
- package/src/types/Onramp.ts +45 -1
- package/src/types/PaymentIntent.ts +10 -0
- package/src/types/PaymentMethod.ts +9 -0
- package/stripe-react-native.podspec +1 -1
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +0 -155
|
@@ -3,4 +3,4 @@ StripeSdk_compileSdkVersion=30
|
|
|
3
3
|
StripeSdk_targetSdkVersion=28
|
|
4
4
|
StripeSdk_minSdkVersion=21
|
|
5
5
|
# Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
|
|
6
|
-
StripeSdk_stripeVersion=23.
|
|
6
|
+
StripeSdk_stripeVersion=23.4.+
|
|
@@ -42,6 +42,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
42
42
|
PaymentMethod.Type.Bancontact -> createBancontactParams()
|
|
43
43
|
PaymentMethod.Type.Billie -> createBillieParams()
|
|
44
44
|
PaymentMethod.Type.SepaDebit -> createSepaParams()
|
|
45
|
+
PaymentMethod.Type.Multibanco -> createMultibancoParams()
|
|
45
46
|
PaymentMethod.Type.Oxxo -> createOXXOParams()
|
|
46
47
|
PaymentMethod.Type.Eps -> createEPSParams()
|
|
47
48
|
PaymentMethod.Type.GrabPay -> createGrabPayParams()
|
|
@@ -131,6 +132,26 @@ class PaymentMethodCreateParamsFactory(
|
|
|
131
132
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
132
133
|
}
|
|
133
134
|
|
|
135
|
+
@Throws(PaymentMethodCreateParamsException::class)
|
|
136
|
+
private fun createMultibancoParams(): PaymentMethodCreateParams {
|
|
137
|
+
billingDetailsParams?.let {
|
|
138
|
+
if (it.email.isNullOrBlank()) {
|
|
139
|
+
throw PaymentMethodCreateParamsException(
|
|
140
|
+
"When creating a Multibanco payment method, you must provide the following billing details: email",
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return PaymentMethodCreateParams.createMultibanco(
|
|
145
|
+
billingDetails = it,
|
|
146
|
+
metadata = metadataParams,
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
throw PaymentMethodCreateParamsException(
|
|
151
|
+
"When creating a Multibanco payment method, you must provide the following billing details: email",
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
134
155
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
135
156
|
private fun createEPSParams(): PaymentMethodCreateParams {
|
|
136
157
|
billingDetailsParams?.let {
|
|
@@ -255,6 +276,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
255
276
|
PaymentMethod.Type.Bancontact,
|
|
256
277
|
PaymentMethod.Type.Billie,
|
|
257
278
|
PaymentMethod.Type.SepaDebit,
|
|
279
|
+
PaymentMethod.Type.Multibanco,
|
|
258
280
|
PaymentMethod.Type.Oxxo,
|
|
259
281
|
PaymentMethod.Type.Eps,
|
|
260
282
|
PaymentMethod.Type.GrabPay,
|
|
@@ -25,6 +25,7 @@ import com.facebook.react.bridge.UiThreadUtil
|
|
|
25
25
|
import com.facebook.react.bridge.WritableMap
|
|
26
26
|
import com.facebook.react.bridge.WritableNativeMap
|
|
27
27
|
import com.facebook.react.module.annotations.ReactModule
|
|
28
|
+
import com.facebook.react.modules.systeminfo.ReactNativeVersion
|
|
28
29
|
import com.reactnativestripesdk.addresssheet.AddressLauncherManager
|
|
29
30
|
import com.reactnativestripesdk.customersheet.CustomerSheetManager
|
|
30
31
|
import com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy
|
|
@@ -213,6 +214,11 @@ class StripeSdkModule(
|
|
|
213
214
|
).toString()
|
|
214
215
|
),
|
|
215
216
|
"appVersion" to (packageInfo?.versionName ?: ""),
|
|
217
|
+
"isNewArchitecture" to BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
|
218
|
+
"reactNativeVersion" to
|
|
219
|
+
with(ReactNativeVersion.VERSION) {
|
|
220
|
+
"${get("major")}.${get("minor")}.${get("patch")}"
|
|
221
|
+
},
|
|
216
222
|
),
|
|
217
223
|
)
|
|
218
224
|
}
|
|
@@ -20,7 +20,7 @@ class StripeSdkPackage : BaseReactPackage() {
|
|
|
20
20
|
when (name) {
|
|
21
21
|
StripeSdkModule.NAME -> StripeSdkModule(reactContext)
|
|
22
22
|
NativeOnrampSdkModuleSpec.NAME -> {
|
|
23
|
-
val onrampModuleClass = getOnrampModuleClass()
|
|
23
|
+
val onrampModuleClass = getOnrampModuleClass() ?: return null
|
|
24
24
|
val constructor = onrampModuleClass.getConstructor(ReactApplicationContext::class.java)
|
|
25
25
|
constructor.newInstance(reactContext) as NativeModule
|
|
26
26
|
}
|
|
@@ -29,10 +29,10 @@ class StripeSdkPackage : BaseReactPackage() {
|
|
|
29
29
|
|
|
30
30
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
31
31
|
val moduleList: Array<Class<out NativeModule?>> =
|
|
32
|
-
|
|
32
|
+
listOfNotNull(
|
|
33
33
|
StripeSdkModule::class.java,
|
|
34
34
|
getOnrampModuleClass(),
|
|
35
|
-
)
|
|
35
|
+
).toTypedArray()
|
|
36
36
|
val reactModuleInfoMap: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
37
37
|
for (moduleClass in moduleList) {
|
|
38
38
|
val reactModule = moduleClass.getAnnotation(ReactModule::class.java) ?: continue
|
|
@@ -63,12 +63,12 @@ class StripeSdkPackage : BaseReactPackage() {
|
|
|
63
63
|
PaymentMethodMessagingElementViewManager(),
|
|
64
64
|
)
|
|
65
65
|
|
|
66
|
-
private fun getOnrampModuleClass(): Class<out NativeModule
|
|
66
|
+
private fun getOnrampModuleClass(): Class<out NativeModule?>? {
|
|
67
67
|
if (BuildConfig.IS_ONRAMP_INCLUDED) {
|
|
68
68
|
@Suppress("UNCHECKED_CAST")
|
|
69
69
|
return Class.forName("com.reactnativestripesdk.OnrampSdkModule") as Class<out NativeModule?>
|
|
70
70
|
} else {
|
|
71
|
-
return
|
|
71
|
+
return null
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -140,6 +140,7 @@ internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String =
|
|
|
140
140
|
PaymentMethod.Type.GrabPay -> "GrabPay"
|
|
141
141
|
PaymentMethod.Type.Ideal -> "Ideal"
|
|
142
142
|
PaymentMethod.Type.Netbanking -> "Netbanking"
|
|
143
|
+
PaymentMethod.Type.Multibanco -> "Multibanco"
|
|
143
144
|
PaymentMethod.Type.Oxxo -> "Oxxo"
|
|
144
145
|
PaymentMethod.Type.P24 -> "P24"
|
|
145
146
|
PaymentMethod.Type.SepaDebit -> "SepaDebit"
|
|
@@ -171,6 +172,7 @@ internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? =
|
|
|
171
172
|
"Fpx" -> PaymentMethod.Type.Fpx
|
|
172
173
|
"GrabPay" -> PaymentMethod.Type.GrabPay
|
|
173
174
|
"Netbanking" -> PaymentMethod.Type.Netbanking
|
|
175
|
+
"Multibanco" -> PaymentMethod.Type.Multibanco
|
|
174
176
|
"Oxxo" -> PaymentMethod.Type.Oxxo
|
|
175
177
|
"P24" -> PaymentMethod.Type.P24
|
|
176
178
|
"SepaDebit" -> PaymentMethod.Type.SepaDebit
|
|
@@ -4,8 +4,10 @@ package com.reactnativestripesdk
|
|
|
4
4
|
|
|
5
5
|
import android.annotation.SuppressLint
|
|
6
6
|
import androidx.compose.ui.graphics.Color
|
|
7
|
+
import com.facebook.react.bridge.Arguments
|
|
7
8
|
import com.facebook.react.bridge.ReadableMap
|
|
8
9
|
import com.stripe.android.crypto.onramp.ExperimentalCryptoOnramp
|
|
10
|
+
import com.stripe.android.crypto.onramp.model.KycInfo
|
|
9
11
|
import com.stripe.android.crypto.onramp.model.OnrampConfiguration
|
|
10
12
|
import com.stripe.android.crypto.onramp.model.PaymentMethodDisplayData
|
|
11
13
|
import com.stripe.android.googlepaylauncher.GooglePayEnvironment
|
|
@@ -14,6 +16,8 @@ import com.stripe.android.link.LinkAppearance
|
|
|
14
16
|
import com.stripe.android.link.LinkAppearance.Colors
|
|
15
17
|
import com.stripe.android.link.LinkAppearance.PrimaryButton
|
|
16
18
|
import com.stripe.android.link.LinkAppearance.Style
|
|
19
|
+
import com.stripe.android.model.DateOfBirth
|
|
20
|
+
import com.stripe.android.paymentsheet.PaymentSheet
|
|
17
21
|
|
|
18
22
|
@SuppressLint("RestrictedApi")
|
|
19
23
|
internal fun mapConfig(
|
|
@@ -50,6 +54,8 @@ internal fun mapGooglePayConfig(params: ReadableMap?): GooglePayPaymentMethodLau
|
|
|
50
54
|
val merchantName = params.getString("merchantName") ?: return null
|
|
51
55
|
val existingPaymentMethodRequired =
|
|
52
56
|
params.hasKey("existingPaymentMethodRequired") && params.getBoolean("existingPaymentMethodRequired")
|
|
57
|
+
val isEmailRequired = if (params.hasKey("isEmailRequired")) params.getBoolean("isEmailRequired") else false
|
|
58
|
+
val allowCreditCards = if (params.hasKey("allowCreditCards")) params.getBoolean("allowCreditCards") else true
|
|
53
59
|
|
|
54
60
|
val billingAddressConfig =
|
|
55
61
|
mapGooglePayBillingAddressConfig(params.getMap("billingAddressConfig"))
|
|
@@ -58,6 +64,8 @@ internal fun mapGooglePayConfig(params: ReadableMap?): GooglePayPaymentMethodLau
|
|
|
58
64
|
environment = if (testEnv) GooglePayEnvironment.Test else GooglePayEnvironment.Production,
|
|
59
65
|
merchantCountryCode = merchantCountryCode,
|
|
60
66
|
merchantName = merchantName,
|
|
67
|
+
isEmailRequired = isEmailRequired,
|
|
68
|
+
allowCreditCards = allowCreditCards,
|
|
61
69
|
billingAddressConfig = billingAddressConfig,
|
|
62
70
|
existingPaymentMethodRequired = existingPaymentMethodRequired,
|
|
63
71
|
)
|
|
@@ -159,3 +167,38 @@ internal fun mapPaymentDetailsType(type: PaymentMethodDisplayData.Type): String
|
|
|
159
167
|
PaymentMethodDisplayData.Type.BankAccount -> "BankAccount"
|
|
160
168
|
PaymentMethodDisplayData.Type.GooglePay -> "GooglePay"
|
|
161
169
|
}
|
|
170
|
+
|
|
171
|
+
@OptIn(ExperimentalCryptoOnramp::class)
|
|
172
|
+
@SuppressLint("RestrictedApi")
|
|
173
|
+
internal fun mapFromKycInfo(kycInfo: KycInfo): ReadableMap {
|
|
174
|
+
val result = Arguments.createMap()
|
|
175
|
+
|
|
176
|
+
kycInfo.firstName?.let { result.putString("firstName", it) }
|
|
177
|
+
kycInfo.lastName?.let { result.putString("lastName", it) }
|
|
178
|
+
kycInfo.idNumber?.let { result.putString("idNumber", it) }
|
|
179
|
+
kycInfo.address?.let { result.putMap("address", mapFromKycAddress(it)) }
|
|
180
|
+
kycInfo.dateOfBirth?.let { result.putMap("dateOfBirth", mapFromDateOfBirth(it)) }
|
|
181
|
+
|
|
182
|
+
return result
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private fun mapFromKycAddress(address: PaymentSheet.Address): ReadableMap {
|
|
186
|
+
val result = Arguments.createMap()
|
|
187
|
+
|
|
188
|
+
address.city?.let { result.putString("city", it) }
|
|
189
|
+
address.country?.let { result.putString("country", it) }
|
|
190
|
+
address.line1?.let { result.putString("line1", it) }
|
|
191
|
+
address.line2?.let { result.putString("line2", it) }
|
|
192
|
+
address.postalCode?.let { result.putString("postalCode", it) }
|
|
193
|
+
address.state?.let { result.putString("state", it) }
|
|
194
|
+
|
|
195
|
+
return result
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private fun mapFromDateOfBirth(dateOfBirth: DateOfBirth): ReadableMap {
|
|
199
|
+
val result = Arguments.createMap()
|
|
200
|
+
result.putInt("day", dateOfBirth.day)
|
|
201
|
+
result.putInt("month", dateOfBirth.month)
|
|
202
|
+
result.putInt("year", dateOfBirth.year)
|
|
203
|
+
return result
|
|
204
|
+
}
|
|
@@ -418,6 +418,7 @@ class OnrampSdkModule(
|
|
|
418
418
|
}
|
|
419
419
|
val currencyCode = googlePayParams.getString("currencyCode") ?: ""
|
|
420
420
|
val amount = googlePayParams.getDouble("amount").toLong()
|
|
421
|
+
|
|
421
422
|
val transactionId = googlePayParams.getString("transactionId")
|
|
422
423
|
val label = googlePayParams.getString("label")
|
|
423
424
|
|
|
@@ -722,7 +723,10 @@ class OnrampSdkModule(
|
|
|
722
723
|
result.displayData.sublabel?.let { displayData.putString("sublabel", it) }
|
|
723
724
|
displayData.putString("type", mapPaymentDetailsType(result.displayData.type))
|
|
724
725
|
|
|
725
|
-
|
|
726
|
+
val map = Arguments.createMap()
|
|
727
|
+
map.putMap("displayData", displayData)
|
|
728
|
+
result.kycInfo?.let { map.putMap("kycInfo", mapFromKycInfo(it)) }
|
|
729
|
+
promise.resolve(map)
|
|
726
730
|
}
|
|
727
731
|
}
|
|
728
732
|
|
|
@@ -3,13 +3,18 @@ package com.reactnativestripesdk.mappers
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
5
|
import com.reactnativestripesdk.utils.createCanAddCardResult
|
|
6
|
+
import com.reactnativestripesdk.utils.mapNextAction
|
|
7
|
+
import com.reactnativestripesdk.utils.mapPaymentMethodType
|
|
6
8
|
import com.reactnativestripesdk.utils.mapToAddress
|
|
7
9
|
import com.reactnativestripesdk.utils.mapToBillingDetails
|
|
10
|
+
import com.reactnativestripesdk.utils.mapToPaymentMethodType
|
|
8
11
|
import com.reactnativestripesdk.utils.mapToPreferredNetworks
|
|
9
12
|
import com.reactnativestripesdk.utils.parseCustomPaymentMethods
|
|
10
13
|
import com.reactnativestripesdk.utils.readableArrayOf
|
|
11
14
|
import com.reactnativestripesdk.utils.readableMapOf
|
|
12
15
|
import com.stripe.android.model.CardBrand
|
|
16
|
+
import com.stripe.android.model.PaymentMethod
|
|
17
|
+
import com.stripe.android.model.StripeIntent
|
|
13
18
|
import org.junit.Assert
|
|
14
19
|
import org.junit.Assert.assertEquals
|
|
15
20
|
import org.junit.Assert.assertFalse
|
|
@@ -80,6 +85,34 @@ class MappersTest {
|
|
|
80
85
|
Assert.assertNull(details?.getMap("token"))
|
|
81
86
|
}
|
|
82
87
|
|
|
88
|
+
@Test
|
|
89
|
+
fun mapPaymentMethodType_Multibanco_ReturnsString() {
|
|
90
|
+
assertEquals("Multibanco", mapPaymentMethodType(PaymentMethod.Type.Multibanco))
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@Test
|
|
94
|
+
fun mapToPaymentMethodType_Multibanco_ReturnsType() {
|
|
95
|
+
assertEquals(PaymentMethod.Type.Multibanco, mapToPaymentMethodType("Multibanco"))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Test
|
|
99
|
+
fun mapNextAction_DisplayMultibancoDetails_ReturnsVoucherUrl() {
|
|
100
|
+
val result =
|
|
101
|
+
mapNextAction(
|
|
102
|
+
StripeIntent.NextActionType.DisplayMultibancoDetails,
|
|
103
|
+
StripeIntent.NextActionData.DisplayMultibancoDetails(
|
|
104
|
+
hostedVoucherUrl = "https://payments.stripe.com/multibanco/voucher",
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
assertNotNull(result)
|
|
109
|
+
assertEquals("multibanco", result?.getString("type"))
|
|
110
|
+
assertEquals(
|
|
111
|
+
"https://payments.stripe.com/multibanco/voucher",
|
|
112
|
+
result?.getString("voucherURL"),
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
83
116
|
// ============================================
|
|
84
117
|
// mapToPreferredNetworks Tests
|
|
85
118
|
// ============================================
|
|
@@ -6,12 +6,21 @@ import android.annotation.SuppressLint
|
|
|
6
6
|
import androidx.compose.ui.graphics.toArgb
|
|
7
7
|
import com.reactnativestripesdk.mapAppearance
|
|
8
8
|
import com.reactnativestripesdk.mapConfig
|
|
9
|
+
import com.reactnativestripesdk.mapFromKycInfo
|
|
10
|
+
import com.reactnativestripesdk.mapGooglePayConfig
|
|
9
11
|
import com.reactnativestripesdk.utils.readableMapOf
|
|
10
12
|
import com.stripe.android.crypto.onramp.ExperimentalCryptoOnramp
|
|
13
|
+
import com.stripe.android.crypto.onramp.model.KycInfo
|
|
14
|
+
import com.stripe.android.googlepaylauncher.GooglePayEnvironment
|
|
15
|
+
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher
|
|
11
16
|
import com.stripe.android.link.LinkAppearance.Style
|
|
17
|
+
import com.stripe.android.model.DateOfBirth
|
|
18
|
+
import com.stripe.android.paymentsheet.PaymentSheet
|
|
12
19
|
import org.junit.Assert.assertEquals
|
|
20
|
+
import org.junit.Assert.assertFalse
|
|
13
21
|
import org.junit.Assert.assertNotNull
|
|
14
22
|
import org.junit.Assert.assertNull
|
|
23
|
+
import org.junit.Assert.assertTrue
|
|
15
24
|
import org.junit.Test
|
|
16
25
|
import org.junit.runner.RunWith
|
|
17
26
|
import org.robolectric.RobolectricTestRunner
|
|
@@ -19,6 +28,182 @@ import org.robolectric.RobolectricTestRunner
|
|
|
19
28
|
@SuppressLint("RestrictedApi")
|
|
20
29
|
@RunWith(RobolectricTestRunner::class)
|
|
21
30
|
class OnrampMappersTest {
|
|
31
|
+
@Test
|
|
32
|
+
fun mapGooglePayConfig_NullMap_ReturnsNull() {
|
|
33
|
+
val result = mapGooglePayConfig(null)
|
|
34
|
+
assertNull(result)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Test
|
|
38
|
+
fun mapGooglePayConfig_MissingMerchantCountryCode_ReturnsNull() {
|
|
39
|
+
val params =
|
|
40
|
+
readableMapOf(
|
|
41
|
+
"merchantName" to "Test Merchant",
|
|
42
|
+
)
|
|
43
|
+
val result = mapGooglePayConfig(params)
|
|
44
|
+
assertNull(result)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@Test
|
|
48
|
+
fun mapGooglePayConfig_Defaults() {
|
|
49
|
+
val params =
|
|
50
|
+
readableMapOf(
|
|
51
|
+
"merchantCountryCode" to "US",
|
|
52
|
+
"merchantName" to "Test Merchant",
|
|
53
|
+
)
|
|
54
|
+
val result = mapGooglePayConfig(params)
|
|
55
|
+
|
|
56
|
+
assertNotNull(result)
|
|
57
|
+
assertEquals(GooglePayEnvironment.Production, result!!.environment)
|
|
58
|
+
assertFalse(result.isEmailRequired)
|
|
59
|
+
assertTrue(result.allowCreditCards)
|
|
60
|
+
assertFalse(result.existingPaymentMethodRequired)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Test
|
|
64
|
+
fun mapGooglePayConfig_TestEnv() {
|
|
65
|
+
val params =
|
|
66
|
+
readableMapOf(
|
|
67
|
+
"merchantCountryCode" to "US",
|
|
68
|
+
"merchantName" to "Test Merchant",
|
|
69
|
+
"testEnv" to true,
|
|
70
|
+
)
|
|
71
|
+
val result = mapGooglePayConfig(params)
|
|
72
|
+
|
|
73
|
+
assertNotNull(result)
|
|
74
|
+
assertEquals(GooglePayEnvironment.Test, result!!.environment)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Test
|
|
78
|
+
fun mapGooglePayConfig_IsEmailRequired_True() {
|
|
79
|
+
val params =
|
|
80
|
+
readableMapOf(
|
|
81
|
+
"merchantCountryCode" to "US",
|
|
82
|
+
"merchantName" to "Test Merchant",
|
|
83
|
+
"isEmailRequired" to true,
|
|
84
|
+
)
|
|
85
|
+
val result = mapGooglePayConfig(params)
|
|
86
|
+
|
|
87
|
+
assertNotNull(result)
|
|
88
|
+
assertTrue(result!!.isEmailRequired)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Test
|
|
92
|
+
fun mapGooglePayConfig_AllowCreditCards_False() {
|
|
93
|
+
val params =
|
|
94
|
+
readableMapOf(
|
|
95
|
+
"merchantCountryCode" to "US",
|
|
96
|
+
"merchantName" to "Test Merchant",
|
|
97
|
+
"allowCreditCards" to false,
|
|
98
|
+
)
|
|
99
|
+
val result = mapGooglePayConfig(params)
|
|
100
|
+
|
|
101
|
+
assertNotNull(result)
|
|
102
|
+
assertFalse(result!!.allowCreditCards)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Test
|
|
106
|
+
fun mapGooglePayConfig_MissingMerchantName_ReturnsNull() {
|
|
107
|
+
val params =
|
|
108
|
+
readableMapOf(
|
|
109
|
+
"merchantCountryCode" to "US",
|
|
110
|
+
)
|
|
111
|
+
val result = mapGooglePayConfig(params)
|
|
112
|
+
assertNull(result)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@Test
|
|
116
|
+
fun mapGooglePayConfig_ExistingPaymentMethodRequired_False() {
|
|
117
|
+
val params =
|
|
118
|
+
readableMapOf(
|
|
119
|
+
"merchantCountryCode" to "US",
|
|
120
|
+
"merchantName" to "Test Merchant",
|
|
121
|
+
"existingPaymentMethodRequired" to false,
|
|
122
|
+
)
|
|
123
|
+
val result = mapGooglePayConfig(params)
|
|
124
|
+
|
|
125
|
+
assertNotNull(result)
|
|
126
|
+
assertFalse(result!!.existingPaymentMethodRequired)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@Test
|
|
130
|
+
fun mapGooglePayConfig_WithBillingAddressConfig_IsRequired() {
|
|
131
|
+
val billingAddressConfig =
|
|
132
|
+
readableMapOf(
|
|
133
|
+
"isRequired" to true,
|
|
134
|
+
)
|
|
135
|
+
val params =
|
|
136
|
+
readableMapOf(
|
|
137
|
+
"merchantCountryCode" to "US",
|
|
138
|
+
"merchantName" to "Test Merchant",
|
|
139
|
+
"billingAddressConfig" to billingAddressConfig,
|
|
140
|
+
)
|
|
141
|
+
val result = mapGooglePayConfig(params)
|
|
142
|
+
|
|
143
|
+
assertNotNull(result)
|
|
144
|
+
assertTrue(result!!.billingAddressConfig.isRequired)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@Test
|
|
148
|
+
fun mapGooglePayConfig_WithBillingAddressConfig_FullFormat() {
|
|
149
|
+
val billingAddressConfig =
|
|
150
|
+
readableMapOf(
|
|
151
|
+
"format" to "Full",
|
|
152
|
+
)
|
|
153
|
+
val params =
|
|
154
|
+
readableMapOf(
|
|
155
|
+
"merchantCountryCode" to "US",
|
|
156
|
+
"merchantName" to "Test Merchant",
|
|
157
|
+
"billingAddressConfig" to billingAddressConfig,
|
|
158
|
+
)
|
|
159
|
+
val result = mapGooglePayConfig(params)
|
|
160
|
+
|
|
161
|
+
assertNotNull(result)
|
|
162
|
+
assertEquals(
|
|
163
|
+
GooglePayPaymentMethodLauncher.BillingAddressConfig.Format.Full,
|
|
164
|
+
result!!.billingAddressConfig.format,
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@Test
|
|
169
|
+
fun mapGooglePayConfig_WithBillingAddressConfig_UnknownFormat_DefaultsToMin() {
|
|
170
|
+
val billingAddressConfig =
|
|
171
|
+
readableMapOf(
|
|
172
|
+
"format" to "Unknown",
|
|
173
|
+
)
|
|
174
|
+
val params =
|
|
175
|
+
readableMapOf(
|
|
176
|
+
"merchantCountryCode" to "US",
|
|
177
|
+
"merchantName" to "Test Merchant",
|
|
178
|
+
"billingAddressConfig" to billingAddressConfig,
|
|
179
|
+
)
|
|
180
|
+
val result = mapGooglePayConfig(params)
|
|
181
|
+
|
|
182
|
+
assertNotNull(result)
|
|
183
|
+
assertEquals(
|
|
184
|
+
GooglePayPaymentMethodLauncher.BillingAddressConfig.Format.Min,
|
|
185
|
+
result!!.billingAddressConfig.format,
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@Test
|
|
190
|
+
fun mapGooglePayConfig_WithBillingAddressConfig_IsPhoneNumberRequired() {
|
|
191
|
+
val billingAddressConfig =
|
|
192
|
+
readableMapOf(
|
|
193
|
+
"isPhoneNumberRequired" to true,
|
|
194
|
+
)
|
|
195
|
+
val params =
|
|
196
|
+
readableMapOf(
|
|
197
|
+
"merchantCountryCode" to "US",
|
|
198
|
+
"merchantName" to "Test Merchant",
|
|
199
|
+
"billingAddressConfig" to billingAddressConfig,
|
|
200
|
+
)
|
|
201
|
+
val result = mapGooglePayConfig(params)
|
|
202
|
+
|
|
203
|
+
assertNotNull(result)
|
|
204
|
+
assertTrue(result!!.billingAddressConfig.isPhoneNumberRequired)
|
|
205
|
+
}
|
|
206
|
+
|
|
22
207
|
@Test
|
|
23
208
|
fun mapConfig_WithAppearance() {
|
|
24
209
|
val appearance =
|
|
@@ -219,4 +404,117 @@ class OnrampMappersTest {
|
|
|
219
404
|
assertEquals(8f, state.primaryButton.cornerRadiusDp)
|
|
220
405
|
assertEquals(48f, state.primaryButton.heightDp)
|
|
221
406
|
}
|
|
407
|
+
|
|
408
|
+
@Test
|
|
409
|
+
fun mapFromKycInfo_AllFields() {
|
|
410
|
+
val kycInfo =
|
|
411
|
+
KycInfo(
|
|
412
|
+
firstName = "Jane",
|
|
413
|
+
lastName = "Doe",
|
|
414
|
+
idNumber = "123456789",
|
|
415
|
+
address =
|
|
416
|
+
PaymentSheet.Address(
|
|
417
|
+
city = "San Francisco",
|
|
418
|
+
country = "US",
|
|
419
|
+
line1 = "123 Main St",
|
|
420
|
+
line2 = "Apt 4",
|
|
421
|
+
postalCode = "94105",
|
|
422
|
+
state = "CA",
|
|
423
|
+
),
|
|
424
|
+
dateOfBirth = DateOfBirth(day = 15, month = 6, year = 1990),
|
|
425
|
+
)
|
|
426
|
+
val result = mapFromKycInfo(kycInfo)
|
|
427
|
+
|
|
428
|
+
assertEquals("Jane", result.getString("firstName"))
|
|
429
|
+
assertEquals("Doe", result.getString("lastName"))
|
|
430
|
+
assertEquals("123456789", result.getString("idNumber"))
|
|
431
|
+
|
|
432
|
+
val address = result.getMap("address")
|
|
433
|
+
assertNotNull(address)
|
|
434
|
+
assertEquals("San Francisco", address!!.getString("city"))
|
|
435
|
+
assertEquals("US", address.getString("country"))
|
|
436
|
+
assertEquals("123 Main St", address.getString("line1"))
|
|
437
|
+
assertEquals("Apt 4", address.getString("line2"))
|
|
438
|
+
assertEquals("94105", address.getString("postalCode"))
|
|
439
|
+
assertEquals("CA", address.getString("state"))
|
|
440
|
+
|
|
441
|
+
val dob = result.getMap("dateOfBirth")
|
|
442
|
+
assertNotNull(dob)
|
|
443
|
+
assertEquals(15, dob!!.getInt("day"))
|
|
444
|
+
assertEquals(6, dob.getInt("month"))
|
|
445
|
+
assertEquals(1990, dob.getInt("year"))
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
@Test
|
|
449
|
+
fun mapFromKycInfo_AllNullFields() {
|
|
450
|
+
val kycInfo =
|
|
451
|
+
KycInfo(
|
|
452
|
+
firstName = null,
|
|
453
|
+
lastName = null,
|
|
454
|
+
idNumber = null,
|
|
455
|
+
address = null,
|
|
456
|
+
dateOfBirth = null,
|
|
457
|
+
)
|
|
458
|
+
val result = mapFromKycInfo(kycInfo)
|
|
459
|
+
|
|
460
|
+
assertFalse(result.hasKey("firstName"))
|
|
461
|
+
assertFalse(result.hasKey("lastName"))
|
|
462
|
+
assertFalse(result.hasKey("idNumber"))
|
|
463
|
+
assertFalse(result.hasKey("address"))
|
|
464
|
+
assertFalse(result.hasKey("dateOfBirth"))
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
@Test
|
|
468
|
+
fun mapFromKycInfo_PartialFields() {
|
|
469
|
+
val kycInfo =
|
|
470
|
+
KycInfo(
|
|
471
|
+
firstName = "Jane",
|
|
472
|
+
lastName = null,
|
|
473
|
+
idNumber = null,
|
|
474
|
+
address = null,
|
|
475
|
+
dateOfBirth = DateOfBirth(day = 1, month = 1, year = 2000),
|
|
476
|
+
)
|
|
477
|
+
val result = mapFromKycInfo(kycInfo)
|
|
478
|
+
|
|
479
|
+
assertEquals("Jane", result.getString("firstName"))
|
|
480
|
+
assertFalse(result.hasKey("lastName"))
|
|
481
|
+
assertFalse(result.hasKey("idNumber"))
|
|
482
|
+
assertFalse(result.hasKey("address"))
|
|
483
|
+
|
|
484
|
+
val dob = result.getMap("dateOfBirth")
|
|
485
|
+
assertNotNull(dob)
|
|
486
|
+
assertEquals(1, dob!!.getInt("day"))
|
|
487
|
+
assertEquals(1, dob.getInt("month"))
|
|
488
|
+
assertEquals(2000, dob.getInt("year"))
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
@Test
|
|
492
|
+
fun mapFromKycInfo_AddressWithPartialFields() {
|
|
493
|
+
val kycInfo =
|
|
494
|
+
KycInfo(
|
|
495
|
+
firstName = null,
|
|
496
|
+
lastName = null,
|
|
497
|
+
idNumber = null,
|
|
498
|
+
address =
|
|
499
|
+
PaymentSheet.Address(
|
|
500
|
+
city = "New York",
|
|
501
|
+
country = "US",
|
|
502
|
+
line1 = null,
|
|
503
|
+
line2 = null,
|
|
504
|
+
postalCode = null,
|
|
505
|
+
state = null,
|
|
506
|
+
),
|
|
507
|
+
dateOfBirth = null,
|
|
508
|
+
)
|
|
509
|
+
val result = mapFromKycInfo(kycInfo)
|
|
510
|
+
|
|
511
|
+
val address = result.getMap("address")
|
|
512
|
+
assertNotNull(address)
|
|
513
|
+
assertEquals("New York", address!!.getString("city"))
|
|
514
|
+
assertEquals("US", address.getString("country"))
|
|
515
|
+
assertFalse(address.hasKey("line1"))
|
|
516
|
+
assertFalse(address.hasKey("line2"))
|
|
517
|
+
assertFalse(address.hasKey("postalCode"))
|
|
518
|
+
assertFalse(address.hasKey("state"))
|
|
519
|
+
}
|
|
222
520
|
}
|
|
@@ -79,6 +79,29 @@ class AddressSheetUtils {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
internal class func buildConfiguration(
|
|
83
|
+
appearance: NSDictionary?,
|
|
84
|
+
defaultValues: NSDictionary?,
|
|
85
|
+
additionalFields: NSDictionary?,
|
|
86
|
+
allowedCountries: [String],
|
|
87
|
+
autocompleteCountries: [String],
|
|
88
|
+
buttonTitle: String?,
|
|
89
|
+
sheetTitle: String?
|
|
90
|
+
) throws -> AddressViewController.Configuration {
|
|
91
|
+
let appearanceConfiguration = try PaymentSheetAppearance.buildAppearanceFromParams(userParams: appearance)
|
|
92
|
+
|
|
93
|
+
var config = AddressViewController.Configuration(
|
|
94
|
+
defaultValues: buildDefaultValues(params: defaultValues),
|
|
95
|
+
additionalFields: buildAdditionalFieldsConfiguration(params: additionalFields),
|
|
96
|
+
allowedCountries: allowedCountries,
|
|
97
|
+
appearance: appearanceConfiguration,
|
|
98
|
+
buttonTitle: buttonTitle,
|
|
99
|
+
title: sheetTitle
|
|
100
|
+
)
|
|
101
|
+
config.autocompleteCountries = autocompleteCountries
|
|
102
|
+
return config
|
|
103
|
+
}
|
|
104
|
+
|
|
82
105
|
internal class func buildResult(address: AddressViewController.AddressDetails) -> [AnyHashable: Any] {
|
|
83
106
|
return [
|
|
84
107
|
"result": [
|
|
@@ -60,7 +60,15 @@ public class AddressSheetView: UIView {
|
|
|
60
60
|
}
|
|
61
61
|
var config: AddressViewController.Configuration
|
|
62
62
|
do {
|
|
63
|
-
config = try
|
|
63
|
+
config = try AddressSheetUtils.buildConfiguration(
|
|
64
|
+
appearance: appearance,
|
|
65
|
+
defaultValues: defaultValues,
|
|
66
|
+
additionalFields: additionalFields,
|
|
67
|
+
allowedCountries: allowedCountries,
|
|
68
|
+
autocompleteCountries: autocompleteCountries,
|
|
69
|
+
buttonTitle: primaryButtonTitle,
|
|
70
|
+
sheetTitle: sheetTitle
|
|
71
|
+
)
|
|
64
72
|
} catch {
|
|
65
73
|
onErrorAction!(
|
|
66
74
|
Errors.createError(ErrorType.Failed, error.localizedDescription) as? [AnyHashable: Any]
|
|
@@ -80,19 +88,6 @@ public class AddressSheetView: UIView {
|
|
|
80
88
|
vc.present(navigationController, animated: true)
|
|
81
89
|
}
|
|
82
90
|
|
|
83
|
-
private func buildAddressSheetConfiguration() throws -> AddressViewController.Configuration {
|
|
84
|
-
let appearanceConfiguration = try PaymentSheetAppearance.buildAppearanceFromParams(userParams: appearance)
|
|
85
|
-
|
|
86
|
-
return AddressViewController.Configuration(
|
|
87
|
-
defaultValues: AddressSheetUtils.buildDefaultValues(params: defaultValues),
|
|
88
|
-
additionalFields: AddressSheetUtils.buildAdditionalFieldsConfiguration(params: additionalFields),
|
|
89
|
-
allowedCountries: allowedCountries,
|
|
90
|
-
appearance: appearanceConfiguration,
|
|
91
|
-
buttonTitle: primaryButtonTitle,
|
|
92
|
-
title: sheetTitle
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
91
|
private func getModalPresentationStyle() -> UIModalPresentationStyle {
|
|
97
92
|
switch presentationStyle {
|
|
98
93
|
case "fullscreen":
|