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.js
CHANGED
|
@@ -24679,11 +24679,14 @@ var nativeSheetIntentIdentity = (intent, intentId, reviewed) => {
|
|
|
24679
24679
|
const currency = own("currency");
|
|
24680
24680
|
return own("id") === intentId && Number.isSafeInteger(amount2) && amount2 === reviewed.amountMinor && typeof currency === "string" && /^[A-Za-z]{3}$/.test(currency) && currency.toUpperCase() === reviewed.currency;
|
|
24681
24681
|
};
|
|
24682
|
-
var
|
|
24683
|
-
var _a2;
|
|
24682
|
+
var nativeSheetMethods = (intent) => {
|
|
24683
|
+
var _a2, _b;
|
|
24684
24684
|
if (!intent || typeof intent !== "object") return false;
|
|
24685
24685
|
const methods = (_a2 = Object.getOwnPropertyDescriptor(intent, "paymentMethodTypes")) == null ? void 0 : _a2.value;
|
|
24686
|
-
|
|
24686
|
+
if (!Array.isArray(methods)) return false;
|
|
24687
|
+
if (methods.length === 1) return methods[0] === "card";
|
|
24688
|
+
const currency = (_b = Object.getOwnPropertyDescriptor(intent, "currency")) == null ? void 0 : _b.value;
|
|
24689
|
+
return methods.length === 2 && methods.includes("card") && methods.includes("cashapp") && typeof currency === "string" && currency.toUpperCase() === "USD";
|
|
24687
24690
|
};
|
|
24688
24691
|
var createPaymentSheetConfirmation = (sdk, options) => {
|
|
24689
24692
|
let active2 = false;
|
|
@@ -24709,7 +24712,7 @@ var createPaymentSheetConfirmation = (sdk, options) => {
|
|
|
24709
24712
|
const requireAdmittedIntent = (result4) => {
|
|
24710
24713
|
if (result4.error || !nativeSheetIntentIdentity(result4.paymentIntent, intentId, options.reviewed))
|
|
24711
24714
|
throw paymentProviderError(NATIVE_SHEET_REVIEW_REQUIRED, "notStarted");
|
|
24712
|
-
if (!
|
|
24715
|
+
if (!nativeSheetMethods(result4.paymentIntent))
|
|
24713
24716
|
throw paymentProviderError(NATIVE_SHEET_CARD_FIELD_MESSAGE, "notStarted", {
|
|
24714
24717
|
code: NATIVE_SHEET_CARD_FIELD_REQUIRED
|
|
24715
24718
|
});
|
|
@@ -24724,9 +24727,9 @@ var createPaymentSheetConfirmation = (sdk, options) => {
|
|
|
24724
24727
|
defaultBillingDetails: billing,
|
|
24725
24728
|
customFlow: false,
|
|
24726
24729
|
allowsDelayedPaymentMethods: false,
|
|
24727
|
-
//
|
|
24728
|
-
//
|
|
24729
|
-
link: { display: sdk.LinkDisplay.
|
|
24730
|
+
// Stripe decides whether the original account/session supports card-mode
|
|
24731
|
+
// Link. This preference does not add an explicit Link/non-card PI type.
|
|
24732
|
+
link: { display: sdk.LinkDisplay.AUTOMATIC }
|
|
24730
24733
|
});
|
|
24731
24734
|
if (initialized.error)
|
|
24732
24735
|
throw paymentProviderError(NATIVE_SHEET_CARD_FIELD_MESSAGE, "notStarted", {
|
|
@@ -24746,7 +24749,7 @@ var createPaymentSheetConfirmation = (sdk, options) => {
|
|
|
24746
24749
|
);
|
|
24747
24750
|
assertAfterPresentation();
|
|
24748
24751
|
const result3 = await sdk.retrievePaymentIntent(clientSecret);
|
|
24749
|
-
if (result3.error || !nativeSheetIntentIdentity(result3.paymentIntent, intentId, options.reviewed) || !
|
|
24752
|
+
if (result3.error || !nativeSheetIntentIdentity(result3.paymentIntent, intentId, options.reviewed) || !nativeSheetMethods(result3.paymentIntent))
|
|
24750
24753
|
throw paymentProviderError(
|
|
24751
24754
|
"The original payment could not be verified.",
|
|
24752
24755
|
"unknown"
|