@stripe/stripe-react-native 0.56.0 → 0.57.1

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.
Files changed (328) hide show
  1. package/android/build.gradle +76 -118
  2. package/android/gradle.properties +1 -1
  3. package/android/settings.gradle +2 -0
  4. package/android/spotless.gradle +1 -1
  5. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +24 -20
  6. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +20 -17
  7. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +28 -32
  8. package/android/src/main/java/com/reactnativestripesdk/{CollectBankAccountLauncherFragment.kt → CollectBankAccountLauncherManager.kt} +23 -44
  9. package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
  10. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +4 -11
  11. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +52 -132
  12. package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +0 -8
  13. package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
  14. package/android/src/main/java/com/reactnativestripesdk/{FinancialConnectionsSheetFragment.kt → FinancialConnectionsSheetManager.kt} +43 -92
  15. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
  16. package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +107 -0
  17. package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherManager.kt +37 -0
  18. package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +7 -5
  19. package/android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt +31 -0
  20. package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +120 -0
  21. package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +228 -0
  22. package/android/src/main/java/com/reactnativestripesdk/{PaymentLauncherFragment.kt → PaymentLauncherManager.kt} +40 -77
  23. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +11 -20
  24. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
  25. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +409 -483
  26. package/android/src/main/java/com/reactnativestripesdk/{PaymentSheetFragment.kt → PaymentSheetManager.kt} +65 -300
  27. package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
  28. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +227 -232
  29. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
  30. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +78 -0
  31. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +52 -39
  32. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
  33. package/android/src/main/java/com/reactnativestripesdk/customersheet/{CustomerSheetFragment.kt → CustomerSheetManager.kt} +64 -99
  34. package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -3
  35. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +5 -10
  36. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +90 -77
  37. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +6 -4
  38. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +13 -3
  39. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +87 -11
  40. package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
  41. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +178 -185
  42. package/android/src/main/java/com/reactnativestripesdk/utils/StripeUIManager.kt +62 -0
  43. package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +118 -0
  44. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
  45. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +922 -0
  46. package/android/src/test/java/com/facebook/testutils/shadows/ShadowArguments.kt +29 -0
  47. package/android/src/test/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManagerTest.kt +163 -0
  48. package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +976 -0
  49. package/android/src/test/java/com/reactnativestripesdk/PaymentSheetAppearanceTest.kt +801 -0
  50. package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +523 -0
  51. package/android/src/test/java/com/reactnativestripesdk/addresssheet/AddressSheetViewTest.kt +551 -0
  52. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +567 -0
  53. package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +456 -0
  54. package/android/src/test/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +43 -0
  55. package/android/src/test/resources/robolectric.properties +2 -0
  56. package/ios/AddressSheet/AddressSheetUtils.swift +3 -3
  57. package/ios/AddressSheet/AddressSheetView.swift +26 -26
  58. package/ios/AddressSheet/AddressSheetViewManager.swift +2 -2
  59. package/ios/ApplePayButtonManager.swift +1 -1
  60. package/ios/ApplePayButtonView.swift +9 -10
  61. package/ios/ApplePayUtils.swift +51 -51
  62. package/ios/ApplePayViewController.swift +25 -29
  63. package/ios/AuBECSDebitFormManager.swift +1 -1
  64. package/ios/AuBECSDebitFormView.swift +13 -15
  65. package/ios/CardFieldManager.swift +4 -4
  66. package/ios/CardFieldView.swift +9 -9
  67. package/ios/CardFormManager.swift +3 -3
  68. package/ios/CardFormView.swift +28 -28
  69. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingView.swift +97 -0
  70. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +133 -0
  71. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.m +16 -0
  72. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.swift +17 -0
  73. package/ios/CustomerSheet/CustomerSheetUtils.swift +15 -16
  74. package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +19 -19
  75. package/ios/EmbeddedPaymentElementView.swift +2 -2
  76. package/ios/Errors.swift +22 -23
  77. package/ios/FinancialConnections.swift +37 -37
  78. package/ios/Mappers.swift +212 -75
  79. package/ios/NavigationBarManager.m +13 -0
  80. package/ios/NavigationBarManager.swift +17 -0
  81. package/ios/NavigationBarView.swift +65 -0
  82. package/ios/NewArch/NavigationBarComponentView.h +10 -0
  83. package/ios/NewArch/NavigationBarComponentView.mm +86 -0
  84. package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
  85. package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
  86. package/ios/PaymentMethodFactory.swift +24 -41
  87. package/ios/PaymentOptionDisplayData+ReactNative.swift +4 -4
  88. package/ios/PaymentPassFinder.swift +9 -10
  89. package/ios/PaymentSheetAppearance.swift +137 -138
  90. package/ios/PushProvisioning/AddToWalletButtonManager.swift +2 -2
  91. package/ios/PushProvisioning/AddToWalletButtonView.swift +16 -18
  92. package/ios/PushProvisioning/PushProvisioningUtils.swift +11 -11
  93. package/ios/StripeContainerManager.swift +1 -1
  94. package/ios/StripeContainerView.swift +3 -3
  95. package/ios/StripeOnrampSdk.h +17 -0
  96. package/ios/StripeOnrampSdk.mm +158 -0
  97. package/ios/StripeSdk.mm +8 -0
  98. package/ios/StripeSdkEmitter.swift +4 -0
  99. package/ios/StripeSdkImpl+CustomerSheet.swift +31 -26
  100. package/ios/StripeSdkImpl+Embedded.swift +11 -9
  101. package/ios/StripeSdkImpl+PaymentSheet.swift +51 -42
  102. package/ios/StripeSdkImpl.swift +919 -191
  103. package/ios/UIColorExtension.swift +72 -0
  104. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  105. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  106. package/lib/commonjs/components/AddressSheet.js +1 -1
  107. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  108. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  109. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  110. package/lib/commonjs/components/CardField.js +1 -1
  111. package/lib/commonjs/components/CardField.js.map +1 -1
  112. package/lib/commonjs/components/CardForm.js +1 -1
  113. package/lib/commonjs/components/CardForm.js.map +1 -1
  114. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  115. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  116. package/lib/commonjs/components/StripeContainer.js +1 -1
  117. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  118. package/lib/commonjs/components/StripeProvider.js +1 -1
  119. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  120. package/lib/commonjs/connect/Components.js +2 -0
  121. package/lib/commonjs/connect/Components.js.map +1 -0
  122. package/lib/commonjs/connect/ConnectComponentsProvider.js +2 -0
  123. package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -0
  124. package/lib/commonjs/connect/EmbeddedComponent.js +19 -0
  125. package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -0
  126. package/lib/commonjs/connect/ModalCloseButton.js +2 -0
  127. package/lib/commonjs/connect/ModalCloseButton.js.map +1 -0
  128. package/lib/commonjs/connect/NavigationBar.js +2 -0
  129. package/lib/commonjs/connect/NavigationBar.js.map +1 -0
  130. package/lib/commonjs/connect/connectTypes.js +2 -0
  131. package/lib/commonjs/connect/connectTypes.js.map +1 -0
  132. package/lib/commonjs/events.js +1 -1
  133. package/lib/commonjs/events.js.map +1 -1
  134. package/lib/commonjs/helpers.js +1 -1
  135. package/lib/commonjs/helpers.js.map +1 -1
  136. package/lib/commonjs/hooks/useOnramp.js +2 -0
  137. package/lib/commonjs/hooks/useOnramp.js.map +1 -0
  138. package/lib/commonjs/index.js +1 -1
  139. package/lib/commonjs/index.js.map +1 -1
  140. package/lib/commonjs/plugin/withStripe.js +1 -1
  141. package/lib/commonjs/plugin/withStripe.js.map +1 -1
  142. package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
  143. package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -1
  144. package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
  145. package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -1
  146. package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
  147. package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
  148. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
  149. package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -1
  150. package/lib/commonjs/specs/NativeCardField.js +1 -1
  151. package/lib/commonjs/specs/NativeCardField.js.map +1 -1
  152. package/lib/commonjs/specs/NativeCardForm.js +1 -1
  153. package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
  154. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +2 -0
  155. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js.map +1 -0
  156. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
  157. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  158. package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
  159. package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -1
  160. package/lib/commonjs/specs/NativeNavigationBar.js +2 -0
  161. package/lib/commonjs/specs/NativeNavigationBar.js.map +1 -0
  162. package/lib/commonjs/specs/NativeOnrampSdkModule.js +2 -0
  163. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -0
  164. package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
  165. package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -1
  166. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  167. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  168. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  169. package/lib/commonjs/types/Errors.js +1 -1
  170. package/lib/commonjs/types/Errors.js.map +1 -1
  171. package/lib/commonjs/types/Onramp.js +2 -0
  172. package/lib/commonjs/types/Onramp.js.map +1 -0
  173. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  174. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  175. package/lib/commonjs/types/index.js +1 -1
  176. package/lib/commonjs/types/index.js.map +1 -1
  177. package/lib/module/components/AddToWalletButton.js +1 -1
  178. package/lib/module/components/AddToWalletButton.js.map +1 -1
  179. package/lib/module/components/AddressSheet.js +1 -1
  180. package/lib/module/components/AddressSheet.js.map +1 -1
  181. package/lib/module/components/AuBECSDebitForm.js +1 -1
  182. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  183. package/lib/module/components/CardField.js +1 -1
  184. package/lib/module/components/CardField.js.map +1 -1
  185. package/lib/module/components/CardForm.js +1 -1
  186. package/lib/module/components/CardForm.js.map +1 -1
  187. package/lib/module/components/PlatformPayButton.js +1 -1
  188. package/lib/module/components/PlatformPayButton.js.map +1 -1
  189. package/lib/module/components/StripeContainer.js +1 -1
  190. package/lib/module/components/StripeContainer.js.map +1 -1
  191. package/lib/module/components/StripeProvider.js +1 -1
  192. package/lib/module/components/StripeProvider.js.map +1 -1
  193. package/lib/module/connect/Components.js +2 -0
  194. package/lib/module/connect/Components.js.map +1 -0
  195. package/lib/module/connect/ConnectComponentsProvider.js +2 -0
  196. package/lib/module/connect/ConnectComponentsProvider.js.map +1 -0
  197. package/lib/module/connect/EmbeddedComponent.js +19 -0
  198. package/lib/module/connect/EmbeddedComponent.js.map +1 -0
  199. package/lib/module/connect/ModalCloseButton.js +2 -0
  200. package/lib/module/connect/ModalCloseButton.js.map +1 -0
  201. package/lib/module/connect/NavigationBar.js +2 -0
  202. package/lib/module/connect/NavigationBar.js.map +1 -0
  203. package/lib/module/connect/connectTypes.js +2 -0
  204. package/lib/module/connect/connectTypes.js.map +1 -0
  205. package/lib/module/events.js +1 -1
  206. package/lib/module/events.js.map +1 -1
  207. package/lib/module/helpers.js +1 -1
  208. package/lib/module/helpers.js.map +1 -1
  209. package/lib/module/hooks/useOnramp.js +2 -0
  210. package/lib/module/hooks/useOnramp.js.map +1 -0
  211. package/lib/module/index.js +1 -1
  212. package/lib/module/index.js.map +1 -1
  213. package/lib/module/plugin/withStripe.js +1 -1
  214. package/lib/module/plugin/withStripe.js.map +1 -1
  215. package/lib/module/specs/NativeAddToWalletButton.js +1 -1
  216. package/lib/module/specs/NativeAddToWalletButton.js.map +1 -1
  217. package/lib/module/specs/NativeAddressSheet.js +1 -1
  218. package/lib/module/specs/NativeAddressSheet.js.map +1 -1
  219. package/lib/module/specs/NativeApplePayButton.js +1 -1
  220. package/lib/module/specs/NativeApplePayButton.js.map +1 -1
  221. package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
  222. package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -1
  223. package/lib/module/specs/NativeCardField.js +1 -1
  224. package/lib/module/specs/NativeCardField.js.map +1 -1
  225. package/lib/module/specs/NativeCardForm.js +1 -1
  226. package/lib/module/specs/NativeCardForm.js.map +1 -1
  227. package/lib/module/specs/NativeConnectAccountOnboardingView.js +2 -0
  228. package/lib/module/specs/NativeConnectAccountOnboardingView.js.map +1 -0
  229. package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
  230. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  231. package/lib/module/specs/NativeGooglePayButton.js +1 -1
  232. package/lib/module/specs/NativeGooglePayButton.js.map +1 -1
  233. package/lib/module/specs/NativeNavigationBar.js +2 -0
  234. package/lib/module/specs/NativeNavigationBar.js.map +1 -0
  235. package/lib/module/specs/NativeOnrampSdkModule.js +2 -0
  236. package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -0
  237. package/lib/module/specs/NativeStripeContainer.js +1 -1
  238. package/lib/module/specs/NativeStripeContainer.js.map +1 -1
  239. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  240. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  241. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  242. package/lib/module/types/Errors.js +1 -1
  243. package/lib/module/types/Errors.js.map +1 -1
  244. package/lib/module/types/Onramp.js +2 -0
  245. package/lib/module/types/Onramp.js.map +1 -0
  246. package/lib/module/types/PaymentIntent.js.map +1 -1
  247. package/lib/module/types/PaymentSheet.js.map +1 -1
  248. package/lib/module/types/index.js +1 -1
  249. package/lib/module/types/index.js.map +1 -1
  250. package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
  251. package/lib/typescript/src/connect/Components.d.ts +23 -0
  252. package/lib/typescript/src/connect/Components.d.ts.map +1 -0
  253. package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +22 -0
  254. package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -0
  255. package/lib/typescript/src/connect/EmbeddedComponent.d.ts +18 -0
  256. package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -0
  257. package/lib/typescript/src/connect/ModalCloseButton.d.ts +7 -0
  258. package/lib/typescript/src/connect/ModalCloseButton.d.ts.map +1 -0
  259. package/lib/typescript/src/connect/NavigationBar.d.ts +8 -0
  260. package/lib/typescript/src/connect/NavigationBar.d.ts.map +1 -0
  261. package/lib/typescript/src/connect/connectTypes.d.ts +464 -0
  262. package/lib/typescript/src/connect/connectTypes.d.ts.map +1 -0
  263. package/lib/typescript/src/events.d.ts +3 -0
  264. package/lib/typescript/src/events.d.ts.map +1 -1
  265. package/lib/typescript/src/functions.d.ts.map +1 -1
  266. package/lib/typescript/src/helpers.d.ts.map +1 -1
  267. package/lib/typescript/src/hooks/useOnramp.d.ts +158 -0
  268. package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -0
  269. package/lib/typescript/src/index.d.ts +4 -0
  270. package/lib/typescript/src/index.d.ts.map +1 -1
  271. package/lib/typescript/src/plugin/withStripe.d.ts +15 -0
  272. package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
  273. package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts +14 -0
  274. package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts.map +1 -0
  275. package/lib/typescript/src/specs/NativeNavigationBar.d.ts +11 -0
  276. package/lib/typescript/src/specs/NativeNavigationBar.d.ts.map +1 -0
  277. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +28 -0
  278. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -0
  279. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -0
  280. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  281. package/lib/typescript/src/types/Errors.d.ts +5 -0
  282. package/lib/typescript/src/types/Errors.d.ts.map +1 -1
  283. package/lib/typescript/src/types/Onramp.d.ts +275 -0
  284. package/lib/typescript/src/types/Onramp.d.ts.map +1 -0
  285. package/lib/typescript/src/types/PaymentIntent.d.ts +1 -9
  286. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  287. package/lib/typescript/src/types/PaymentMethod.d.ts +2 -8
  288. package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
  289. package/lib/typescript/src/types/PaymentSheet.d.ts +7 -0
  290. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  291. package/lib/typescript/src/types/index.d.ts +7 -1
  292. package/lib/typescript/src/types/index.d.ts.map +1 -1
  293. package/package.json +24 -12
  294. package/src/components/StripeProvider.tsx +5 -0
  295. package/src/connect/Components.tsx +279 -0
  296. package/src/connect/ConnectComponentsProvider.tsx +93 -0
  297. package/src/connect/EmbeddedComponent.tsx +407 -0
  298. package/src/connect/ModalCloseButton.tsx +44 -0
  299. package/src/connect/NavigationBar.tsx +29 -0
  300. package/src/connect/connectTypes.ts +626 -0
  301. package/src/events.ts +22 -0
  302. package/src/hooks/useOnramp.tsx +334 -0
  303. package/src/index.tsx +13 -0
  304. package/src/plugin/withStripe.ts +104 -7
  305. package/src/specs/NativeConnectAccountOnboardingView.ts +19 -0
  306. package/src/specs/NativeNavigationBar.ts +16 -0
  307. package/src/specs/NativeOnrampSdkModule.ts +47 -0
  308. package/src/specs/NativeStripeSdkModule.ts +5 -0
  309. package/src/types/Errors.ts +6 -0
  310. package/src/types/Onramp.ts +317 -0
  311. package/src/types/PaymentIntent.ts +0 -10
  312. package/src/types/PaymentMethod.ts +0 -9
  313. package/src/types/PaymentSheet.ts +7 -0
  314. package/src/types/index.ts +8 -0
  315. package/stripe-react-native.podspec +21 -8
  316. package/android/.idea/AndroidProjectSystem.xml +0 -6
  317. package/android/.idea/caches/deviceStreaming.xml +0 -703
  318. package/android/.idea/compiler.xml +0 -6
  319. package/android/.idea/gradle.xml +0 -18
  320. package/android/.idea/migrations.xml +0 -10
  321. package/android/.idea/misc.xml +0 -10
  322. package/android/.idea/runConfigurations.xml +0 -17
  323. package/android/.idea/vcs.xml +0 -6
  324. package/android/local.properties +0 -8
  325. package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +0 -146
  326. package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +0 -68
  327. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +0 -102
  328. package/android/src/main/java/com/reactnativestripesdk/utils/StripeFragment.kt +0 -52
