@stripe/stripe-react-native 0.71.0 → 0.72.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.
Files changed (66) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementView.kt +7 -103
  3. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementViewManager.kt +1 -5
  4. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +0 -26
  5. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +6 -21
  6. package/android/src/main/java/com/reactnativestripesdk/LinkControllerManager.kt +59 -18
  7. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +14 -0
  8. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +6 -50
  9. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +38 -187
  10. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +2 -0
  11. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
  12. package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +1 -0
  13. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +0 -60
  14. package/ios/CurrencySelectorElementView.swift +18 -129
  15. package/ios/Mappers.swift +2 -0
  16. package/ios/PaymentMethodFactory.swift +14 -1
  17. package/ios/StripeSdk.mm +7 -0
  18. package/ios/StripeSdkImpl+Checkout.swift +35 -259
  19. package/ios/StripeSdkImpl+Embedded.swift +5 -28
  20. package/ios/StripeSdkImpl+LinkController.swift +40 -2
  21. package/ios/StripeSdkImpl+PaymentSheet.swift +2 -15
  22. package/ios/StripeSdkImpl.swift +2 -4
  23. package/lib/commonjs/connect/EmbeddedComponent.js +2 -2
  24. package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
  25. package/lib/commonjs/functions.js +1 -1
  26. package/lib/commonjs/functions.js.map +1 -1
  27. package/lib/commonjs/hooks/useLinkController.js +1 -1
  28. package/lib/commonjs/hooks/useLinkController.js.map +1 -1
  29. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  30. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  31. package/lib/module/connect/EmbeddedComponent.js +2 -2
  32. package/lib/module/connect/EmbeddedComponent.js.map +1 -1
  33. package/lib/module/functions.js +1 -1
  34. package/lib/module/functions.js.map +1 -1
  35. package/lib/module/hooks/useLinkController.js +1 -1
  36. package/lib/module/hooks/useLinkController.js.map +1 -1
  37. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  38. package/lib/module/types/PaymentIntent.js.map +1 -1
  39. package/lib/typescript/src/connect/EmbeddedComponent.d.ts +1 -0
  40. package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -1
  41. package/lib/typescript/src/functions.d.ts +11 -0
  42. package/lib/typescript/src/functions.d.ts.map +1 -1
  43. package/lib/typescript/src/hooks/useLinkController.d.ts +7 -0
  44. package/lib/typescript/src/hooks/useLinkController.d.ts.map +1 -1
  45. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +4 -0
  46. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  47. package/lib/typescript/src/types/LinkController.d.ts +10 -5
  48. package/lib/typescript/src/types/LinkController.d.ts.map +1 -1
  49. package/lib/typescript/src/types/PaymentIntent.d.ts +9 -1
  50. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/connect/EmbeddedComponent.tsx +14 -2
  53. package/src/functions.ts +26 -0
  54. package/src/hooks/useLinkController.tsx +24 -1
  55. package/src/specs/NativeStripeSdkModule.ts +5 -0
  56. package/src/types/LinkController.ts +9 -5
  57. package/src/types/PaymentIntent.ts +11 -1
  58. package/stripe-react-native.podspec +1 -1
  59. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorAppearance.kt +0 -229
  60. package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutAddressUpdate.kt +0 -45
  61. package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutMappers.kt +0 -127
  62. package/android/src/test/java/com/reactnativestripesdk/CurrencySelectorAppearanceTest.kt +0 -137
  63. package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutMappersTest.kt +0 -98
  64. package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutTestFixtures.java +0 -57
  65. package/ios/CurrencySelectorAppearance.swift +0 -120
  66. package/ios/Mappers+Checkout.swift +0 -337
