@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
@@ -0,0 +1,10 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import <React/RCTViewComponentView.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ @interface NavigationBarComponentView : RCTViewComponentView
7
+
8
+ @end
9
+
10
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,86 @@
1
+ #import "NavigationBarComponentView.h"
2
+
3
+ #import <react/renderer/components/rnstripe/ComponentDescriptors.h>
4
+ #import <react/renderer/components/rnstripe/EventEmitters.h>
5
+ #import <react/renderer/components/rnstripe/Props.h>
6
+ #import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
7
+
8
+ #import <React/RCTConversions.h>
9
+ #import <React/RCTFabricComponentsPlugins.h>
10
+ #import "StripeNewArchConversions.h"
11
+ #import "StripeSwiftInterop.h"
12
+
13
+ using namespace facebook::react;
14
+ using namespace stripe::react;
15
+
16
+ @interface NavigationBarComponentView () <RCTNavigationBarViewProtocol>
17
+ @end
18
+
19
+ @implementation NavigationBarComponentView {
20
+ NavigationBarView *_view;
21
+ }
22
+
23
+ // Needed because of this: https://github.com/facebook/react-native/pull/37274
24
+ + (void)load
25
+ {
26
+ [super load];
27
+ }
28
+
29
+ - (instancetype)initWithFrame:(CGRect)frame
30
+ {
31
+ if (self = [super initWithFrame:frame]) {
32
+ static const auto defaultProps = std::make_shared<const NavigationBarProps>();
33
+ _props = defaultProps;
34
+ [self prepareView];
35
+ }
36
+
37
+ return self;
38
+ }
39
+
40
+ - (void)prepareView
41
+ {
42
+ _view = [[NavigationBarView alloc] initWithFrame:self.frame];
43
+ self.contentView = _view;
44
+
45
+ __weak __typeof(self) weakSelf = self;
46
+
47
+ _view.onCloseButtonPress = ^(NSDictionary *event) {
48
+ __typeof(self) strongSelf = weakSelf;
49
+ if (!strongSelf || !strongSelf->_eventEmitter) {
50
+ return;
51
+ }
52
+ NavigationBarEventEmitter::OnCloseButtonPress emitterEvent = {};
53
+ std::static_pointer_cast<const NavigationBarEventEmitter>(strongSelf->_eventEmitter)
54
+ ->onCloseButtonPress(std::move(emitterEvent));
55
+ };
56
+ }
57
+
58
+ - (void)updateProps:(const facebook::react::Props::Shared &)props
59
+ oldProps:(const facebook::react::Props::Shared &)oldProps
60
+ {
61
+ const auto &newViewProps = *std::static_pointer_cast<const NavigationBarProps>(props);
62
+
63
+ _view.title = RCTNSStringFromStringNilIfEmpty(newViewProps.title);
64
+
65
+ [super updateProps:props oldProps:oldProps];
66
+ }
67
+
68
+ #pragma mark - RCTComponentViewProtocol
69
+
70
+ + (ComponentDescriptorProvider)componentDescriptorProvider
71
+ {
72
+ return concreteComponentDescriptorProvider<NavigationBarComponentDescriptor>();
73
+ }
74
+
75
+ - (void)prepareForRecycle
76
+ {
77
+ [super prepareForRecycle];
78
+ [self prepareView];
79
+ }
80
+
81
+ @end
82
+
83
+ Class<RCTComponentViewProtocol> NavigationBarCls(void)
84
+ {
85
+ return NavigationBarComponentView.class;
86
+ }
@@ -23,5 +23,6 @@
23
23
  - (void)emitEmbeddedPaymentElementRowSelectionImmediateAction;
24
24
  - (void)emitEmbeddedPaymentElementLoadingFailed:(NSDictionary *)value;
25
25
  - (void)emitOnCustomPaymentMethodConfirmHandlerCallback:(NSDictionary *)value;
26
+ - (void)emitOnCheckoutClientSecretRequested:(NSDictionary *)value;
26
27
  @end
27
28
 
@@ -23,7 +23,8 @@
23
23
  @"embeddedPaymentElementFormSheetConfirmComplete",
24
24
  @"embeddedPaymentElementRowSelectionImmediateAction",
25
25
  @"embeddedPaymentElementLoadingFailed",
26
- @"onCustomPaymentMethodConfirmHandlerCallback"
26
+ @"onCustomPaymentMethodConfirmHandlerCallback",
27
+ @"onCheckoutClientSecretRequested"
27
28
  ];
28
29
  }
29
30
 
@@ -122,4 +123,9 @@
122
123
  [self sendEventWithName:@"onCustomPaymentMethodConfirmHandlerCallback" body:value];