@@ -1,20 +1,18 @@
1
1
  package com.reactnativestripesdk
2
2
 
3
- import androidx.fragment.app.FragmentActivity
4
- import com.facebook.react.bridge.Promise
3
+ import android.annotation.SuppressLint
4
+ import androidx.activity.ComponentActivity
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.reactnativestripesdk.utils.ConfirmPaymentErrorType
7
7
  import com.reactnativestripesdk.utils.ConfirmSetupIntentErrorType
8
- import com.reactnativestripesdk.utils.ErrorType
9
- import com.reactnativestripesdk.utils.StripeFragment
8
+ import com.reactnativestripesdk.utils.StripeUIManager
10
9
  import com.reactnativestripesdk.utils.createError
11
- import com.reactnativestripesdk.utils.createMissingActivityError
12
10
  import com.reactnativestripesdk.utils.createResult
13
11
  import com.reactnativestripesdk.utils.mapFromPaymentIntentResult
14
12
  import com.reactnativestripesdk.utils.mapFromSetupIntentResult
15
- import com.reactnativestripesdk.utils.removeFragment
16
13
  import com.stripe.android.ApiResultCallback
17
14
  import com.stripe.android.Stripe
15
+ import com.stripe.android.core.reactnative.ReactNativeSdkInternal
18
16
  import com.stripe.android.model.ConfirmPaymentIntentParams
