tf-checkout-react-native 2.0.0-beta.16 → 2.0.0-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tf-checkout-react-native",
3
- "version": "2.0.0-beta.16",
3
+ "version": "2.0.0-beta.17",
4
4
  "description": "TheTicketFairy ReactNative Checkout library",
5
5
  "homepage": "https://github.com/theticketfairy/tf-shared-libraries#readme",
6
6
  "author": "The Ticket Fairy",
@@ -59,12 +59,21 @@ export const nativeSheetIntentIdentity = (
59
59
  )
60
60
  }
61
61
 
62
- /** The bridge must preserve the complete raw PI payment_method_types list.
63
- * Stripe may offer card-mode Link within this existing card payment contract. */
64
- const nativeSheetCardMethods = (intent: unknown): boolean => {
62
+ /** Keep the complete original list: the server can enable immediate USD Cash
63
+ * App Pay beside card. Other rails still need their own canonical contract. */
64
+ const nativeSheetMethods = (intent: unknown): boolean => {
65
65
  if (!intent || typeof intent !== 'object') return false
66
66
  const methods = Object.getOwnPropertyDescriptor(intent, 'paymentMethodTypes')?.value
67
- return Array.isArray(methods) && methods.length === 1 && methods[0] === 'card'
67
+ if (!Array.isArray(methods)) return false
68
+ if (methods.length === 1) return methods[0] === 'card'
69
+ const currency = Object.getOwnPropertyDescriptor(intent, 'currency')?.value
70
+ return (
71
+ methods.length === 2 &&
72
+ methods.includes('card') &&
73
+ methods.includes('cashapp') &&
74
+ typeof currency === 'string' &&
75
+ currency.toUpperCase() === 'USD'
76
+ )
68
77
  }
69
78
 
70
79
  /** Internal building block. The caller must hold
@@ -111,7 +120,7 @@ export const createPaymentSheetConfirmation = (
111
120
  !nativeSheetIntentIdentity(result.paymentIntent, intentId, options.reviewed)
112
121
  )
113
122
  throw paymentProviderError(NATIVE_SHEET_REVIEW_REQUIRED, 'notStarted')
114
- if (!nativeSheetCardMethods(result.paymentIntent))
123
+ if (!nativeSheetMethods(result.paymentIntent))
115
124
  throw paymentProviderError(NATIVE_SHEET_CARD_FIELD_MESSAGE, 'notStarted', {
116
125
  code: NATIVE_SHEET_CARD_FIELD_REQUIRED,
117
126
  })
@@ -155,7 +164,7 @@ export const createPaymentSheetConfirmation = (
155
164
  if (
156
165
  result.error ||
157
166
  !nativeSheetIntentIdentity(result.paymentIntent, intentId, options.reviewed) ||
158
- !nativeSheetCardMethods(result.paymentIntent)
167
+ !nativeSheetMethods(result.paymentIntent)
159
168
  )
160
169
  throw paymentProviderError(
161
170
  'The original payment could not be verified.',