@payfurl/client 4.8.2 → 4.8.3
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/sdk/{CxPayThreeDsProvider-Bp4sKMzc.js → CxPayThreeDsProvider-DQHrNbtf.js} +1 -1
- package/dist/sdk/{DefaultThreeDsProvider-C8fvdcdV.js → DefaultThreeDsProvider-P_cdnP1M.js} +1 -1
- package/dist/sdk/{EcentricThreeDsProvider-CSIqFEH9.js → EcentricThreeDsProvider-B_CTaoAa.js} +2 -2
- package/dist/sdk/{EpnaThreeDsProvider-CjnXfXfj.js → EpnaThreeDsProvider-DGmOGtwW.js} +1 -1
- package/dist/sdk/{FlashBancThreeDsProvider-BOERTXdy.js → FlashBancThreeDsProvider-B-_q0Wgx.js} +1 -1
- package/dist/sdk/{GPaymentsThreeDsProvider-D2dgmsTM.js → GPaymentsThreeDsProvider-CNvS1TEr.js} +2 -2
- package/dist/sdk/{MetricsGlobalThreeDsProvider-CeAloHov.js → MetricsGlobalThreeDsProvider-bHlBG5TO.js} +2 -2
- package/dist/sdk/{NmiThreeDsProvider-ByzInS-p.js → NmiThreeDsProvider-pYfkqY6w.js} +1 -1
- package/dist/sdk/{NuveiThreeDsProvider-Ooo_XU5V.js → NuveiThreeDsProvider-DW0A-UVJ.js} +2 -2
- package/dist/sdk/{PayGLocalThreeDsProvider-D1X7xek6.js → PayGLocalThreeDsProvider-BHwgDrtz.js} +2 -2
- package/dist/sdk/{PayWayAppleButton-DFJOTxyM.js → PayWayAppleButton-DcRb1H14.js} +1 -1
- package/dist/sdk/{PayabliThreeDsProvider-TDa0W26Q.js → PayabliThreeDsProvider-Bp9H8Pm4.js} +1 -1
- package/dist/sdk/{SkyBankThreeDsProvider-WIifLqXk.js → SkyBankThreeDsProvider-DNIVJ3RD.js} +1 -1
- package/dist/sdk/{cxpay-Bze99TLg.js → cxpay-HDQIqLHk.js} +1 -1
- package/dist/sdk/{default-BdRXNBJ_.js → default-DLW8OfDP.js} +1 -1
- package/dist/sdk/{ecentric-BbLkqZna.js → ecentric-lSpPCcHF.js} +1 -1
- package/dist/sdk/{epna-6uMsniWG.js → epna-BkB_D01q.js} +1 -1
- package/dist/sdk/{flashbanc-DsGHVILz.js → flashbanc-CHej1ZtB.js} +1 -1
- package/dist/sdk/{fraudStatus.type-B8m9Jl_d.js → fraudStatus.type-Cq1nS1HG.js} +16 -16
- package/dist/sdk/{gpayments-B7J1_ySK.js → gpayments-CZAu93lM.js} +1 -1
- package/dist/sdk/{metrics_global-CPOgWXZw.js → metrics_global-DLxl6iHN.js} +1 -1
- package/dist/sdk/{nmi-DiB_GFdO.js → nmi-nHY0rKqg.js} +1 -1
- package/dist/sdk/{nuvei-Dyu7qen0.js → nuvei-spbTTTAx.js} +1 -1
- package/dist/sdk/{payabli-r9g-MFCG.js → payabli-sfIGcqVb.js} +1 -1
- package/dist/sdk/payfurl.es.js +1 -1
- package/dist/sdk/payfurl.umd.js +2 -2
- package/dist/sdk/{payglocal-Bk_L4Uzv.js → payglocal-YM-pH-l6.js} +1 -1
- package/dist/sdk/{payway_rest-DGJjXIxe.js → payway_rest-BmoVSVNb.js} +1 -1
- package/dist/sdk/{skybank-CJVIDcgL.js → skybank-DLrBhuxw.js} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var S = (n, e, s) => e in n ? d(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s;
|
|
3
3
|
var r = (n, e, s) => S(n, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { d as p, c as m, i as g, o as T, a as f, b as I, e as l, f as y, C as A, u as C, r as E, _ as v, T as _, h as R, j as P } from "./fraudStatus.type-
|
|
4
|
+
import { d as p, c as m, i as g, o as T, a as f, b as I, e as l, f as y, C as A, u as C, r as E, _ as v, T as _, h as R, j as P } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
5
5
|
const U = { class: "mask" }, $ = { class: "wrapper" }, b = { class: "container" }, L = ["action"], M = ["value"], k = /* @__PURE__ */ p({
|
|
6
6
|
__name: "ThreeDsChallenge",
|
|
7
7
|
props: {
|
package/dist/sdk/{EcentricThreeDsProvider-CSIqFEH9.js → EcentricThreeDsProvider-B_CTaoAa.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var h = Object.defineProperty;
|
|
2
2
|
var c = (s, t, e) => t in s ? h(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
3
|
var l = (s, t, e) => c(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { DefaultThreeDsProvider as d } from "./DefaultThreeDsProvider-
|
|
5
|
-
import { d as p, c as u, i as m, o as D, a as f, b as g, e as a, f as S, C as T, u as _, r as y, _ as C, h as v } from "./fraudStatus.type-
|
|
4
|
+
import { DefaultThreeDsProvider as d } from "./DefaultThreeDsProvider-P_cdnP1M.js";
|
|
5
|
+
import { d as p, c as u, i as m, o as D, a as f, b as g, e as a, f as S, C as T, u as _, r as y, _ as C, h as v } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
6
6
|
const P = { class: "mask" }, I = { class: "wrapper" }, A = { class: "container" }, V = ["action"], E = ["value"], $ = /* @__PURE__ */ p({
|
|
7
7
|
__name: "ecentric",
|
|
8
8
|
props: {
|
package/dist/sdk/{GPaymentsThreeDsProvider-D2dgmsTM.js → GPaymentsThreeDsProvider-CNvS1TEr.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var l = Object.defineProperty;
|
|
2
2
|
var c = (o, r, e) => r in o ? l(o, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[r] = e;
|
|
3
3
|
var n = (o, r, e) => c(o, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { DefaultThreeDsProvider as d } from "./DefaultThreeDsProvider-
|
|
5
|
-
import { d as u, c as p, i, a as g, b as m, e as a, n as h, _ as D, h as S } from "./fraudStatus.type-
|
|
4
|
+
import { DefaultThreeDsProvider as d } from "./DefaultThreeDsProvider-P_cdnP1M.js";
|
|
5
|
+
import { d as u, c as p, i, a as g, b as m, e as a, n as h, _ as D, h as S } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
6
6
|
const y = { class: "mask" }, f = { class: "wrapper" }, _ = ["src"], C = /* @__PURE__ */ u({
|
|
7
7
|
__name: "GPayments",
|
|
8
8
|
props: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var E = Object.defineProperty;
|
|
2
2
|
var _ = (h, o, t) => o in h ? E(h, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[o] = t;
|
|
3
3
|
var m = (h, o, t) => _(h, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
-
import { DefaultThreeDsProvider as A } from "./DefaultThreeDsProvider-
|
|
5
|
-
import { d as v, o as T, k as b, w as L, v as N, a as x, b as I, e as g, f as G, C as $, r as H, _ as M, s as p, h as k, j as F } from "./fraudStatus.type-
|
|
4
|
+
import { DefaultThreeDsProvider as A } from "./DefaultThreeDsProvider-P_cdnP1M.js";
|
|
5
|
+
import { d as v, o as T, k as b, w as L, v as N, a as x, b as I, e as g, f as G, C as $, r as H, _ as M, s as p, h as k, j as F } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
6
6
|
const O = { class: "mask" }, U = { class: "wrapper" }, j = { class: "container" }, B = /* @__PURE__ */ v({
|
|
7
7
|
__name: "MetricsGlobalThreeDsChallenge",
|
|
8
8
|
emits: ["close", "submit"],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
2
|
var p = (n, o, t) => o in n ? u(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
|
|
3
3
|
var h = (n, o, t) => p(n, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
-
import { d as m, j as d, o as g, a as D, b as S, e as l, _ as f, s as y, h as P } from "./fraudStatus.type-
|
|
5
|
-
import { DefaultThreeDsProvider as T, THREE_DS_METHOD_INVOCATION_COMPLETE as N, THREE_DS_CHALLENGE_COMPLETE as I } from "./DefaultThreeDsProvider-
|
|
4
|
+
import { d as m, j as d, o as g, a as D, b as S, e as l, _ as f, s as y, h as P } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
5
|
+
import { DefaultThreeDsProvider as T, THREE_DS_METHOD_INVOCATION_COMPLETE as N, THREE_DS_CHALLENGE_COMPLETE as I } from "./DefaultThreeDsProvider-P_cdnP1M.js";
|
|
6
6
|
const C = { class: "mask" }, _ = /* @__PURE__ */ m({
|
|
7
7
|
__name: "nuvei",
|
|
8
8
|
props: {
|
package/dist/sdk/{PayGLocalThreeDsProvider-D1X7xek6.js → PayGLocalThreeDsProvider-BHwgDrtz.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DefaultThreeDsProvider as y } from "./DefaultThreeDsProvider-
|
|
2
|
-
import { o as p, k as D, I as _, r as f, d as w, c as E, i as I, l as L, a as S, b as k, e as u, _ as R, s as c, h as U } from "./fraudStatus.type-
|
|
1
|
+
import { DefaultThreeDsProvider as y } from "./DefaultThreeDsProvider-P_cdnP1M.js";
|
|
2
|
+
import { o as p, k as D, I as _, r as f, d as w, c as E, i as I, l as L, a as S, b as k, e as u, _ as R, s as c, h as U } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
3
3
|
const h = f(!1);
|
|
4
4
|
function b(s, ...e) {
|
|
5
5
|
h.value && console.log(s, e);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var g = Object.defineProperty;
|
|
2
2
|
var b = (o, t, i) => t in o ? g(o, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[t] = i;
|
|
3
3
|
var e = (o, t, i) => b(o, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
-
import { R as A, g as v, H as C } from "./fraudStatus.type-
|
|
4
|
+
import { R as A, g as v, H as C } from "./fraudStatus.type-Cq1nS1HG.js";
|
|
5
5
|
const d = {
|
|
6
6
|
CHECKOUT: "CHECKOUT",
|
|
7
7
|
CHARGE: "CHARGE"
|
|
@@ -30,26 +30,26 @@ const mc = {
|
|
|
30
30
|
errorUrl: "https://y2it4xhgpx5junghaf3psg7a7q0splje.lambda-url.ap-southeast-2.on.aws"
|
|
31
31
|
}, gc = {
|
|
32
32
|
baseUrl: "https://assets.payfurl.com",
|
|
33
|
-
cssUrl: "https://assets.payfurl.com/v4.8.
|
|
34
|
-
url: "https://assets.payfurl.com/v4.8.
|
|
35
|
-
secureUrl: "https://assets.payfurl.com/v4.8.
|
|
36
|
-
redirectUrl: "https://assets.payfurl.com/v4.8.
|
|
33
|
+
cssUrl: "https://assets.payfurl.com/v4.8.3/js/",
|
|
34
|
+
url: "https://assets.payfurl.com/v4.8.3/iframe/index.html",
|
|
35
|
+
secureUrl: "https://assets.payfurl.com/v4.8.3/secure/index.html",
|
|
36
|
+
redirectUrl: "https://assets.payfurl.com/v4.8.3/checkout/redirect.html",
|
|
37
37
|
apiUrl: "https://develop-api.payfurl.com",
|
|
38
38
|
errorUrl: "https://y2it4xhgpx5junghaf3psg7a7q0splje.lambda-url.ap-southeast-2.on.aws"
|
|
39
39
|
}, yc = {
|
|
40
40
|
baseUrl: "https://assets.payfurl.com",
|
|
41
|
-
cssUrl: "https://assets.payfurl.com/v4.8.
|
|
42
|
-
url: "https://assets.payfurl.com/v4.8.
|
|
43
|
-
secureUrl: "https://assets.payfurl.com/v4.8.
|
|
44
|
-
redirectUrl: "https://assets.payfurl.com/v4.8.
|
|
41
|
+
cssUrl: "https://assets.payfurl.com/v4.8.3/js/",
|
|
42
|
+
url: "https://assets.payfurl.com/v4.8.3/iframe/index.html",
|
|
43
|
+
secureUrl: "https://assets.payfurl.com/v4.8.3/secure/index.html",
|
|
44
|
+
redirectUrl: "https://assets.payfurl.com/v4.8.3/checkout/redirect.html",
|
|
45
45
|
apiUrl: "https://sandbox-api.payfurl.com",
|
|
46
46
|
errorUrl: "https://gujl7xo5fhpkjaain4swyiymt40loyia.lambda-url.ap-southeast-2.on.aws"
|
|
47
47
|
}, Pc = {
|
|
48
48
|
baseUrl: "https://assets.payfurl.com",
|
|
49
|
-
cssUrl: "https://assets.payfurl.com/v4.8.
|
|
50
|
-
url: "https://assets.payfurl.com/v4.8.
|
|
51
|
-
secureUrl: "https://assets.payfurl.com/v4.8.
|
|
52
|
-
redirectUrl: "https://assets.payfurl.com/v4.8.
|
|
49
|
+
cssUrl: "https://assets.payfurl.com/v4.8.3/js/",
|
|
50
|
+
url: "https://assets.payfurl.com/v4.8.3/iframe/index.html",
|
|
51
|
+
secureUrl: "https://assets.payfurl.com/v4.8.3/secure/index.html",
|
|
52
|
+
redirectUrl: "https://assets.payfurl.com/v4.8.3/checkout/redirect.html",
|
|
53
53
|
apiUrl: "https://api.payfurl.com",
|
|
54
54
|
errorUrl: "https://4rvkh6tupgcmqk3b2igkpdi2zi0mveyg.lambda-url.ap-southeast-2.on.aws"
|
|
55
55
|
};
|
|
@@ -9701,7 +9701,7 @@ w([
|
|
|
9701
9701
|
w([
|
|
9702
9702
|
b
|
|
9703
9703
|
], pr.prototype, "getMessageHandler", null);
|
|
9704
|
-
const jp = "4.8.
|
|
9704
|
+
const jp = "4.8.3", ot = {
|
|
9705
9705
|
version: jp
|
|
9706
9706
|
}, xn = {
|
|
9707
9707
|
CHECK_FRAUD: "CHECK_FRAUD"
|
|
@@ -10358,7 +10358,7 @@ class Er {
|
|
|
10358
10358
|
})
|
|
10359
10359
|
}), this.billingAddress && ((u = this.applePayButton) == null || u.setBillingAddress(this.billingAddress)), this.customer && ((d = this.applePayButton) == null || d.setCustomerInfo(this.customer)), this.order && ((f = this.applePayButton) == null || f.setOrderInfo(this.order)), (h = this.applePayButton) == null || h.draw(), window.postMessage({ status: Cr }, "*");
|
|
10360
10360
|
});
|
|
10361
|
-
Ii(/* @__PURE__ */ Object.assign({ "./applepay/ApplePayButton.interface.ts": () => Promise.resolve().then(() => z0), "./applepay/ApplePayButtonOptions.type.ts": () => Promise.resolve().then(() => q0), "./applepay/PayWayAppleButton.ts": () => import("./PayWayAppleButton-
|
|
10361
|
+
Ii(/* @__PURE__ */ Object.assign({ "./applepay/ApplePayButton.interface.ts": () => Promise.resolve().then(() => z0), "./applepay/ApplePayButtonOptions.type.ts": () => Promise.resolve().then(() => q0), "./applepay/PayWayAppleButton.ts": () => import("./PayWayAppleButton-DcRb1H14.js"), "./applepay/payway_rest.ts": () => import("./payway_rest-BmoVSVNb.js") }), `./applepay/${n.providerType.toLowerCase()}.ts`, 3).then(T(this, "[localAddApplePay], then", (c) => {
|
|
10362
10362
|
this.log(`Loading ${n.providerType}...`, c), l(c);
|
|
10363
10363
|
})).catch(() => {
|
|
10364
10364
|
this.log(`Error loading ${n.providerType}`), a();
|
|
@@ -12177,7 +12177,7 @@ async function j0(t) {
|
|
|
12177
12177
|
throw new Error(`Module ${t} not found`);
|
|
12178
12178
|
return await e[s]();
|
|
12179
12179
|
}
|
|
12180
|
-
return await Ii(/* @__PURE__ */ Object.assign({ "../3ds/CxPayThreeDsProvider.ts": () => import("./CxPayThreeDsProvider-
|
|
12180
|
+
return await Ii(/* @__PURE__ */ Object.assign({ "../3ds/CxPayThreeDsProvider.ts": () => import("./CxPayThreeDsProvider-DQHrNbtf.js"), "../3ds/DefaultThreeDsProvider.ts": () => import("./DefaultThreeDsProvider-P_cdnP1M.js"), "../3ds/EcentricThreeDsProvider.ts": () => import("./EcentricThreeDsProvider-B_CTaoAa.js"), "../3ds/EpnaThreeDsProvider.ts": () => import("./EpnaThreeDsProvider-DGmOGtwW.js"), "../3ds/FlashBancThreeDsProvider.ts": () => import("./FlashBancThreeDsProvider-B-_q0Wgx.js"), "../3ds/GPaymentsThreeDsProvider.ts": () => import("./GPaymentsThreeDsProvider-CNvS1TEr.js"), "../3ds/MetricsGlobalThreeDsProvider.ts": () => import("./MetricsGlobalThreeDsProvider-bHlBG5TO.js"), "../3ds/NmiThreeDsProvider.ts": () => import("./NmiThreeDsProvider-pYfkqY6w.js"), "../3ds/NuveiThreeDsProvider.ts": () => import("./NuveiThreeDsProvider-DW0A-UVJ.js"), "../3ds/PayGLocalThreeDsProvider.ts": () => import("./PayGLocalThreeDsProvider-BHwgDrtz.js"), "../3ds/PayabliThreeDsProvider.ts": () => import("./PayabliThreeDsProvider-Bp9H8Pm4.js"), "../3ds/SkyBankThreeDsProvider.ts": () => import("./SkyBankThreeDsProvider-DNIVJ3RD.js"), "../3ds/ThreeDsAuthResponse.type.ts": () => Promise.resolve().then(() => uc), "../3ds/ThreeDsInitResponse.type.ts": () => Promise.resolve().then(() => dc), "../3ds/ThreeDsPostAuthResponse.type.ts": () => import("./ThreeDsPostAuthResponse.type-CaV_50Qh.js"), "../3ds/ThreeDsProvider.interface.ts": () => Promise.resolve().then(() => hc), "../3ds/cxpay.ts": () => import("./cxpay-HDQIqLHk.js"), "../3ds/default.ts": () => import("./default-DLW8OfDP.js"), "../3ds/ecentric.ts": () => import("./ecentric-lSpPCcHF.js"), "../3ds/epna.ts": () => import("./epna-BkB_D01q.js"), "../3ds/flashbanc.ts": () => import("./flashbanc-CHej1ZtB.js"), "../3ds/gpayments.ts": () => import("./gpayments-CZAu93lM.js"), "../3ds/metrics_global.ts": () => import("./metrics_global-DLxl6iHN.js"), "../3ds/nmi.ts": () => import("./nmi-nHY0rKqg.js"), "../3ds/nuvei.ts": () => import("./nuvei-spbTTTAx.js"), "../3ds/payabli.ts": () => import("./payabli-sfIGcqVb.js"), "../3ds/payglocal.ts": () => import("./payglocal-YM-pH-l6.js"), "../3ds/skybank.ts": () => import("./skybank-DLrBhuxw.js") }), `../3ds/${t.toLowerCase()}.ts`, 3);
|
|
12181
12181
|
}
|
|
12182
12182
|
async function Y0(t) {
|
|
12183
12183
|
const r = cc();
|
|
@@ -13398,7 +13398,7 @@ class X {
|
|
|
13398
13398
|
}));
|
|
13399
13399
|
}
|
|
13400
13400
|
addSecondary3DsProcessor(r, e, s, i, n, o, a) {
|
|
13401
|
-
this.log("[addSecondary3DsProcessor]", e, s), Ii(/* @__PURE__ */ Object.assign({ "./3ds/CxPayThreeDsProvider.ts": () => import("./CxPayThreeDsProvider-
|
|
13401
|
+
this.log("[addSecondary3DsProcessor]", e, s), Ii(/* @__PURE__ */ Object.assign({ "./3ds/CxPayThreeDsProvider.ts": () => import("./CxPayThreeDsProvider-DQHrNbtf.js"), "./3ds/DefaultThreeDsProvider.ts": () => import("./DefaultThreeDsProvider-P_cdnP1M.js"), "./3ds/EcentricThreeDsProvider.ts": () => import("./EcentricThreeDsProvider-B_CTaoAa.js"), "./3ds/EpnaThreeDsProvider.ts": () => import("./EpnaThreeDsProvider-DGmOGtwW.js"), "./3ds/FlashBancThreeDsProvider.ts": () => import("./FlashBancThreeDsProvider-B-_q0Wgx.js"), "./3ds/GPaymentsThreeDsProvider.ts": () => import("./GPaymentsThreeDsProvider-CNvS1TEr.js"), "./3ds/MetricsGlobalThreeDsProvider.ts": () => import("./MetricsGlobalThreeDsProvider-bHlBG5TO.js"), "./3ds/NmiThreeDsProvider.ts": () => import("./NmiThreeDsProvider-pYfkqY6w.js"), "./3ds/NuveiThreeDsProvider.ts": () => import("./NuveiThreeDsProvider-DW0A-UVJ.js"), "./3ds/PayGLocalThreeDsProvider.ts": () => import("./PayGLocalThreeDsProvider-BHwgDrtz.js"), "./3ds/PayabliThreeDsProvider.ts": () => import("./PayabliThreeDsProvider-Bp9H8Pm4.js"), "./3ds/SkyBankThreeDsProvider.ts": () => import("./SkyBankThreeDsProvider-DNIVJ3RD.js"), "./3ds/ThreeDsAuthResponse.type.ts": () => Promise.resolve().then(() => uc), "./3ds/ThreeDsInitResponse.type.ts": () => Promise.resolve().then(() => dc), "./3ds/ThreeDsPostAuthResponse.type.ts": () => import("./ThreeDsPostAuthResponse.type-CaV_50Qh.js"), "./3ds/ThreeDsProvider.interface.ts": () => Promise.resolve().then(() => hc), "./3ds/cxpay.ts": () => import("./cxpay-HDQIqLHk.js"), "./3ds/default.ts": () => import("./default-DLW8OfDP.js"), "./3ds/ecentric.ts": () => import("./ecentric-lSpPCcHF.js"), "./3ds/epna.ts": () => import("./epna-BkB_D01q.js"), "./3ds/flashbanc.ts": () => import("./flashbanc-CHej1ZtB.js"), "./3ds/gpayments.ts": () => import("./gpayments-CZAu93lM.js"), "./3ds/metrics_global.ts": () => import("./metrics_global-DLxl6iHN.js"), "./3ds/nmi.ts": () => import("./nmi-nHY0rKqg.js"), "./3ds/nuvei.ts": () => import("./nuvei-spbTTTAx.js"), "./3ds/payabli.ts": () => import("./payabli-sfIGcqVb.js"), "./3ds/payglocal.ts": () => import("./payglocal-YM-pH-l6.js"), "./3ds/skybank.ts": () => import("./skybank-DLrBhuxw.js") }), `./3ds/${s.toLowerCase()}.ts`, 3).then(T(this, "[addSecondary3DsProcessor], onload", (l) => {
|
|
13402
13402
|
var u;
|
|
13403
13403
|
this.log(`Loading ${s}...`, l);
|
|
13404
13404
|
const c = l.default(this.log.bind(this), r, {
|
package/dist/sdk/payfurl.es.js
CHANGED
package/dist/sdk/payfurl.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(ft,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(ft=typeof globalThis<"u"?globalThis:ft||self,ft.payfurl=v())})(this,function(){"use strict";var Tg=Object.defineProperty;var wg=(ft,v,Wr)=>v in ft?Tg(ft,v,{enumerable:!0,configurable:!0,writable:!0,value:Wr}):ft[v]=Wr;var f=(ft,v,Wr)=>wg(ft,typeof v!="symbol"?v+"":v,Wr);const ft=(r,t,e)=>{const s=r[t];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((i,n)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==e?". Note that variables only represent file names one level deep.":""))))})};function v(r,t,e,s){var i=arguments.length,n=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,e,s);else for(var a=r.length-1;a>=0;a--)(o=r[a])&&(n=(i<3?o(n):i>3?o(t,e,n):o(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n}typeof SuppressedError=="function"&&SuppressedError;const Wr={baseUrl:"",cssUrl:"",redirectUrl:"",url:"",secureUrl:"/dist/secure/index.html",apiUrl:"",errorUrl:"https://y2it4xhgpx5junghaf3psg7a7q0splje.lambda-url.ap-southeast-2.on.aws"},hu={baseUrl:"https://assets.payfurl.com",cssUrl:"https://assets.payfurl.com/v4.8.
|
|
1
|
+
(function(ft,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(ft=typeof globalThis<"u"?globalThis:ft||self,ft.payfurl=v())})(this,function(){"use strict";var Tg=Object.defineProperty;var wg=(ft,v,Wr)=>v in ft?Tg(ft,v,{enumerable:!0,configurable:!0,writable:!0,value:Wr}):ft[v]=Wr;var f=(ft,v,Wr)=>wg(ft,typeof v!="symbol"?v+"":v,Wr);const ft=(r,t,e)=>{const s=r[t];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((i,n)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==e?". Note that variables only represent file names one level deep.":""))))})};function v(r,t,e,s){var i=arguments.length,n=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,t,e,s);else for(var a=r.length-1;a>=0;a--)(o=r[a])&&(n=(i<3?o(n):i>3?o(t,e,n):o(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n}typeof SuppressedError=="function"&&SuppressedError;const Wr={baseUrl:"",cssUrl:"",redirectUrl:"",url:"",secureUrl:"/dist/secure/index.html",apiUrl:"",errorUrl:"https://y2it4xhgpx5junghaf3psg7a7q0splje.lambda-url.ap-southeast-2.on.aws"},hu={baseUrl:"https://assets.payfurl.com",cssUrl:"https://assets.payfurl.com/v4.8.3/js/",url:"https://assets.payfurl.com/v4.8.3/iframe/index.html",secureUrl:"https://assets.payfurl.com/v4.8.3/secure/index.html",redirectUrl:"https://assets.payfurl.com/v4.8.3/checkout/redirect.html",apiUrl:"https://develop-api.payfurl.com",errorUrl:"https://y2it4xhgpx5junghaf3psg7a7q0splje.lambda-url.ap-southeast-2.on.aws"},pu={baseUrl:"https://assets.payfurl.com",cssUrl:"https://assets.payfurl.com/v4.8.3/js/",url:"https://assets.payfurl.com/v4.8.3/iframe/index.html",secureUrl:"https://assets.payfurl.com/v4.8.3/secure/index.html",redirectUrl:"https://assets.payfurl.com/v4.8.3/checkout/redirect.html",apiUrl:"https://sandbox-api.payfurl.com",errorUrl:"https://gujl7xo5fhpkjaain4swyiymt40loyia.lambda-url.ap-southeast-2.on.aws"},fu={baseUrl:"https://assets.payfurl.com",cssUrl:"https://assets.payfurl.com/v4.8.3/js/",url:"https://assets.payfurl.com/v4.8.3/iframe/index.html",secureUrl:"https://assets.payfurl.com/v4.8.3/secure/index.html",redirectUrl:"https://assets.payfurl.com/v4.8.3/checkout/redirect.html",apiUrl:"https://api.payfurl.com",errorUrl:"https://4rvkh6tupgcmqk3b2igkpdi2zi0mveyg.lambda-url.ap-southeast-2.on.aws"};var Ze;(function(r){r.LOCAL="local",r.DEVELOPMENT="development",r.SANDBOX="sandbox",r.PRODUCTION="production"})(Ze||(Ze={}));const on={[Ze.LOCAL]:Wr,[Ze.DEVELOPMENT]:hu,[Ze.SANDBOX]:pu,[Ze.PRODUCTION]:fu};function Io(r){return on[r]}function mu(r){let t=on[r];return t||(t=on[Ze.PRODUCTION]),t.errorUrl}class vt{constructor(t,e,s){f(this,"publicKey","");f(this,"version","");f(this,"regionResolver",null);this.publicKey=t||"",this.version=e||"",this.regionResolver=s||null}invoke(t,e,s,i,n,o){const a=new XMLHttpRequest;a||n==null||n(0,""),a.onreadystatechange=function(){if(a.readyState===4){if(a.status===200||a.status===201){i==null||i(a.status,a.responseText);return}n==null||n(a.status,a.responseText)}};const l=new URL(t);if(this.regionResolver){const c=new URL(this.regionResolver.getRegionUrl());l.hostname=c.hostname}if(a.open(e,l.toString()),a.setRequestHeader("Content-Type","application/json"),this.publicKey&&a.setRequestHeader("x-publickey",this.publicKey),this.version&&a.setRequestHeader("sdk-version",this.version),o)for(const[c,u]of Object.entries(o))a.setRequestHeader(c,u);a.send(String(s))}}function Ao(){const r=[1,4,8,15,16,24,32,48];let t=screen.colorDepth;if(r.indexOf(t)==-1){let e=r[0],s=Math.abs(r[0]-t);for(let i=1;i<=r.length;i++){const n=Math.abs(r[i]-t);n<s&&(e=r[i],s=n)}t=e}return t}const tt=class tt{constructor(){f(this,"httpInvoker",null);if(tt.instance)return tt.instance;this.httpInvoker=new vt,tt.instance=this}static init(t,e,s){return tt.environment=t,tt.publicKey=e,tt.version=s,new tt}sendError(t,e,s){var i;try{const n=mu(tt.environment),o=new Date;(i=this.httpInvoker)==null||i.invoke(n,"POST",JSON.stringify({method:t,message:e,context:{publicKey:tt.publicKey,version:tt.version,environment:tt.environment,browser:{userAgent:navigator.userAgent,language:window.navigator.language,colorDepth:String(Ao()),screenHeight:screen.height+"",screenWidth:screen.width+"",timezone:Math.round(o.getTimezoneOffset()/60)+"",referrer:document.referrer}},arguments:Object.values(s).map(a=>typeof a=="object"?JSON.stringify(a):String(a))}))}catch(n){console.error("Error sending error",n)}}};f(tt,"instance"),f(tt,"environment"),f(tt,"publicKey"),f(tt,"version");let jr=tt;function C(r,t,e){const s=e.value;e.value=function(){try{return s.apply(this,arguments)}catch(i){throw new jr().sendError(t,i.message,an(Array.from(arguments))),console.warn("[ErrorHandled], exception",{error:i,target:r,propertyKey:t,arguments}),i}}}function S(r,t,e){return function(...s){try{return e.apply(r,s)}catch(i){throw new jr().sendError(t,i.message,an(s)),console.warn("[ErrorHandledFunction], exception",{error:i,funcName:t,args:s}),i}}}function gu(r,t,e){new jr().sendError(r,t,an(e))}function an(r){return r.map(t=>ln(t))}function ln(r){if(typeof r!="object"||r===null)return typeof r=="string"&&r.replace(/\s/g,"").search(/^[0-9]{8,19}$/)!==-1?"**** **** **** "+r.replace(/\s/g,"").slice(-4):typeof r=="string"&&r.replace(/\s/g,"").search(/^[0-9]{3,4}$/)!==-1?"***":r;if(Array.isArray(r))return r.map(e=>ln(e));const t={};for(const e in r)r.hasOwnProperty&&r.hasOwnProperty(e)&&typeof r[e]!="function"&&!(r[e]instanceof Node)&&(r.constructor===Object||r.name==="click2PayError")&&(t[e]=ln(r[e]),e==="cardNumber"&&t[e]?t[e]="**** **** **** "+t[e].replace(" ","").slice(-4):e==="ccv"&&(t[e]="***"));return t}var Do={};/**
|
|
2
2
|
* @vue/shared v3.5.33
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
@@ -148,7 +148,7 @@ Expected function or array of functions, received type ${typeof r}.`),Ye)}functi
|
|
|
148
148
|
width=${ce},
|
|
149
149
|
height=${ie},
|
|
150
150
|
top=${A},
|
|
151
|
-
left=${R}`),s("newWindow",(K=d.value)==null?void 0:K.externalId)}else y.value=!0,w.value=!0,s("popup",(X=d.value)==null?void 0:X.externalId);return!1}}function W(){y.value=!1,w.value=!1,u==null||u.close(),s("popupClose")}return nt(()=>{window.addEventListener("message",N),Fi(i.value,Ys)||(o.value=!0,s("activate",e.options))}),Et(()=>{window.removeEventListener("message",N)}),(P,K)=>(B(),Y(Le,null,[St(Re(wr,{"use-local":""},null,512),[[Fr,!m.value]]),w.value&&!y.value?(B(),Cr(wr,{key:0,message:"Finalise the payment"})):me("",!0),I("div",{id:`payfurl-${a.value}-form`,class:"payfurl-checkout-form",ref_key:"root",ref:i},[I("div",{class:"container-form",style:mt(`visibility: ${Ae(n)?"hidden":"visible"}`)},[Ae(p)?(B(),Y("div",vm,Ce(Ae(p)),1)):me("",!0),I("div",bm,[E.value?(B(),Y("button",{key:0,onClick:D,type:"button"},Ce(h.value),1)):me("",!0),l.value?(B(),Y("p",Cm,Ce(l.value),1)):me("",!0)])],4)],8,Pm),y.value?(B(),Cr(ym,{key:1,onClose:W,url:m.value,name:h.value},null,8,["url","name"])):me("",!0)],64))}}),[["__scopeId","data-v-2c4ce814"]]),ps={CHECKOUT:"CHECKOUT",CHECK_STATUS:"CHECK_STATUS"},Qi=(r,t)=>({[ps.CHECKOUT]:{url:r+"/payment_method/checkout",method:"POST"},[ps.CHECK_STATUS]:{url:r+"/checkout/external/"+t,method:"GET"}});class fr{constructor(t,e){f(this,"container",null);f(this,"log");f(this,"apiUrl","");f(this,"redirectUrl","");f(this,"checkStatusHandler",null);f(this,"successCallback",null);f(this,"userOnValidate");f(this,"httpInvoker",null);f(this,"destroy",()=>{});this.log=t,this.apiUrl=e.apiUrl,this.redirectUrl=e.redirectUrl,this.successCallback=e.onSuccess||null;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}setOnValidate(t){this.userOnValidate=t}getOnValidate(){return this.userOnValidate}cleanUp(t){var e,s;((e=this.container)==null?void 0:e.id)===(t==null?void 0:t.id)&&((s=this.destroy)==null||s.call(this))}addCheckout(t,e,s,i,n,o,a){this.log(`[addCheckout][${i}]`,{amount:e,providerId:n,providerType:i,options:o,checkoutOptions:a}),this.container=t;let l=!1,c;const u=Je({el:t,component:Tm,props:{log:this.log,providerType:i,options:{providerId:n,amount:e,currency:s,checkoutOptions:a},onValidate:this.getOnValidate.bind(this)},on:{activate:S(this,"[sdk][checkoutProcessor][${providerType}]: activate checkout form",d=>{if(l)return;l=!0,this.log(`[sdk][checkoutProcessor][${i}]: activate checkout form`,d);const p=()=>{l=!1};this.checkout(d,i,o,p),c=this.getMessageHandler(d,i,o,p).bind(this),window.addEventListener("message",c)}),popup:S(this,"[sdk][checkoutProcessor][${providerType}]: popup open",d=>{this.log(`[sdk][checkoutProcessor][${i}]: popup open`,d),this.checkStatus(t,d,i,c)}),popupClose:S(this,"[sdk][checkoutProcessor][${providerType}]: popup close",()=>{this.log(`[sdk][checkoutProcessor][${i}]: popup close`),this.stopCheckingStatus(null)}),newWindow:S(this,"[sdk][checkoutProcessor][${providerType}]: new window open",d=>{this.log(`[sdk][checkoutProcessor][${i}]: new window open`,d),this.checkStatus(t,d,i,c)}),newWindowClose:S(this,"[sdk][checkoutProcessor][${providerType}]: new window close",()=>{this.log(`[sdk][checkoutProcessor][${i}]: new window close`),this.stopCheckingStatus(null)})}});this.destroy=u.destroy}checkout(t,e,s,i){var n,o,a,l,c,u,d,p,h,m,y,w,E,N;(N=this.httpInvoker)==null||N.invoke(Qi(this.apiUrl)[ps.CHECKOUT].url,Qi(this.apiUrl)[ps.CHECKOUT].method,JSON.stringify({providerId:t.providerId,amount:t.amount,currency:t.currency,shippingAmount:s.shippingAmount,customer:{firstName:(n=s.customer)==null?void 0:n.firstName,lastName:(o=s.customer)==null?void 0:o.lastName,email:(a=s.customer)==null?void 0:a.email,phone:(l=s.customer)==null?void 0:l.phoneNumber,billingAddress:{name:((c=s.billingAddress)==null?void 0:c.firstName)+" "+((u=s.billingAddress)==null?void 0:u.lastName),addressLine1:(d=s.billingAddress)==null?void 0:d.streetAddress,addressLine2:(p=s.billingAddress)==null?void 0:p.streetAddress2,suburb:(h=s.billingAddress)==null?void 0:h.region,state:(m=s.billingAddress)==null?void 0:m.state,countryCode:(y=s.billingAddress)==null?void 0:y.country,postcode:(w=s.billingAddress)==null?void 0:w.postalCode}},items:(E=s.orderItems)==null?void 0:E.map(D=>({name:D.name,reference:D.sku,quantity:D.quantity,amount:D.totalAmount})),options:{...t.checkoutOptions,redirectUrl:this.redirectUrl},metadata:Fe(s==null?void 0:s.metadata)}),this.getSuccessCheckoutHandler(e).bind(this),S(this,"[sdk][checkoutProcessor][${providerType}]: failureCheckoutHandler",(D,W)=>{i==null||i(D,W),this.getFailureCheckoutHandler(e).bind(this)(D,W)}))}getSuccessCheckoutHandler(t){return S(this,"[sdk][checkoutProcessor][${providerType}]: successCheckoutHandler",(e,s)=>{this.log(`[sdk][checkoutProcessor][${t}]: successCheckoutHandler`,e,s);const i=JSON.parse(s),n=JSON.parse(window.atob(i.checkoutData));window.postMessage({status:Zi,component:"checkout",providerType:t,checkoutData:n},"*")})}getFailureCheckoutHandler(t){return S(this,"[sdk][checkoutProcessor][${providerType}]: failureCheckoutHandler",(e,s)=>{this.log(`[sdk][checkoutProcessor][${t}]: failureCheckoutHandler`,e,s),dt().stopLoading(),window.postMessage({status:"error",component:"checkout",providerType:t,error:"Invalid payment details",originalError:s},"*")})}stopCheckingStatus(t){this.checkStatusHandler&&(clearInterval(this.checkStatusHandler),this.checkStatusHandler=null),t&&window.removeEventListener("message",t)}checkStatus(t,e,s,i){var l;this.checkStatusHandler||(this.checkStatusHandler=setInterval(this.checkStatus.bind(this,t,e,s,i),5e3),this.log(`[sdk][checkoutProcessor][${s}]: Starting polling...`));const n=this,o=S(this,`[sdk][checkoutProcessor][${s}]: failureCheckStatusHandler`,(c,u)=>{dt().stopLoading(),n.log(`[sdk][checkoutProcessor][${s}]: failureCheckStatusHandler`,c,u),window.postMessage({status:"message",component:"checkout",providerType:s,message:"Checkout has been cancelled"},"*")}),a=S(this,`[sdk][checkoutProcessor][${s}]: successCheckStatusHandler`,(c,u)=>{var p;dt().stopLoading(),n.log(`[sdk][checkoutProcessor][${s}]: successCheckStatusHandler`,{transactionId:c,token:u}),as(t,"Transaction in progress. Please don't close the window or navigate away");const d={};c&&(d.transactionId=c),u&&(d.token=u),(p=n.successCallback)==null||p.call(n,d)});(l=this.httpInvoker)==null||l.invoke(Qi(this.apiUrl,e)[ps.CHECK_STATUS].url,Qi(this.apiUrl,e)[ps.CHECK_STATUS].method,{},S(this,`[sdk][checkoutProcessor][${s}]: checkStatus, success`,(c,u)=>{const d=JSON.parse(u);if(this.log("checkoutStatus",d),!d)return this.stopCheckingStatus(i),o(c,u);if(d.status=="SUCCESS"&&d.status==="SUCCESS")return this.stopCheckingStatus(i),a(d.transactionId,d.tokenId)}),S(this,`[sdk][checkoutProcessor][${s}]: checkStatus, failure`,(c,u)=>(this.log(`[sdk][checkoutProcessor][${s}]: checkStatus`,{status:c,body:u}),this.stopCheckingStatus(i),o(c,u))))}getMessageHandler(t,e,s,i){return S(this,`[sdk][checkoutProcessor][${e}]: message received`,n=>{var o;if((o=n==null?void 0:n.data)!=null&&o.status){if(n.data.status===zs){if(Number(t.amount)==Number(n.data.amount))return;this.log(`[sdk][checkoutProcessor][${e}]: message received`,n.data),t.amount=Number(n.data.amount),this.checkout(t,e,s,i);return}if(n.data.status===qs){if(t.currency==n.data.currency)return;this.log(`[sdk][checkoutProcessor][${e}]: message received`,n.data),t.currency=n.data.currency,this.checkout(t,e,s,i);return}}})}}v([C],fr.prototype,"cleanUp",null),v([C],fr.prototype,"addCheckout",null),v([C],fr.prototype,"checkout",null),v([C],fr.prototype,"getSuccessCheckoutHandler",null),v([C],fr.prototype,"getFailureCheckoutHandler",null),v([C],fr.prototype,"stopCheckingStatus",null),v([C],fr.prototype,"checkStatus",null),v([C],fr.prototype,"getMessageHandler",null);const ht={version:"4.8.2"},yo={CHECK_FRAUD:"CHECK_FRAUD"},mc=r=>({[yo.CHECK_FRAUD]:{url:r+"/fraud_check",method:"POST"}});class gc{constructor(t,e){f(this,"providerId","");f(this,"stopPaymentOnFailure",!1);f(this,"log");f(this,"apiUrl","");f(this,"getFraudCheckData");f(this,"metadata",{});f(this,"amount",0);f(this,"currency","AUD");f(this,"address",null);f(this,"customer",null);f(this,"order",null);f(this,"paymentInformation",null);f(this,"paypalInformation",null);f(this,"checkResult",null);f(this,"httpInvoker",null);this.log=t,this.providerId=e.providerId,this.stopPaymentOnFailure=e.stopPaymentOnFailure,this.apiUrl=e.apiUrl,this.metadata=e.metadata,this.getFraudCheckData=e.getFraudCheckData;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}fraudCheck(t,e){var s;if(!this.customer)return e({error:"Customer information is required"});if(!this.address)return e({error:"Address information is required"});if(!this.order)return e({error:"Order information is required"});if(!this.paymentInformation&&!this.paypalInformation)return e({error:"Payment information is required"});this.log("[fraudCheck]",{amount:this.amount,currency:this.currency,paymentInformation:this.paymentInformation,paypalInformation:this.paypalInformation,customer:this.customer,address:this.address,order:this.order,metadata:this.metadata}),(s=this.httpInvoker)==null||s.invoke(mc(this.apiUrl)[yo.CHECK_FRAUD].url,mc(this.apiUrl)[yo.CHECK_FRAUD].method,this.getFraudCheckData(this.providerId,this.amount,this.currency,this.paymentInformation,this.paypalInformation,this.customer,this.address,this.order,this.metadata),S(this,"[fraudCheck], success",(i,n)=>{if(this.log("[fraudCheck], success",i,n,this.stopPaymentOnFailure),this.checkResult=JSON.parse(n),this.checkResult===null)return e({error:"Fraud Check Failed",body:n});this.checkResult.providerId=this.providerId,this.checkResult.stopPaymentOnFailure=this.stopPaymentOnFailure,t(this.checkResult)}),S(this,"[fraudCheck], failure",(i,n)=>{this.log("[fraudCheck], failure",i,n),e({error:"Fraud Check Failed",body:n})}))}setAmount(t){this.amount=t}setCurrency(t){this.currency=t}setAddressInfo(t){this.address={...t}}setCustomerInfo(t){this.customer={...t}}setOrderInfo(t){this.order={...t}}setPaymentInfo(t){this.paymentInformation={...t}}setPaypalInfo(t){this.paypalInformation={...t}}getProviderId(){return this.providerId}getCheckResult(){return this.checkResult}}v([C],gc.prototype,"fraudCheck",null);const wm={style:{position:"relative"}},Sm={key:0,class:"error text-normal"},yc="payfurl-googlepay-script",Em=Ie({__name:"GooglePayForm",props:{log:{type:Function},el:{},environment:{},amount:{},currency:{},options:{},onValidate:{type:Function}},emits:["complete","activate","close","error"],setup(r,{emit:t}){const e=r,s=t,i=q(null),n=q(e.amount),o=q(e.currency),a=q(!0),l=q("");let c=!1;const{isLoading:u}=dt();function d(){if(c)return;if(c=!0,document.getElementById(yc)){W();return}window.google=null;const P=document.createElement("script");P.src="https://pay.google.com/gp/p/js/pay.js",P.type="text/javascript",P.id=yc,P.onload=W,document.body.appendChild(P)}let p=null;function h(){return p===null&&(p=new window.google.payments.api.PaymentsClient({environment:e.environment!=Ze.PRODUCTION?"TEST":"PRODUCTION"})),p}const m={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};function y(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[m]}}function w(){const K=h().createButton({onClick:N});e.el.appendChild(K)}function E(){return e.environment!=Ze.PRODUCTION?{merchantName:e.options.googlePayMerchantName??"Example Merchant"}:{merchantName:e.options.googlePayMerchantName??"Example Merchant",merchantId:e.options.googlePayMerchantId}}function N(){var X;if(e.log("[onGooglePaymentButtonClicked]"),((X=e.onValidate())==null?void 0:X())===!1)return;const P=D(),K=h();e.log("[paymentData], request",P),K.loadPaymentData(P).then(function(ee){e.log("[paymentData], success",ee);const ce=JSON.parse(ee.paymentMethodData.tokenizationData.token);ee.paymentMethodData.tokenizationData={...ee.paymentMethodData.tokenizationData,...ce},s("complete",ee)}).catch(function(ee){e.log("[paymentData], error",ee),!(ee instanceof AbortError)&&s("error",ee.message)})}function D(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{...m,tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:e.options.gateway,gatewayMerchantId:e.options.googlePayGatewayMerchantId}}}],transactionInfo:{totalPriceStatus:"FINAL",countryCode:"AU",currencyCode:o.value,totalPrice:Number(n.value).toFixed(2)},merchantInfo:E()}}function W(){h().isReadyToPay(y()).then(function(K){K.result&&(w(),window.postMessage({status:Sr},"*"))}).catch(function(K){console.error("Load GooglePay error",K)})}function k(P){var K,X,ee,ce,ie,we,$e;(K=P==null?void 0:P.data)!=null&&K.status&&(P.data.status==="activate"&&P.data.component==="googlepay"&&((X=e.log)==null||X.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),a.value=!0,s("activate"),d()),P.data.status==="deactivate"&&P.data.component==="googlepay"&&((ee=e.log)==null||ee.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),a.value=!1),P.data.status==="message"&&P.data.component==="googlepay"&&((ce=e.log)==null||ce.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),l.value=P.data.message),P.data.status==="error"&&P.data.component==="googlepay"&&((ie=e.log)==null||ie.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),l.value=P.data.error),P.data.status===zs&&((we=e.log)==null||we.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),n.value=Number(P.data.amount)),P.data.status===qs&&(($e=e.log)==null||$e.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),o.value=P.data.currency))}return Et(()=>{window.removeEventListener("message",k)}),nt(()=>{window.addEventListener("message",k),Fi(i.value,Ys)||(a.value=!0,s("activate"),d())}),(P,K)=>(B(),Y(Le,null,[I("div",wm,[St(Re(wr,null,null,512),[[Fr,Ae(u)]])]),I("div",{style:{position:"relative"},ref_key:"root",ref:i},[l.value?(B(),Y("div",Sm,Ce(l.value),1)):me("",!0)],512)],64))}}),Po={ADD_CHARGE_WITH_GOOGLE_PAY:"ADD_CHARGE_WITH_GOOGLE_PAY"},Pc=r=>({[Po.ADD_CHARGE_WITH_GOOGLE_PAY]:{url:r+"/charge/token/google",method:"POST"}});class Kr{constructor(t,e){f(this,"container",null);f(this,"log");f(this,"apiUrl","");f(this,"environment","");f(this,"failureCallback",null);f(this,"successCallback",null);f(this,"userOnValidate");f(this,"httpInvoker",null);f(this,"destroy",()=>{});f(this,"amount",0);f(this,"currency","");f(this,"billingAddress",null);f(this,"customer",null);f(this,"order",null);this.log=t,this.environment=e.environment,this.apiUrl=e.apiUrl,this.failureCallback=e.onFailure||null,this.successCallback=e.onSuccess||null;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}setAmount(t){this.amount=t}setCurrency(t){this.currency=t}setCustomerInfo(t){this.customer={...t}}setBillingAddress(t){this.billingAddress={...t}}setOrderInfo(t){this.order={...t}}setOnValidate(t){this.userOnValidate=t}getOnValidate(){return this.userOnValidate}cleanUp(t){var e;t===this.container&&((e=this.destroy)==null||e.call(this))}addGooglePay(t,e,s,i,n){this.log("[addGooglePay]",{providerId:e,amount:s,currency:i,options:n}),this.validateOptions(t,s,i,n),this.setAmount(s),this.setCurrency(i);let o=!1;this.container=t;const a=Je({el:t,component:Em,props:{log:this.log,el:t,environment:this.environment,amount:this.amount,currency:this.currency,options:n,onValidate:this.getOnValidate.bind(this)},on:{activate:S(this,"[GooglePay]: activate",()=>{o||(o=!0,this.log("[GooglePay]: activate googlepay form"))}),complete:S(this,"[GooglePay]: complete",l=>{var u,d,p,h;this.log("[GooglePay]: complete",l);const c={amount:this.amount,currency:this.currency,paymentData:{paymentMethodData:{tokenizationData:{intermediateSigningKey:l.paymentMethodData.tokenizationData.intermediateSigningKey,protocolVersion:l.paymentMethodData.tokenizationData.protocolVersion,signature:l.paymentMethodData.tokenizationData.signature,signedMessage:l.paymentMethodData.tokenizationData.signedMessage}},paymentInfo:{cardDetails:l.paymentMethodData.info.cardDetails,cardNetwork:l.paymentMethodData.info.cardNetwork}},firstName:(u=this.customer)==null?void 0:u.firstName,lastName:(d=this.customer)==null?void 0:d.lastName,email:(p=this.customer)==null?void 0:p.email,phone:(h=this.customer)==null?void 0:h.phoneNumber,address:this.billingAddress&&{line1:this.billingAddress.streetAddress,line2:this.billingAddress.streetAddress2,city:this.billingAddress.city,country:this.billingAddress.country,postalCode:this.billingAddress.postalCode,state:this.billingAddress.state}||void 0,order:this.order&&{dutyAmount:this.order.taxAmount,freightAmount:this.order.shippingAmount,items:this.order.orderItems.map(m=>({description:m.name,productCode:m.sku,quantity:Number(m.quantity),amount:Number(m.unitPrice),unitOfMeasure:m.unitOfMeasure}))}||void 0,metadata:Fe(n==null?void 0:n.metadata)};this.addChargeWithGooglePay(t,e,c)}),error:S(this,"[GooglePay]: error",l=>{var c;this.log("[GooglePay]: error",l),he(t,"Unable to pay with Google Pay"),(c=this.failureCallback)==null||c.call(this,{error:"Unable to pay with Google Pay",body:l})})}});this.destroy=a.destroy}addChargeWithGooglePay(t,e,s){var i;this.log("[addChargeWithGooglePay]",s),(i=this.httpInvoker)==null||i.invoke(Pc(this.apiUrl)[Po.ADD_CHARGE_WITH_GOOGLE_PAY].url,Pc(this.apiUrl)[Po.ADD_CHARGE_WITH_GOOGLE_PAY].method,JSON.stringify(s),this.getSuccessAddChargeHandler(t).bind(this),this.getFailureAddChargeHandler(t).bind(this),{providerId:e})}getFailureAddChargeHandler(t){return S(this,"[GooglePay], failure",(e,s)=>{var i;this.log("[GooglePay], failure",s),he(t,"Unable to pay with Google Pay"),(i=this.failureCallback)==null||i.call(this,{error:"Unable to pay with Google Pay",body:s})})}getSuccessAddChargeHandler(t){return S(this,"[GooglePay], success",(e,s)=>{var n;const i=JSON.parse(s);this.log("[GooglePay], success",i),(n=this.successCallback)==null||n.call(this,{transactionId:i.chargeId})})}validateOptions(t,e,s,i){if(!kt(s))throw he(t,"Invalid currency: "+s),new TypeError("invalid currency: "+s);if(!ot(e))throw he(t,"Invalid amount: "+e),new TypeError("invalid amount: "+e);if(!i.gateway)throw he(t,"Invalid gateway parameter"),new TypeError("Invalid gateway parameter");if(!i.googlePayGatewayMerchantId)throw he(t,"Invalid gateway merchant id parameter"),new TypeError("Invalid gateway merchant id parameter")}}v([C],Kr.prototype,"cleanUp",null),v([C],Kr.prototype,"addGooglePay",null),v([C],Kr.prototype,"addChargeWithGooglePay",null),v([C],Kr.prototype,"getFailureAddChargeHandler",null),v([C],Kr.prototype,"getSuccessAddChargeHandler",null),v([C],Kr.prototype,"validateOptions",null);const _m={style:{position:"relative"}},km={key:0,class:"error text-normal"},vc="payfurl-applepay-script",Im=Ie({__name:"ApplePayForm",props:{log:{type:Function},el:{},environment:{},amount:{},currency:{},options:{},onValidate:{type:Function}},emits:["submit","validate","activate","close","error","cancel"],setup(r,{emit:t}){const e=r,s=t,i=q(null),n=q(e.amount),o=q(e.currency),a=q(!0),l=q("");let c=!1;const{isLoading:u}=dt();function d(){var w;if(e.log("[onApplePayButtonClicked]"),!ApplePaySession||((w=e.onValidate())==null?void 0:w())===!1)return;const m={countryCode:"AU",currencyCode:o.value,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard","amex","discover"],total:{label:e.options.lineItemLabel,type:"final",amount:Number(n.value).toFixed(2)}};e.log("[onApplePayButtonClicked], Create ApplePaySession",m);const y=new ApplePaySession(3,m);y.onvalidatemerchant=E=>{const N=E.validationURL;s("validate",{validationUrl:N,merchantIdentifier:e.options.merchantIdentifier,domainName:e.options.domainName,displayName:e.options.displayName},y)},y.onpaymentauthorized=E=>{e.log("[onpaymentauthorized]",E),s("submit",E.payment,y)},y.oncancel=E=>{e.log("[oncancel]",E),s("cancel")},y.begin()}function p(){if(document.getElementById(vc)||c)return;c=!0,window.google=null;const m=document.createElement("script");m.src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",m.type="text/javascript",m.id=vc,m.onload=()=>{var w;const y=document.createElement("apple-pay-button");y.buttonstyle="black",y.locale="en-US",y.type="buy",y.onclick=d,(w=i.value)==null||w.appendChild(y),window.postMessage({status:Sr},"*")},document.body.appendChild(m)}function h(m){var y,w,E,N,D,W,k;(y=m==null?void 0:m.data)!=null&&y.status&&(m.data.status==="activate"&&m.data.component==="applepay"&&((w=e.log)==null||w.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),a.value=!0,s("activate"),p()),m.data.status==="deactivate"&&m.data.component==="applepay"&&((E=e.log)==null||E.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),a.value=!1),m.data.status==="message"&&m.data.component==="applepay"&&((N=e.log)==null||N.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),l.value=m.data.message),m.data.status==="error"&&m.data.component==="applepay"&&((D=e.log)==null||D.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),l.value=m.data.error),m.data.status===zs&&((W=e.log)==null||W.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),n.value=Number(m.data.amount)),m.data.status===qs&&((k=e.log)==null||k.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),o.value=m.data.currency))}return Et(()=>{window.removeEventListener("message",h)}),nt(()=>{window.addEventListener("message",h),Fi(i.value,Ys)||(a.value=!0,s("activate"),p())}),(m,y)=>(B(),Y(Le,null,[I("div",_m,[St(Re(wr,null,null,512),[[Fr,Ae(u)]])]),I("div",{style:{position:"relative"},ref_key:"root",ref:i},[l.value?(B(),Y("div",km,Ce(l.value),1)):me("",!0)],512)],64))}}),fs={VALIDATE_MERCHANT:"VALIDATE_MERCHANT",ADD_CHARGE_WITH_APPLE_PAY:"ADD_CHARGE_WITH_APPLE_PAY"},en=r=>({[fs.VALIDATE_MERCHANT]:{url:r+"/charge/token/apple/validate",method:"POST"},[fs.ADD_CHARGE_WITH_APPLE_PAY]:{url:r+"/charge/token/apple",method:"POST"}});class Er{constructor(t,e){f(this,"container",null);f(this,"log");f(this,"apiUrl","");f(this,"environment","");f(this,"publicKey","");f(this,"version","");f(this,"applePayButton",null);f(this,"failureCallback",null);f(this,"successCallback",null);f(this,"userOnValidate");f(this,"httpInvoker",null);f(this,"destroy",()=>{});f(this,"amount",0);f(this,"currency","");f(this,"billingAddress",null);f(this,"customer",null);f(this,"order",null);this.log=t,this.environment=e.environment,this.apiUrl=e.apiUrl,this.publicKey=e.publicKey,this.version=e.version,this.failureCallback=e.onFailure||null,this.successCallback=e.onSuccess||null;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}setAmount(t){var e;this.amount=t,(e=this.applePayButton)==null||e.setAmount(t)}setCurrency(t){var e;this.currency=t,(e=this.applePayButton)==null||e.setCurrency(t)}setCustomerInfo(t){var e;this.customer={...t},(e=this.applePayButton)==null||e.setCustomerInfo(t)}setBillingAddress(t){var e;this.billingAddress={...t},(e=this.applePayButton)==null||e.setBillingAddress(t)}setOrderInfo(t){var e;this.order={...t},(e=this.applePayButton)==null||e.setOrderInfo(t)}setOnValidate(t){this.userOnValidate=t}getOnValidate(){return this.userOnValidate}cleanUp(t){var e,s;(t==null?void 0:t.id)===((e=this.container)==null?void 0:e.id)&&((s=this.destroy)==null||s.call(this))}addApplePay(t,e,s,i,n){this.log("[addApplePay]",{providerId:e,amount:s,currency:i,options:n}),this.validateOptions(t,s,i,n),this.setAmount(s),this.setCurrency(i);let o=!1;this.container=t;const a=S(this,"[ApplePay][renderDefaultComponent]",()=>{this.log("[addApplePay], renderDefaultComponent",{providerId:e,amount:s,currency:i,options:n});const c=Je({el:t,component:Im,props:{log:this.log,el:t,environment:this.environment,amount:this.amount,currency:this.currency,options:n,onValidate:this.getOnValidate.bind(this)},on:{activate:()=>{o||(o=!0,this.log("activate applepay form"))},validate:S(this,"[addApplePay], validate",(u,d)=>{this.log("[ApplePay]: validate",u),this.validateMerchant(t,e,u,d)}),submit:S(this,"[addApplePay], submit",(u,d)=>{var h,m,y,w;this.log("[ApplePay]: complete",u);const p={amount:this.amount,currency:this.currency,token:u.token,firstName:(h=this.customer)==null?void 0:h.firstName,lastName:(m=this.customer)==null?void 0:m.lastName,email:(y=this.customer)==null?void 0:y.email,phone:(w=this.customer)==null?void 0:w.phoneNumber,address:this.billingAddress&&{line1:this.billingAddress.streetAddress,line2:this.billingAddress.streetAddress2,city:this.billingAddress.city,country:this.billingAddress.country,postalCode:this.billingAddress.postalCode,state:this.billingAddress.state}||void 0,order:this.order&&{dutyAmount:this.order.taxAmount,freightAmount:this.order.shippingAmount,items:this.order.orderItems.map(E=>({description:E.name,productCode:E.sku,quantity:Number(E.quantity),amount:Number(E.unitPrice)}))}||void 0,metadata:n.metadata};this.addChargeWithApplePay(t,e,p,d)}),error:S(this,"[addApplePay], error",(u,d)=>{var p;this.log("[ApplePay]: error",u),he(t,"Unable to pay with ApplePay"),d.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[{code:"unknown",message:u}]}),(p=this.failureCallback)==null||p.call(this,{error:"Unable to pay with ApplePay",body:u})}),cancel:S(this,"[addApplePay], calcel",()=>{var u;this.log("[ApplePay]: cancel"),he(t,"ApplePay canceled"),(u=this.failureCallback)==null||u.call(this,{error:"ApplePay canceled"})})}});this.destroy=c.destroy}),l=S(this,"[ApplePay][renderCustomComponent]",c=>{var u,d,p,h;this.log("[addApplePay], renderCustomComponent",{providerId:e,amount:s,currency:i,options:n}),this.applePayButton=c.default(this.log.bind(this),t,n.providerId,s,i,{environment:this.environment,publicKey:this.publicKey,apiUrl:this.apiUrl,version:this.version,options:n,clientParameters:n.clientParameters,onValidate:this.getOnValidate.bind(this),onSuccess:S(this,"[addApplePay], success",m=>{var w,E;this.log("[addApplePay], success",m),(w=this.applePayButton)==null||w.hide();const y={token:m.token,transactionId:m.transactionId};m.clickToPayData&&(y.clickToPayData=m.clickToPayData),(E=this.successCallback)==null||E.call(this,y)}),onFailure:S(this,"[addApplePay], failure",m=>{var y,w;this.log("[addApplePay], failure",m),(y=this.applePayButton)==null||y.redraw(),(w=this.failureCallback)==null||w.call(this,{error:m.error})})}),this.billingAddress&&((u=this.applePayButton)==null||u.setBillingAddress(this.billingAddress)),this.customer&&((d=this.applePayButton)==null||d.setCustomerInfo(this.customer)),this.order&&((p=this.applePayButton)==null||p.setOrderInfo(this.order)),(h=this.applePayButton)==null||h.draw(),window.postMessage({status:Sr},"*")});ft(Object.assign({"./applepay/ApplePayButton.interface.ts":()=>Promise.resolve().then(()=>b0),"./applepay/ApplePayButtonOptions.type.ts":()=>Promise.resolve().then(()=>C0),"./applepay/PayWayAppleButton.ts":()=>Promise.resolve().then(()=>T0),"./applepay/payway_rest.ts":()=>Promise.resolve().then(()=>S0)}),`./applepay/${n.providerType.toLowerCase()}.ts`,3).then(S(this,"[localAddApplePay], then",c=>{this.log(`Loading ${n.providerType}...`,c),l(c)})).catch(()=>{this.log(`Error loading ${n.providerType}`),a()})}validateMerchant(t,e,s,i){var n;this.log("[validateMerchant]",s),(n=this.httpInvoker)==null||n.invoke(en(this.apiUrl)[fs.VALIDATE_MERCHANT].url,en(this.apiUrl)[fs.VALIDATE_MERCHANT].method,JSON.stringify(s),S(this,"[validateMerchant], success",(o,a)=>{try{const l=JSON.parse(a);this.log("[validateMerchant], success",l),i.completeMerchantValidation(l)}catch(l){this.log("error parsing validateMerchant response",l)}}),S(this,"[validateMerchant], failure",(o,a)=>{var l;this.log("[validateMerchant], failure",a),he(t,"Unable to pay with ApplePay"),(l=this.failureCallback)==null||l.call(this,{error:"Unable to pay with ApplePay",body:a})}),{providerId:e})}addChargeWithApplePay(t,e,s,i){var n;this.log("[addChargeWithApplePay]",s),(n=this.httpInvoker)==null||n.invoke(en(this.apiUrl)[fs.ADD_CHARGE_WITH_APPLE_PAY].url,en(this.apiUrl)[fs.ADD_CHARGE_WITH_APPLE_PAY].method,JSON.stringify(s),this.getSuccessAddChargeHandler(t,i).bind(this),this.getFailureAddChargeHandler(t,i).bind(this),{providerId:e})}getFailureAddChargeHandler(t,e){return S(this,"[getFailureAddChargeHandler]",(s,i)=>{var n;this.log("[ApplePay], failure",i),he(t,"Unable to pay with ApplePay"),e.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[{code:"unknown",message:i}]}),(n=this.failureCallback)==null||n.call(this,{error:"Unable to pay with ApplePay",body:i})})}getSuccessAddChargeHandler(t,e){return S(this,"[getSuccessAddChargeHandler]",(s,i)=>{var a;const n=JSON.parse(i);this.log("[ApplePay], success",n);const o={status:ApplePaySession.STATUS_SUCCESS,paymentToken:n};e.completePayment(o),(a=this.successCallback)==null||a.call(this,{transactionId:n.chargeId})})}validateOptions(t,e,s,i){if(!kt(s))throw he(t,"Invalid currency: "+s),new TypeError("invalid currency: "+s);if(!ot(e))throw he(t,"Invalid amount: "+e),new TypeError("invalid amount: "+e);if(!i.lineItemLabel)throw he(t,"Invalid lineItemLabel parameter"),new TypeError("Invalid lineItemLabel parameter");if(!i.domainName)throw he(t,"Invalid domainName parameter"),new TypeError("Invalid domainName parameter");if(!i.displayName)throw he(t,"Invalid displayName parameter"),new TypeError("Invalid displayName parameter");if(!i.merchantIdentifier)throw he(t,"Invalid merchantIdentifier parameter"),new TypeError("Invalid merchantIdentifier parameter")}}v([C],Er.prototype,"cleanUp",null),v([C],Er.prototype,"addApplePay",null),v([C],Er.prototype,"validateMerchant",null),v([C],Er.prototype,"addChargeWithApplePay",null),v([C],Er.prototype,"getFailureAddChargeHandler",null),v([C],Er.prototype,"getSuccessAddChargeHandler",null),v([C],Er.prototype,"validateOptions",null);const Am=Oe(Ie({__name:"ApplePayIcon",props:{size:{},grayscale:{type:Boolean}},setup(r){const e=`--size: ${r.size}px`;return(s,i)=>(B(),Y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2","xml:space":"preserve",style:e},[...i[0]||(i[0]=[I("path",{id:"XMLID_34_",d:`M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9
|
|
151
|
+
left=${R}`),s("newWindow",(K=d.value)==null?void 0:K.externalId)}else y.value=!0,w.value=!0,s("popup",(X=d.value)==null?void 0:X.externalId);return!1}}function W(){y.value=!1,w.value=!1,u==null||u.close(),s("popupClose")}return nt(()=>{window.addEventListener("message",N),Fi(i.value,Ys)||(o.value=!0,s("activate",e.options))}),Et(()=>{window.removeEventListener("message",N)}),(P,K)=>(B(),Y(Le,null,[St(Re(wr,{"use-local":""},null,512),[[Fr,!m.value]]),w.value&&!y.value?(B(),Cr(wr,{key:0,message:"Finalise the payment"})):me("",!0),I("div",{id:`payfurl-${a.value}-form`,class:"payfurl-checkout-form",ref_key:"root",ref:i},[I("div",{class:"container-form",style:mt(`visibility: ${Ae(n)?"hidden":"visible"}`)},[Ae(p)?(B(),Y("div",vm,Ce(Ae(p)),1)):me("",!0),I("div",bm,[E.value?(B(),Y("button",{key:0,onClick:D,type:"button"},Ce(h.value),1)):me("",!0),l.value?(B(),Y("p",Cm,Ce(l.value),1)):me("",!0)])],4)],8,Pm),y.value?(B(),Cr(ym,{key:1,onClose:W,url:m.value,name:h.value},null,8,["url","name"])):me("",!0)],64))}}),[["__scopeId","data-v-2c4ce814"]]),ps={CHECKOUT:"CHECKOUT",CHECK_STATUS:"CHECK_STATUS"},Qi=(r,t)=>({[ps.CHECKOUT]:{url:r+"/payment_method/checkout",method:"POST"},[ps.CHECK_STATUS]:{url:r+"/checkout/external/"+t,method:"GET"}});class fr{constructor(t,e){f(this,"container",null);f(this,"log");f(this,"apiUrl","");f(this,"redirectUrl","");f(this,"checkStatusHandler",null);f(this,"successCallback",null);f(this,"userOnValidate");f(this,"httpInvoker",null);f(this,"destroy",()=>{});this.log=t,this.apiUrl=e.apiUrl,this.redirectUrl=e.redirectUrl,this.successCallback=e.onSuccess||null;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}setOnValidate(t){this.userOnValidate=t}getOnValidate(){return this.userOnValidate}cleanUp(t){var e,s;((e=this.container)==null?void 0:e.id)===(t==null?void 0:t.id)&&((s=this.destroy)==null||s.call(this))}addCheckout(t,e,s,i,n,o,a){this.log(`[addCheckout][${i}]`,{amount:e,providerId:n,providerType:i,options:o,checkoutOptions:a}),this.container=t;let l=!1,c;const u=Je({el:t,component:Tm,props:{log:this.log,providerType:i,options:{providerId:n,amount:e,currency:s,checkoutOptions:a},onValidate:this.getOnValidate.bind(this)},on:{activate:S(this,"[sdk][checkoutProcessor][${providerType}]: activate checkout form",d=>{if(l)return;l=!0,this.log(`[sdk][checkoutProcessor][${i}]: activate checkout form`,d);const p=()=>{l=!1};this.checkout(d,i,o,p),c=this.getMessageHandler(d,i,o,p).bind(this),window.addEventListener("message",c)}),popup:S(this,"[sdk][checkoutProcessor][${providerType}]: popup open",d=>{this.log(`[sdk][checkoutProcessor][${i}]: popup open`,d),this.checkStatus(t,d,i,c)}),popupClose:S(this,"[sdk][checkoutProcessor][${providerType}]: popup close",()=>{this.log(`[sdk][checkoutProcessor][${i}]: popup close`),this.stopCheckingStatus(null)}),newWindow:S(this,"[sdk][checkoutProcessor][${providerType}]: new window open",d=>{this.log(`[sdk][checkoutProcessor][${i}]: new window open`,d),this.checkStatus(t,d,i,c)}),newWindowClose:S(this,"[sdk][checkoutProcessor][${providerType}]: new window close",()=>{this.log(`[sdk][checkoutProcessor][${i}]: new window close`),this.stopCheckingStatus(null)})}});this.destroy=u.destroy}checkout(t,e,s,i){var n,o,a,l,c,u,d,p,h,m,y,w,E,N;(N=this.httpInvoker)==null||N.invoke(Qi(this.apiUrl)[ps.CHECKOUT].url,Qi(this.apiUrl)[ps.CHECKOUT].method,JSON.stringify({providerId:t.providerId,amount:t.amount,currency:t.currency,shippingAmount:s.shippingAmount,customer:{firstName:(n=s.customer)==null?void 0:n.firstName,lastName:(o=s.customer)==null?void 0:o.lastName,email:(a=s.customer)==null?void 0:a.email,phone:(l=s.customer)==null?void 0:l.phoneNumber,billingAddress:{name:((c=s.billingAddress)==null?void 0:c.firstName)+" "+((u=s.billingAddress)==null?void 0:u.lastName),addressLine1:(d=s.billingAddress)==null?void 0:d.streetAddress,addressLine2:(p=s.billingAddress)==null?void 0:p.streetAddress2,suburb:(h=s.billingAddress)==null?void 0:h.region,state:(m=s.billingAddress)==null?void 0:m.state,countryCode:(y=s.billingAddress)==null?void 0:y.country,postcode:(w=s.billingAddress)==null?void 0:w.postalCode}},items:(E=s.orderItems)==null?void 0:E.map(D=>({name:D.name,reference:D.sku,quantity:D.quantity,amount:D.totalAmount})),options:{...t.checkoutOptions,redirectUrl:this.redirectUrl},metadata:Fe(s==null?void 0:s.metadata)}),this.getSuccessCheckoutHandler(e).bind(this),S(this,"[sdk][checkoutProcessor][${providerType}]: failureCheckoutHandler",(D,W)=>{i==null||i(D,W),this.getFailureCheckoutHandler(e).bind(this)(D,W)}))}getSuccessCheckoutHandler(t){return S(this,"[sdk][checkoutProcessor][${providerType}]: successCheckoutHandler",(e,s)=>{this.log(`[sdk][checkoutProcessor][${t}]: successCheckoutHandler`,e,s);const i=JSON.parse(s),n=JSON.parse(window.atob(i.checkoutData));window.postMessage({status:Zi,component:"checkout",providerType:t,checkoutData:n},"*")})}getFailureCheckoutHandler(t){return S(this,"[sdk][checkoutProcessor][${providerType}]: failureCheckoutHandler",(e,s)=>{this.log(`[sdk][checkoutProcessor][${t}]: failureCheckoutHandler`,e,s),dt().stopLoading(),window.postMessage({status:"error",component:"checkout",providerType:t,error:"Invalid payment details",originalError:s},"*")})}stopCheckingStatus(t){this.checkStatusHandler&&(clearInterval(this.checkStatusHandler),this.checkStatusHandler=null),t&&window.removeEventListener("message",t)}checkStatus(t,e,s,i){var l;this.checkStatusHandler||(this.checkStatusHandler=setInterval(this.checkStatus.bind(this,t,e,s,i),5e3),this.log(`[sdk][checkoutProcessor][${s}]: Starting polling...`));const n=this,o=S(this,`[sdk][checkoutProcessor][${s}]: failureCheckStatusHandler`,(c,u)=>{dt().stopLoading(),n.log(`[sdk][checkoutProcessor][${s}]: failureCheckStatusHandler`,c,u),window.postMessage({status:"message",component:"checkout",providerType:s,message:"Checkout has been cancelled"},"*")}),a=S(this,`[sdk][checkoutProcessor][${s}]: successCheckStatusHandler`,(c,u)=>{var p;dt().stopLoading(),n.log(`[sdk][checkoutProcessor][${s}]: successCheckStatusHandler`,{transactionId:c,token:u}),as(t,"Transaction in progress. Please don't close the window or navigate away");const d={};c&&(d.transactionId=c),u&&(d.token=u),(p=n.successCallback)==null||p.call(n,d)});(l=this.httpInvoker)==null||l.invoke(Qi(this.apiUrl,e)[ps.CHECK_STATUS].url,Qi(this.apiUrl,e)[ps.CHECK_STATUS].method,{},S(this,`[sdk][checkoutProcessor][${s}]: checkStatus, success`,(c,u)=>{const d=JSON.parse(u);if(this.log("checkoutStatus",d),!d)return this.stopCheckingStatus(i),o(c,u);if(d.status=="SUCCESS"&&d.status==="SUCCESS")return this.stopCheckingStatus(i),a(d.transactionId,d.tokenId)}),S(this,`[sdk][checkoutProcessor][${s}]: checkStatus, failure`,(c,u)=>(this.log(`[sdk][checkoutProcessor][${s}]: checkStatus`,{status:c,body:u}),this.stopCheckingStatus(i),o(c,u))))}getMessageHandler(t,e,s,i){return S(this,`[sdk][checkoutProcessor][${e}]: message received`,n=>{var o;if((o=n==null?void 0:n.data)!=null&&o.status){if(n.data.status===zs){if(Number(t.amount)==Number(n.data.amount))return;this.log(`[sdk][checkoutProcessor][${e}]: message received`,n.data),t.amount=Number(n.data.amount),this.checkout(t,e,s,i);return}if(n.data.status===qs){if(t.currency==n.data.currency)return;this.log(`[sdk][checkoutProcessor][${e}]: message received`,n.data),t.currency=n.data.currency,this.checkout(t,e,s,i);return}}})}}v([C],fr.prototype,"cleanUp",null),v([C],fr.prototype,"addCheckout",null),v([C],fr.prototype,"checkout",null),v([C],fr.prototype,"getSuccessCheckoutHandler",null),v([C],fr.prototype,"getFailureCheckoutHandler",null),v([C],fr.prototype,"stopCheckingStatus",null),v([C],fr.prototype,"checkStatus",null),v([C],fr.prototype,"getMessageHandler",null);const ht={version:"4.8.3"},yo={CHECK_FRAUD:"CHECK_FRAUD"},mc=r=>({[yo.CHECK_FRAUD]:{url:r+"/fraud_check",method:"POST"}});class gc{constructor(t,e){f(this,"providerId","");f(this,"stopPaymentOnFailure",!1);f(this,"log");f(this,"apiUrl","");f(this,"getFraudCheckData");f(this,"metadata",{});f(this,"amount",0);f(this,"currency","AUD");f(this,"address",null);f(this,"customer",null);f(this,"order",null);f(this,"paymentInformation",null);f(this,"paypalInformation",null);f(this,"checkResult",null);f(this,"httpInvoker",null);this.log=t,this.providerId=e.providerId,this.stopPaymentOnFailure=e.stopPaymentOnFailure,this.apiUrl=e.apiUrl,this.metadata=e.metadata,this.getFraudCheckData=e.getFraudCheckData;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}fraudCheck(t,e){var s;if(!this.customer)return e({error:"Customer information is required"});if(!this.address)return e({error:"Address information is required"});if(!this.order)return e({error:"Order information is required"});if(!this.paymentInformation&&!this.paypalInformation)return e({error:"Payment information is required"});this.log("[fraudCheck]",{amount:this.amount,currency:this.currency,paymentInformation:this.paymentInformation,paypalInformation:this.paypalInformation,customer:this.customer,address:this.address,order:this.order,metadata:this.metadata}),(s=this.httpInvoker)==null||s.invoke(mc(this.apiUrl)[yo.CHECK_FRAUD].url,mc(this.apiUrl)[yo.CHECK_FRAUD].method,this.getFraudCheckData(this.providerId,this.amount,this.currency,this.paymentInformation,this.paypalInformation,this.customer,this.address,this.order,this.metadata),S(this,"[fraudCheck], success",(i,n)=>{if(this.log("[fraudCheck], success",i,n,this.stopPaymentOnFailure),this.checkResult=JSON.parse(n),this.checkResult===null)return e({error:"Fraud Check Failed",body:n});this.checkResult.providerId=this.providerId,this.checkResult.stopPaymentOnFailure=this.stopPaymentOnFailure,t(this.checkResult)}),S(this,"[fraudCheck], failure",(i,n)=>{this.log("[fraudCheck], failure",i,n),e({error:"Fraud Check Failed",body:n})}))}setAmount(t){this.amount=t}setCurrency(t){this.currency=t}setAddressInfo(t){this.address={...t}}setCustomerInfo(t){this.customer={...t}}setOrderInfo(t){this.order={...t}}setPaymentInfo(t){this.paymentInformation={...t}}setPaypalInfo(t){this.paypalInformation={...t}}getProviderId(){return this.providerId}getCheckResult(){return this.checkResult}}v([C],gc.prototype,"fraudCheck",null);const wm={style:{position:"relative"}},Sm={key:0,class:"error text-normal"},yc="payfurl-googlepay-script",Em=Ie({__name:"GooglePayForm",props:{log:{type:Function},el:{},environment:{},amount:{},currency:{},options:{},onValidate:{type:Function}},emits:["complete","activate","close","error"],setup(r,{emit:t}){const e=r,s=t,i=q(null),n=q(e.amount),o=q(e.currency),a=q(!0),l=q("");let c=!1;const{isLoading:u}=dt();function d(){if(c)return;if(c=!0,document.getElementById(yc)){W();return}window.google=null;const P=document.createElement("script");P.src="https://pay.google.com/gp/p/js/pay.js",P.type="text/javascript",P.id=yc,P.onload=W,document.body.appendChild(P)}let p=null;function h(){return p===null&&(p=new window.google.payments.api.PaymentsClient({environment:e.environment!=Ze.PRODUCTION?"TEST":"PRODUCTION"})),p}const m={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};function y(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[m]}}function w(){const K=h().createButton({onClick:N});e.el.appendChild(K)}function E(){return e.environment!=Ze.PRODUCTION?{merchantName:e.options.googlePayMerchantName??"Example Merchant"}:{merchantName:e.options.googlePayMerchantName??"Example Merchant",merchantId:e.options.googlePayMerchantId}}function N(){var X;if(e.log("[onGooglePaymentButtonClicked]"),((X=e.onValidate())==null?void 0:X())===!1)return;const P=D(),K=h();e.log("[paymentData], request",P),K.loadPaymentData(P).then(function(ee){e.log("[paymentData], success",ee);const ce=JSON.parse(ee.paymentMethodData.tokenizationData.token);ee.paymentMethodData.tokenizationData={...ee.paymentMethodData.tokenizationData,...ce},s("complete",ee)}).catch(function(ee){e.log("[paymentData], error",ee),!(ee instanceof AbortError)&&s("error",ee.message)})}function D(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{...m,tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:e.options.gateway,gatewayMerchantId:e.options.googlePayGatewayMerchantId}}}],transactionInfo:{totalPriceStatus:"FINAL",countryCode:"AU",currencyCode:o.value,totalPrice:Number(n.value).toFixed(2)},merchantInfo:E()}}function W(){h().isReadyToPay(y()).then(function(K){K.result&&(w(),window.postMessage({status:Sr},"*"))}).catch(function(K){console.error("Load GooglePay error",K)})}function k(P){var K,X,ee,ce,ie,we,$e;(K=P==null?void 0:P.data)!=null&&K.status&&(P.data.status==="activate"&&P.data.component==="googlepay"&&((X=e.log)==null||X.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),a.value=!0,s("activate"),d()),P.data.status==="deactivate"&&P.data.component==="googlepay"&&((ee=e.log)==null||ee.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),a.value=!1),P.data.status==="message"&&P.data.component==="googlepay"&&((ce=e.log)==null||ce.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),l.value=P.data.message),P.data.status==="error"&&P.data.component==="googlepay"&&((ie=e.log)==null||ie.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),l.value=P.data.error),P.data.status===zs&&((we=e.log)==null||we.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),n.value=Number(P.data.amount)),P.data.status===qs&&(($e=e.log)==null||$e.call(e,`[GooglePay]: message "${P.data.status}" received`,P.data),o.value=P.data.currency))}return Et(()=>{window.removeEventListener("message",k)}),nt(()=>{window.addEventListener("message",k),Fi(i.value,Ys)||(a.value=!0,s("activate"),d())}),(P,K)=>(B(),Y(Le,null,[I("div",wm,[St(Re(wr,null,null,512),[[Fr,Ae(u)]])]),I("div",{style:{position:"relative"},ref_key:"root",ref:i},[l.value?(B(),Y("div",Sm,Ce(l.value),1)):me("",!0)],512)],64))}}),Po={ADD_CHARGE_WITH_GOOGLE_PAY:"ADD_CHARGE_WITH_GOOGLE_PAY"},Pc=r=>({[Po.ADD_CHARGE_WITH_GOOGLE_PAY]:{url:r+"/charge/token/google",method:"POST"}});class Kr{constructor(t,e){f(this,"container",null);f(this,"log");f(this,"apiUrl","");f(this,"environment","");f(this,"failureCallback",null);f(this,"successCallback",null);f(this,"userOnValidate");f(this,"httpInvoker",null);f(this,"destroy",()=>{});f(this,"amount",0);f(this,"currency","");f(this,"billingAddress",null);f(this,"customer",null);f(this,"order",null);this.log=t,this.environment=e.environment,this.apiUrl=e.apiUrl,this.failureCallback=e.onFailure||null,this.successCallback=e.onSuccess||null;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}setAmount(t){this.amount=t}setCurrency(t){this.currency=t}setCustomerInfo(t){this.customer={...t}}setBillingAddress(t){this.billingAddress={...t}}setOrderInfo(t){this.order={...t}}setOnValidate(t){this.userOnValidate=t}getOnValidate(){return this.userOnValidate}cleanUp(t){var e;t===this.container&&((e=this.destroy)==null||e.call(this))}addGooglePay(t,e,s,i,n){this.log("[addGooglePay]",{providerId:e,amount:s,currency:i,options:n}),this.validateOptions(t,s,i,n),this.setAmount(s),this.setCurrency(i);let o=!1;this.container=t;const a=Je({el:t,component:Em,props:{log:this.log,el:t,environment:this.environment,amount:this.amount,currency:this.currency,options:n,onValidate:this.getOnValidate.bind(this)},on:{activate:S(this,"[GooglePay]: activate",()=>{o||(o=!0,this.log("[GooglePay]: activate googlepay form"))}),complete:S(this,"[GooglePay]: complete",l=>{var u,d,p,h;this.log("[GooglePay]: complete",l);const c={amount:this.amount,currency:this.currency,paymentData:{paymentMethodData:{tokenizationData:{intermediateSigningKey:l.paymentMethodData.tokenizationData.intermediateSigningKey,protocolVersion:l.paymentMethodData.tokenizationData.protocolVersion,signature:l.paymentMethodData.tokenizationData.signature,signedMessage:l.paymentMethodData.tokenizationData.signedMessage}},paymentInfo:{cardDetails:l.paymentMethodData.info.cardDetails,cardNetwork:l.paymentMethodData.info.cardNetwork}},firstName:(u=this.customer)==null?void 0:u.firstName,lastName:(d=this.customer)==null?void 0:d.lastName,email:(p=this.customer)==null?void 0:p.email,phone:(h=this.customer)==null?void 0:h.phoneNumber,address:this.billingAddress&&{line1:this.billingAddress.streetAddress,line2:this.billingAddress.streetAddress2,city:this.billingAddress.city,country:this.billingAddress.country,postalCode:this.billingAddress.postalCode,state:this.billingAddress.state}||void 0,order:this.order&&{dutyAmount:this.order.taxAmount,freightAmount:this.order.shippingAmount,items:this.order.orderItems.map(m=>({description:m.name,productCode:m.sku,quantity:Number(m.quantity),amount:Number(m.unitPrice),unitOfMeasure:m.unitOfMeasure}))}||void 0,metadata:Fe(n==null?void 0:n.metadata)};this.addChargeWithGooglePay(t,e,c)}),error:S(this,"[GooglePay]: error",l=>{var c;this.log("[GooglePay]: error",l),he(t,"Unable to pay with Google Pay"),(c=this.failureCallback)==null||c.call(this,{error:"Unable to pay with Google Pay",body:l})})}});this.destroy=a.destroy}addChargeWithGooglePay(t,e,s){var i;this.log("[addChargeWithGooglePay]",s),(i=this.httpInvoker)==null||i.invoke(Pc(this.apiUrl)[Po.ADD_CHARGE_WITH_GOOGLE_PAY].url,Pc(this.apiUrl)[Po.ADD_CHARGE_WITH_GOOGLE_PAY].method,JSON.stringify(s),this.getSuccessAddChargeHandler(t).bind(this),this.getFailureAddChargeHandler(t).bind(this),{providerId:e})}getFailureAddChargeHandler(t){return S(this,"[GooglePay], failure",(e,s)=>{var i;this.log("[GooglePay], failure",s),he(t,"Unable to pay with Google Pay"),(i=this.failureCallback)==null||i.call(this,{error:"Unable to pay with Google Pay",body:s})})}getSuccessAddChargeHandler(t){return S(this,"[GooglePay], success",(e,s)=>{var n;const i=JSON.parse(s);this.log("[GooglePay], success",i),(n=this.successCallback)==null||n.call(this,{transactionId:i.chargeId})})}validateOptions(t,e,s,i){if(!kt(s))throw he(t,"Invalid currency: "+s),new TypeError("invalid currency: "+s);if(!ot(e))throw he(t,"Invalid amount: "+e),new TypeError("invalid amount: "+e);if(!i.gateway)throw he(t,"Invalid gateway parameter"),new TypeError("Invalid gateway parameter");if(!i.googlePayGatewayMerchantId)throw he(t,"Invalid gateway merchant id parameter"),new TypeError("Invalid gateway merchant id parameter")}}v([C],Kr.prototype,"cleanUp",null),v([C],Kr.prototype,"addGooglePay",null),v([C],Kr.prototype,"addChargeWithGooglePay",null),v([C],Kr.prototype,"getFailureAddChargeHandler",null),v([C],Kr.prototype,"getSuccessAddChargeHandler",null),v([C],Kr.prototype,"validateOptions",null);const _m={style:{position:"relative"}},km={key:0,class:"error text-normal"},vc="payfurl-applepay-script",Im=Ie({__name:"ApplePayForm",props:{log:{type:Function},el:{},environment:{},amount:{},currency:{},options:{},onValidate:{type:Function}},emits:["submit","validate","activate","close","error","cancel"],setup(r,{emit:t}){const e=r,s=t,i=q(null),n=q(e.amount),o=q(e.currency),a=q(!0),l=q("");let c=!1;const{isLoading:u}=dt();function d(){var w;if(e.log("[onApplePayButtonClicked]"),!ApplePaySession||((w=e.onValidate())==null?void 0:w())===!1)return;const m={countryCode:"AU",currencyCode:o.value,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard","amex","discover"],total:{label:e.options.lineItemLabel,type:"final",amount:Number(n.value).toFixed(2)}};e.log("[onApplePayButtonClicked], Create ApplePaySession",m);const y=new ApplePaySession(3,m);y.onvalidatemerchant=E=>{const N=E.validationURL;s("validate",{validationUrl:N,merchantIdentifier:e.options.merchantIdentifier,domainName:e.options.domainName,displayName:e.options.displayName},y)},y.onpaymentauthorized=E=>{e.log("[onpaymentauthorized]",E),s("submit",E.payment,y)},y.oncancel=E=>{e.log("[oncancel]",E),s("cancel")},y.begin()}function p(){if(document.getElementById(vc)||c)return;c=!0,window.google=null;const m=document.createElement("script");m.src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",m.type="text/javascript",m.id=vc,m.onload=()=>{var w;const y=document.createElement("apple-pay-button");y.buttonstyle="black",y.locale="en-US",y.type="buy",y.onclick=d,(w=i.value)==null||w.appendChild(y),window.postMessage({status:Sr},"*")},document.body.appendChild(m)}function h(m){var y,w,E,N,D,W,k;(y=m==null?void 0:m.data)!=null&&y.status&&(m.data.status==="activate"&&m.data.component==="applepay"&&((w=e.log)==null||w.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),a.value=!0,s("activate"),p()),m.data.status==="deactivate"&&m.data.component==="applepay"&&((E=e.log)==null||E.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),a.value=!1),m.data.status==="message"&&m.data.component==="applepay"&&((N=e.log)==null||N.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),l.value=m.data.message),m.data.status==="error"&&m.data.component==="applepay"&&((D=e.log)==null||D.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),l.value=m.data.error),m.data.status===zs&&((W=e.log)==null||W.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),n.value=Number(m.data.amount)),m.data.status===qs&&((k=e.log)==null||k.call(e,`[ApplePay]: message "${m.data.status}" received`,m.data),o.value=m.data.currency))}return Et(()=>{window.removeEventListener("message",h)}),nt(()=>{window.addEventListener("message",h),Fi(i.value,Ys)||(a.value=!0,s("activate"),p())}),(m,y)=>(B(),Y(Le,null,[I("div",_m,[St(Re(wr,null,null,512),[[Fr,Ae(u)]])]),I("div",{style:{position:"relative"},ref_key:"root",ref:i},[l.value?(B(),Y("div",km,Ce(l.value),1)):me("",!0)],512)],64))}}),fs={VALIDATE_MERCHANT:"VALIDATE_MERCHANT",ADD_CHARGE_WITH_APPLE_PAY:"ADD_CHARGE_WITH_APPLE_PAY"},en=r=>({[fs.VALIDATE_MERCHANT]:{url:r+"/charge/token/apple/validate",method:"POST"},[fs.ADD_CHARGE_WITH_APPLE_PAY]:{url:r+"/charge/token/apple",method:"POST"}});class Er{constructor(t,e){f(this,"container",null);f(this,"log");f(this,"apiUrl","");f(this,"environment","");f(this,"publicKey","");f(this,"version","");f(this,"applePayButton",null);f(this,"failureCallback",null);f(this,"successCallback",null);f(this,"userOnValidate");f(this,"httpInvoker",null);f(this,"destroy",()=>{});f(this,"amount",0);f(this,"currency","");f(this,"billingAddress",null);f(this,"customer",null);f(this,"order",null);this.log=t,this.environment=e.environment,this.apiUrl=e.apiUrl,this.publicKey=e.publicKey,this.version=e.version,this.failureCallback=e.onFailure||null,this.successCallback=e.onSuccess||null;const s=new It(e.environment,At(e.publicKey));this.httpInvoker=new vt(e.publicKey,e.version,s)}setAmount(t){var e;this.amount=t,(e=this.applePayButton)==null||e.setAmount(t)}setCurrency(t){var e;this.currency=t,(e=this.applePayButton)==null||e.setCurrency(t)}setCustomerInfo(t){var e;this.customer={...t},(e=this.applePayButton)==null||e.setCustomerInfo(t)}setBillingAddress(t){var e;this.billingAddress={...t},(e=this.applePayButton)==null||e.setBillingAddress(t)}setOrderInfo(t){var e;this.order={...t},(e=this.applePayButton)==null||e.setOrderInfo(t)}setOnValidate(t){this.userOnValidate=t}getOnValidate(){return this.userOnValidate}cleanUp(t){var e,s;(t==null?void 0:t.id)===((e=this.container)==null?void 0:e.id)&&((s=this.destroy)==null||s.call(this))}addApplePay(t,e,s,i,n){this.log("[addApplePay]",{providerId:e,amount:s,currency:i,options:n}),this.validateOptions(t,s,i,n),this.setAmount(s),this.setCurrency(i);let o=!1;this.container=t;const a=S(this,"[ApplePay][renderDefaultComponent]",()=>{this.log("[addApplePay], renderDefaultComponent",{providerId:e,amount:s,currency:i,options:n});const c=Je({el:t,component:Im,props:{log:this.log,el:t,environment:this.environment,amount:this.amount,currency:this.currency,options:n,onValidate:this.getOnValidate.bind(this)},on:{activate:()=>{o||(o=!0,this.log("activate applepay form"))},validate:S(this,"[addApplePay], validate",(u,d)=>{this.log("[ApplePay]: validate",u),this.validateMerchant(t,e,u,d)}),submit:S(this,"[addApplePay], submit",(u,d)=>{var h,m,y,w;this.log("[ApplePay]: complete",u);const p={amount:this.amount,currency:this.currency,token:u.token,firstName:(h=this.customer)==null?void 0:h.firstName,lastName:(m=this.customer)==null?void 0:m.lastName,email:(y=this.customer)==null?void 0:y.email,phone:(w=this.customer)==null?void 0:w.phoneNumber,address:this.billingAddress&&{line1:this.billingAddress.streetAddress,line2:this.billingAddress.streetAddress2,city:this.billingAddress.city,country:this.billingAddress.country,postalCode:this.billingAddress.postalCode,state:this.billingAddress.state}||void 0,order:this.order&&{dutyAmount:this.order.taxAmount,freightAmount:this.order.shippingAmount,items:this.order.orderItems.map(E=>({description:E.name,productCode:E.sku,quantity:Number(E.quantity),amount:Number(E.unitPrice)}))}||void 0,metadata:n.metadata};this.addChargeWithApplePay(t,e,p,d)}),error:S(this,"[addApplePay], error",(u,d)=>{var p;this.log("[ApplePay]: error",u),he(t,"Unable to pay with ApplePay"),d.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[{code:"unknown",message:u}]}),(p=this.failureCallback)==null||p.call(this,{error:"Unable to pay with ApplePay",body:u})}),cancel:S(this,"[addApplePay], calcel",()=>{var u;this.log("[ApplePay]: cancel"),he(t,"ApplePay canceled"),(u=this.failureCallback)==null||u.call(this,{error:"ApplePay canceled"})})}});this.destroy=c.destroy}),l=S(this,"[ApplePay][renderCustomComponent]",c=>{var u,d,p,h;this.log("[addApplePay], renderCustomComponent",{providerId:e,amount:s,currency:i,options:n}),this.applePayButton=c.default(this.log.bind(this),t,n.providerId,s,i,{environment:this.environment,publicKey:this.publicKey,apiUrl:this.apiUrl,version:this.version,options:n,clientParameters:n.clientParameters,onValidate:this.getOnValidate.bind(this),onSuccess:S(this,"[addApplePay], success",m=>{var w,E;this.log("[addApplePay], success",m),(w=this.applePayButton)==null||w.hide();const y={token:m.token,transactionId:m.transactionId};m.clickToPayData&&(y.clickToPayData=m.clickToPayData),(E=this.successCallback)==null||E.call(this,y)}),onFailure:S(this,"[addApplePay], failure",m=>{var y,w;this.log("[addApplePay], failure",m),(y=this.applePayButton)==null||y.redraw(),(w=this.failureCallback)==null||w.call(this,{error:m.error})})}),this.billingAddress&&((u=this.applePayButton)==null||u.setBillingAddress(this.billingAddress)),this.customer&&((d=this.applePayButton)==null||d.setCustomerInfo(this.customer)),this.order&&((p=this.applePayButton)==null||p.setOrderInfo(this.order)),(h=this.applePayButton)==null||h.draw(),window.postMessage({status:Sr},"*")});ft(Object.assign({"./applepay/ApplePayButton.interface.ts":()=>Promise.resolve().then(()=>b0),"./applepay/ApplePayButtonOptions.type.ts":()=>Promise.resolve().then(()=>C0),"./applepay/PayWayAppleButton.ts":()=>Promise.resolve().then(()=>T0),"./applepay/payway_rest.ts":()=>Promise.resolve().then(()=>S0)}),`./applepay/${n.providerType.toLowerCase()}.ts`,3).then(S(this,"[localAddApplePay], then",c=>{this.log(`Loading ${n.providerType}...`,c),l(c)})).catch(()=>{this.log(`Error loading ${n.providerType}`),a()})}validateMerchant(t,e,s,i){var n;this.log("[validateMerchant]",s),(n=this.httpInvoker)==null||n.invoke(en(this.apiUrl)[fs.VALIDATE_MERCHANT].url,en(this.apiUrl)[fs.VALIDATE_MERCHANT].method,JSON.stringify(s),S(this,"[validateMerchant], success",(o,a)=>{try{const l=JSON.parse(a);this.log("[validateMerchant], success",l),i.completeMerchantValidation(l)}catch(l){this.log("error parsing validateMerchant response",l)}}),S(this,"[validateMerchant], failure",(o,a)=>{var l;this.log("[validateMerchant], failure",a),he(t,"Unable to pay with ApplePay"),(l=this.failureCallback)==null||l.call(this,{error:"Unable to pay with ApplePay",body:a})}),{providerId:e})}addChargeWithApplePay(t,e,s,i){var n;this.log("[addChargeWithApplePay]",s),(n=this.httpInvoker)==null||n.invoke(en(this.apiUrl)[fs.ADD_CHARGE_WITH_APPLE_PAY].url,en(this.apiUrl)[fs.ADD_CHARGE_WITH_APPLE_PAY].method,JSON.stringify(s),this.getSuccessAddChargeHandler(t,i).bind(this),this.getFailureAddChargeHandler(t,i).bind(this),{providerId:e})}getFailureAddChargeHandler(t,e){return S(this,"[getFailureAddChargeHandler]",(s,i)=>{var n;this.log("[ApplePay], failure",i),he(t,"Unable to pay with ApplePay"),e.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[{code:"unknown",message:i}]}),(n=this.failureCallback)==null||n.call(this,{error:"Unable to pay with ApplePay",body:i})})}getSuccessAddChargeHandler(t,e){return S(this,"[getSuccessAddChargeHandler]",(s,i)=>{var a;const n=JSON.parse(i);this.log("[ApplePay], success",n);const o={status:ApplePaySession.STATUS_SUCCESS,paymentToken:n};e.completePayment(o),(a=this.successCallback)==null||a.call(this,{transactionId:n.chargeId})})}validateOptions(t,e,s,i){if(!kt(s))throw he(t,"Invalid currency: "+s),new TypeError("invalid currency: "+s);if(!ot(e))throw he(t,"Invalid amount: "+e),new TypeError("invalid amount: "+e);if(!i.lineItemLabel)throw he(t,"Invalid lineItemLabel parameter"),new TypeError("Invalid lineItemLabel parameter");if(!i.domainName)throw he(t,"Invalid domainName parameter"),new TypeError("Invalid domainName parameter");if(!i.displayName)throw he(t,"Invalid displayName parameter"),new TypeError("Invalid displayName parameter");if(!i.merchantIdentifier)throw he(t,"Invalid merchantIdentifier parameter"),new TypeError("Invalid merchantIdentifier parameter")}}v([C],Er.prototype,"cleanUp",null),v([C],Er.prototype,"addApplePay",null),v([C],Er.prototype,"validateMerchant",null),v([C],Er.prototype,"addChargeWithApplePay",null),v([C],Er.prototype,"getFailureAddChargeHandler",null),v([C],Er.prototype,"getSuccessAddChargeHandler",null),v([C],Er.prototype,"validateOptions",null);const Am=Oe(Ie({__name:"ApplePayIcon",props:{size:{},grayscale:{type:Boolean}},setup(r){const e=`--size: ${r.size}px`;return(s,i)=>(B(),Y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2","xml:space":"preserve",style:e},[...i[0]||(i[0]=[I("path",{id:"XMLID_34_",d:`M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9
|
|
152
152
|
C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2
|
|
153
153
|
c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7
|
|
154
154
|
c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2
|