123
124
  }
124
125
 
126
+ - (void)emitOnCheckoutClientSecretRequested:(NSDictionary *)value
127
+ {
128
+ [self sendEventWithName:@"onCheckoutClientSecretRequested" body:value];
129
+ }
130
+
125
131
  @end
@@ -2,12 +2,12 @@ import Foundation
2
2
  import Stripe
3
3
 
4
4
  class PaymentMethodFactory {
5
- var billingDetailsParams: STPPaymentMethodBillingDetails? = nil
6
- var paymentMethodData: NSDictionary? = nil
7
- var paymentMethodOptions: NSDictionary? = nil
8
- var cardFieldView: CardFieldView? = nil
9
- var cardFormView: CardFormView? = nil
10
- var metadata: [String: String]? = nil
5
+ var billingDetailsParams: STPPaymentMethodBillingDetails?
6
+ var paymentMethodData: NSDictionary?
7
+ var paymentMethodOptions: NSDictionary?
8
+ var cardFieldView: CardFieldView?
9
+ var cardFormView: CardFormView?
10
+ var metadata: [String: String]?
11
11
 
12
12
  init(paymentMethodData: NSDictionary?, options: NSDictionary, cardFieldView: CardFieldView?, cardFormView: CardFormView?) {
13
13
  self.paymentMethodData = paymentMethodData
@@ -39,8 +39,6 @@ class PaymentMethodFactory {
39
39
  return try createBilliePaymentMethodParams()
40
40
  case STPPaymentMethodType.SEPADebit:
41
41
  return try createSepaPaymentMethodParams()
42
- case STPPaymentMethodType.giropay:
43
- return try createGiropayPaymentMethodParams()
44
42
  case STPPaymentMethodType.EPS:
45
43
  return try createEPSPaymentMethodParams()
46
44
  case STPPaymentMethodType.grabPay:
@@ -63,8 +61,8 @@ class PaymentMethodFactory {
63
61
  return try createCashAppPaymentMethodParams()
64
62
  case STPPaymentMethodType.revolutPay:
65
63
  return try createRevolutPayPaymentMethodParams()
66
- // case STPPaymentMethodType.weChatPay:
67
- // return try createWeChatPayPaymentMethodParams()
64
+ // case STPPaymentMethodType.weChatPay:
65
+ // return try createWeChatPayPaymentMethodParams()
68
66
  default:
69
67
  throw PaymentMethodError.paymentNotSupported
70
68
  }
@@ -96,8 +94,6 @@ class PaymentMethodFactory {
96
94
  return nil
97
95
  case STPPaymentMethodType.OXXO:
98
96
  return nil
99
- case STPPaymentMethodType.giropay:
100
- return nil
101
97
  case STPPaymentMethodType.grabPay:
102
98
  return nil
103
99
  case STPPaymentMethodType.przelewy24:
@@ -128,11 +124,11 @@ class PaymentMethodFactory {
128
124
  }
129
125
  }
130
126
 
131
- // private func createWeChatPayPaymentMethodParams() throws -> STPPaymentMethodParams {
132
- // let params = STPPaymentMethodWeChatPayParams()
133
- // return STPPaymentMethodParams(weChatPay: params, billingDetails: billingDetailsParams, metadata: metadata)
134
- // }
135
- //
127
+ // private func createWeChatPayPaymentMethodParams() throws -> STPPaymentMethodParams {
128
+ // let params = STPPaymentMethodWeChatPayParams()
129
+ // return STPPaymentMethodParams(weChatPay: params, billingDetails: billingDetailsParams, metadata: metadata)
130
+ // }
131
+ //
136
132
 
137
133
  private func createUSBankAccountPaymentMethodOptions() throws -> STPConfirmPaymentMethodOptions {
138
134
  let paymentOptions = STPConfirmPaymentMethodOptions()
@@ -159,26 +155,25 @@ class PaymentMethodFactory {
159
155
  params.bankName = bankName
160
156
  }
161
157
 
162
-
163
- return STPPaymentMethodParams(iDEAL: params, billingDetails: billingDetailsParams, metadata: metadata)
158
+ return STPPaymentMethodParams(iDEAL: params, billingDetails: billingDetailsParams, metadata: metadata)
164
159
  }
165
160
 
166
161
  private func createGrabpayPaymentMethodParams() -> STPPaymentMethodParams {
167
162
  let params = STPPaymentMethodGrabPayParams()
168
163
 
169
- return STPPaymentMethodParams(grabPay: params, billingDetails: billingDetailsParams, metadata: metadata)
164
+ return STPPaymentMethodParams(grabPay: params, billingDetails: billingDetailsParams, metadata: metadata)
170
165
  }
171
166
 
172
167
  private func createCardPaymentMethodParams() throws -> STPPaymentMethodParams {
173
168
  if let token = paymentMethodData?["token"] as? String {
174
169
  let methodParams = STPPaymentMethodCardParams()
175
170
  methodParams.token = token
176
- return STPPaymentMethodParams(card: methodParams, billingDetails: billingDetailsParams, metadata: metadata)
171
+ return STPPaymentMethodParams(card: methodParams, billingDetails: billingDetailsParams, metadata: metadata)
177
172
  }
178
173
 
179
174
  if let params = cardFieldView?.cardParams as? STPPaymentMethodParams {
180
175
  if let postalCode = cardFieldView?.cardPostalCode{
181
- if (billingDetailsParams == nil) {
176
+ if billingDetailsParams == nil {
182
177
  let bd = STPPaymentMethodBillingDetails()
183
178
  bd.address = STPPaymentMethodAddress()
184
179
  bd.address?.postalCode = postalCode
@@ -192,7 +187,7 @@ class PaymentMethodFactory {
192
187
  }
193
188
  if let params = cardFormView?.cardParams as? STPPaymentMethodCardParams {
194
189
  if let address = cardFormView?.cardForm?.cardParams?.billingDetails?.address {
195
- if (billingDetailsParams == nil) {
190
+ if billingDetailsParams == nil {
196
191
  let bd = STPPaymentMethodBillingDetails()
197
192
  bd.address = STPPaymentMethodAddress()
198
193
  bd.address?.postalCode = address.postalCode
@@ -209,7 +204,6 @@ class PaymentMethodFactory {
209
204
  throw PaymentMethodError.cardPaymentMissingParams
210
205
  }
211
206
 
212
-
213
207
  private func createCardPaymentMethodOptions() -> STPConfirmPaymentMethodOptions? {
214
208
  let cvc = paymentMethodData?["cvc"] as? String
215
209
  guard cvc != nil else {
@@ -217,7 +211,7 @@ class PaymentMethodFactory {
217
211
  }
218
212
 
219
213
  let cardOptions = STPConfirmCardOptions()
220
- cardOptions.cvc = cvc;
214
+ cardOptions.cvc = cvc
221
215
  let paymentMethodOptions = STPConfirmPaymentMethodOptions()
222
216
  paymentMethodOptions.cardOptions = cardOptions
223
217
 
@@ -231,7 +225,7 @@ class PaymentMethodFactory {
231
225
  params.rawBankString = "test_offline_bank"
232
226
  }
233
227
 
234
- return STPPaymentMethodParams(fpx: params, billingDetails: billingDetailsParams, metadata: metadata)
228
+ return STPPaymentMethodParams(fpx: params, billingDetails: billingDetailsParams, metadata: metadata)
235
229
  }
236
230
 
237
231
  private func createAlipayPaymentMethodParams() throws -> STPPaymentMethodParams {
@@ -303,16 +297,6 @@ class PaymentMethodFactory {
303
297
  return STPPaymentMethodParams(oxxo: params, billingDetails: billingDetails, metadata: metadata)
304
298
  }
305
299
 
306
- private func createGiropayPaymentMethodParams() throws -> STPPaymentMethodParams {
307
- let params = STPPaymentMethodGiropayParams()
308
-
309
- guard let billingDetails = billingDetailsParams else {
310
- throw PaymentMethodError.giropayPaymentMissingParams
311
- }
312
-
313
- return STPPaymentMethodParams(giropay: params, billingDetails: billingDetails, metadata: metadata)
314
- }
315
-
316
300
  private func createEPSPaymentMethodParams() throws -> STPPaymentMethodParams {
317
301
  let params = STPPaymentMethodEPSParams()
318
302
 
@@ -380,8 +364,10 @@ class PaymentMethodFactory {
380
364
  }
381
365
 
382
366
  private func createAffirmPaymentMethodParams() throws -> STPPaymentMethodParams {
383
- let params = STPPaymentMethodAffirmParams()
384
- return STPPaymentMethodParams(affirm: params, metadata: metadata)
367
+ let affirmParams = STPPaymentMethodAffirmParams()
368
+ let params = STPPaymentMethodParams(affirm: affirmParams, metadata: metadata)
369
+ params.billingDetails = billingDetailsParams
370
+ return params
385
371
  }
386
372
 
387
373
  private func createCashAppPaymentMethodParams() throws -> STPPaymentMethodParams {
@@ -419,7 +405,6 @@ enum PaymentMethodError: Error {
419
405
  case bancontactPaymentMissingParams
420
406
  case billiePaymentMissingParams
421
407
  case sepaPaymentMissingParams
422
- case giropayPaymentMissingParams
423
408
  case p24PaymentMissingParams
424
409
  case afterpayClearpayPaymentMissingParams
425
410
  // Klarna no longer requires email and country in billing details
@@ -434,8 +419,6 @@ extension PaymentMethodError: LocalizedError {
434
419
  switch self {
435
420
  case .cardPaymentMissingParams:
436
421
  return NSLocalizedString("Card details not complete", comment: "Create payment error")
437
- case .giropayPaymentMissingParams:
438
- return NSLocalizedString("You must provide billing details", comment: "Create payment error")
439
422
  case .idealPaymentMissingParams:
440
423
  return NSLocalizedString("You must provide bank name", comment: "Create payment error")
441
424
  case .p24PaymentMissingParams:
@@ -32,7 +32,7 @@ extension EmbeddedPaymentElement.PaymentOptionDisplayData {
32
32
  "line1": addr.line1 ?? "",
33
33
  "line2": addr.line2 ?? "",
34
34
  "postalCode": addr.postalCode ?? "",
35
- "state": addr.state ?? ""
35
+ "state": addr.state ?? "",
36
36
  ]
37
37
  }()
38
38
 
@@ -40,7 +40,7 @@ extension EmbeddedPaymentElement.PaymentOptionDisplayData {
40
40
  "name": billing.name ?? "",
41
41
  "email": billing.email ?? "",
42
42
  "phone": billing.phone ?? "",
43
- "address": addressDict
43
+ "address": addressDict,
44
44
  ]
45
45
  }()
46
46
 
@@ -53,7 +53,7 @@ extension EmbeddedPaymentElement.PaymentOptionDisplayData {
53
53
  from: NSRange(location: 0, length: mandateText.length),
54
54
  documentAttributes: [
55
55
  .documentType: NSAttributedString.DocumentType.html,
56
- .characterEncoding: String.Encoding.utf8.rawValue
56
+ .characterEncoding: String.Encoding.utf8.rawValue,
57
57
  ]
58
58
  )
59
59
  return String(data: htmlData, encoding: .utf8)
@@ -69,7 +69,7 @@ extension EmbeddedPaymentElement.PaymentOptionDisplayData {
69
69
  "label": label,
70
70
  "billingDetails": billingDetailsDict,
71
71
  "paymentMethodType": paymentMethodType,
72
- "mandateHTML": mandateTextHTML
72
+ "mandateHTML": mandateTextHTML,
73
73
  ]
74
74
  }
75
75
  }
@@ -12,7 +12,7 @@ internal class PaymentPassFinder: NSObject {
12
12
  case CURRENT_DEVICE
13
13
  case PAIRED_DEVICE
14
14
  }
15
-
15
+
16
16
  class func findPassWith(
17
17
  primaryAccountIdentifier: String,
18
18
  hasPairedAppleWatch: Bool,
@@ -27,21 +27,21 @@ internal class PaymentPassFinder: NSObject {
27
27
  .first(where: { $0.paymentPass?.primaryAccountIdentifier == primaryAccountIdentifier && $0.paymentPass?.passActivationState != .deactivated && !$0.isRemotePass })
28
28
  }
29
29
  }()
30
-
30
+
31
31
  var passLocations: [PassLocation] = []
32
- if (existingPassOnDevice != nil) {
32
+ if existingPassOnDevice != nil {
33
33
  passLocations.append(.CURRENT_DEVICE)
34
34
  }
35
-
35
+
36
36
  // We're done here if the user does not have a paired Apple Watch
37
- if (!hasPairedAppleWatch) {
37
+ if !hasPairedAppleWatch {
38
38
  completion(
39
39
  passLocations.count < 1,
40
40
  passLocations
41
41
  )
42
42
  return
43
43
  }
44
-
44
+
45
45
  let existingPassOnPairedDevices: PKPass? = {
46
46
  if #available(iOS 13.4, *) {
47
47
  return PKPassLibrary().remoteSecureElementPasses
@@ -51,12 +51,11 @@ internal class PaymentPassFinder: NSObject {
51
51
  .first(where: { $0.paymentPass?.primaryAccountIdentifier == primaryAccountIdentifier && $0.paymentPass?.passActivationState != .deactivated })
52
52
  }
53
53
  }()
54
-
55
-
56
- if (existingPassOnPairedDevices != nil) {
54
+
55
+ if existingPassOnPairedDevices != nil {
57
56
  passLocations.append(.PAIRED_DEVICE)
58
57
  }
59
-
58
+
60
59
  completion(
61
60
  passLocations.count < 2,
62
61
  passLocations