@funnelfox/billing 0.9.3-ffb-apple-pay-continue-button.33 → 0.10.1
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 +4 -0
- package/dist/chunk-index.cjs.js +135 -159
- package/dist/chunk-index.cjs3.js +1 -1
- package/dist/chunk-index.es.js +134 -160
- package/dist/chunk-index.es3.js +1 -1
- package/dist/chunk-stripe-card-form.cjs.js +5 -5
- package/dist/chunk-stripe-card-form.es.js +5 -5
- package/dist/chunk-stripe-wallet.cjs.js +9 -2
- package/dist/chunk-stripe-wallet.es.js +9 -2
- package/dist/funnelfox-billing.js +146 -165
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +57 -42
|
@@ -123,6 +123,8 @@
|
|
|
123
123
|
this.errorType = options.errorType || null;
|
|
124
124
|
this.requestId = options.requestId || null;
|
|
125
125
|
this.response = options.response || null;
|
|
126
|
+
this.declineCode = options.declineCode || null;
|
|
127
|
+
this.declineCodeSource = options.declineCodeSource || null;
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
class PrimerError extends FunnefoxSDKError {
|
|
@@ -327,6 +329,74 @@
|
|
|
327
329
|
/**
|
|
328
330
|
* @fileoverview Helper utilities for Funnefox SDK
|
|
329
331
|
*/
|
|
332
|
+
// Mirrors Stripe Elements: a card number that can never become valid is reported while the buyer
|
|
333
|
+
// types, an incomplete value only after they leave the field, and an empty one only after a submit
|
|
334
|
+
// attempt. Primer reports every error on every keystroke, even for fields the buyer has not reached
|
|
335
|
+
// yet, and its expiry codes cannot tell a typo from a half-typed date ("1" is already
|
|
336
|
+
// expiryYearInvalid, "01/2" is cardExpired), so expiry errors wait for the buyer to leave the field.
|
|
337
|
+
const HOSTED_INPUT_ERRORS_SHOWN_WHILE_TYPING = new Set(['cardInvalid']);
|
|
338
|
+
const HOSTED_INPUT_ERRORS_FOR_EMPTY_FIELD = new Set([
|
|
339
|
+
'cardRequired',
|
|
340
|
+
'expiryRequired',
|
|
341
|
+
'cvvRequired',
|
|
342
|
+
]);
|
|
343
|
+
function getVisibleHostedInputError(input) {
|
|
344
|
+
if (!input.error) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
if (input.errorCode &&
|
|
348
|
+
HOSTED_INPUT_ERRORS_SHOWN_WHILE_TYPING.has(input.errorCode)) {
|
|
349
|
+
return input.error;
|
|
350
|
+
}
|
|
351
|
+
if (input.active) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
if (input.submitted) {
|
|
355
|
+
return input.error;
|
|
356
|
+
}
|
|
357
|
+
if (input.errorCode &&
|
|
358
|
+
HOSTED_INPUT_ERRORS_FOR_EMPTY_FIELD.has(input.errorCode)) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
return input.touched ? input.error : null;
|
|
362
|
+
}
|
|
363
|
+
function resolveTaxDisplay(source) {
|
|
364
|
+
return {
|
|
365
|
+
...resolveTaxAmount(source),
|
|
366
|
+
...resolveTaxBreakdown(source.tax_breakdown),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function resolveTaxBreakdown(breakdown) {
|
|
370
|
+
if (!Array.isArray(breakdown)) {
|
|
371
|
+
return {};
|
|
372
|
+
}
|
|
373
|
+
const taxBreakdown = breakdown.map(entry => ({
|
|
374
|
+
amount: entry.amount,
|
|
375
|
+
percentage: entry.percentage,
|
|
376
|
+
inclusive: entry.inclusive,
|
|
377
|
+
taxType: entry.tax_type,
|
|
378
|
+
country: entry.country,
|
|
379
|
+
subdivision: entry.subdivision,
|
|
380
|
+
taxabilityReason: entry.taxability_reason,
|
|
381
|
+
}));
|
|
382
|
+
const percentages = taxBreakdown.map(entry => Number(entry.percentage));
|
|
383
|
+
if (!percentages.length || !percentages.every(Number.isFinite)) {
|
|
384
|
+
return { taxBreakdown };
|
|
385
|
+
}
|
|
386
|
+
const taxRate = Number(percentages.reduce((sum, percentage) => sum + percentage, 0).toFixed(6));
|
|
387
|
+
return { taxBreakdown, taxRate };
|
|
388
|
+
}
|
|
389
|
+
function resolveTaxAmount(source) {
|
|
390
|
+
const taxBehavior = source.tax_behavior ??
|
|
391
|
+
((source.tax_amount ?? 0) > 0 ? 'exclusive' : undefined);
|
|
392
|
+
if (taxBehavior === 'inclusive') {
|
|
393
|
+
return { taxBehavior, taxAmount: source.tax_inclusive_amount ?? 0 };
|
|
394
|
+
}
|
|
395
|
+
if (taxBehavior === 'exclusive') {
|
|
396
|
+
return { taxBehavior, taxAmount: source.tax_amount ?? 0 };
|
|
397
|
+
}
|
|
398
|
+
return { taxAmount: 0 };
|
|
399
|
+
}
|
|
330
400
|
function merge(...objects) {
|
|
331
401
|
const result = {};
|
|
332
402
|
for (const obj of objects) {
|
|
@@ -495,7 +565,7 @@
|
|
|
495
565
|
/**
|
|
496
566
|
* @fileoverview Constants for Funnefox SDK
|
|
497
567
|
*/
|
|
498
|
-
const SDK_VERSION = '0.
|
|
568
|
+
const SDK_VERSION = '0.10.1';
|
|
499
569
|
const DEFAULTS = {
|
|
500
570
|
BASE_URL: 'https://billing.funnelfox.com',
|
|
501
571
|
REGION: 'default',
|
|
@@ -632,117 +702,6 @@
|
|
|
632
702
|
return true;
|
|
633
703
|
}
|
|
634
704
|
|
|
635
|
-
/**
|
|
636
|
-
* @fileoverview Support for Apple's official <apple-pay-button> custom element.
|
|
637
|
-
*
|
|
638
|
-
* Primer's checkout-web v2 renders the Apple Pay button through the CSS
|
|
639
|
-
* approach (-webkit-appearance: -apple-pay-button), and WebKit only accepts
|
|
640
|
-
* the 7 legacy values for -apple-pay-button-type. Newer types such as
|
|
641
|
-
* 'continue' are silently dropped and fall back to 'plain' (verified in
|
|
642
|
-
* Safari 26 on macOS and iOS — see PRD-1426).
|
|
643
|
-
*
|
|
644
|
-
* Apple's official custom element supports the full set of button types, so
|
|
645
|
-
* for "native-only" types we overlay it on top of the (visually hidden)
|
|
646
|
-
* Primer button and forward clicks, keeping Primer's payment flow untouched.
|
|
647
|
-
*/
|
|
648
|
-
const APPLE_PAY_SDK_URL = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
|
|
649
|
-
/** How long to wait for the <apple-pay-button> element definition before
|
|
650
|
-
* giving up and falling back to Primer's own button. */
|
|
651
|
-
const ELEMENT_DEFINITION_TIMEOUT_MS = 4000;
|
|
652
|
-
/**
|
|
653
|
-
* Button types WebKit can render through Primer's CSS approach.
|
|
654
|
-
* Everything outside this list requires the native <apple-pay-button> element.
|
|
655
|
-
*/
|
|
656
|
-
const CSS_RENDERABLE_APPLE_PAY_TYPES = [
|
|
657
|
-
'plain',
|
|
658
|
-
'buy',
|
|
659
|
-
'set-up',
|
|
660
|
-
'donate',
|
|
661
|
-
'check-out',
|
|
662
|
-
'book',
|
|
663
|
-
'subscribe',
|
|
664
|
-
];
|
|
665
|
-
/**
|
|
666
|
-
* Returns true when the requested Apple Pay buttonType can only be rendered
|
|
667
|
-
* with Apple's native <apple-pay-button> element.
|
|
668
|
-
*/
|
|
669
|
-
function isNativeOnlyApplePayButtonType(type) {
|
|
670
|
-
return !!type && !CSS_RENDERABLE_APPLE_PAY_TYPES.includes(type);
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Loads Apple's apple-pay-sdk.js (defines the <apple-pay-button> custom
|
|
674
|
-
* element). Resolves to true when the element is available.
|
|
675
|
-
*/
|
|
676
|
-
async function loadApplePayButtonElement() {
|
|
677
|
-
if (typeof window === 'undefined' || !window.customElements) {
|
|
678
|
-
return false;
|
|
679
|
-
}
|
|
680
|
-
if (window.customElements.get('apple-pay-button')) {
|
|
681
|
-
return true;
|
|
682
|
-
}
|
|
683
|
-
try {
|
|
684
|
-
await loadScript$1({
|
|
685
|
-
src: APPLE_PAY_SDK_URL,
|
|
686
|
-
crossOrigin: 'anonymous',
|
|
687
|
-
appendTo: 'head',
|
|
688
|
-
});
|
|
689
|
-
// Never hang on a script that loaded but did not define the element —
|
|
690
|
-
// fall back to Primer's own button instead.
|
|
691
|
-
const defined = window.customElements
|
|
692
|
-
.whenDefined('apple-pay-button')
|
|
693
|
-
.then(() => true);
|
|
694
|
-
const timeout = new Promise(resolve => {
|
|
695
|
-
setTimeout(() => resolve(false), ELEMENT_DEFINITION_TIMEOUT_MS);
|
|
696
|
-
});
|
|
697
|
-
return await Promise.race([defined, timeout]);
|
|
698
|
-
}
|
|
699
|
-
catch {
|
|
700
|
-
return false;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Renders Apple's native <apple-pay-button> stretched over `wrapper` and
|
|
705
|
-
* forwards clicks to the Primer-rendered <button> inside it. The synchronous
|
|
706
|
-
* forwarded click preserves the user activation required by ApplePaySession.
|
|
707
|
-
*
|
|
708
|
-
* Returns the overlay element, or null when the Apple Pay SDK could not be
|
|
709
|
-
* loaded (callers should keep Primer's own button visible as a fallback).
|
|
710
|
-
*/
|
|
711
|
-
async function overlayNativeApplePayButton(wrapper, options) {
|
|
712
|
-
const available = await loadApplePayButtonElement();
|
|
713
|
-
if (!available) {
|
|
714
|
-
return null;
|
|
715
|
-
}
|
|
716
|
-
// The overlay is only safe when Primer's own clickable button is present —
|
|
717
|
-
// otherwise there is nothing to forward the click to.
|
|
718
|
-
if (!wrapper.querySelector('button')) {
|
|
719
|
-
return null;
|
|
720
|
-
}
|
|
721
|
-
const native = document.createElement('apple-pay-button');
|
|
722
|
-
native.setAttribute('type', options.buttonType);
|
|
723
|
-
native.setAttribute('buttonstyle', options.buttonStyle || 'black');
|
|
724
|
-
native.setAttribute('locale', (typeof navigator !== 'undefined' && navigator.language) || 'en-US');
|
|
725
|
-
native.style.cssText = [
|
|
726
|
-
'position:absolute',
|
|
727
|
-
'inset:0',
|
|
728
|
-
'width:100%',
|
|
729
|
-
'height:100%',
|
|
730
|
-
'--apple-pay-button-width:100%',
|
|
731
|
-
'--apple-pay-button-height:100%',
|
|
732
|
-
'--apple-pay-button-border-radius:28px',
|
|
733
|
-
'display:block',
|
|
734
|
-
'cursor:pointer',
|
|
735
|
-
'z-index:1',
|
|
736
|
-
].join(';');
|
|
737
|
-
wrapper.style.position = 'relative';
|
|
738
|
-
native.addEventListener('click', () => {
|
|
739
|
-
const primerButton = wrapper.querySelector('button');
|
|
740
|
-
primerButton?.click();
|
|
741
|
-
});
|
|
742
|
-
wrapper.appendChild(native);
|
|
743
|
-
return native;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
705
|
/**
|
|
747
706
|
* @fileoverview Primer SDK integration wrapper
|
|
748
707
|
*/
|
|
@@ -781,7 +740,6 @@
|
|
|
781
740
|
}
|
|
782
741
|
async createHeadlessCheckout(clientToken, options, method) {
|
|
783
742
|
await this.ensurePrimerLoaded();
|
|
784
|
-
this.applePayOptions = options.applePay;
|
|
785
743
|
this.currentHeadless = PrimerWrapper.headlessManager.getOrCreate(clientToken, options, method);
|
|
786
744
|
return this.currentHeadless;
|
|
787
745
|
}
|
|
@@ -828,53 +786,16 @@
|
|
|
828
786
|
}
|
|
829
787
|
htmlNode.appendChild(wrapper);
|
|
830
788
|
/* end hack */
|
|
831
|
-
/* PRD-1426: WebKit cannot render newer Apple Pay button types (e.g.
|
|
832
|
-
* 'continue') through the CSS approach Primer v2 uses. For those types
|
|
833
|
-
* we overlay Apple's official <apple-pay-button> element on top of the
|
|
834
|
-
* visually hidden Primer button and forward clicks, keeping Primer's
|
|
835
|
-
* payment flow untouched. The Primer button is hidden BEFORE it renders
|
|
836
|
-
* to avoid a flash of the plain button; if the Apple SDK fails to load,
|
|
837
|
-
* the rule is removed and Primer's own button stays visible (graceful
|
|
838
|
-
* fallback to 'plain'). */
|
|
839
|
-
const applePayConfig = this.applePayOptions;
|
|
840
|
-
const nativeButtonType = allowedPaymentMethod === exports.PaymentMethod.APPLE_PAY &&
|
|
841
|
-
applePayConfig?.buttonType &&
|
|
842
|
-
isNativeOnlyApplePayButtonType(applePayConfig.buttonType)
|
|
843
|
-
? applePayConfig.buttonType
|
|
844
|
-
: null;
|
|
845
|
-
let hideRuleIndex = null;
|
|
846
|
-
if (nativeButtonType && sheet) {
|
|
847
|
-
hideRuleIndex = sheet.insertRule(`
|
|
848
|
-
.${wrapper.className} > button {
|
|
849
|
-
opacity: 0 !important;
|
|
850
|
-
}
|
|
851
|
-
`);
|
|
852
|
-
}
|
|
853
789
|
button = pmManager.createButton();
|
|
854
790
|
await button.render(wrapper, {});
|
|
855
|
-
let nativeOverlay = null;
|
|
856
|
-
if (nativeButtonType) {
|
|
857
|
-
nativeOverlay = await overlayNativeApplePayButton(wrapper, {
|
|
858
|
-
buttonType: nativeButtonType,
|
|
859
|
-
buttonStyle: applePayConfig?.buttonStyle,
|
|
860
|
-
});
|
|
861
|
-
if (!nativeOverlay && sheet && hideRuleIndex !== null) {
|
|
862
|
-
sheet.deleteRule(hideRuleIndex);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
791
|
this.destroyCallbacks.push(() => button.clean());
|
|
866
792
|
onMethodRender(allowedPaymentMethod);
|
|
867
793
|
return {
|
|
868
794
|
setDisabled: (disabled) => {
|
|
869
795
|
button.setDisabled(disabled);
|
|
870
|
-
if (nativeOverlay) {
|
|
871
|
-
nativeOverlay.style.pointerEvents = disabled ? 'none' : '';
|
|
872
|
-
nativeOverlay.style.opacity = disabled ? '0.5' : '';
|
|
873
|
-
}
|
|
874
796
|
},
|
|
875
797
|
destroy: () => {
|
|
876
798
|
styleEl.remove();
|
|
877
|
-
nativeOverlay?.remove();
|
|
878
799
|
button.clean();
|
|
879
800
|
},
|
|
880
801
|
};
|
|
@@ -959,11 +880,22 @@
|
|
|
959
880
|
? 'Please enter a postal code'
|
|
960
881
|
: null;
|
|
961
882
|
};
|
|
883
|
+
const focusedHostedInputs = new Set();
|
|
962
884
|
const onHostedInputChange = (name) => (event) => {
|
|
963
885
|
const input = event;
|
|
964
|
-
|
|
965
|
-
|
|
886
|
+
const justFocused = input.active && !focusedHostedInputs.has(name);
|
|
887
|
+
if (input.active) {
|
|
888
|
+
focusedHostedInputs.add(name);
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
focusedHostedInputs.delete(name);
|
|
892
|
+
}
|
|
893
|
+
// Primer sends a change on focus before any keystroke; like Stripe, the error the buyer
|
|
894
|
+
// came back to fix stays visible until they start typing.
|
|
895
|
+
if (justFocused) {
|
|
896
|
+
return;
|
|
966
897
|
}
|
|
898
|
+
dispatchError(name, getVisibleHostedInputError(input));
|
|
967
899
|
};
|
|
968
900
|
const cardHolderOnChange = async (e) => {
|
|
969
901
|
pmManager.setCardholderName(e.target.value);
|
|
@@ -1221,6 +1153,37 @@
|
|
|
1221
1153
|
}
|
|
1222
1154
|
PrimerWrapper.headlessManager = new HeadlessManager();
|
|
1223
1155
|
|
|
1156
|
+
/**
|
|
1157
|
+
* @fileoverview Normalization of payment failure errors
|
|
1158
|
+
*/
|
|
1159
|
+
const STRIPE_CARD_ERROR = 'card_error';
|
|
1160
|
+
function declineCodeFromStripeError(error) {
|
|
1161
|
+
const { type, code } = error;
|
|
1162
|
+
if (type !== STRIPE_CARD_ERROR || typeof code !== 'string' || !code) {
|
|
1163
|
+
return null;
|
|
1164
|
+
}
|
|
1165
|
+
return code.toUpperCase();
|
|
1166
|
+
}
|
|
1167
|
+
function toPaymentFailure(error) {
|
|
1168
|
+
const failure = new Error(error?.message || 'Payment processing failed');
|
|
1169
|
+
if (error instanceof APIError) {
|
|
1170
|
+
if (error.declineCode) {
|
|
1171
|
+
failure.declineCode = error.declineCode;
|
|
1172
|
+
}
|
|
1173
|
+
if (error.declineCodeSource) {
|
|
1174
|
+
failure.declineCodeSource = error.declineCodeSource;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
else if (error instanceof Error) {
|
|
1178
|
+
const declineCode = declineCodeFromStripeError(error);
|
|
1179
|
+
if (declineCode) {
|
|
1180
|
+
failure.declineCode = declineCode;
|
|
1181
|
+
failure.declineCodeSource = 'stripe';
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
return failure;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1224
1187
|
/**
|
|
1225
1188
|
* @fileoverview API client for Funnefox backend integration
|
|
1226
1189
|
*/
|
|
@@ -1418,7 +1381,11 @@
|
|
|
1418
1381
|
status: 'succeeded',
|
|
1419
1382
|
};
|
|
1420
1383
|
case 'failed':
|
|
1421
|
-
throw new APIError(data.failed_message_for_user || 'Payment failed', null, {
|
|
1384
|
+
throw new APIError(data.failed_message_for_user || 'Payment failed', null, {
|
|
1385
|
+
response,
|
|
1386
|
+
declineCode: data.decline_code,
|
|
1387
|
+
declineCodeSource: data.decline_code_source,
|
|
1388
|
+
});
|
|
1422
1389
|
case 'cancelled':
|
|
1423
1390
|
throw new APIError('Payment was cancelled by user', null, {
|
|
1424
1391
|
response,
|
|
@@ -2019,8 +1986,8 @@
|
|
|
2019
1986
|
}
|
|
2020
1987
|
return {
|
|
2021
1988
|
amountTotal: data.amount_total,
|
|
2022
|
-
taxAmount: data.tax_amount ?? 0,
|
|
2023
1989
|
currency: data.currency ?? '',
|
|
1990
|
+
...resolveTaxDisplay(data),
|
|
2024
1991
|
};
|
|
2025
1992
|
};
|
|
2026
1993
|
this.emitTaxInfo = (info) => {
|
|
@@ -2053,8 +2020,8 @@
|
|
|
2053
2020
|
}
|
|
2054
2021
|
this.emitTaxInfo({
|
|
2055
2022
|
amountTotal: tax.amount_total,
|
|
2056
|
-
taxAmount: tax.tax_amount,
|
|
2057
2023
|
currency: tax.currency,
|
|
2024
|
+
...resolveTaxDisplay(tax),
|
|
2058
2025
|
});
|
|
2059
2026
|
}
|
|
2060
2027
|
catch (err) {
|
|
@@ -2073,6 +2040,7 @@
|
|
|
2073
2040
|
if (this.taxRecalcDebounce) {
|
|
2074
2041
|
clearTimeout(this.taxRecalcDebounce);
|
|
2075
2042
|
}
|
|
2043
|
+
this.checkoutConfig.onTaxPending?.();
|
|
2076
2044
|
this.emit(EVENTS.TAX_PENDING);
|
|
2077
2045
|
this.taxRecalcDebounce = setTimeout(this.runTaxRecalc, TAX_RECALC_DEBOUNCE_MS$1);
|
|
2078
2046
|
};
|
|
@@ -2130,8 +2098,8 @@
|
|
|
2130
2098
|
}
|
|
2131
2099
|
catch (error) {
|
|
2132
2100
|
this._setState('error');
|
|
2133
|
-
this.emit(EVENTS.PURCHASE_FAILURE,
|
|
2134
|
-
primerHandler.handleFailure(error
|
|
2101
|
+
this.emit(EVENTS.PURCHASE_FAILURE, toPaymentFailure(error));
|
|
2102
|
+
primerHandler.handleFailure(error?.message || 'Payment processing failed');
|
|
2135
2103
|
}
|
|
2136
2104
|
finally {
|
|
2137
2105
|
this.onLoaderChangeWithRace(false);
|
|
@@ -2155,8 +2123,8 @@
|
|
|
2155
2123
|
}
|
|
2156
2124
|
catch (error) {
|
|
2157
2125
|
this._setState('error');
|
|
2158
|
-
this.emit(EVENTS.PURCHASE_FAILURE,
|
|
2159
|
-
primerHandler.handleFailure(error
|
|
2126
|
+
this.emit(EVENTS.PURCHASE_FAILURE, toPaymentFailure(error));
|
|
2127
|
+
primerHandler.handleFailure(error?.message || 'Payment processing failed');
|
|
2160
2128
|
}
|
|
2161
2129
|
finally {
|
|
2162
2130
|
this.emit(EVENTS.PURCHASE_COMPLETED);
|
|
@@ -2745,6 +2713,9 @@
|
|
|
2745
2713
|
await this.primerWrapper.initializeHeadlessCheckout(this.clientToken, checkoutOptions, method);
|
|
2746
2714
|
const methodInterface = await this.primerWrapper.initMethod(method, element, methodOptions);
|
|
2747
2715
|
this.startUnhandledTelemetry(method);
|
|
2716
|
+
if (this.isTaxEnabled() && !this.lastTaxInfo) {
|
|
2717
|
+
this.emitSessionTaxEstimate();
|
|
2718
|
+
}
|
|
2748
2719
|
return {
|
|
2749
2720
|
...methodInterface,
|
|
2750
2721
|
destroy: async () => {
|
|
@@ -2908,6 +2879,9 @@
|
|
|
2908
2879
|
...DEFAULT_BUTTONS_OPTIONS[exports.PaymentMethod.GOOGLE_PAY],
|
|
2909
2880
|
...(options.googlePay || {}),
|
|
2910
2881
|
},
|
|
2882
|
+
onTaxChange: options.onTaxChange,
|
|
2883
|
+
onTaxError: options.onTaxError,
|
|
2884
|
+
onTaxPending: options.onTaxPending,
|
|
2911
2885
|
},
|
|
2912
2886
|
});
|
|
2913
2887
|
return await checkoutInstance.initMethod(method, element, {
|
|
@@ -3098,7 +3072,7 @@
|
|
|
3098
3072
|
|
|
3099
3073
|
var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Cardholder name</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" type=\"text\" pattern=\"[A-Za-z\\s]+\" placeholder=\"Full name on card\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div id=\"countrySelectorField\">\n <label class=\"ff-card-form-label\" for=\"countrySelectorInput\">Country</label>\n <div class=\"ff-select-wrap\">\n <select class=\"ff-card-form-text-input ff-card-form-select\" id=\"countrySelectorInput\"></select>\n <div class=\"ff-select-arrow\" aria-hidden=\"true\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"postalCodeInput\">Zip code</label>\n <input class=\"ff-card-form-text-input\" id=\"postalCodeInput\" placeholder=\"12345\">\n <div class=\"errorContainer\"></div>\n</div>\n";
|
|
3100
3074
|
|
|
3101
|
-
if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #
|
|
3075
|
+
if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #df1b41;\n font-size: 15px;\n line-height: 1.15;\n margin: 4px 0 10px;\n }\n\n #cvvInput {\n position: relative;\n }\n\n #cvvInput > svg {\n z-index: 1;\n position: absolute;\n top: 5px;\n right: 5px;\n width: 26px;\n height: 26px;\n }\n";
|
|
3102
3076
|
|
|
3103
3077
|
class CardSkin {
|
|
3104
3078
|
constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {
|
|
@@ -3492,7 +3466,7 @@
|
|
|
3492
3466
|
|
|
3493
3467
|
const TAX_RECALC_DEBOUNCE_MS = 600;
|
|
3494
3468
|
async function mountStripeCardForm(element, session, params) {
|
|
3495
|
-
const { stripe_public_key, amount, currency, order_id, is_link_enabled,
|
|
3469
|
+
const { stripe_public_key, amount, currency, order_id, is_link_enabled, amount_total, } = session.data;
|
|
3496
3470
|
// Tax flow is driven by the tenant setting (session.tax_enabled); enableTax is a legacy override.
|
|
3497
3471
|
const taxEnabled = session.data.tax_enabled ?? params.enableTax ?? false;
|
|
3498
3472
|
const stripe = await getStripe(stripe_public_key);
|
|
@@ -3588,8 +3562,8 @@
|
|
|
3588
3562
|
taxCalc = { id: tax.tax_calculation_id, country, postal };
|
|
3589
3563
|
params.onTaxChange?.({
|
|
3590
3564
|
amountTotal: tax.amount_total,
|
|
3591
|
-
taxAmount: tax.tax_amount,
|
|
3592
3565
|
currency: tax.currency,
|
|
3566
|
+
...resolveTaxDisplay(tax),
|
|
3593
3567
|
});
|
|
3594
3568
|
}
|
|
3595
3569
|
catch (err) {
|
|
@@ -3634,8 +3608,8 @@
|
|
|
3634
3608
|
if (taxEnabled && amount_total != null) {
|
|
3635
3609
|
params.onTaxChange?.({
|
|
3636
3610
|
amountTotal: amount_total,
|
|
3637
|
-
taxAmount: tax_amount ?? 0,
|
|
3638
3611
|
currency,
|
|
3612
|
+
...resolveTaxDisplay(session.data),
|
|
3639
3613
|
});
|
|
3640
3614
|
}
|
|
3641
3615
|
if (taxEnabled && collectLocation)
|
|
@@ -3697,7 +3671,7 @@
|
|
|
3697
3671
|
params.onPaymentSuccess?.(paymentMethod, order_id);
|
|
3698
3672
|
}
|
|
3699
3673
|
catch (err) {
|
|
3700
|
-
params.onPaymentFail?.(err);
|
|
3674
|
+
params.onPaymentFail?.(toPaymentFailure(err));
|
|
3701
3675
|
throw err;
|
|
3702
3676
|
}
|
|
3703
3677
|
finally {
|
|
@@ -3801,6 +3775,13 @@
|
|
|
3801
3775
|
if (!canPay)
|
|
3802
3776
|
throw new Error('No wallet payment method available');
|
|
3803
3777
|
}
|
|
3778
|
+
if (taxEnabled && session.data.amount_total != null) {
|
|
3779
|
+
params.onTaxChange?.({
|
|
3780
|
+
amountTotal: session.data.amount_total,
|
|
3781
|
+
currency: session.data.currency,
|
|
3782
|
+
...resolveTaxDisplay(session.data),
|
|
3783
|
+
});
|
|
3784
|
+
}
|
|
3804
3785
|
return new Promise((resolve, reject) => {
|
|
3805
3786
|
paymentRequest.on('paymentmethod', async (event) => {
|
|
3806
3787
|
let completed = false;
|
|
@@ -3857,7 +3838,7 @@
|
|
|
3857
3838
|
}
|
|
3858
3839
|
catch (err) {
|
|
3859
3840
|
completeOnce('fail');
|
|
3860
|
-
params.onPaymentFail?.(err);
|
|
3841
|
+
params.onPaymentFail?.(toPaymentFailure(err));
|
|
3861
3842
|
reject(err);
|
|
3862
3843
|
}
|
|
3863
3844
|
finally {
|