@@ -1 +1 @@
1
- {"version":3,"file":"LinkController.d.ts","sourceRoot":"","sources":["../../../../src/types/LinkController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEjE;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oGAAoG;IACpG,2BAA2B,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACtD,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,wLAAwL;IACxL,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAA;CAAE,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB;IACE,iEAAiE;IACjE,aAAa,EAAE,mBAAmB,CAAC;IACnC,qEAAqE;IACrE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GACD;IACE,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC;;;OAGG;IACH,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;CACzC,CAAC"}
1
+ {"version":3,"file":"LinkController.d.ts","sourceRoot":"","sources":["../../../../src/types/LinkController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEjE;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oGAAoG;IACpG,2BAA2B,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACtD,oHAAoH;IACpH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,wLAAwL;IACxL,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAA;CAAE,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAChC;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAA;CAAE,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB;IACE,iEAAiE;IACjE,aAAa,EAAE,mBAAmB,CAAC;IACnC,qEAAqE;IACrE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GACD;IACE,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC;;;OAGG;IACH,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;CACzC,CAAC"}
@@ -27,7 +27,7 @@ export interface Result {
27
27
  nextAction: NextAction | null;
28
28
  }
29
29
  export type CaptureMethod = 'Automatic' | 'Manual';
30
- export type ConfirmParams = CardParams | IdealParams | OxxoParams | MultibancoParams | P24Params | AlipayParams | AlmaParams | SepaParams | EpsParams | AuBecsDebitParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams | BillieParams | USBankAccountParams | PayPalParams | AffirmParams | CashAppParams | RevolutPayParams | PayByBankParams;
30
+ export type ConfirmParams = CardParams | IdealParams | OxxoParams | MultibancoParams | P24Params | AlipayParams | AlmaParams | SepaParams | EpsParams | AuBecsDebitParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams | BillieParams | USBankAccountParams | PayPalParams | AffirmParams | CashAppParams | RevolutPayParams | PayByBankParams | TwintParams;
31
31
  export type ConfirmOptions = PaymentMethod.ConfirmOptions;
32
32
  export type LastPaymentError = StripeError<string> & {
33
33
  paymentMethod: PaymentMethodResult;
@@ -144,6 +144,14 @@ export interface BancontactParams {
144
144
  metadata?: MetaData;
145
145
  };
146
146
  }
147
+ export interface TwintParams {
148
+ paymentMethodType: 'Twint';
149
+ paymentMethodData: {
150
+ billingDetails: BillingDetails;
151
+ mandateData?: MandateData;
152
+ metadata?: MetaData;
153
+ };
154
+ }
147
155
  export type BillieParams = {
148
156
  paymentMethodType: 'Billie';
149
157
  paymentMethodData: {
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentIntent.d.ts","sourceRoot":"","sources":["../../../../src/types/PaymentIntent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACxE,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UA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C;CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-react-native",
3
- "version": "0.71.0",
3
+ "version": "0.72.0",
4
4
  "author": "Stripe",
5
5
  "description": "Stripe SDK for React Native",
6
6
  "main": "lib/commonjs/index",
@@ -754,7 +754,7 @@ export function EmbeddedComponent(props: EmbeddedComponentProps) {
754
754
  if (navigationType !== 'click') return true;
755
755
 
756
756
  // Allow navigation within allowed Stripe domains (matching iOS SDK behavior)
757
- if (ALLOWED_STRIPE_HOSTS.some((host) => url.includes(host))) {
757
+ if (isAllowedStripeHost(url)) {
758
758
  return true; // Allow in-WebView navigation
759
759
  }
760
760
 
@@ -865,12 +865,24 @@ function isValidUrl(url: string): boolean {
865
865
  }
866
866
  }
867
867
 
868
+ export function isAllowedStripeHost(url: string): boolean {
869
+ try {
870
+ const parsedUrl = new URL(url);
871
+ return ALLOWED_STRIPE_HOSTS.some(
872
+ (host) => parsedUrl.hostname === host || parsedUrl.host === host
873
+ );
874
+ } catch {
875
+ return false;
876
+ }
877
+ }
878
+
868
879
  // Detects Stripe CSV export URLs
869
880
  function isCsvExportUrl(url: string): boolean {
870
881
  try {
871
882
  const parsedUrl = new URL(url);
872
883
  return (
873
- parsedUrl.hostname.includes('stripe-data-exports') ||
884
+ parsedUrl.hostname === 'stripe-data-exports.com' ||
885
+ parsedUrl.hostname.endsWith('.stripe-data-exports.com') ||
874
886
  parsedUrl.pathname.includes('stripe-data-exports')
875
887
  );
876
888
  } catch {
package/src/functions.ts CHANGED
@@ -1007,3 +1007,29 @@ export const presentLinkController =
1007
1007
  return { error };
1008
1008
  }
1009
1009
  };
1010
+
1011
+ /**
1012
+ * Confirms a SetupIntent using the payment method from the most recent
1013
+ * `presentLinkController` call. Must be called after a successful `presentLinkController`.
1014
+ *
1015
+ * Provide a fresh SetupIntent client secret for each confirmation; reusing a
1016
+ * consumed secret will fail.
1017
+ *
1018
+ * @PrivatePreview This API is in private preview and may change without notice.
1019
+ * It will have no effect unless your Stripe account is enrolled in the private preview.
1020
+ */
1021
+ export const confirmLinkControllerSetupIntent = async (
1022
+ clientSecret: string
1023
+ ): Promise<LinkController.ConfirmSetupIntentResult> => {
1024
+ try {
1025
+ const { error } = await NativeStripeSdk.confirmLinkControllerSetupIntent({
1026
+ clientSecret,
1027
+ });
1028
+ if (error) {
1029
+ return { error };
1030
+ }
1031
+ return {};
1032
+ } catch (error: any) {
1033
+ return { error };
1034
+ }
1035
+ };
@@ -1,5 +1,9 @@
1
1
  import { useState, useCallback } from 'react';
2
- import { initLinkController, presentLinkController } from '../functions';
2
+ import {
3
+ initLinkController,
4
+ presentLinkController,
5
+ confirmLinkControllerSetupIntent,
6
+ } from '../functions';
3
7
  import type { LinkController } from '../types';
4
8
 
5
9
  /**
@@ -34,6 +38,18 @@ export function useLinkController() {
34
38
  return result;
35
39
  }, []);
36
40
 
41
+ const confirmSetupIntent = useCallback(
42
+ async (
43
+ clientSecret: string
44
+ ): Promise<LinkController.ConfirmSetupIntentResult> => {
45
+ setLoading(true);
46
+ const result = await confirmLinkControllerSetupIntent(clientSecret);
47
+ setLoading(false);
48
+ return result;
49
+ },
50
+ []
51
+ );
52
+
37
53
  return {
38
54
  /** Whether an operation is currently in progress. */
39
55
  loading,
@@ -50,5 +66,12 @@ export function useLinkController() {
50
66
  * @PrivatePreview
51
67
  */
52
68
  presentLinkController: present,
69
+ /**
70
+ * Confirms a SetupIntent using the payment method from the most recent
71
+ * `presentLinkController` call. Must be called after a successful presentation.
72
+ *
73
+ * @PrivatePreview
74
+ */
75
+ confirmLinkControllerSetupIntent: confirmSetupIntent,
53
76
  };
54
77
  }
@@ -282,6 +282,11 @@ export interface Spec extends TurboModule {
282
282
  /** @PrivatePreview */
283
283
  presentLinkController(): Promise<UnsafeObject<LinkController.PresentResult>>;
284
284
 
285
+ /** @PrivatePreview */
286
+ confirmLinkControllerSetupIntent(
287
+ params: UnsafeObject<{ clientSecret: string }>
288
+ ): Promise<UnsafeObject<LinkController.ConfirmSetupIntentResult>>;
289
+
285
290
  // Events
286
291
  addListener: (eventType: string) => void;
287
292
  removeListeners: (count: number) => void;
@@ -19,15 +19,12 @@ export type Configuration = {
19
19
  merchantDisplayName: string;
20
20
  /** Payment method types to support in the Link sheet. If omitted, all available types are shown. */
21
21
  supportedPaymentMethodTypes?: LinkPaymentMethodType[];
22
+ /** Payment method type strings to use when creating the SetupIntent. If omitted, types are chosen automatically. */
23
+ paymentMethodTypes?: string[];
22
24
  /** Customer phone number in E.164 format to prefill during signup. */
23
25
  phoneNumber?: string;
24
26
  /** Whether to allow the user to log out. Defaults to true. */
25
27
  allowLogout?: boolean;
26
- /**
27
- * Optional SetupIntent client secret. When provided, the SDK confirms the SetupIntent
28
- * with the selected payment method automatically before returning.
29
- */
30
- setupIntentClientSecret?: string;
31
28
  };
32
29
 
33
30
  /**
@@ -53,6 +50,13 @@ export type InitResult =
53
50
  | { error?: undefined }
54
51
  | { error: StripeError<LinkControllerError> };
55
52
 
53
+ /**
54
+ * @PrivatePreview Result returned from `confirmLinkControllerSetupIntent`.
55
+ */
56
+ export type ConfirmSetupIntentResult =
57
+ | { error?: undefined }
58
+ | { error: StripeError<LinkControllerError> };
59
+
56
60
  /**
57
61
  * @PrivatePreview Result returned from `presentLinkController`.
58
62
  */
@@ -52,7 +52,8 @@ export type ConfirmParams =
52
52
  | AffirmParams
53
53
  | CashAppParams
54
54
  | RevolutPayParams
55
- | PayByBankParams;
55
+ | PayByBankParams
56
+ | TwintParams;
56
57
 
57
58
  export type ConfirmOptions = PaymentMethod.ConfirmOptions;
58
59
 
@@ -186,6 +187,15 @@ export interface BancontactParams {
186
187
  };
187
188
  }
188
189
 
190
+ export interface TwintParams {
191
+ paymentMethodType: 'Twint';
192
+ paymentMethodData: {
193
+ billingDetails: BillingDetails;
194
+ mandateData?: MandateData;
195
+ metadata?: MetaData;
196
+ };
197
+ }
198
+
189
199
  export type BillieParams = {
190
200
  paymentMethodType: 'Billie';
191
201
  paymentMethodData: {
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
  # Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
5
- stripe_version = '26.3.0'
5
+ stripe_version = '26.4.1'
6
6
 
7
7
  fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
8
8
 
@@ -1,229 +0,0 @@
1
- package com.reactnativestripesdk
2
-
3
- import android.annotation.SuppressLint
4
- import android.content.Context
5
- import android.content.res.Configuration
6
- import androidx.compose.ui.graphics.Color
7
- import androidx.core.graphics.toColorInt
8
- import com.facebook.react.bridge.ReadableMap
9
- import com.facebook.react.bridge.ReadableType
10
- import com.reactnativestripesdk.utils.PaymentSheetAppearanceException
11
- import com.stripe.android.checkout.Checkout
12
- import com.stripe.android.paymentelement.CheckoutSessionPreview
13
-
14
- @OptIn(CheckoutSessionPreview::class)
15
- @SuppressLint("RestrictedApi")
16
- fun buildCurrencySelectorAppearance(
17
- params: ReadableMap?,
18
- context: Context,
19
- ): Checkout.CurrencySelectorContentAppearance {
20
- val appearance = Checkout.CurrencySelectorContentAppearance()
21
-
22
- params ?: return appearance
23
-
24
- applyCurrencySelectorColors(appearance, params, context)
25
- applyCurrencySelectorDimensions(appearance, params)
26
- applyCurrencySelectorFont(appearance, params, context)
27
- applyCurrencySelectorLabelContent(appearance, params)
28
-
29
- return appearance
30
- }
31
-
32
- @OptIn(CheckoutSessionPreview::class)
33
- @SuppressLint("RestrictedApi")
34
- private fun applyCurrencySelectorColors(
35
- appearance: Checkout.CurrencySelectorContentAppearance,
36
- params: ReadableMap,
37
- context: Context,
38
- ) {
39
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.BACKGROUND)?.let {
40
- appearance.background(it)
41
- }
42
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.SELECTED_BACKGROUND)?.let {
43
- appearance.selectedBackground(it)
44
- }
45
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.BORDER_COLOR)?.let {
46
- appearance.borderColor(it)
47
- }
48
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.TEXT_COLOR)?.let {
49
- appearance.textColor(it)
50
- }
51
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.SELECTED_TEXT_COLOR)?.let {
52
- appearance.selectedTextColor(it)
53
- }
54
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.TEXT_SECONDARY_COLOR)?.let {
55
- appearance.textSecondaryColor(it)
56
- }
57
- dynamicColorFromParams(context, params, CurrencySelectorAppearanceKeys.DANGER_COLOR)?.let {
58
- appearance.dangerColor(it)
59
- }
60
- }
61
-
62
- @OptIn(CheckoutSessionPreview::class)
63
- @SuppressLint("RestrictedApi")
64
- private fun applyCurrencySelectorDimensions(
65
- appearance: Checkout.CurrencySelectorContentAppearance,
66
- params: ReadableMap,
67
- ) {
68
- getFloatOrNull(params, CurrencySelectorAppearanceKeys.CORNER_RADIUS)?.let {
69
- appearance.cornerRadiusDp(it)
70
- }
71
- getFloatOrNull(params, CurrencySelectorAppearanceKeys.BORDER_WIDTH)?.let {
72
- appearance.borderWidthDp(it)
73
- }
74
- getFloatOrNull(params, CurrencySelectorAppearanceKeys.CONTENT_VERTICAL_PADDING)?.let {
75
- appearance.contentVerticalPaddingDp(it)
76
- }
77
- }
78
-
79
- @OptIn(CheckoutSessionPreview::class)
80
- @SuppressLint("RestrictedApi")
81
- private fun applyCurrencySelectorFont(
82
- appearance: Checkout.CurrencySelectorContentAppearance,
83
- params: ReadableMap,
84
- context: Context,
85
- ) {
86
- params.getMap(CurrencySelectorAppearanceKeys.FONT)?.let { font ->
87
- getCurrencySelectorFontResId(font, CurrencySelectorAppearanceKeys.FAMILY, context)?.let {
88
- appearance.fontResId(it)
89
- }
90
- getFloatOrNull(font, CurrencySelectorAppearanceKeys.SCALE)?.let {
91
- appearance.sizeScaleFactor(it)
92
- }
93
- }
94
- }
95
-
96
- @OptIn(CheckoutSessionPreview::class)
97
- @SuppressLint("RestrictedApi")
98
- private fun applyCurrencySelectorLabelContent(
99
- appearance: Checkout.CurrencySelectorContentAppearance,
100
- params: ReadableMap,
101
- ) {
102
- when (params.getString(CurrencySelectorAppearanceKeys.LABEL_CONTENT)) {
103
- CurrencySelectorAppearanceKeys.AMOUNT -> {
104
- appearance.labelContent(Checkout.CurrencySelectorContentAppearance.LabelContent.AMOUNT)
105
- }
106
- CurrencySelectorAppearanceKeys.CURRENCY_CODE -> {
107
- appearance.labelContent(Checkout.CurrencySelectorContentAppearance.LabelContent.CURRENCY_CODE)
108
- }
109
- CurrencySelectorAppearanceKeys.AUTOMATIC -> {
110
- appearance.labelContent(Checkout.CurrencySelectorContentAppearance.LabelContent.AUTOMATIC)
111
- }
112
- }
113
- }
114
-
115
- private fun dynamicColorFromParams(
116
- context: Context,
117
- params: ReadableMap?,
118
- key: String,
119
- ): Color? {
120
- if (params == null) {
121
- return null
122
- }
123
-
124
- if (params.hasKey(key) && params.getType(key) == ReadableType.Map) {
125
- val colorMap = params.getMap(key)
126
- val isDark =
127
- (
128
- context.resources.configuration.uiMode
129
- and Configuration.UI_MODE_NIGHT_MASK
130
- ) == Configuration.UI_MODE_NIGHT_YES
131
-
132
- val hex =
133
- if (isDark) {
134
- colorMap?.getString(CurrencySelectorAppearanceKeys.DARK)
135
- } else {
136
- colorMap?.getString(CurrencySelectorAppearanceKeys.LIGHT)
137
- }
138
-
139
- return colorFromHex(hex)?.let { Color(it) }
140
- }
141
-
142
- return colorFromHex(params.getString(key))?.let { Color(it) }
143
- }
144
-
145
- private fun colorFromHex(hexString: String?): Int? =
146
- hexString?.trim()?.replace("#", "")?.let {
147
- if (it.length == HEX_COLOR_LENGTH_RGB || it.length == HEX_COLOR_LENGTH_ARGB) {
148
- "#$it".toColorInt()
149
- } else {
150
- android.util.Log.w(
151
- "StripeCurrencySelector",
152
- "Invalid hex color: expected length 6 or 8, but received: $it",
153
- )
154
- null
155
- }
156
- }
157
-
158
- private fun getFloatOrNull(
159
- map: ReadableMap?,
160
- key: String,
161
- ): Float? =
162
- if (map?.hasKey(key) == true && map.getType(key) == ReadableType.Number) {
163
- map.getDouble(key).toFloat()
164
- } else {
165
- null
166
- }
167
-
168
- @SuppressLint("DiscouragedApi")
169
- private fun getCurrencySelectorFontResId(
170
- map: ReadableMap?,
171
- key: String,
172
- context: Context,
173
- ): Int? {
174
- val fontErrorPrefix = "Encountered an error when setting a custom font:"
175
- if (map?.hasKey(key) != true) {
176
- return null
177
- }
178
-
179
- val fontFileName = map.getString(key)
180
- val validationError =
181
- when {
182
- fontFileName == null ->
183
- "$fontErrorPrefix expected String for font.$key, but received null."
184
- Regex("[^a-z0-9_]").containsMatchIn(fontFileName) ->
185
- "$fontErrorPrefix appearance.font.$key should only contain " +
186
- "lowercase alphanumeric characters and underscores on Android, " +
187
- "but received '$fontFileName'. " +
188
- "This value must match the filename in android/app/src/main/res/font"
189
- else -> null
190
- }
191
- if (validationError != null) {
192
- throw PaymentSheetAppearanceException(validationError)
193
- }
194
-
195
- val id = context.resources.getIdentifier(fontFileName, "font", context.packageName)
196
- if (id == 0) {
197
- throw PaymentSheetAppearanceException("$fontErrorPrefix Failed to find font: $fontFileName")
198
- }
199
- return id
200
- }
201
-
202
- private object CurrencySelectorAppearanceKeys {
203
- const val LIGHT = "light"
204
- const val DARK = "dark"
205
-
206
- const val BACKGROUND = "background"
207
- const val SELECTED_BACKGROUND = "selectedBackground"
208
- const val BORDER_COLOR = "borderColor"
209
- const val TEXT_COLOR = "textColor"
210
- const val SELECTED_TEXT_COLOR = "selectedTextColor"
211
- const val TEXT_SECONDARY_COLOR = "textSecondaryColor"
212
- const val DANGER_COLOR = "dangerColor"
213
-
214
- const val CORNER_RADIUS = "cornerRadius"
215
- const val BORDER_WIDTH = "borderWidth"
216
- const val CONTENT_VERTICAL_PADDING = "contentVerticalPadding"
217
-
218
- const val FONT = "font"
219
- const val FAMILY = "family"
220
- const val SCALE = "scale"
221
-
222
- const val LABEL_CONTENT = "labelContent"
223
- const val AUTOMATIC = "automatic"
224
- const val CURRENCY_CODE = "currencyCode"
225
- const val AMOUNT = "amount"
226
- }
227
-
228
- private const val HEX_COLOR_LENGTH_RGB = 6
229
- private const val HEX_COLOR_LENGTH_ARGB = 8
@@ -1,45 +0,0 @@
1
- package com.reactnativestripesdk.utils
2
-
3
- import com.facebook.react.bridge.ReadableMap
4
- import com.stripe.android.paymentelement.CheckoutSessionPreview
5
- import com.stripe.android.checkout.Address as CheckoutAddress
6
-
7
- @OptIn(CheckoutSessionPreview::class)
8
- internal data class CheckoutAddressUpdate(
9
- val name: String? = null,
10
- val phone: String? = null,
11
- val country: String,
12
- val line1: String? = null,
13
- val line2: String? = null,
14
- val city: String? = null,
15
- val state: String? = null,
16
- val postalCode: String? = null,
17
- )
18
-
19
- internal fun buildCheckoutAddressUpdate(
20
- name: String?,
21
- phone: String?,
22
- address: ReadableMap,
23
- ): CheckoutAddressUpdate? {
24
- val country = address.getString("country")?.trim()?.takeIf { it.isNotEmpty() } ?: return null
25
- return CheckoutAddressUpdate(
26
- name = name?.trim(),
27
- phone = phone?.trim(),
28
- country = country,
29
- line1 = address.getString("line1")?.trim(),
30
- line2 = address.getString("line2")?.trim(),
31
- city = address.getString("city")?.trim(),
32
- state = address.getString("state")?.trim(),
33
- postalCode = address.getString("postalCode")?.trim(),
34
- )
35
- }
36
-
37
- @OptIn(CheckoutSessionPreview::class)
38
- internal fun CheckoutAddressUpdate.toCheckoutAddress(): CheckoutAddress =
39
- CheckoutAddress()
40
- .country(country)
41
- .line1(line1)
42
- .line2(line2)
43
- .city(city)
44
- .state(state)
45
- .postalCode(postalCode)
@@ -1,127 +0,0 @@
1
- package com.reactnativestripesdk.utils
2
-
3
- import com.facebook.react.bridge.Arguments
4
- import com.facebook.react.bridge.WritableArray
5
- import com.facebook.react.bridge.WritableMap
6
- import com.stripe.android.checkout.Checkout
7
- import com.stripe.android.checkout.CheckoutSession
8
- import com.stripe.android.paymentelement.CheckoutSessionPreview
9
-
10
- @OptIn(CheckoutSessionPreview::class)
11
- internal fun mapFromCheckoutState(checkout: Checkout): WritableMap =
12
- mapFromCheckoutState(
13
- isLoading = checkout.isLoading.value,
14
- session = checkout.checkoutSession.value,
15
- )
16
-
17
- @OptIn(CheckoutSessionPreview::class)
18
- internal fun mapFromCheckoutState(
19
- isLoading: Boolean,
20
- session: CheckoutSession,
21
- ): WritableMap =
22
- Arguments.createMap().apply {
23
- putString("status", if (isLoading) "loading" else "loaded")
24
- putMap("session", mapFromCheckoutSession(session))
25
- }
26
-
27
- @OptIn(CheckoutSessionPreview::class)
28
- private fun mapFromCheckoutSession(session: CheckoutSession): WritableMap =
29
- Arguments.createMap().apply {
30
- putString("id", session.id)
31
- putBoolean("livemode", false)
32
-
33
- if (session.currency.isNotBlank()) {
34
- putString("currency", session.currency)
35
- }
36
-
37
- putMap("status", mapFromStatus(session.status))
38
- putMap("tax", mapFromTax(session.tax))
39
- session.totalSummary?.let { putMap("total", mapFromTotal(it)) }
40
-
41
- putArray("lineItems", mapFromLineItems(session))
42
- putArray("shippingOptions", mapFromShippingOptions(session))
43
- putArray("discountAmounts", Arguments.createArray())
44
- putArray("currencyOptions", Arguments.createArray())
45
- }
46
-
47
- @OptIn(CheckoutSessionPreview::class)
48
- private fun mapFromStatus(status: CheckoutSession.Status): WritableMap =
49
- Arguments.createMap().apply {
50
- putString(
51
- "type",
52
- when (status) {
53
- CheckoutSession.Status.Open -> "open"
54
- CheckoutSession.Status.Complete -> "complete"
55
- CheckoutSession.Status.Expired -> "expired"
56
- else -> "unknown"
57
- }
58
- )
59
- }
60
-
61
- @OptIn(CheckoutSessionPreview::class)
62
- private fun mapFromTax(tax: CheckoutSession.Tax): WritableMap =
63
- Arguments.createMap().apply {
64
- putString(
65
- "status",
66
- when (tax.status) {
67
- CheckoutSession.Tax.Status.Ready -> "ready"
68
- CheckoutSession.Tax.Status.RequiresShippingAddress -> "requiresShippingAddress"
69
- CheckoutSession.Tax.Status.RequiresBillingAddress -> "requiresBillingAddress"
70
- else -> "unknown"
71
- }
72
- )
73
- }
74
-
75
- @OptIn(CheckoutSessionPreview::class)
76
- private fun mapFromTotal(totals: CheckoutSession.TotalSummary): WritableMap =
77
- Arguments.createMap().apply {
78
- val taxTotal = totals.taxAmounts.sumOf { it.amount }
79
-
80
- putMap("subtotal", makeAmount(totals.subtotal))
81
- putMap("taxExclusive", makeAmount(taxTotal))
82
- putMap("taxInclusive", makeAmount(0L))
83
- putMap("shippingRate", makeAmount(totals.shippingRate?.amount ?: 0L))
84
- putMap("discount", makeAmount(0L))
85
- putMap("total", makeAmount(totals.totalAmountDue))
86
- putMap("appliedBalance", makeAmount(0L))
87
- putBoolean("balanceAppliedToNextInvoice", false)
88
- }
89
-
90
- @OptIn(CheckoutSessionPreview::class)
91
- private fun mapFromLineItems(session: CheckoutSession): WritableArray =
92
- Arguments.createArray().apply {
93
- session.lineItems.forEach { item ->
94
- pushMap(
95
- Arguments.createMap().apply {
96
- putString("id", item.id)
97
- putString("name", item.name)
98
- putInt("quantity", item.quantity)
99
- putArray("images", Arguments.createArray())
100
- putArray("discountAmounts", Arguments.createArray())
101
- putArray("taxAmounts", Arguments.createArray())
102
- item.unitAmount?.let { putMap("unitAmount", makeAmount(it)) }
103
- },
104
- )
105
- }
106
- }
107
-
108
- @OptIn(CheckoutSessionPreview::class)
109
- private fun mapFromShippingOptions(session: CheckoutSession): WritableArray =
110
- Arguments.createArray().apply {
111
- session.shippingOptions.forEach { option ->
112
- pushMap(
113
- Arguments.createMap().apply {
114
- putString("id", option.id)
115
- putString("displayName", option.displayName)
116
- putMap("amount", makeAmount(option.amount))
117
- putString("currency", session.currency)
118
- },
119
- )
120
- }
121
- }
122
-
123
- private fun makeAmount(minorUnits: Long): WritableMap =
124
- Arguments.createMap().apply {
125
- putString("amount", "")
126
- putDouble("minorUnitsAmount", minorUnits.toDouble())
127
- }