tf-checkout-react-native 2.0.0-beta.15 → 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/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/paymentSheet.ts +18 -9
package/dist/index.mjs
CHANGED
|
@@ -24199,11 +24199,14 @@ var nativeSheetIntentIdentity = (intent, intentId, reviewed) => {
|
|
|
24199
24199
|
const currency = own("currency");
|
|
24200
24200
|
return own("id") === intentId && Number.isSafeInteger(amount2) && amount2 === reviewed.amountMinor && typeof currency === "string" && /^[A-Za-z]{3}$/.test(currency) && currency.toUpperCase() === reviewed.currency;
|
|
24201
24201
|
};
|
|
24202
|
-
var
|
|
24203
|
-
var _a2;
|
|
24202
|
+
var nativeSheetMethods = (intent) => {
|
|
24203
|
+
var _a2, _b;
|
|
24204
24204
|
if (!intent || typeof intent !== "object") return false;
|
|
24205
24205
|
const methods = (_a2 = Object.getOwnPropertyDescriptor(intent, "paymentMethodTypes")) == null ? void 0 : _a2.value;
|
|
24206
|
-
|
|
24206
|
+
if (!Array.isArray(methods)) return false;
|
|
24207
|
+
if (methods.length === 1) return methods[0] === "card";
|
|
24208
|
+
const currency = (_b = Object.getOwnPropertyDescriptor(intent, "currency")) == null ? void 0 : _b.value;
|
|
24209
|
+
return methods.length === 2 && methods.includes("card") && methods.includes("cashapp") && typeof currency === "string" && currency.toUpperCase() === "USD";
|
|
24207
24210
|
};
|
|
24208
24211
|
var createPaymentSheetConfirmation = (sdk, options) => {
|
|
24209
24212
|
let active2 = false;
|
|
@@ -24229,7 +24232,7 @@ var createPaymentSheetConfirmation = (sdk, options) => {
|
|
|
24229
24232
|
const requireAdmittedIntent = (result4) => {
|
|
24230
24233
|
if (result4.error || !nativeSheetIntentIdentity(result4.paymentIntent, intentId, options.reviewed))
|
|
24231
24234
|
throw paymentProviderError(NATIVE_SHEET_REVIEW_REQUIRED, "notStarted");
|
|
24232
|
-
if (!
|
|
24235
|
+
if (!nativeSheetMethods(result4.paymentIntent))
|
|
24233
24236
|
throw paymentProviderError(NATIVE_SHEET_CARD_FIELD_MESSAGE, "notStarted", {
|
|
24234
24237
|
code: NATIVE_SHEET_CARD_FIELD_REQUIRED
|
|
24235
24238
|
});
|
|
@@ -24244,9 +24247,9 @@ var createPaymentSheetConfirmation = (sdk, options) => {
|
|
|
24244
24247
|
defaultBillingDetails: billing,
|
|
24245
24248
|
customFlow: false,
|
|
24246
24249
|
allowsDelayedPaymentMethods: false,
|
|
24247
|
-
//
|
|
24248
|
-
//
|
|
24249
|
-
link: { display: sdk.LinkDisplay.
|
|
24250
|
+
// Stripe decides whether the original account/session supports card-mode
|
|
24251
|
+
// Link. This preference does not add an explicit Link/non-card PI type.
|
|
24252
|
+
link: { display: sdk.LinkDisplay.AUTOMATIC }
|
|
24250
24253
|
});
|
|
24251
24254
|
if (initialized.error)
|
|
24252
24255
|
throw paymentProviderError(NATIVE_SHEET_CARD_FIELD_MESSAGE, "notStarted", {
|
|
@@ -24266,7 +24269,7 @@ var createPaymentSheetConfirmation = (sdk, options) => {
|
|
|
24266
24269
|
);
|
|
24267
24270
|
assertAfterPresentation();
|
|
24268
24271
|
const result3 = await sdk.retrievePaymentIntent(clientSecret);
|
|
24269
|
-
if (result3.error || !nativeSheetIntentIdentity(result3.paymentIntent, intentId, options.reviewed) || !
|
|
24272
|
+
if (result3.error || !nativeSheetIntentIdentity(result3.paymentIntent, intentId, options.reviewed) || !nativeSheetMethods(result3.paymentIntent))
|
|
24270
24273
|
throw paymentProviderError(
|
|
24271
24274
|
"The original payment could not be verified.",
|
|
24272
24275
|
"unknown"
|