19
17
  import com.stripe.android.model.ConfirmSetupIntentParams
20
18
  import com.stripe.android.model.PaymentIntent
@@ -24,12 +22,13 @@ import com.stripe.android.payments.paymentlauncher.PaymentLauncher
24
22
  import com.stripe.android.payments.paymentlauncher.PaymentResult
25
23
 
26
24
  /** Instances of this class should only be initialized with the companion's helper methods. */
27
- class PaymentLauncherFragment : StripeFragment() {
28
- private lateinit var context: ReactApplicationContext
25
+ @OptIn(ReactNativeSdkInternal::class)
26
+ class PaymentLauncherManager(
27
+ context: ReactApplicationContext,
28
+ ) : StripeUIManager(context) {
29
29
  private lateinit var stripe: Stripe
30
30
  private lateinit var publishableKey: String
31
31
  private var stripeAccountId: String? = null
32
- private lateinit var promise: Promise
33
32
 
34
33
  // Used when confirming a payment intent
35
34
  private var paymentIntentClientSecret: String? = null
@@ -52,20 +51,17 @@ class PaymentLauncherFragment : StripeFragment() {
52
51
  stripe: Stripe,
53
52
  publishableKey: String,
54
53
  stripeAccountId: String?,
55
- promise: Promise,
56
54
  paymentIntentClientSecret: String? = null,
57
55
  confirmPaymentParams: ConfirmPaymentIntentParams? = null,
58
56
  setupIntentClientSecret: String? = null,
59
57
  confirmSetupParams: ConfirmSetupIntentParams? = null,
60
58
  handleNextActionPaymentIntentClientSecret: String? = null,
61
59
  handleNextActionSetupIntentClientSecret: String? = null,
62
- ): PaymentLauncherFragment {
63
- val instance = PaymentLauncherFragment()
64
- instance.context = context
60
+ ): PaymentLauncherManager {
61
+ val instance = PaymentLauncherManager(context)
65
62
  instance.stripe = stripe
66
63
  instance.publishableKey = publishableKey
67
64
  instance.stripeAccountId = stripeAccountId
68
- instance.promise = promise
69
65
  instance.paymentIntentClientSecret = paymentIntentClientSecret
70
66
  instance.confirmPaymentParams = confirmPaymentParams
71
67
  instance.setupIntentClientSecret = setupIntentClientSecret
@@ -81,21 +77,18 @@ class PaymentLauncherFragment : StripeFragment() {
81
77
  stripe: Stripe,
82
78
  publishableKey: String,
83
79
  stripeAccountId: String?,
84
- promise: Promise,
85
80
  paymentIntentClientSecret: String,
86
81
  confirmPaymentParams: ConfirmPaymentIntentParams,
87
- ): PaymentLauncherFragment {
82
+ ): PaymentLauncherManager {
88
83
  val paymentLauncherFragment =
89
84
  create(
90
85
  context,
91
86
  stripe,
92
87
  publishableKey,
93
88
  stripeAccountId,
94
- promise,
95
89
  paymentIntentClientSecret = paymentIntentClientSecret,
96
90
  confirmPaymentParams = confirmPaymentParams,
97
91
  )
98
- addFragment(paymentLauncherFragment, context, promise)
99
92
  return paymentLauncherFragment
100
93
  }
101
94
 
@@ -105,21 +98,18 @@ class PaymentLauncherFragment : StripeFragment() {
105
98
  stripe: Stripe,
106
99
  publishableKey: String,
107
100
  stripeAccountId: String?,
108
- promise: Promise,
109
101
  setupIntentClientSecret: String,
110
102
  confirmSetupParams: ConfirmSetupIntentParams,
111
- ): PaymentLauncherFragment {
103
+ ): PaymentLauncherManager {
112
104
  val paymentLauncherFragment =
113
105
  create(
114
106
  context,
115
107
  stripe,
116
108
  publishableKey,
117
109
  stripeAccountId,
118
- promise,
119
110
  setupIntentClientSecret = setupIntentClientSecret,
120
111
  confirmSetupParams = confirmSetupParams,
121
112
  )
122
- addFragment(paymentLauncherFragment, context, promise)
123
113
  return paymentLauncherFragment
124
114
  }
125
115
 
@@ -129,19 +119,16 @@ class PaymentLauncherFragment : StripeFragment() {
129
119
  stripe: Stripe,
130
120
  publishableKey: String,
131
121
  stripeAccountId: String?,
132
- promise: Promise,
133
122
  handleNextActionPaymentIntentClientSecret: String,
134
- ): PaymentLauncherFragment {
123
+ ): PaymentLauncherManager {
135
124
  val paymentLauncherFragment =
136
125
  create(
137
126
  context,
138
127
  stripe,
139
128
  publishableKey,
140
129
  stripeAccountId,
141
- promise,
142
130
  handleNextActionPaymentIntentClientSecret = handleNextActionPaymentIntentClientSecret,
143
131
  )
144
- addFragment(paymentLauncherFragment, context, promise)
145
132
  return paymentLauncherFragment
146
133
  }
147
134
 
@@ -151,44 +138,23 @@ class PaymentLauncherFragment : StripeFragment() {
151
138
  stripe: Stripe,
152
139
  publishableKey: String,
153
140
  stripeAccountId: String?,
154
- promise: Promise,
155
141
  handleNextActionSetupIntentClientSecret: String,
156
- ): PaymentLauncherFragment {
142
+ ): PaymentLauncherManager {
157
143
  val paymentLauncherFragment =
158
144
  create(
159
145
  context,
160
146
  stripe,
161
147
  publishableKey,
162
148
  stripeAccountId,
163
- promise,
164
149
  handleNextActionSetupIntentClientSecret = handleNextActionSetupIntentClientSecret,
165
150
  )
166
- addFragment(paymentLauncherFragment, context, promise)
167
151
  return paymentLauncherFragment
168
152
  }
169
-
170
- private fun addFragment(
171
- fragment: PaymentLauncherFragment,
172
- context: ReactApplicationContext,
173
- promise: Promise,
174
- ) {
175
- (context.currentActivity as? FragmentActivity)?.let {
176
- try {
177
- it.supportFragmentManager
178
- .beginTransaction()
179
- .add(fragment, TAG)
180
- .commit()
181
- } catch (error: IllegalStateException) {
182
- promise.resolve(createError(ErrorType.Failed.toString(), error.message))
183
- }
184
- } ?: run { promise.resolve(createMissingActivityError()) }
185
- }
186
-
187
- internal const val TAG = "payment_launcher_fragment"
188
153
  }
189
154
 
190
- override fun prepare() {
191
- paymentLauncher = createPaymentLauncher()
155
+ override fun onPresent() {
156
+ val activity = getCurrentActivityOrResolveWithError(promise) ?: return
157
+ paymentLauncher = createPaymentLauncher(activity)
192
158
  if (paymentIntentClientSecret != null && confirmPaymentParams != null) {
193
159
  paymentLauncher.confirm(confirmPaymentParams!!)
194
160
  } else if (setupIntentClientSecret != null && confirmSetupParams != null) {
@@ -204,8 +170,9 @@ class PaymentLauncherFragment : StripeFragment() {
204
170
  }
205
171
  }
206
172
 
207
- private fun createPaymentLauncher(): PaymentLauncher =
208
- PaymentLauncher.create(this, publishableKey, stripeAccountId) { paymentResult ->
173
+ private fun createPaymentLauncher(activity: ComponentActivity): PaymentLauncher =
174
+ @SuppressLint("RestrictedApi")
175
+ PaymentLauncher.create(activity, signal, publishableKey, stripeAccountId) { paymentResult ->
209
176
  when (paymentResult) {
210
177
  is PaymentResult.Completed -> {
211
178
  paymentIntentClientSecret?.let {
@@ -219,14 +186,12 @@ class PaymentLauncherFragment : StripeFragment() {
219
186
  } ?: throw Exception("Failed to create Payment Launcher. No client secret provided.")
220
187
  }
221
188
  is PaymentResult.Canceled -> {
222
- promise.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), message = null))
223
- removeFragment(context)
189
+ promise?.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), message = null))
224
190
  }
225
191
  is PaymentResult.Failed -> {
226
- promise.resolve(
192
+ promise?.resolve(
227
193
  createError(ConfirmPaymentErrorType.Failed.toString(), paymentResult.throwable),
228
194
  )
229
- removeFragment(context)
230
195
  }
231
196
  }
232
197
  }
@@ -241,8 +206,7 @@ class PaymentLauncherFragment : StripeFragment() {
241
206
  expand = listOf("payment_method"),
242
207
  object : ApiResultCallback<SetupIntent> {
243
208
  override fun onError(e: Exception) {
244
- promise.resolve(createError(ConfirmSetupIntentErrorType.Failed.toString(), e))
245
- removeFragment(context)
209
+ promise?.resolve(createError(ConfirmSetupIntentErrorType.Failed.toString(), e))
246
210
  }
247
211
 
248
212
  override fun onSuccess(result: SetupIntent) {
@@ -252,19 +216,19 @@ class PaymentLauncherFragment : StripeFragment() {
252
216
  StripeIntent.Status.RequiresConfirmation,
253
217
  StripeIntent.Status.RequiresCapture,
254
218
  -> {
255
- promise.resolve(createResult("setupIntent", mapFromSetupIntentResult(result)))
219
+ promise?.resolve(createResult("setupIntent", mapFromSetupIntentResult(result)))
256
220
  }
257
221
  StripeIntent.Status.RequiresAction -> {
258
222
  if (isNextActionSuccessState(result.nextActionType)) {
259
- promise.resolve(createResult("setupIntent", mapFromSetupIntentResult(result)))
223
+ promise?.resolve(createResult("setupIntent", mapFromSetupIntentResult(result)))
260
224
  } else {
261
225
  (result.lastSetupError)?.let {
262
- promise.resolve(
226
+ promise?.resolve(
263
227
  createError(ConfirmSetupIntentErrorType.Canceled.toString(), it),
264
228
  )
265
229
  }
266
230
  ?: run {
267
- promise.resolve(
231
+ promise?.resolve(
268
232
  createError(
269
233
  ConfirmSetupIntentErrorType.Canceled.toString(),
270
234
  "Setup has been canceled",
@@ -274,7 +238,7 @@ class PaymentLauncherFragment : StripeFragment() {
274
238
  }
275
239
  }
276
240
  StripeIntent.Status.RequiresPaymentMethod -> {
277
- promise.resolve(
241
+ promise?.resolve(
278
242
  createError(
279
243
  ConfirmSetupIntentErrorType.Failed.toString(),
280
244
  result.lastSetupError,
@@ -282,7 +246,7 @@ class PaymentLauncherFragment : StripeFragment() {
282
246
  )
283
247
  }
284
248
  StripeIntent.Status.Canceled -> {
285
- promise.resolve(
249
+ promise?.resolve(
286
250
  createError(
287
251
  ConfirmSetupIntentErrorType.Canceled.toString(),
288
252
  result.lastSetupError,
@@ -290,7 +254,7 @@ class PaymentLauncherFragment : StripeFragment() {
290
254
  )
291
255
  }
292
256
  else -> {
293
- promise.resolve(
257
+ promise?.resolve(
294
258
  createError(
295
259
  ConfirmSetupIntentErrorType.Unknown.toString(),
296
260
  "unhandled error: ${result.status}",
@@ -298,7 +262,6 @@ class PaymentLauncherFragment : StripeFragment() {
298
262
  )
299
263
  }
300
264
  }
301
- removeFragment(context)
302
265
  }
303
266
  },
304
267
  )
@@ -314,8 +277,7 @@ class PaymentLauncherFragment : StripeFragment() {
314
277
  expand = listOf("payment_method"),
315
278
  object : ApiResultCallback<PaymentIntent> {
316
279
  override fun onError(e: Exception) {
317
- promise.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), e))
318
- removeFragment(context)
280
+ promise?.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), e))
319
281
  }
320
282
 
321
283
  override fun onSuccess(result: PaymentIntent) {
@@ -325,17 +287,17 @@ class PaymentLauncherFragment : StripeFragment() {
325
287
  StripeIntent.Status.RequiresConfirmation,
326
288
  StripeIntent.Status.RequiresCapture,
327
289
  -> {
328
- promise.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(result)))
290
+ promise?.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(result)))
329
291
  }
330
292
  StripeIntent.Status.RequiresAction -> {
331
293
  if (isNextActionSuccessState(result.nextActionType)) {
332
- promise.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(result)))
294
+ promise?.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(result)))
333
295
  } else {
334
296
  (result.lastPaymentError)?.let {
335
- promise.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), it))
297
+ promise?.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), it))
336
298
  }
337
299
  ?: run {
338
- promise.resolve(
300
+ promise?.resolve(
339
301
  createError(
340
302
  ConfirmPaymentErrorType.Canceled.toString(),
341
303
  "The payment has been canceled",
@@ -345,12 +307,12 @@ class PaymentLauncherFragment : StripeFragment() {
345
307
  }
346
308
  }
347
309
  StripeIntent.Status.RequiresPaymentMethod -> {
348
- promise.resolve(
310
+ promise?.resolve(
349
311
  createError(ConfirmPaymentErrorType.Failed.toString(), result.lastPaymentError),
350
312
  )
351
313
  }
352
314
  StripeIntent.Status.Canceled -> {
353
- promise.resolve(
315
+ promise?.resolve(
354
316
  createError(
355
317
  ConfirmPaymentErrorType.Canceled.toString(),
356
318
  result.lastPaymentError,
@@ -358,7 +320,7 @@ class PaymentLauncherFragment : StripeFragment() {
358
320
  )
359
321
  }
360
322
  else -> {
361
- promise.resolve(
323
+ promise?.resolve(
362
324
  createError(
363
325
  ConfirmPaymentErrorType.Unknown.toString(),
364
326
  "unhandled error: ${result.status}",
@@ -366,7 +328,6 @@ class PaymentLauncherFragment : StripeFragment() {
366
328
  )
367
329
  }
368
330
  }
369
- removeFragment(context)
370
331
  }
371
332
  },
372
333
  )
@@ -381,6 +342,7 @@ class PaymentLauncherFragment : StripeFragment() {
381
342
  StripeIntent.NextActionType.DisplayOxxoDetails,
382
343
  StripeIntent.NextActionType.DisplayBoletoDetails,
383
344
  StripeIntent.NextActionType.DisplayKonbiniDetails,
345
+ StripeIntent.NextActionType.DisplayPayNowDetails,
384
346
  StripeIntent.NextActionType.VerifyWithMicrodeposits,
385
347
  StripeIntent.NextActionType.DisplayMultibancoDetails,
386
348
  StripeIntent.NextActionType.DisplayPayNowDetails,
@@ -394,6 +356,7 @@ class PaymentLauncherFragment : StripeFragment() {
394
356
  StripeIntent.NextActionType.UpiAwaitNotification,
395
357
  StripeIntent.NextActionType.CashAppRedirect,
396
358
  StripeIntent.NextActionType.SwishRedirect,
359
+ StripeIntent.NextActionType.DisplayPromptPayDetails,
397
360
  null,
398
361
  -> false
399
362
  }
@@ -1,12 +1,12 @@
1
1
  package com.reactnativestripesdk
2
2
 
3
3
  import com.facebook.react.bridge.ReadableMap
4
- import com.reactnativestripesdk.utils.getBooleanOrFalse
5
- import com.reactnativestripesdk.utils.getMapOrNull
4
+ import com.reactnativestripesdk.utils.getBooleanOr
6
5
  import com.reactnativestripesdk.utils.getValOr
7
6
  import com.reactnativestripesdk.utils.mapToBillingDetails
8
7
  import com.reactnativestripesdk.utils.mapToMetadata
9
8
  import com.reactnativestripesdk.utils.mapToPaymentIntentFutureUsage
9
+ import com.reactnativestripesdk.utils.mapToShippingDetails
10
10
  import com.reactnativestripesdk.utils.mapToUSBankAccountHolderType
11
11
  import com.reactnativestripesdk.utils.mapToUSBankAccountType
12
12
  import com.stripe.android.model.ConfirmPaymentIntentParams
@@ -25,11 +25,11 @@ class PaymentMethodCreateParamsFactory(
25
25
  ) {
26
26
  private val billingDetailsParams =
27
27
  mapToBillingDetails(
28
- getMapOrNull(paymentMethodData, "billingDetails"),
28
+ paymentMethodData?.getMap("billingDetails"),
29
29
  cardFieldView?.cardAddress ?: cardFormView?.cardAddress,
30
30
  )
31
31
  private val metadataParams: Map<String, String>? =
32
- mapToMetadata(getMapOrNull(paymentMethodData, "metadata"))
32
+ mapToMetadata(paymentMethodData?.getMap("metadata"))
33
33
 
34
34
  @Throws(PaymentMethodCreateParamsException::class)
35
35
  fun createPaymentMethodParams(paymentMethodType: PaymentMethod.Type): PaymentMethodCreateParams {
@@ -43,7 +43,6 @@ class PaymentMethodCreateParamsFactory(
43
43
  PaymentMethod.Type.Billie -> createBillieParams()
44
44
  PaymentMethod.Type.SepaDebit -> createSepaParams()
45
45
  PaymentMethod.Type.Oxxo -> createOXXOParams()
46
- PaymentMethod.Type.Giropay -> createGiropayParams()
47
46
  PaymentMethod.Type.Eps -> createEPSParams()
48
47
  PaymentMethod.Type.GrabPay -> createGrabPayParams()
49
48
  PaymentMethod.Type.P24 -> createP24Params()
@@ -132,15 +131,6 @@ class PaymentMethodCreateParamsFactory(
132
131
  throw PaymentMethodCreateParamsException("You must provide billing details")
133
132
  }
134
133
 
135
- @Throws(PaymentMethodCreateParamsException::class)
136
- private fun createGiropayParams(): PaymentMethodCreateParams {
137
- billingDetailsParams?.let {
138
- return PaymentMethodCreateParams.createGiropay(billingDetails = it, metadata = metadataParams)
139
- }
140
-
141
- throw PaymentMethodCreateParamsException("You must provide billing details")
142
- }
143
-
144
134
  @Throws(PaymentMethodCreateParamsException::class)
145
135
  private fun createEPSParams(): PaymentMethodCreateParams {
146
136
  billingDetailsParams?.let {
@@ -167,7 +157,7 @@ class PaymentMethodCreateParamsFactory(
167
157
 
168
158
  @Throws(PaymentMethodCreateParamsException::class)
169
159
  private fun createFpxParams(): PaymentMethodCreateParams {
170
- val bank = getBooleanOrFalse(paymentMethodData, "testOfflineBank").let { "test_offline_bank" }
160
+ val bank = paymentMethodData.getBooleanOr("testOfflineBank", false).let { "test_offline_bank" }
171
161
  return PaymentMethodCreateParams.create(
172
162
  PaymentMethodCreateParams.Fpx(bank),
173
163
  metadata = metadataParams,
@@ -189,7 +179,7 @@ class PaymentMethodCreateParamsFactory(
189
179
  @Throws(PaymentMethodCreateParamsException::class)
190
180
  private fun createAuBecsDebitParams(): PaymentMethodCreateParams {
191
181
  val formDetails =
192
- getMapOrNull(paymentMethodData, "formDetails")
182
+ paymentMethodData?.getMap("formDetails")
193
183
  ?: run { throw PaymentMethodCreateParamsException("You must provide form details") }
194
184
 
195
185
  val bsbNumber = getValOr(formDetails, "bsbNumber") as String
@@ -266,7 +256,6 @@ class PaymentMethodCreateParamsFactory(
266
256
  PaymentMethod.Type.Billie,
267
257
  PaymentMethod.Type.SepaDebit,
268
258
  PaymentMethod.Type.Oxxo,
269
- PaymentMethod.Type.Giropay,
270
259
  PaymentMethod.Type.Eps,
271
260
  PaymentMethod.Type.GrabPay,
272
261
  PaymentMethod.Type.P24,
@@ -415,10 +404,12 @@ class PaymentMethodCreateParamsFactory(
415
404
  }
416
405
 
417
406
  val params = createAffirmParams()
407
+ val shippingDetails = mapToShippingDetails(paymentMethodData?.getMap("shippingDetails"))
418
408
 
419
409
  return ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
420
410
  paymentMethodCreateParams = params,
421
411
  clientSecret = clientSecret,
412
+ shipping = shippingDetails,
422
413
  setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
423
414
  mandateData = buildMandateDataParams(),
424
415
  )
@@ -455,9 +446,9 @@ class PaymentMethodCreateParamsFactory(
455
446
  }
456
447
 
457
448
  private fun buildMandateDataParams(): MandateDataParams? {
458
- getMapOrNull(paymentMethodData, "mandateData")?.let { mandateData ->
459
- getMapOrNull(mandateData, "customerAcceptance")?.let { customerAcceptance ->
460
- getMapOrNull(customerAcceptance, "online")?.let { onlineParams ->
449
+ paymentMethodData?.getMap("mandateData")?.let { mandateData ->
450
+ mandateData.getMap("customerAcceptance")?.let { customerAcceptance ->
451
+ customerAcceptance.getMap("online")?.let { onlineParams ->
461
452
  return MandateDataParams(
462
453
  MandateDataParams.Type.Online(
463
454
  ipAddress = getValOr(onlineParams, "ipAddress", "") ?: "",
@@ -11,8 +11,6 @@ import androidx.compose.ui.text.style.TextDecoration
11
11
  import androidx.compose.ui.unit.TextUnit
12
12
  import com.facebook.react.bridge.Arguments
13
13
  import com.facebook.react.bridge.WritableMap
14
- import com.reactnativestripesdk.getBase64FromBitmap
15
- import com.reactnativestripesdk.getBitmapFromDrawable
16
14
  import com.reactnativestripesdk.utils.mapFromPaymentSheetBillingDetails
17
15
  import com.stripe.android.paymentelement.EmbeddedPaymentElement
18
16
  import kotlinx.coroutines.Dispatchers
@@ -50,7 +48,7 @@ suspend fun EmbeddedPaymentElement.PaymentOptionDisplayData.toWritableMap(): Wri
50
48
  getBase64FromBitmap(bitmap)
51
49
  } ?: ""
52
50
  }
53
- } catch (e: Exception) {
51
+ } catch (_: Exception) {
54
52
  // If imageLoader fails or times out, return empty string
55
53
  ""
56
54
  }
@@ -120,17 +118,17 @@ fun AnnotatedString.toHtmlString(): String {
120
118
  }
121
119
  }
122
120
  AnnotationType.STRING_ANNOTATION -> {
123
- val stringAnnotation = annotation.data as AnnotatedString.Range<String>
121
+ val stringAnnotation = annotation.data as AnnotatedString.Range<*>
124
122
  when (stringAnnotation.tag) {
125
123
  "URL", "LINK_TAG" -> {
126
124
  val url = stringAnnotation.item
127
- htmlBuilder.append("<a href=\"${escapeHtml(url)}\">")
125
+ htmlBuilder.append("<a href=\"${escapeHtml(url as String)}\">")
128
126
  openTags.add(TagInfo(annotation.end, "</a>"))
129
127
  }
130
128
  }
131
129
  }
132
130
  AnnotationType.LINK_ANNOTATION -> {
133
- val linkAnnotation = annotation.data as AnnotatedString.Range<LinkAnnotation>
131
+ val linkAnnotation = annotation.data as AnnotatedString.Range<*>
134
132
  when (val linkItem = linkAnnotation.item) {
135
133
  is LinkAnnotation.Url -> {
136
134
  htmlBuilder.append("<a href=\"${escapeHtml(linkItem.url)}\">")