@flopay/vue 1.14.8 → 1.14.9
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/README.md +2 -0
- package/dist/{chunk-SWZFYEFE.mjs → chunk-5K5MGWEN.mjs} +2 -2
- package/dist/{chunk-GDB2HY7D.mjs → chunk-RAXPWAR7.mjs} +77 -3
- package/dist/index.cjs +126 -5
- package/dist/index.mjs +54 -3
- package/dist/payment-method-setup-entry.cjs +76 -4
- package/dist/payment-method-setup-entry.mjs +1 -1
- package/dist/{payment-method-setup-paypal-XPSU4CHA.mjs → payment-method-setup-paypal-D6FEQQJY.mjs} +4 -1
- package/dist/{stripe-elements-B55YXBZK.mjs → stripe-elements-SXMTHEF6.mjs} +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -140,5 +140,7 @@ Errors are `FloPayError` instances from `@flopay/shared`, emitted through `@erro
|
|
|
140
140
|
| `UnsupportedBackendVaultCapability` | The session has no hosted vault card form and no other usable method. |
|
|
141
141
|
| `stored_payment_method_unsupported` | The buyer's saved method cannot be charged; ask for another method. |
|
|
142
142
|
| `MissingCheckoutSessionToken` | A session id was given without its `nonce`. |
|
|
143
|
+
| `network_request_failed` | Type `network_error`. `FloPayCheckout` could not start because creating or reading the session never got a response, after the SDK's retries. `cause` holds the original error; `sessionId` is set when the session already existed. |
|
|
144
|
+
| `CheckoutInitializationFailed` | Type `api_error`. `FloPayCheckout` could not start for a reason that is not a network failure, with `sessionId` set once the session exists. |
|
|
143
145
|
|
|
144
146
|
Setup surfaces emit `FloPayCardSetupError`, whose `retryable` says whether trying again can help.
|
|
@@ -38,10 +38,10 @@ function delay(ms) {
|
|
|
38
38
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
39
39
|
}
|
|
40
40
|
var StripeSetupMethods = defineAsyncComponent(
|
|
41
|
-
() => import("./stripe-elements-
|
|
41
|
+
() => import("./stripe-elements-SXMTHEF6.mjs").then((module) => module.StripePaymentMethods)
|
|
42
42
|
);
|
|
43
43
|
var PayPalSetupMethods = defineAsyncComponent(
|
|
44
|
-
() => import("./payment-method-setup-paypal-
|
|
44
|
+
() => import("./payment-method-setup-paypal-D6FEQQJY.mjs").then((module) => module.PayPalSetupMethod)
|
|
45
45
|
);
|
|
46
46
|
var FloPayPaymentMethodSetup = defineComponent({
|
|
47
47
|
name: "FloPayPaymentMethodSetup",
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
import { PaymentAPI } from "@flopay/js/card-setup";
|
|
3
3
|
import {
|
|
4
4
|
buildWalletSheetWindowMessage,
|
|
5
|
+
classifyPaymentRejection,
|
|
5
6
|
denyPaymentPermissionToNewFrames,
|
|
6
7
|
detectPayPalEnvironment,
|
|
7
8
|
FloPayError,
|
|
8
9
|
invokeMerchantCallback as invokeMerchantCallback2,
|
|
9
10
|
isProviderDecline,
|
|
11
|
+
isSettledSessionIntent,
|
|
10
12
|
isWalletSheetRefusedForWindowSize,
|
|
11
13
|
readStripeRedirectParams as readStripeRedirectParams2,
|
|
12
14
|
resolveSetupFutureUsage,
|
|
13
15
|
resolveWalletModeOptions,
|
|
16
|
+
settledSessionIntentError,
|
|
14
17
|
shouldPreferWalletPopup,
|
|
15
18
|
stripeExpressMethodToOptionKey,
|
|
16
19
|
toStripeAppearance,
|
|
@@ -245,6 +248,49 @@ function stripeMethodCategory(method) {
|
|
|
245
248
|
function declineReason(error) {
|
|
246
249
|
return error.decline_code ?? error.code ?? "provider_declined";
|
|
247
250
|
}
|
|
251
|
+
var SETTLED_ACTION_REQUIRED_CODES = /* @__PURE__ */ new Map([
|
|
252
|
+
["3ds_required", "authentication_required"],
|
|
253
|
+
["paypal_direct_required", "paypal_direct_required"]
|
|
254
|
+
]);
|
|
255
|
+
async function reportSettledIntentVerdict(response, method, sessionId, session, outcomes) {
|
|
256
|
+
const json = response.status === 204 ? null : await response.json().catch(() => null);
|
|
257
|
+
if (response.ok) {
|
|
258
|
+
const authorized = session?.captureMethod === "manual" || json?.status === "authorized";
|
|
259
|
+
const paymentId = typeof json?.paymentId === "string" ? json.paymentId : session?.paymentId;
|
|
260
|
+
const authorizationExpiresAt = typeof json?.authorizationExpiresAt === "string" ? json.authorizationExpiresAt : session?.authorizationExpiresAt;
|
|
261
|
+
outcomes.complete(
|
|
262
|
+
authorized ? {
|
|
263
|
+
status: "authorized",
|
|
264
|
+
...paymentId ? { paymentId } : {},
|
|
265
|
+
sessionId: typeof json?.sessionId === "string" ? json.sessionId : sessionId,
|
|
266
|
+
...authorizationExpiresAt ? { authorizationExpiresAt } : {},
|
|
267
|
+
checkoutMethod: method
|
|
268
|
+
} : { status: "succeeded", checkoutMethod: method }
|
|
269
|
+
);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const type = typeof json?.type === "string" ? json.type : void 0;
|
|
273
|
+
const message = typeof json?.message === "string" ? json.message : void 0;
|
|
274
|
+
const code = typeof json?.code === "string" ? json.code : void 0;
|
|
275
|
+
const actionCode = type === void 0 ? void 0 : SETTLED_ACTION_REQUIRED_CODES.get(type);
|
|
276
|
+
if (actionCode === void 0 && classifyPaymentRejection(response.status, json) === "payment_declined") {
|
|
277
|
+
outcomes.decline({
|
|
278
|
+
method,
|
|
279
|
+
message: message ?? "Your payment was declined.",
|
|
280
|
+
code,
|
|
281
|
+
declineCode: typeof json?.declineCode === "string" ? json.declineCode : code,
|
|
282
|
+
sessionId
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
outcomes.error(
|
|
287
|
+
new FloPayError(message ?? "Payment could not be completed. Please try again.", "api_error", {
|
|
288
|
+
code: actionCode ?? code ?? "payment_processing_error",
|
|
289
|
+
statusCode: response.status,
|
|
290
|
+
sessionId
|
|
291
|
+
})
|
|
292
|
+
);
|
|
293
|
+
}
|
|
248
294
|
var StripePaymentMethods = defineComponent2({
|
|
249
295
|
name: "FloPayStripePaymentMethods",
|
|
250
296
|
props: {
|
|
@@ -331,11 +377,13 @@ var StripePaymentMethods = defineComponent2({
|
|
|
331
377
|
const setupFutureUsage = resolveSetupFutureUsage(props.session, methods, surface);
|
|
332
378
|
const currency = (props.currency ?? props.session?.currency ?? "usd").toLowerCase();
|
|
333
379
|
const appearance = props.appearance ? { appearance: toStripeAppearance(props.appearance) } : {};
|
|
334
|
-
return props.intentKind === "setup" ? { mode: "setup", currency,
|
|
380
|
+
return props.intentKind === "setup" ? { mode: "setup", currency, allowedPaymentMethodTypes: methods, ...appearance } : {
|
|
335
381
|
mode: props.session?.mode === "subscription" ? "subscription" : "payment",
|
|
336
382
|
amount: props.amount,
|
|
337
383
|
currency,
|
|
338
|
-
|
|
384
|
+
// Stripe.js Endive (@stripe/stripe-js 10) removed the Elements
|
|
385
|
+
// `paymentMethodTypes` option; `allowedPaymentMethodTypes` replaces it.
|
|
386
|
+
allowedPaymentMethodTypes: methods,
|
|
339
387
|
...setupFutureUsage ? { setupFutureUsage } : {},
|
|
340
388
|
...appearance
|
|
341
389
|
};
|
|
@@ -352,7 +400,7 @@ var StripePaymentMethods = defineComponent2({
|
|
|
352
400
|
return {
|
|
353
401
|
...resolveWalletModeOptions(props.totalAmount, props.session?.captureMethod),
|
|
354
402
|
currency,
|
|
355
|
-
|
|
403
|
+
allowedPaymentMethodTypes: methods,
|
|
356
404
|
...setupFutureUsage ? { setupFutureUsage } : {},
|
|
357
405
|
...props.appearance ? { appearance: toStripeAppearance(props.appearance) } : {}
|
|
358
406
|
};
|
|
@@ -458,6 +506,11 @@ var StripePaymentMethods = defineComponent2({
|
|
|
458
506
|
observeWalletSheetClick(event.expressPaymentType, clickStartedAt);
|
|
459
507
|
event.resolve();
|
|
460
508
|
};
|
|
509
|
+
const settledVerdictOutcomes = {
|
|
510
|
+
complete: (result) => invokeMerchantCallback2(() => emit("complete", result)),
|
|
511
|
+
decline: (decline) => invokeMerchantCallback2(() => emit("decline", decline)),
|
|
512
|
+
error: (failure) => invokeMerchantCallback2(() => emit("error", failure))
|
|
513
|
+
};
|
|
461
514
|
const confirm = async (elements, method, intentKind = props.intentKind, attempt = null) => {
|
|
462
515
|
if (!stripe || processing.value) return;
|
|
463
516
|
processing.value = true;
|
|
@@ -476,6 +529,17 @@ var StripePaymentMethods = defineComponent2({
|
|
|
476
529
|
paymentMethodId: null,
|
|
477
530
|
intentKind
|
|
478
531
|
});
|
|
532
|
+
if (isSettledSessionIntent(intent)) {
|
|
533
|
+
if (intentKind === "setup") throw settledSessionIntentError(sessionId);
|
|
534
|
+
await reportSettledIntentVerdict(
|
|
535
|
+
intent.response,
|
|
536
|
+
method,
|
|
537
|
+
sessionId,
|
|
538
|
+
props.session,
|
|
539
|
+
settledVerdictOutcomes
|
|
540
|
+
);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
479
543
|
const clientSecret = intent.clientSecret ?? "";
|
|
480
544
|
const returnUrl = props.returnUrl ?? window.location.href;
|
|
481
545
|
const { error } = intentKind === "setup" ? await stripe.confirmSetup({
|
|
@@ -581,6 +645,16 @@ var StripePaymentMethods = defineComponent2({
|
|
|
581
645
|
paymentMethodId: paymentMethod?.id ?? null,
|
|
582
646
|
intentKind: "payment"
|
|
583
647
|
});
|
|
648
|
+
if (isSettledSessionIntent(intent)) {
|
|
649
|
+
await reportSettledIntentVerdict(
|
|
650
|
+
intent.response,
|
|
651
|
+
"paypal",
|
|
652
|
+
sessionId,
|
|
653
|
+
props.session,
|
|
654
|
+
settledVerdictOutcomes
|
|
655
|
+
);
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
584
658
|
if (intent.provider !== "stripe") {
|
|
585
659
|
throw new Error("Invalid provider returned for PayPal intent");
|
|
586
660
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -263,7 +263,46 @@ function stripeMethodCategory(method) {
|
|
|
263
263
|
function declineReason(error) {
|
|
264
264
|
return error.decline_code ?? error.code ?? "provider_declined";
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
async function reportSettledIntentVerdict(response, method, sessionId, session, outcomes) {
|
|
267
|
+
const json = response.status === 204 ? null : await response.json().catch(() => null);
|
|
268
|
+
if (response.ok) {
|
|
269
|
+
const authorized = session?.captureMethod === "manual" || json?.status === "authorized";
|
|
270
|
+
const paymentId = typeof json?.paymentId === "string" ? json.paymentId : session?.paymentId;
|
|
271
|
+
const authorizationExpiresAt = typeof json?.authorizationExpiresAt === "string" ? json.authorizationExpiresAt : session?.authorizationExpiresAt;
|
|
272
|
+
outcomes.complete(
|
|
273
|
+
authorized ? {
|
|
274
|
+
status: "authorized",
|
|
275
|
+
...paymentId ? { paymentId } : {},
|
|
276
|
+
sessionId: typeof json?.sessionId === "string" ? json.sessionId : sessionId,
|
|
277
|
+
...authorizationExpiresAt ? { authorizationExpiresAt } : {},
|
|
278
|
+
checkoutMethod: method
|
|
279
|
+
} : { status: "succeeded", checkoutMethod: method }
|
|
280
|
+
);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const type = typeof json?.type === "string" ? json.type : void 0;
|
|
284
|
+
const message = typeof json?.message === "string" ? json.message : void 0;
|
|
285
|
+
const code = typeof json?.code === "string" ? json.code : void 0;
|
|
286
|
+
const actionCode = type === void 0 ? void 0 : SETTLED_ACTION_REQUIRED_CODES.get(type);
|
|
287
|
+
if (actionCode === void 0 && (0, import_shared6.classifyPaymentRejection)(response.status, json) === "payment_declined") {
|
|
288
|
+
outcomes.decline({
|
|
289
|
+
method,
|
|
290
|
+
message: message ?? "Your payment was declined.",
|
|
291
|
+
code,
|
|
292
|
+
declineCode: typeof json?.declineCode === "string" ? json.declineCode : code,
|
|
293
|
+
sessionId
|
|
294
|
+
});
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
outcomes.error(
|
|
298
|
+
new import_shared6.FloPayError(message ?? "Payment could not be completed. Please try again.", "api_error", {
|
|
299
|
+
code: actionCode ?? code ?? "payment_processing_error",
|
|
300
|
+
statusCode: response.status,
|
|
301
|
+
sessionId
|
|
302
|
+
})
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
var import_card_setup2, import_shared6, import_vue4, WALLET_METHODS, EXPRESS_CHECKOUT_CLICK_BUDGET_MS, PAYPAL_REDIRECT_TILE_HEIGHT, stripePayPalResumeAttempts, SETTLED_ACTION_REQUIRED_CODES, StripePaymentMethods;
|
|
267
306
|
var init_stripe_elements = __esm({
|
|
268
307
|
"src/stripe-elements.ts"() {
|
|
269
308
|
"use strict";
|
|
@@ -277,6 +316,10 @@ var init_stripe_elements = __esm({
|
|
|
277
316
|
EXPRESS_CHECKOUT_CLICK_BUDGET_MS = 900;
|
|
278
317
|
PAYPAL_REDIRECT_TILE_HEIGHT = 44;
|
|
279
318
|
stripePayPalResumeAttempts = /* @__PURE__ */ new Map();
|
|
319
|
+
SETTLED_ACTION_REQUIRED_CODES = /* @__PURE__ */ new Map([
|
|
320
|
+
["3ds_required", "authentication_required"],
|
|
321
|
+
["paypal_direct_required", "paypal_direct_required"]
|
|
322
|
+
]);
|
|
280
323
|
StripePaymentMethods = (0, import_vue4.defineComponent)({
|
|
281
324
|
name: "FloPayStripePaymentMethods",
|
|
282
325
|
props: {
|
|
@@ -363,11 +406,13 @@ var init_stripe_elements = __esm({
|
|
|
363
406
|
const setupFutureUsage = (0, import_shared6.resolveSetupFutureUsage)(props.session, methods, surface);
|
|
364
407
|
const currency = (props.currency ?? props.session?.currency ?? "usd").toLowerCase();
|
|
365
408
|
const appearance = props.appearance ? { appearance: (0, import_shared6.toStripeAppearance)(props.appearance) } : {};
|
|
366
|
-
return props.intentKind === "setup" ? { mode: "setup", currency,
|
|
409
|
+
return props.intentKind === "setup" ? { mode: "setup", currency, allowedPaymentMethodTypes: methods, ...appearance } : {
|
|
367
410
|
mode: props.session?.mode === "subscription" ? "subscription" : "payment",
|
|
368
411
|
amount: props.amount,
|
|
369
412
|
currency,
|
|
370
|
-
|
|
413
|
+
// Stripe.js Endive (@stripe/stripe-js 10) removed the Elements
|
|
414
|
+
// `paymentMethodTypes` option; `allowedPaymentMethodTypes` replaces it.
|
|
415
|
+
allowedPaymentMethodTypes: methods,
|
|
371
416
|
...setupFutureUsage ? { setupFutureUsage } : {},
|
|
372
417
|
...appearance
|
|
373
418
|
};
|
|
@@ -384,7 +429,7 @@ var init_stripe_elements = __esm({
|
|
|
384
429
|
return {
|
|
385
430
|
...(0, import_shared6.resolveWalletModeOptions)(props.totalAmount, props.session?.captureMethod),
|
|
386
431
|
currency,
|
|
387
|
-
|
|
432
|
+
allowedPaymentMethodTypes: methods,
|
|
388
433
|
...setupFutureUsage ? { setupFutureUsage } : {},
|
|
389
434
|
...props.appearance ? { appearance: (0, import_shared6.toStripeAppearance)(props.appearance) } : {}
|
|
390
435
|
};
|
|
@@ -490,6 +535,11 @@ var init_stripe_elements = __esm({
|
|
|
490
535
|
observeWalletSheetClick(event.expressPaymentType, clickStartedAt);
|
|
491
536
|
event.resolve();
|
|
492
537
|
};
|
|
538
|
+
const settledVerdictOutcomes = {
|
|
539
|
+
complete: (result) => (0, import_shared6.invokeMerchantCallback)(() => emit("complete", result)),
|
|
540
|
+
decline: (decline) => (0, import_shared6.invokeMerchantCallback)(() => emit("decline", decline)),
|
|
541
|
+
error: (failure) => (0, import_shared6.invokeMerchantCallback)(() => emit("error", failure))
|
|
542
|
+
};
|
|
493
543
|
const confirm = async (elements, method, intentKind = props.intentKind, attempt = null) => {
|
|
494
544
|
if (!stripe || processing.value) return;
|
|
495
545
|
processing.value = true;
|
|
@@ -508,6 +558,17 @@ var init_stripe_elements = __esm({
|
|
|
508
558
|
paymentMethodId: null,
|
|
509
559
|
intentKind
|
|
510
560
|
});
|
|
561
|
+
if ((0, import_shared6.isSettledSessionIntent)(intent)) {
|
|
562
|
+
if (intentKind === "setup") throw (0, import_shared6.settledSessionIntentError)(sessionId);
|
|
563
|
+
await reportSettledIntentVerdict(
|
|
564
|
+
intent.response,
|
|
565
|
+
method,
|
|
566
|
+
sessionId,
|
|
567
|
+
props.session,
|
|
568
|
+
settledVerdictOutcomes
|
|
569
|
+
);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
511
572
|
const clientSecret = intent.clientSecret ?? "";
|
|
512
573
|
const returnUrl = props.returnUrl ?? window.location.href;
|
|
513
574
|
const { error } = intentKind === "setup" ? await stripe.confirmSetup({
|
|
@@ -613,6 +674,16 @@ var init_stripe_elements = __esm({
|
|
|
613
674
|
paymentMethodId: paymentMethod?.id ?? null,
|
|
614
675
|
intentKind: "payment"
|
|
615
676
|
});
|
|
677
|
+
if ((0, import_shared6.isSettledSessionIntent)(intent)) {
|
|
678
|
+
await reportSettledIntentVerdict(
|
|
679
|
+
intent.response,
|
|
680
|
+
"paypal",
|
|
681
|
+
sessionId,
|
|
682
|
+
props.session,
|
|
683
|
+
settledVerdictOutcomes
|
|
684
|
+
);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
616
687
|
if (intent.provider !== "stripe") {
|
|
617
688
|
throw new Error("Invalid provider returned for PayPal intent");
|
|
618
689
|
}
|
|
@@ -945,6 +1016,7 @@ var init_payment_method_setup_paypal = __esm({
|
|
|
945
1016
|
paymentMethodId: null,
|
|
946
1017
|
intentKind: "setup"
|
|
947
1018
|
});
|
|
1019
|
+
if ((0, import_shared13.isSettledSessionIntent)(intent)) throw (0, import_shared13.settledSessionIntentError)(sessionId);
|
|
948
1020
|
if (intent.provider !== "paypal" || intent.providerObjectType !== "setup_token") {
|
|
949
1021
|
throw new import_shared13.FloPayError(
|
|
950
1022
|
"The billing API did not return a PayPal setup token.",
|
|
@@ -1315,6 +1387,7 @@ var BuyerIdentityFallbackPanel = (0, import_vue2.defineComponent)({
|
|
|
1315
1387
|
|
|
1316
1388
|
// src/direct-paypal-button.ts
|
|
1317
1389
|
init_context();
|
|
1390
|
+
var PAYPAL_INTENT_SETTLED_CODE = "paypal_intent_settled";
|
|
1318
1391
|
var PAYPAL_INIT_RETRY_DELAY_MS = 1e3;
|
|
1319
1392
|
var PayPalStartupFailure = class extends Error {
|
|
1320
1393
|
constructor(message, options = {}) {
|
|
@@ -1409,6 +1482,7 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1409
1482
|
let attemptLive = false;
|
|
1410
1483
|
let intentIdempotencyKey;
|
|
1411
1484
|
let intentAttemptActive = false;
|
|
1485
|
+
let attemptSettled = false;
|
|
1412
1486
|
const beginIntentAttempt = () => {
|
|
1413
1487
|
intentIdempotencyKey = (0, import_shared4.generateIdempotencyKey)();
|
|
1414
1488
|
if (!intentIdempotencyKey) {
|
|
@@ -1476,6 +1550,19 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1476
1550
|
const inAppBrowser = () => (0, import_shared4.detectPayPalEnvironment)().inAppBrowser;
|
|
1477
1551
|
const effectiveSessionId = () => prepared?.sessionId ?? props.sessionId ?? "";
|
|
1478
1552
|
const effectiveNonce = () => prepared?.nonce ?? props.nonce;
|
|
1553
|
+
const reportSettledIntentVerdict2 = async (response, sessionId) => {
|
|
1554
|
+
if (response.ok) {
|
|
1555
|
+
const result = { status: "succeeded", checkoutMethod: "paypal" };
|
|
1556
|
+
(0, import_shared4.invokeMerchantCallback)(() => emit("complete", result));
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
const json = await response.json().catch(() => null);
|
|
1560
|
+
const failure = (0, import_shared4.describePayPalProcessFailure)(json);
|
|
1561
|
+
emitDecline(failure.message, sessionId, {
|
|
1562
|
+
code: failure.code,
|
|
1563
|
+
declineCode: failure.declineCode
|
|
1564
|
+
});
|
|
1565
|
+
};
|
|
1479
1566
|
const createIntent = async () => {
|
|
1480
1567
|
if (!intentAttemptActive) beginIntentAttempt();
|
|
1481
1568
|
const intent = await api().createSessionIntent(
|
|
@@ -1484,6 +1571,15 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1484
1571
|
(0, import_shared4.buildPayPalSessionIntentRequest)(configuredObjectType()),
|
|
1485
1572
|
{ idempotencyKey: intentIdempotencyKey }
|
|
1486
1573
|
);
|
|
1574
|
+
if ((0, import_shared4.isSettledSessionIntent)(intent)) {
|
|
1575
|
+
await reportSettledIntentVerdict2(intent.response, effectiveSessionId());
|
|
1576
|
+
attemptSettled = true;
|
|
1577
|
+
attemptLive = false;
|
|
1578
|
+
prepared = null;
|
|
1579
|
+
throw new import_shared4.FloPayError("PayPal checkout already settled.", "api_error", {
|
|
1580
|
+
code: PAYPAL_INTENT_SETTLED_CODE
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1487
1583
|
if (intent.provider !== "paypal" || intent.providerObjectType !== objectType()) {
|
|
1488
1584
|
throw new import_shared4.FloPayError("PayPal could not start this payment.", "api_error", {
|
|
1489
1585
|
code: "paypal_intent_mismatch"
|
|
@@ -1549,6 +1645,17 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1549
1645
|
return;
|
|
1550
1646
|
}
|
|
1551
1647
|
prepared = null;
|
|
1648
|
+
if (error instanceof import_shared4.FloPayError && error.code === "checkout_processing_timeout") {
|
|
1649
|
+
(0, import_shared4.invokeMerchantCallback)(() => emit("error", error));
|
|
1650
|
+
notifyTechnicalFailure(error, error.message, {
|
|
1651
|
+
code: "checkout_processing_timeout",
|
|
1652
|
+
popupBlocked: false,
|
|
1653
|
+
provider: "paypal",
|
|
1654
|
+
paymentMethodCategory: "paypal",
|
|
1655
|
+
terminalReason: classification.terminalReason
|
|
1656
|
+
});
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1552
1659
|
const recoveryMessage = (0, import_shared4.buildExternalMethodRecoveryMessage)(
|
|
1553
1660
|
"PayPal",
|
|
1554
1661
|
classification.popupBlocked,
|
|
@@ -1677,6 +1784,7 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1677
1784
|
beginIntentAttempt();
|
|
1678
1785
|
prepared = null;
|
|
1679
1786
|
attemptLive = false;
|
|
1787
|
+
attemptSettled = false;
|
|
1680
1788
|
let next = {};
|
|
1681
1789
|
const runner = props.runBeforeButtonClick;
|
|
1682
1790
|
if (runner) {
|
|
@@ -1772,6 +1880,10 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1772
1880
|
onCancel: () => cancel(gen),
|
|
1773
1881
|
onError: (error) => {
|
|
1774
1882
|
if (!isCurrent(gen)) return;
|
|
1883
|
+
if (attemptSettled || error instanceof import_shared4.FloPayError && error.code === PAYPAL_INTENT_SETTLED_CODE) {
|
|
1884
|
+
trace("onError:settled");
|
|
1885
|
+
return;
|
|
1886
|
+
}
|
|
1775
1887
|
trace(
|
|
1776
1888
|
`onError rendered=${rendered} msg=${errorMessage(error, "PayPal failed to render.").slice(0, 120)}`
|
|
1777
1889
|
);
|
|
@@ -1857,6 +1969,7 @@ var DirectPayPalButton = (0, import_vue3.defineComponent)({
|
|
|
1857
1969
|
attemptLive = false;
|
|
1858
1970
|
intentIdempotencyKey = void 0;
|
|
1859
1971
|
intentAttemptActive = false;
|
|
1972
|
+
attemptSettled = false;
|
|
1860
1973
|
closeButtons();
|
|
1861
1974
|
if (!props.clientId) {
|
|
1862
1975
|
setState("exhausted");
|
|
@@ -3683,10 +3796,12 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
|
|
|
3683
3796
|
await runSavedPayment(result);
|
|
3684
3797
|
}
|
|
3685
3798
|
};
|
|
3799
|
+
let sessionResponseReceived = false;
|
|
3686
3800
|
const start = async () => {
|
|
3687
3801
|
const api = createApi();
|
|
3688
3802
|
if (props.sessionId) {
|
|
3689
3803
|
const result = await api.getUnifiedCheckoutSession(props.sessionId, props.nonce);
|
|
3804
|
+
sessionResponseReceived = true;
|
|
3690
3805
|
adopt(result);
|
|
3691
3806
|
await settleMode(result);
|
|
3692
3807
|
return;
|
|
@@ -3711,6 +3826,7 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
|
|
|
3711
3826
|
} : {}
|
|
3712
3827
|
});
|
|
3713
3828
|
const resolved = await resolveInlineSession(api, params);
|
|
3829
|
+
sessionResponseReceived = true;
|
|
3714
3830
|
if (!resolved.claimed) {
|
|
3715
3831
|
adopt(resolved.result);
|
|
3716
3832
|
await settleMode(resolved.result);
|
|
@@ -3732,7 +3848,12 @@ var FloPayCheckout = (0, import_vue7.defineComponent)({
|
|
|
3732
3848
|
() => {
|
|
3733
3849
|
if (active) state.loading = false;
|
|
3734
3850
|
},
|
|
3735
|
-
(error) => fail(
|
|
3851
|
+
(error) => fail(
|
|
3852
|
+
(0, import_shared9.toPublicCheckoutInitError)(error, {
|
|
3853
|
+
stage: sessionResponseReceived ? "post_session" : "session_request",
|
|
3854
|
+
sessionId: props.sessionId || state.session?.id || void 0
|
|
3855
|
+
})
|
|
3856
|
+
)
|
|
3736
3857
|
);
|
|
3737
3858
|
});
|
|
3738
3859
|
(0, import_vue7.onBeforeUnmount)(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-DUU6SMKP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
FloPayPaymentMethodSetup
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5K5MGWEN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
FloPayCardSetupError,
|
|
9
9
|
VaultCardFields
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
FloPayProvider,
|
|
16
16
|
StripePaymentMethods,
|
|
17
17
|
hasStripePayPalReturn
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RAXPWAR7.mjs";
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
import { dropThirdPartyOnlyError } from "@flopay/shared";
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
resolveIdempotencyKey,
|
|
56
56
|
resolveTheme as resolveTheme2,
|
|
57
57
|
serializeCreateParams,
|
|
58
|
+
toPublicCheckoutInitError,
|
|
58
59
|
wasSessionRecentlyCompleted
|
|
59
60
|
} from "@flopay/shared";
|
|
60
61
|
import {
|
|
@@ -270,6 +271,7 @@ import {
|
|
|
270
271
|
invokeMerchantCallback,
|
|
271
272
|
isPayPalAcknowledgementDeadWindow,
|
|
272
273
|
isPayPalTeardownMessage,
|
|
274
|
+
isSettledSessionIntent,
|
|
273
275
|
isValidEmail as isValidEmail2,
|
|
274
276
|
mergePayPalPayerIdentity,
|
|
275
277
|
needsPayPalPayerDetails,
|
|
@@ -405,6 +407,7 @@ var BuyerIdentityFallbackPanel = defineComponent({
|
|
|
405
407
|
});
|
|
406
408
|
|
|
407
409
|
// src/direct-paypal-button.ts
|
|
410
|
+
var PAYPAL_INTENT_SETTLED_CODE = "paypal_intent_settled";
|
|
408
411
|
var PAYPAL_INIT_RETRY_DELAY_MS = 1e3;
|
|
409
412
|
var PayPalStartupFailure = class extends Error {
|
|
410
413
|
constructor(message, options = {}) {
|
|
@@ -499,6 +502,7 @@ var DirectPayPalButton = defineComponent2({
|
|
|
499
502
|
let attemptLive = false;
|
|
500
503
|
let intentIdempotencyKey;
|
|
501
504
|
let intentAttemptActive = false;
|
|
505
|
+
let attemptSettled = false;
|
|
502
506
|
const beginIntentAttempt = () => {
|
|
503
507
|
intentIdempotencyKey = generateIdempotencyKey();
|
|
504
508
|
if (!intentIdempotencyKey) {
|
|
@@ -566,6 +570,19 @@ var DirectPayPalButton = defineComponent2({
|
|
|
566
570
|
const inAppBrowser = () => detectPayPalEnvironment().inAppBrowser;
|
|
567
571
|
const effectiveSessionId = () => prepared?.sessionId ?? props.sessionId ?? "";
|
|
568
572
|
const effectiveNonce = () => prepared?.nonce ?? props.nonce;
|
|
573
|
+
const reportSettledIntentVerdict = async (response, sessionId) => {
|
|
574
|
+
if (response.ok) {
|
|
575
|
+
const result = { status: "succeeded", checkoutMethod: "paypal" };
|
|
576
|
+
invokeMerchantCallback(() => emit("complete", result));
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
const json = await response.json().catch(() => null);
|
|
580
|
+
const failure = describePayPalProcessFailure(json);
|
|
581
|
+
emitDecline(failure.message, sessionId, {
|
|
582
|
+
code: failure.code,
|
|
583
|
+
declineCode: failure.declineCode
|
|
584
|
+
});
|
|
585
|
+
};
|
|
569
586
|
const createIntent = async () => {
|
|
570
587
|
if (!intentAttemptActive) beginIntentAttempt();
|
|
571
588
|
const intent = await api().createSessionIntent(
|
|
@@ -574,6 +591,15 @@ var DirectPayPalButton = defineComponent2({
|
|
|
574
591
|
buildPayPalSessionIntentRequest(configuredObjectType()),
|
|
575
592
|
{ idempotencyKey: intentIdempotencyKey }
|
|
576
593
|
);
|
|
594
|
+
if (isSettledSessionIntent(intent)) {
|
|
595
|
+
await reportSettledIntentVerdict(intent.response, effectiveSessionId());
|
|
596
|
+
attemptSettled = true;
|
|
597
|
+
attemptLive = false;
|
|
598
|
+
prepared = null;
|
|
599
|
+
throw new FloPayError2("PayPal checkout already settled.", "api_error", {
|
|
600
|
+
code: PAYPAL_INTENT_SETTLED_CODE
|
|
601
|
+
});
|
|
602
|
+
}
|
|
577
603
|
if (intent.provider !== "paypal" || intent.providerObjectType !== objectType()) {
|
|
578
604
|
throw new FloPayError2("PayPal could not start this payment.", "api_error", {
|
|
579
605
|
code: "paypal_intent_mismatch"
|
|
@@ -639,6 +665,17 @@ var DirectPayPalButton = defineComponent2({
|
|
|
639
665
|
return;
|
|
640
666
|
}
|
|
641
667
|
prepared = null;
|
|
668
|
+
if (error instanceof FloPayError2 && error.code === "checkout_processing_timeout") {
|
|
669
|
+
invokeMerchantCallback(() => emit("error", error));
|
|
670
|
+
notifyTechnicalFailure(error, error.message, {
|
|
671
|
+
code: "checkout_processing_timeout",
|
|
672
|
+
popupBlocked: false,
|
|
673
|
+
provider: "paypal",
|
|
674
|
+
paymentMethodCategory: "paypal",
|
|
675
|
+
terminalReason: classification.terminalReason
|
|
676
|
+
});
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
642
679
|
const recoveryMessage = buildExternalMethodRecoveryMessage(
|
|
643
680
|
"PayPal",
|
|
644
681
|
classification.popupBlocked,
|
|
@@ -767,6 +804,7 @@ var DirectPayPalButton = defineComponent2({
|
|
|
767
804
|
beginIntentAttempt();
|
|
768
805
|
prepared = null;
|
|
769
806
|
attemptLive = false;
|
|
807
|
+
attemptSettled = false;
|
|
770
808
|
let next = {};
|
|
771
809
|
const runner = props.runBeforeButtonClick;
|
|
772
810
|
if (runner) {
|
|
@@ -862,6 +900,10 @@ var DirectPayPalButton = defineComponent2({
|
|
|
862
900
|
onCancel: () => cancel(gen),
|
|
863
901
|
onError: (error) => {
|
|
864
902
|
if (!isCurrent(gen)) return;
|
|
903
|
+
if (attemptSettled || error instanceof FloPayError2 && error.code === PAYPAL_INTENT_SETTLED_CODE) {
|
|
904
|
+
trace("onError:settled");
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
865
907
|
trace(
|
|
866
908
|
`onError rendered=${rendered} msg=${errorMessage(error, "PayPal failed to render.").slice(0, 120)}`
|
|
867
909
|
);
|
|
@@ -947,6 +989,7 @@ var DirectPayPalButton = defineComponent2({
|
|
|
947
989
|
attemptLive = false;
|
|
948
990
|
intentIdempotencyKey = void 0;
|
|
949
991
|
intentAttemptActive = false;
|
|
992
|
+
attemptSettled = false;
|
|
950
993
|
closeButtons();
|
|
951
994
|
if (!props.clientId) {
|
|
952
995
|
setState("exhausted");
|
|
@@ -2654,10 +2697,12 @@ var FloPayCheckout = defineComponent4({
|
|
|
2654
2697
|
await runSavedPayment(result);
|
|
2655
2698
|
}
|
|
2656
2699
|
};
|
|
2700
|
+
let sessionResponseReceived = false;
|
|
2657
2701
|
const start = async () => {
|
|
2658
2702
|
const api = createApi();
|
|
2659
2703
|
if (props.sessionId) {
|
|
2660
2704
|
const result = await api.getUnifiedCheckoutSession(props.sessionId, props.nonce);
|
|
2705
|
+
sessionResponseReceived = true;
|
|
2661
2706
|
adopt(result);
|
|
2662
2707
|
await settleMode(result);
|
|
2663
2708
|
return;
|
|
@@ -2682,6 +2727,7 @@ var FloPayCheckout = defineComponent4({
|
|
|
2682
2727
|
} : {}
|
|
2683
2728
|
});
|
|
2684
2729
|
const resolved = await resolveInlineSession(api, params);
|
|
2730
|
+
sessionResponseReceived = true;
|
|
2685
2731
|
if (!resolved.claimed) {
|
|
2686
2732
|
adopt(resolved.result);
|
|
2687
2733
|
await settleMode(resolved.result);
|
|
@@ -2703,7 +2749,12 @@ var FloPayCheckout = defineComponent4({
|
|
|
2703
2749
|
() => {
|
|
2704
2750
|
if (active) state.loading = false;
|
|
2705
2751
|
},
|
|
2706
|
-
(error) => fail(
|
|
2752
|
+
(error) => fail(
|
|
2753
|
+
toPublicCheckoutInitError(error, {
|
|
2754
|
+
stage: sessionResponseReceived ? "post_session" : "session_request",
|
|
2755
|
+
sessionId: props.sessionId || state.session?.id || void 0
|
|
2756
|
+
})
|
|
2757
|
+
)
|
|
2707
2758
|
);
|
|
2708
2759
|
});
|
|
2709
2760
|
onBeforeUnmount4(() => {
|
|
@@ -256,7 +256,46 @@ function stripeMethodCategory(method) {
|
|
|
256
256
|
function declineReason(error) {
|
|
257
257
|
return error.decline_code ?? error.code ?? "provider_declined";
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
async function reportSettledIntentVerdict(response, method, sessionId, session, outcomes) {
|
|
260
|
+
const json = response.status === 204 ? null : await response.json().catch(() => null);
|
|
261
|
+
if (response.ok) {
|
|
262
|
+
const authorized = session?.captureMethod === "manual" || json?.status === "authorized";
|
|
263
|
+
const paymentId = typeof json?.paymentId === "string" ? json.paymentId : session?.paymentId;
|
|
264
|
+
const authorizationExpiresAt = typeof json?.authorizationExpiresAt === "string" ? json.authorizationExpiresAt : session?.authorizationExpiresAt;
|
|
265
|
+
outcomes.complete(
|
|
266
|
+
authorized ? {
|
|
267
|
+
status: "authorized",
|
|
268
|
+
...paymentId ? { paymentId } : {},
|
|
269
|
+
sessionId: typeof json?.sessionId === "string" ? json.sessionId : sessionId,
|
|
270
|
+
...authorizationExpiresAt ? { authorizationExpiresAt } : {},
|
|
271
|
+
checkoutMethod: method
|
|
272
|
+
} : { status: "succeeded", checkoutMethod: method }
|
|
273
|
+
);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const type = typeof json?.type === "string" ? json.type : void 0;
|
|
277
|
+
const message = typeof json?.message === "string" ? json.message : void 0;
|
|
278
|
+
const code = typeof json?.code === "string" ? json.code : void 0;
|
|
279
|
+
const actionCode = type === void 0 ? void 0 : SETTLED_ACTION_REQUIRED_CODES.get(type);
|
|
280
|
+
if (actionCode === void 0 && (0, import_shared5.classifyPaymentRejection)(response.status, json) === "payment_declined") {
|
|
281
|
+
outcomes.decline({
|
|
282
|
+
method,
|
|
283
|
+
message: message ?? "Your payment was declined.",
|
|
284
|
+
code,
|
|
285
|
+
declineCode: typeof json?.declineCode === "string" ? json.declineCode : code,
|
|
286
|
+
sessionId
|
|
287
|
+
});
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
outcomes.error(
|
|
291
|
+
new import_shared5.FloPayError(message ?? "Payment could not be completed. Please try again.", "api_error", {
|
|
292
|
+
code: actionCode ?? code ?? "payment_processing_error",
|
|
293
|
+
statusCode: response.status,
|
|
294
|
+
sessionId
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
var import_card_setup2, import_shared5, import_vue5, WALLET_METHODS, EXPRESS_CHECKOUT_CLICK_BUDGET_MS, PAYPAL_REDIRECT_TILE_HEIGHT, stripePayPalResumeAttempts, SETTLED_ACTION_REQUIRED_CODES, StripePaymentMethods;
|
|
260
299
|
var init_stripe_elements = __esm({
|
|
261
300
|
"src/stripe-elements.ts"() {
|
|
262
301
|
"use strict";
|
|
@@ -270,6 +309,10 @@ var init_stripe_elements = __esm({
|
|
|
270
309
|
EXPRESS_CHECKOUT_CLICK_BUDGET_MS = 900;
|
|
271
310
|
PAYPAL_REDIRECT_TILE_HEIGHT = 44;
|
|
272
311
|
stripePayPalResumeAttempts = /* @__PURE__ */ new Map();
|
|
312
|
+
SETTLED_ACTION_REQUIRED_CODES = /* @__PURE__ */ new Map([
|
|
313
|
+
["3ds_required", "authentication_required"],
|
|
314
|
+
["paypal_direct_required", "paypal_direct_required"]
|
|
315
|
+
]);
|
|
273
316
|
StripePaymentMethods = (0, import_vue5.defineComponent)({
|
|
274
317
|
name: "FloPayStripePaymentMethods",
|
|
275
318
|
props: {
|
|
@@ -356,11 +399,13 @@ var init_stripe_elements = __esm({
|
|
|
356
399
|
const setupFutureUsage = (0, import_shared5.resolveSetupFutureUsage)(props.session, methods, surface);
|
|
357
400
|
const currency = (props.currency ?? props.session?.currency ?? "usd").toLowerCase();
|
|
358
401
|
const appearance = props.appearance ? { appearance: (0, import_shared5.toStripeAppearance)(props.appearance) } : {};
|
|
359
|
-
return props.intentKind === "setup" ? { mode: "setup", currency,
|
|
402
|
+
return props.intentKind === "setup" ? { mode: "setup", currency, allowedPaymentMethodTypes: methods, ...appearance } : {
|
|
360
403
|
mode: props.session?.mode === "subscription" ? "subscription" : "payment",
|
|
361
404
|
amount: props.amount,
|
|
362
405
|
currency,
|
|
363
|
-
|
|
406
|
+
// Stripe.js Endive (@stripe/stripe-js 10) removed the Elements
|
|
407
|
+
// `paymentMethodTypes` option; `allowedPaymentMethodTypes` replaces it.
|
|
408
|
+
allowedPaymentMethodTypes: methods,
|
|
364
409
|
...setupFutureUsage ? { setupFutureUsage } : {},
|
|
365
410
|
...appearance
|
|
366
411
|
};
|
|
@@ -377,7 +422,7 @@ var init_stripe_elements = __esm({
|
|
|
377
422
|
return {
|
|
378
423
|
...(0, import_shared5.resolveWalletModeOptions)(props.totalAmount, props.session?.captureMethod),
|
|
379
424
|
currency,
|
|
380
|
-
|
|
425
|
+
allowedPaymentMethodTypes: methods,
|
|
381
426
|
...setupFutureUsage ? { setupFutureUsage } : {},
|
|
382
427
|
...props.appearance ? { appearance: (0, import_shared5.toStripeAppearance)(props.appearance) } : {}
|
|
383
428
|
};
|
|
@@ -483,6 +528,11 @@ var init_stripe_elements = __esm({
|
|
|
483
528
|
observeWalletSheetClick(event.expressPaymentType, clickStartedAt);
|
|
484
529
|
event.resolve();
|
|
485
530
|
};
|
|
531
|
+
const settledVerdictOutcomes = {
|
|
532
|
+
complete: (result) => (0, import_shared5.invokeMerchantCallback)(() => emit("complete", result)),
|
|
533
|
+
decline: (decline) => (0, import_shared5.invokeMerchantCallback)(() => emit("decline", decline)),
|
|
534
|
+
error: (failure) => (0, import_shared5.invokeMerchantCallback)(() => emit("error", failure))
|
|
535
|
+
};
|
|
486
536
|
const confirm = async (elements, method, intentKind = props.intentKind, attempt = null) => {
|
|
487
537
|
if (!stripe || processing.value) return;
|
|
488
538
|
processing.value = true;
|
|
@@ -501,6 +551,17 @@ var init_stripe_elements = __esm({
|
|
|
501
551
|
paymentMethodId: null,
|
|
502
552
|
intentKind
|
|
503
553
|
});
|
|
554
|
+
if ((0, import_shared5.isSettledSessionIntent)(intent)) {
|
|
555
|
+
if (intentKind === "setup") throw (0, import_shared5.settledSessionIntentError)(sessionId);
|
|
556
|
+
await reportSettledIntentVerdict(
|
|
557
|
+
intent.response,
|
|
558
|
+
method,
|
|
559
|
+
sessionId,
|
|
560
|
+
props.session,
|
|
561
|
+
settledVerdictOutcomes
|
|
562
|
+
);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
504
565
|
const clientSecret = intent.clientSecret ?? "";
|
|
505
566
|
const returnUrl = props.returnUrl ?? window.location.href;
|
|
506
567
|
const { error } = intentKind === "setup" ? await stripe.confirmSetup({
|
|
@@ -606,6 +667,16 @@ var init_stripe_elements = __esm({
|
|
|
606
667
|
paymentMethodId: paymentMethod?.id ?? null,
|
|
607
668
|
intentKind: "payment"
|
|
608
669
|
});
|
|
670
|
+
if ((0, import_shared5.isSettledSessionIntent)(intent)) {
|
|
671
|
+
await reportSettledIntentVerdict(
|
|
672
|
+
intent.response,
|
|
673
|
+
"paypal",
|
|
674
|
+
sessionId,
|
|
675
|
+
props.session,
|
|
676
|
+
settledVerdictOutcomes
|
|
677
|
+
);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
609
680
|
if (intent.provider !== "stripe") {
|
|
610
681
|
throw new Error("Invalid provider returned for PayPal intent");
|
|
611
682
|
}
|
|
@@ -938,6 +1009,7 @@ var init_payment_method_setup_paypal = __esm({
|
|
|
938
1009
|
paymentMethodId: null,
|
|
939
1010
|
intentKind: "setup"
|
|
940
1011
|
});
|
|
1012
|
+
if ((0, import_shared6.isSettledSessionIntent)(intent)) throw (0, import_shared6.settledSessionIntentError)(sessionId);
|
|
941
1013
|
if (intent.provider !== "paypal" || intent.providerObjectType !== "setup_token") {
|
|
942
1014
|
throw new import_shared6.FloPayError(
|
|
943
1015
|
"The billing API did not return a PayPal setup token.",
|
package/dist/{payment-method-setup-paypal-XPSU4CHA.mjs → payment-method-setup-paypal-D6FEQQJY.mjs}
RENAMED
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
classifyExternalMethodFailure,
|
|
6
6
|
detectPayPalEnvironment,
|
|
7
7
|
FloPayError,
|
|
8
|
-
|
|
8
|
+
isSettledSessionIntent,
|
|
9
|
+
PAYPAL_VAULTED_PAYMENT_METHOD_TYPE,
|
|
10
|
+
settledSessionIntentError
|
|
9
11
|
} from "@flopay/shared";
|
|
10
12
|
import { loadScript } from "@paypal/paypal-js";
|
|
11
13
|
import { defineComponent, h, onBeforeUnmount, onMounted, ref } from "vue";
|
|
@@ -72,6 +74,7 @@ var PayPalSetupMethod = defineComponent({
|
|
|
72
74
|
paymentMethodId: null,
|
|
73
75
|
intentKind: "setup"
|
|
74
76
|
});
|
|
77
|
+
if (isSettledSessionIntent(intent)) throw settledSessionIntentError(sessionId);
|
|
75
78
|
if (intent.provider !== "paypal" || intent.providerObjectType !== "setup_token") {
|
|
76
79
|
throw new FloPayError(
|
|
77
80
|
"The billing API did not return a PayPal setup token.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/vue",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@flopay/js": "1.14.
|
|
40
|
-
"@flopay/shared": "1.14.
|
|
39
|
+
"@flopay/js": "1.14.9",
|
|
40
|
+
"@flopay/shared": "1.14.9",
|
|
41
41
|
"@paypal/paypal-js": "^10.1.0",
|
|
42
|
-
"@stripe/stripe-js": "^
|
|
42
|
+
"@stripe/stripe-js": "^10.2.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vue": ">=3.3.0"
|