@stripe/stripe-react-native 0.63.0 → 0.65.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/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +835 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +17 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +2 -2
- package/android/detekt/detekt-baseline.xml +146 -0
- package/android/detekt/detekt.gradle +45 -0
- package/android/detekt/detekt.yml +722 -0
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +0 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +22 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +2 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +82 -4
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +5 -5
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +2 -4
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +36 -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/PaymentMethodMessagingElementConfigTest.kt +3 -3
- 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 -5
- package/ios/PaymentMethodFactory.swift +19 -0
- package/ios/PaymentMethodMessagingElementConfig.swift +6 -3
- package/ios/PaymentMethodMessagingElementView.swift +19 -0
- package/ios/StripeSdk-Bridging-Header.h +1 -0
- package/ios/StripeSdk.mm +1 -1
- package/ios/StripeSdkImpl.swift +38 -102
- package/ios/StripeSwiftInterop.h +1 -0
- package/jest/mock.js +3 -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/PaymentMethodMessagingElement.js +2 -0
- package/lib/commonjs/components/PaymentMethodMessagingElement.js.map +1 -0
- 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/useCheckout.js +2 -0
- package/lib/commonjs/hooks/useCheckout.js.map +1 -0
- package/lib/commonjs/hooks/useOnramp.js +1 -1
- package/lib/commonjs/hooks/useOnramp.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.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/NativePaymentMethodMessagingElement.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/Checkout.js +2 -0
- package/lib/commonjs/types/Checkout.js.map +1 -0
- 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/commonjs/types/PaymentSheet.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/PaymentMethodMessagingElement.js +2 -0
- package/lib/module/components/PaymentMethodMessagingElement.js.map +1 -0
- 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/useCheckout.js +2 -0
- package/lib/module/hooks/useCheckout.js.map +1 -0
- package/lib/module/hooks/useOnramp.js +1 -1
- package/lib/module/hooks/useOnramp.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.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/NativePaymentMethodMessagingElement.js.map +1 -1
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/Checkout.js +2 -0
- package/lib/module/types/Checkout.js.map +1 -0
- 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/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts +41 -0
- package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts.map +1 -0
- 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/useCheckout.d.ts +21 -0
- package/lib/typescript/src/hooks/useCheckout.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts +9 -3
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.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/NativePaymentMethodMessagingElement.d.ts +1 -6
- package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +16 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/Checkout.d.ts +336 -0
- package/lib/typescript/src/types/Checkout.d.ts.map +1 -0
- 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 -6
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +22 -6
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts +16 -1
- package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts.map +1 -1
- package/package.json +8 -5
- package/src/components/PaymentMethodMessagingElement.tsx +109 -0
- 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/useCheckout.tsx +168 -0
- package/src/hooks/useOnramp.tsx +45 -24
- package/src/index.tsx +4 -0
- package/src/specs/NativeOnrampSdkModule.ts +1 -1
- package/src/specs/NativePaymentMethodMessagingElement.ts +0 -7
- package/src/specs/NativeStripeSdkModule.ts +53 -1
- package/src/types/Checkout.ts +377 -0
- 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 -6
- package/src/types/PaymentSheet.ts +29 -6
- package/src/types/components/PaymentMethodMessagingElementComponent.tsx +17 -1
- package/stripe-react-native.podspec +8 -8
- package/android/spotless.gradle +0 -19
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +0 -155
|
@@ -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":
|
package/ios/Mappers.swift
CHANGED
|
@@ -295,8 +295,8 @@ class Mappers {
|
|
|
295
295
|
case STPPaymentMethodType.EPS: return "Eps"
|
|
296
296
|
case STPPaymentMethodType.bancontact: return "Bancontact"
|
|
297
297
|
case STPPaymentMethodType.billie: return "Billie"
|
|
298
|
+
case STPPaymentMethodType.multibanco: return "Multibanco"
|
|
298
299
|
case STPPaymentMethodType.OXXO: return "Oxxo"
|
|
299
|
-
case STPPaymentMethodType.UPI: return "Upi"
|
|
300
300
|
case STPPaymentMethodType.afterpayClearpay: return "AfterpayClearpay"
|
|
301
301
|
case STPPaymentMethodType.klarna: return "Klarna"
|
|
302
302
|
case STPPaymentMethodType.USBankAccount: return "USBankAccount"
|
|
@@ -327,8 +327,8 @@ class Mappers {
|
|
|
327
327
|
case "Eps": return STPPaymentMethodType.EPS
|
|
328
328
|
case "Bancontact": return STPPaymentMethodType.bancontact
|
|
329
329
|
case "Billie": return STPPaymentMethodType.billie
|
|
330
|
+
case "Multibanco": return STPPaymentMethodType.multibanco
|
|
330
331
|
case "Oxxo": return STPPaymentMethodType.OXXO
|
|
331
|
-
case "Upi": return STPPaymentMethodType.UPI
|
|
332
332
|
case "AfterpayClearpay": return STPPaymentMethodType.afterpayClearpay
|
|
333
333
|
case "Klarna": return STPPaymentMethodType.klarna
|
|
334
334
|
case "WeChatPay": return STPPaymentMethodType.weChatPay
|
|
@@ -475,6 +475,14 @@ class Mappers {
|
|
|
475
475
|
"type": "konbiniVoucher",
|
|
476
476
|
"voucherURL": it.konbiniDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(),
|
|
477
477
|
]
|
|
478
|
+
case .multibancoDisplayDetails:
|
|
479
|
+
return [
|
|
480
|
+
"type": "multibanco",
|
|
481
|
+
"entity": it.multibancoDisplayDetails?.entity ?? NSNull(),
|
|
482
|
+
"reference": it.multibancoDisplayDetails?.reference ?? NSNull(),
|
|
483
|
+
"expiresAt": it.multibancoDisplayDetails?.expiresAt.timeIntervalSince1970 ?? NSNull(),
|
|
484
|
+
"voucherURL": it.multibancoDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(),
|
|
485
|
+
]
|
|
478
486
|
default: // .useStripeSDK, .BLIKAuthorize, .unknown
|
|
479
487
|
return nil
|
|
480
488
|
}
|
|
@@ -691,9 +699,6 @@ class Mappers {
|
|
|
691
699
|
"SepaDebit": sepaDebit,
|
|
692
700
|
"BacsDebit": bacsDebit,
|
|
693
701
|
"AuBecsDebit": auBECSDebit,
|
|
694
|
-
"Upi": [
|
|
695
|
-
"vpa": paymentMethod.upi?.vpa
|
|
696
|
-
],
|
|
697
702
|
"USBankAccount": USBankAccount,
|
|
698
703
|
]
|
|
699
704
|
return method
|
|
@@ -1267,6 +1272,70 @@ class Mappers {
|
|
|
1267
1272
|
)
|
|
1268
1273
|
}
|
|
1269
1274
|
|
|
1275
|
+
class func mapFromKycInfo(_ kycInfo: KycInfo) -> [String: Any] {
|
|
1276
|
+
var result: [String: Any] = [:]
|
|
1277
|
+
|
|
1278
|
+
if let firstName = kycInfo.firstName {
|
|
1279
|
+
result["firstName"] = firstName
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
if let lastName = kycInfo.lastName {
|
|
1283
|
+
result["lastName"] = lastName
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
if let idNumber = kycInfo.idNumber {
|
|
1287
|
+
result["idNumber"] = idNumber
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
if let address = kycInfo.address {
|
|
1291
|
+
result["address"] = mapFromKycAddress(address)
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
if let dateOfBirth = kycInfo.dateOfBirth {
|
|
1295
|
+
result["dateOfBirth"] = mapFromDateOfBirth(dateOfBirth)
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
return result
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
class func mapFromKycAddress(_ address: Address) -> [String: Any] {
|
|
1302
|
+
var result: [String: Any] = [:]
|
|
1303
|
+
|
|
1304
|
+
if let city = address.city {
|
|
1305
|
+
result["city"] = city
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
if let country = address.country {
|
|
1309
|
+
result["country"] = country
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
if let line1 = address.line1 {
|
|
1313
|
+
result["line1"] = line1
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
if let line2 = address.line2 {
|
|
1317
|
+
result["line2"] = line2
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
if let postalCode = address.postalCode {
|
|
1321
|
+
result["postalCode"] = postalCode
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
if let state = address.state {
|
|
1325
|
+
result["state"] = state
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
return result
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
class func mapFromDateOfBirth(_ dateOfBirth: KycInfo.DateOfBirth) -> [String: Int] {
|
|
1332
|
+
[
|
|
1333
|
+
"day": dateOfBirth.day,
|
|
1334
|
+
"month": dateOfBirth.month,
|
|
1335
|
+
"year": dateOfBirth.year,
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1270
1339
|
private class func mapOptionalKycAddress(_ value: Any?) throws -> Address? {
|
|
1271
1340
|
guard let value else {
|
|
1272
1341
|
return nil
|
|
@@ -37,6 +37,8 @@ class PaymentMethodFactory {
|
|
|
37
37
|
return try createBancontactPaymentMethodParams()
|
|
38
38
|
case STPPaymentMethodType.billie:
|
|
39
39
|
return try createBilliePaymentMethodParams()
|
|
40
|
+
case STPPaymentMethodType.multibanco:
|
|
41
|
+
return try createMultibancoPaymentMethodParams()
|
|
40
42
|
case STPPaymentMethodType.SEPADebit:
|
|
41
43
|
return try createSepaPaymentMethodParams()
|
|
42
44
|
case STPPaymentMethodType.EPS:
|
|
@@ -90,6 +92,8 @@ class PaymentMethodFactory {
|
|
|
90
92
|
return nil
|
|
91
93
|
case STPPaymentMethodType.billie:
|
|
92
94
|
return nil
|
|
95
|
+
case STPPaymentMethodType.multibanco:
|
|
96
|
+
return nil
|
|
93
97
|
case STPPaymentMethodType.SEPADebit:
|
|
94
98
|
return nil
|
|
95
99
|
case STPPaymentMethodType.OXXO:
|
|
@@ -297,6 +301,18 @@ class PaymentMethodFactory {
|
|
|
297
301
|
return STPPaymentMethodParams(oxxo: params, billingDetails: billingDetails, metadata: metadata)
|
|
298
302
|
}
|
|
299
303
|
|
|
304
|
+
private func createMultibancoPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
305
|
+
let params = STPPaymentMethodMultibancoParams()
|
|
306
|
+
|
|
307
|
+
guard let billingDetails = billingDetailsParams,
|
|
308
|
+
let email = billingDetails.email,
|
|
309
|
+
!email.isEmpty else {
|
|
310
|
+
throw PaymentMethodError.multibancoPaymentMissingParams
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return STPPaymentMethodParams(multibanco: params, billingDetails: billingDetails, metadata: metadata)
|
|
314
|
+
}
|
|
315
|
+
|
|
300
316
|
private func createEPSPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
301
317
|
let params = STPPaymentMethodEPSParams()
|
|
302
318
|
|
|
@@ -406,6 +422,7 @@ enum PaymentMethodError: Error {
|
|
|
406
422
|
case billiePaymentMissingParams
|
|
407
423
|
case sepaPaymentMissingParams
|
|
408
424
|
case p24PaymentMissingParams
|
|
425
|
+
case multibancoPaymentMissingParams
|
|
409
426
|
case afterpayClearpayPaymentMissingParams
|
|
410
427
|
// Klarna no longer requires email and country in billing details
|
|
411
428
|
case weChatPayPaymentMissingParams
|
|
@@ -429,6 +446,8 @@ extension PaymentMethodError: LocalizedError {
|
|
|
429
446
|
return NSLocalizedString("Billie requires that you provide the following billing details: email, country", comment: "Create payment error")
|
|
430
447
|
case .sepaPaymentMissingParams:
|
|
431
448
|
return NSLocalizedString("You must provide billing details and IBAN", comment: "Create payment error")
|
|
449
|
+
case .multibancoPaymentMissingParams:
|
|
450
|
+
return NSLocalizedString("Multibanco requires that you provide the following billing details: email", comment: "Create payment error")
|
|
432
451
|
case .epsPaymentMissingParams:
|
|
433
452
|
return NSLocalizedString("You must provide billing details", comment: "Create payment error")
|
|
434
453
|
case .afterpayClearpayPaymentMissingParams:
|
|
@@ -29,10 +29,13 @@ internal class PaymentMethodMessagingElementConfig {
|
|
|
29
29
|
|
|
30
30
|
// Parse font
|
|
31
31
|
if let fontParams = params["font"] as? NSDictionary {
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
let size = fontParams["size"] as? CGFloat
|
|
33
|
+
let family = fontParams["family"] as? String
|
|
34
|
+
|
|
35
|
+
if let family = family, let customFont = UIFont(name: family, size: size ?? UIFont.systemFontSize) {
|
|
35
36
|
appearance.font = customFont
|
|
37
|
+
} else if let size = size {
|
|
38
|
+
appearance.font = UIFont.systemFont(ofSize: size)
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -21,6 +21,9 @@ public class PaymentMethodMessagingElementContainerView: UIView, UIGestureRecogn
|
|
|
21
21
|
private var appearanceConfig: PaymentMethodMessagingElement.Appearance?
|
|
22
22
|
private var lastConfig: NSDictionary?
|
|
23
23
|
|
|
24
|
+
// Used to track height updates
|
|
25
|
+
private var previousHeight: CGFloat?
|
|
26
|
+
|
|
24
27
|
@objc var appearance: NSDictionary? {
|
|
25
28
|
didSet {
|
|
26
29
|
if let appearance = appearance {
|
|
@@ -67,6 +70,19 @@ public class PaymentMethodMessagingElementContainerView: UIView, UIGestureRecogn
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
public override func layoutSubviews() {
|
|
74
|
+
super.layoutSubviews()
|
|
75
|
+
|
|
76
|
+
// Calculate our natural height
|
|
77
|
+
let desiredHeight = systemLayoutSizeFitting(CGSize(width: frame.width, height: UIView.layoutFittingCompressedSize.height)).height
|
|
78
|
+
|
|
79
|
+
// Notify if changed
|
|
80
|
+
if desiredHeight != previousHeight {
|
|
81
|
+
StripeSdkImpl.shared.emitter?.emitPaymentMethodMessagingElementDidUpdateHeight(["height": desiredHeight])
|
|
82
|
+
self.previousHeight = desiredHeight
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
70
86
|
private func attachPaymentElementIfAvailable() {
|
|
71
87
|
removePaymentMethodMessagingElement()
|
|
72
88
|
guard let messagingElement = messagingInstance else {
|
|
@@ -76,7 +92,10 @@ public class PaymentMethodMessagingElementContainerView: UIView, UIGestureRecogn
|
|
|
76
92
|
let messagingElementView = messagingElement.view
|
|
77
93
|
addSubview(messagingElementView)
|
|
78
94
|
messagingElementView.translatesAutoresizingMaskIntoConstraints = false
|
|
95
|
+
let height = self.messagingInstance?.view.systemLayoutSizeFitting(CGSize(width: self.messagingInstance?.view.bounds.width ?? 0, height: UIView.layoutFittingCompressedSize.height)).height
|
|
96
|
+
self.previousHeight = height ?? 0
|
|
79
97
|
|
|
98
|
+
StripeSdkImpl.shared.emitter?.emitPaymentMethodMessagingElementDidUpdateHeight(["height": height ?? 0])
|
|
80
99
|
NSLayoutConstraint.activate([
|
|
81
100
|
messagingElementView.topAnchor.constraint(equalTo: topAnchor),
|
|
82
101
|
messagingElementView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
package/ios/StripeSdk.mm
CHANGED
|
@@ -92,7 +92,7 @@ RCT_EXPORT_METHOD(configureOrderTracking:(nonnull NSString *)orderTypeIdentifier
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
RCT_EXPORT_METHOD(confirmPayment:(nonnull NSString *)paymentIntentClientSecret
|
|
95
|
-
params:(
|
|
95
|
+
params:(nullable NSDictionary *)params
|
|
96
96
|
options:(nonnull NSDictionary *)options
|
|
97
97
|
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
98
98
|
reject:(nonnull RCTPromiseRejectBlock)reject)
|