@payfurl/react-plugin 1.4.0 → 1.6.0
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 +142 -0
- package/dist/DefaultThreeDsProvider-BS9pznAi-fDl8jKzq.js +248 -0
- package/dist/{MetricsGlobalThreeDsProvider-B-EQQsEV-BYhakAA4.js → MetricsGlobalThreeDsProvider-C2mH6Z-m-BTiFsRgv.js} +25 -25
- package/dist/PayWayAppleButton-BcXMphiU-BwJKfUAJ.js +184 -0
- package/dist/components/PayfurlDropin.d.ts +8 -3
- package/dist/{cxpay-VbaQA3_P-DlS7yCqQ.js → cxpay-Bdz9DX5E-9-_yu7t4.js} +1 -1
- package/dist/{default-Diji0SXY-ghmIvhgy.js → default-CmqRUII8-B6Im_IPh.js} +1 -1
- package/dist/{ecentric-BlNDCZo_-Bd8Q_3ZG.js → ecentric-CZzDL4aQ-BRg09Y8f.js} +24 -21
- package/dist/{epna-CxmJ_mqR-D4gbP4NT.js → epna-A5WIS8Rv-DhjWr-Wx.js} +1 -1
- package/dist/{flashbanc-BAxvqtBB-DVXrWV0Z.js → flashbanc-BnKR75SO-BStfAWAb.js} +1 -1
- package/dist/forter-DtCvNxaz-D5SEPByD.js +36 -0
- package/dist/{gpayments-B5KWQV4S-QV7caEyB.js → gpayments-C98_oxi_-D02_MfHY.js} +23 -23
- package/dist/index-CqIxTjar.js +12169 -0
- package/dist/index.d.ts +1 -1
- package/dist/metrics_global-c4lRSySk-WxebdZ3j.js +7 -0
- package/dist/{nmi-Ch7qQ6Av-DbPjmA5v.js → nmi-CrPg94-y-Bco-VeX9.js} +1 -1
- package/dist/{nuvei-DRmlfpTL-ByeKEnae.js → nuvei-8V5Z1Bqi-7VHagYOe.js} +31 -32
- package/dist/{payabli-CiBJ1-vC-BthvUlRk.js → payabli-CAvI6xn--Nz5dJc0q.js} +1 -1
- package/dist/payfurl-react.es.js +1 -1
- package/dist/payfurl-react.umd.js +24 -22
- package/dist/payglocal-BcbX7wj--Dd68qYZO.js +114 -0
- package/dist/{payway_rest-CjgIP42z-7zwBGwnD.js → payway_rest-Det6oVYM-BzfFo5sS.js} +1 -1
- package/dist/{skybank-D7uRF17E-BXng_6yf.js → skybank-CldRW65N-BFprFe0k.js} +1 -1
- package/package.json +4 -3
- package/dist/DefaultThreeDsProvider-CzqbXEws-C21Rr7_5.js +0 -219
- package/dist/PayWayAppleButton-C-XfcgNS-rgWe-QJM.js +0 -163
- package/dist/forter-R2alfHeE-C5KHGNgt.js +0 -33
- package/dist/index-CL6hUU-f.js +0 -11224
- package/dist/metrics_global-HMMDzPlb-CXHJ1NHy.js +0 -7
- package/dist/payglocal-uAPlijwL-CvGatUVh.js +0 -109
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { O as C } from "./DefaultThreeDsProvider-BS9pznAi-fDl8jKzq.js";
|
|
2
|
+
import { j as u, q as f, i as E, u as S, e as L, b as D, U as R, a as v, y, t as b, X as d, z as k, k as m, c as I, l as U } from "./index-CqIxTjar.js";
|
|
3
|
+
var h = D(!1);
|
|
4
|
+
function A(e, ...t) {
|
|
5
|
+
h.value && console.log(m(e), m(t));
|
|
6
|
+
}
|
|
7
|
+
function p(e) {
|
|
8
|
+
var t, s;
|
|
9
|
+
(t = e == null ? void 0 : e.data) != null && t.status && e.data.status === "init-card-form" && (h.value = !!((s = e == null ? void 0 : e.data) != null && s.debug));
|
|
10
|
+
}
|
|
11
|
+
function _() {
|
|
12
|
+
return v(() => {
|
|
13
|
+
window.addEventListener("message", p);
|
|
14
|
+
}), y(() => {
|
|
15
|
+
window.removeEventListener("message", p);
|
|
16
|
+
}), {
|
|
17
|
+
debug: h,
|
|
18
|
+
logMessage: A
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var x = { class: "modal-mask" }, M = { class: "modal-wrapper" }, G = ["src"], O = /* @__PURE__ */ S(/* @__PURE__ */ L({
|
|
22
|
+
__name: "PayGLocalThreeDsChallenge",
|
|
23
|
+
props: { url: {} },
|
|
24
|
+
emits: ["close"],
|
|
25
|
+
setup(e, { emit: t }) {
|
|
26
|
+
let { logMessage: s } = _(), r = e, n = t, o = D(r.url), i = k(() => U(o.value) ? o.value : "");
|
|
27
|
+
R(() => r.url, (a) => {
|
|
28
|
+
o.value = a;
|
|
29
|
+
}), v(() => {
|
|
30
|
+
window.addEventListener("message", c);
|
|
31
|
+
}), y(() => {
|
|
32
|
+
window.removeEventListener("message", c);
|
|
33
|
+
});
|
|
34
|
+
function c(a) {
|
|
35
|
+
var g;
|
|
36
|
+
if (s("PayGLocalThreeDsChallenge: Message received", a.data), !((g = a == null ? void 0 : a.data) != null && g["payglocal-token"])) return;
|
|
37
|
+
let l = a.data["payglocal-token"];
|
|
38
|
+
s("Token received", l);
|
|
39
|
+
let T = l.split(".")[1], w = window.atob(T), P = JSON.parse(w);
|
|
40
|
+
n("close", P);
|
|
41
|
+
}
|
|
42
|
+
return (a, l) => (I(), b("div", x, [d("div", M, [d("iframe", {
|
|
43
|
+
src: i.value,
|
|
44
|
+
sandbox: "allow-same-origin allow-scripts allow-popups allow-forms"
|
|
45
|
+
}, null, 8, G)])]));
|
|
46
|
+
}
|
|
47
|
+
}), [["__scopeId", "data-v-9fa1282d"]]), $ = class extends C {
|
|
48
|
+
getType() {
|
|
49
|
+
return "PayGLocal";
|
|
50
|
+
}
|
|
51
|
+
onPreAuth() {
|
|
52
|
+
var e, t;
|
|
53
|
+
this.log(`[${this.getType()}]: onPreAuth`), (e = this.threeDsProcessor) != null && e.getTokenId() ? this.threeDsProcessor.getGatewayData(this.threeDsProcessor.getProviderId(), this.threeDsProcessor.getTokenId(), (s) => {
|
|
54
|
+
var r;
|
|
55
|
+
return this.initChallenge(((r = s.gatewayMetadata) == null ? void 0 : r.RedirectUrl) || "");
|
|
56
|
+
}, () => {
|
|
57
|
+
var s;
|
|
58
|
+
return (s = this.threeDsProcessor) == null ? void 0 : s.onError({ error: "Unable to get card information" });
|
|
59
|
+
}) : (t = this.threeDsProcessor) == null || t.tokeniseCard(this.threeDsProcessor.getProviderId(), (s) => {
|
|
60
|
+
this.log(`[${this.getType()}]: tokeniseCard`, s), this.initChallenge(s.gatewayTokenData.RedirectUrl);
|
|
61
|
+
}, (s) => {
|
|
62
|
+
var r;
|
|
63
|
+
u(this.container, s), (r = this.threeDsProcessor) == null || r.onError({ error: s });
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
onAuth(e, t) {
|
|
67
|
+
}
|
|
68
|
+
onPostAuth() {
|
|
69
|
+
}
|
|
70
|
+
initChallenge(e) {
|
|
71
|
+
var s;
|
|
72
|
+
if (this.log(`[${this.getType()}]: initChallenge`, e), !e) {
|
|
73
|
+
u(this.container, "3D Secure URL is missing"), (s = this.threeDsProcessor) == null || s.onError({ error: "3D Secure URL is missing" });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.setChallengeFrameVisible(!0);
|
|
77
|
+
let { destroy: t } = f({
|
|
78
|
+
el: document.body,
|
|
79
|
+
component: O,
|
|
80
|
+
props: { url: e },
|
|
81
|
+
on: { close: (r) => {
|
|
82
|
+
var n, o, i;
|
|
83
|
+
this.closeChallenge(), this.log(`[${this.getType()}]: Challenge Results`, r), r.status === "AUTHORIZED" ? (n = this.threeDsProcessor) == null || n.onSuccess({
|
|
84
|
+
acsRenderingType: {},
|
|
85
|
+
acsTransID: "",
|
|
86
|
+
authenticationType: "",
|
|
87
|
+
authenticationValue: "",
|
|
88
|
+
challengeCancel: "",
|
|
89
|
+
dsTransID: "",
|
|
90
|
+
eci: "",
|
|
91
|
+
interactionCounter: "",
|
|
92
|
+
messageCategory: "",
|
|
93
|
+
messageExtension: [],
|
|
94
|
+
messageType: "",
|
|
95
|
+
messageVersion: "",
|
|
96
|
+
threeDSRequestorTransID: "",
|
|
97
|
+
threeDSServerTransID: "",
|
|
98
|
+
transStatusReason: "",
|
|
99
|
+
transStatus: "Y"
|
|
100
|
+
}) : r.status === "CUSTOMER_CANCELLED" ? (o = this.threeDsProcessor) == null || o.onError({
|
|
101
|
+
error: "Challenge cancelled",
|
|
102
|
+
cancelReason: "abandoned"
|
|
103
|
+
}) : (i = this.threeDsProcessor) == null || i.onError({ error: E });
|
|
104
|
+
} }
|
|
105
|
+
});
|
|
106
|
+
this.threeDSDestroy = t;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function z(e, t, s) {
|
|
110
|
+
return new $(e, t, s);
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
z as default
|
|
114
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfurl/react-plugin",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "PayFURL React Plugin",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"dev": "vite",
|
|
24
24
|
"build": "vite build && vue-tsc --emitDeclarationOnly",
|
|
25
|
-
"preview": "vite preview"
|
|
25
|
+
"preview": "vite preview",
|
|
26
|
+
"lint": "eslint . --max-warnings 0"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@payfurl/client": "^4.
|
|
29
|
+
"@payfurl/client": "^4.12.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"react": "^18.3.1",
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
var S = Object.defineProperty;
|
|
2
|
-
var g = (t, s, e) => s in t ? S(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
|
-
var r = (t, s, e) => g(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import { E as p, D as m, H as T, t as u, o as I, a as v, Z as f, b as y, c as A, X as l, d as C, u as R, e as P, P as U, g as b, K as E, i as w } from "./index-CL6hUU-f.js";
|
|
5
|
-
var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" }, k = ["action"], V = ["value"], _ = /* @__PURE__ */ v(/* @__PURE__ */ f({
|
|
6
|
-
__name: "ThreeDsChallenge",
|
|
7
|
-
props: {
|
|
8
|
-
threeDSServerTransID: {},
|
|
9
|
-
acsTransID: {},
|
|
10
|
-
formAction: {}
|
|
11
|
-
},
|
|
12
|
-
emits: ["close", "submit"],
|
|
13
|
-
setup(t, { emit: s }) {
|
|
14
|
-
let e = t, a = s, n = U(() => w(e.formAction) ? e.formAction : ""), o = b(null), c = JSON.stringify({
|
|
15
|
-
threeDSServerTransID: e.threeDSServerTransID,
|
|
16
|
-
acsTransID: e.acsTransID,
|
|
17
|
-
messageVersion: "2.2.0",
|
|
18
|
-
messageType: "CReq",
|
|
19
|
-
challengeWindowSize: "01"
|
|
20
|
-
}), D = encodeURI(window.btoa(c).replace(/=*$/, ""));
|
|
21
|
-
return y(() => {
|
|
22
|
-
var i;
|
|
23
|
-
n.value && ((i = o.value) == null || i.submit());
|
|
24
|
-
}), (i, h) => (E(), A("div", $, [l("div", M, [l("div", L, [
|
|
25
|
-
C(R, {
|
|
26
|
-
onClick: h[0] || (h[0] = (N) => a("close")),
|
|
27
|
-
id: "3ds-challenge-close"
|
|
28
|
-
}),
|
|
29
|
-
h[1] || (h[1] = l("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)),
|
|
30
|
-
l("form", {
|
|
31
|
-
action: n.value,
|
|
32
|
-
target: "ThreeDsChallengeIFrame",
|
|
33
|
-
method: "post",
|
|
34
|
-
ref_key: "form",
|
|
35
|
-
ref: o
|
|
36
|
-
}, [l("input", {
|
|
37
|
-
type: "hidden",
|
|
38
|
-
name: "creq",
|
|
39
|
-
value: P(D)
|
|
40
|
-
}, null, 8, V)], 8, k)
|
|
41
|
-
])])]));
|
|
42
|
-
}
|
|
43
|
-
}), [["__scopeId", "data-v-07081e85"]]), q = class {
|
|
44
|
-
constructor() {
|
|
45
|
-
r(this, "iframeId", "threeDsIframeMethod");
|
|
46
|
-
r(this, "containerId", "payfurlContainerFormInvoker");
|
|
47
|
-
r(this, "iframe", null);
|
|
48
|
-
r(this, "container", null);
|
|
49
|
-
}
|
|
50
|
-
createIFrame() {
|
|
51
|
-
this.iframe || (this.container = document.createElement("div"), this.container.id = this.containerId, document.body.appendChild(this.container), this.iframe = document.createElement("iframe"), this.iframe.name = this.iframeId, this.iframe.style.display = "none", this.container.appendChild(this.iframe));
|
|
52
|
-
}
|
|
53
|
-
invoke(t, s, e, a, n) {
|
|
54
|
-
var c;
|
|
55
|
-
this.createIFrame();
|
|
56
|
-
let o = document.createElement("form");
|
|
57
|
-
o.action = t, o.target = this.iframeId, o.method = "post", (c = this.container) == null || c.appendChild(o);
|
|
58
|
-
for (let D in e) {
|
|
59
|
-
let i = document.createElement("input");
|
|
60
|
-
i.type = "hidden", i.name = D, i.value = e[D], o.appendChild(i);
|
|
61
|
-
}
|
|
62
|
-
o.submit();
|
|
63
|
-
}
|
|
64
|
-
}, { hideSpinner: d, showSpinner: F } = I(), J = class {
|
|
65
|
-
constructor(t, s, e) {
|
|
66
|
-
r(this, "log");
|
|
67
|
-
r(this, "container");
|
|
68
|
-
r(this, "options");
|
|
69
|
-
r(this, "threeDsProcessor", null);
|
|
70
|
-
r(this, "threeDSDestroy", () => {
|
|
71
|
-
});
|
|
72
|
-
r(this, "threeDSServerTransID", "");
|
|
73
|
-
r(this, "threeDSAuthURL", "");
|
|
74
|
-
r(this, "threeDSRequestorTransID", "");
|
|
75
|
-
r(this, "threeDSMonitorURL", "");
|
|
76
|
-
r(this, "internalMessageHandler", this.messageHandler.bind(this));
|
|
77
|
-
r(this, "onError", (t, s) => {
|
|
78
|
-
var e, a;
|
|
79
|
-
this.closeChallenge(), d(), t === 404 ? (e = this.threeDsProcessor) == null || e.onError({ error: "This feature is only supported by ActiveServer v1.1.2+" }) : (a = this.threeDsProcessor) == null || a.onError({
|
|
80
|
-
error: u,
|
|
81
|
-
body: s
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
r(this, "onSuccess", (t, s) => {
|
|
85
|
-
var a, n;
|
|
86
|
-
this.closeChallenge(), d();
|
|
87
|
-
let e = JSON.parse(s);
|
|
88
|
-
["Y", "A"].includes(e.transStatus) ? (a = this.threeDsProcessor) == null || a.onSuccess(e) : (this.log(`[${this.getType()}]: ${u}`, e), (n = this.threeDsProcessor) == null || n.onError({ error: u }));
|
|
89
|
-
});
|
|
90
|
-
r(this, "onInitAuthSuccess", (t, s) => {
|
|
91
|
-
let e = JSON.parse(s);
|
|
92
|
-
this.log(`[${this.getType()}][onInitAuthSuccess]`, e), this.threeDSRequestorTransID = e.threeDSRequestorTransID, this.threeDSServerTransID = e.threeDSServerTransID, this.threeDSMonitorURL = e.threeDSMonitorURL, this.threeDSAuthURL = e.threeDSAuthURL, e.threeDSMethodURL ? this.threeDsMethodInvoke(e.threeDSServerTransID, e.threeDSMethodURL) : this.onAuth(!1, "");
|
|
93
|
-
});
|
|
94
|
-
r(this, "onDoAuthSuccess", (t, s) => {
|
|
95
|
-
var a;
|
|
96
|
-
let e = JSON.parse(s);
|
|
97
|
-
if (this.log(`[${this.getType()}][onDoAuthSuccess]`, e), !e.transStatus) this.onError(t, "No transStatus specified");
|
|
98
|
-
else switch (e.transStatus) {
|
|
99
|
-
case "C":
|
|
100
|
-
if (!e.acsURL) {
|
|
101
|
-
this.onError(t, "Invalid Challenge Url");
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
this.doChallenge(e.acsURL, e.acsTransID, e.authenticationValue);
|
|
105
|
-
break;
|
|
106
|
-
case "N":
|
|
107
|
-
this.log(`[${this.getType()}][threeDsAuth], 3DS Verification failed, transaction denied`), this.onError(400, "3DS Verification failed, transaction denied");
|
|
108
|
-
break;
|
|
109
|
-
case "U":
|
|
110
|
-
this.log(`[${this.getType()}][threeDsAuth], Unable to perform 3DS verification`), this.onError(400, "Unable to perform 3DS verification");
|
|
111
|
-
break;
|
|
112
|
-
case "R":
|
|
113
|
-
this.log(`[${this.getType()}][threeDsAuth], Unable to perform 3DS verification, rejected at issuer`), this.onError(400, "Unable to perform 3DS verification, rejected at issuer");
|
|
114
|
-
break;
|
|
115
|
-
default:
|
|
116
|
-
this.log(`[${this.getType()}][threeDsAuth], 3DS challenge not required, tranStatus: ${e.transStatus}`), (a = this.threeDsProcessor) == null || a.onSuccess({
|
|
117
|
-
threeDSServerTransID: e.threeDSServerTransID,
|
|
118
|
-
threeDSRequestorTransID: "",
|
|
119
|
-
acsRenderingType: e.acsRenderingType,
|
|
120
|
-
acsTransID: e.acsTransID,
|
|
121
|
-
authenticationType: e.authenticationType,
|
|
122
|
-
authenticationValue: e.authenticationValue,
|
|
123
|
-
challengeCancel: "",
|
|
124
|
-
dsTransID: e.dsTransID,
|
|
125
|
-
eci: e.eci,
|
|
126
|
-
interactionCounter: "",
|
|
127
|
-
messageCategory: "",
|
|
128
|
-
messageExtension: e.messageExtension,
|
|
129
|
-
messageType: e.messageType,
|
|
130
|
-
messageVersion: e.messageVersion,
|
|
131
|
-
transStatus: e.transStatus,
|
|
132
|
-
transStatusReason: e.transStatusReason
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
this.log = t, this.container = s, this.options = e;
|
|
137
|
-
}
|
|
138
|
-
getType() {
|
|
139
|
-
return "Default";
|
|
140
|
-
}
|
|
141
|
-
getDomain() {
|
|
142
|
-
return "";
|
|
143
|
-
}
|
|
144
|
-
onPreAuth() {
|
|
145
|
-
this.log(`[${this.getType()}][onPreAuth]`), this.threeDsProcessor && (F(), this.threeDsProcessor.onPreAuth(this.onInitAuthSuccess, this.onError), window.addEventListener("message", this.internalMessageHandler));
|
|
146
|
-
}
|
|
147
|
-
onAuth(t, s) {
|
|
148
|
-
var e;
|
|
149
|
-
this.log(`[${this.getType()}][onAuth]`, {
|
|
150
|
-
threeDSAuthURL: this.threeDSAuthURL,
|
|
151
|
-
threeDSRequestorTransID: this.threeDSRequestorTransID,
|
|
152
|
-
threeDSServerTransID: this.threeDSServerTransID,
|
|
153
|
-
isMethodPerformed: t
|
|
154
|
-
}), (e = this.threeDsProcessor) == null || e.onAuth(this.threeDSAuthURL, this.threeDSRequestorTransID, this.threeDSServerTransID, t, s, this.onDoAuthSuccess, this.onError);
|
|
155
|
-
}
|
|
156
|
-
onPostAuth() {
|
|
157
|
-
var t;
|
|
158
|
-
this.log(`[${this.getType()}][onPostAuth]`, { threeDSServerTransID: this.threeDSServerTransID }), (t = this.threeDsProcessor) == null || t.onPostAuth({ threeDSServerTransID: this.threeDSServerTransID }, this.onSuccess, this.onError);
|
|
159
|
-
}
|
|
160
|
-
setThreeDsProcessor(t) {
|
|
161
|
-
this.log(`[${this.getType()}][setThreeDsProcessor]`), this.threeDsProcessor = t;
|
|
162
|
-
}
|
|
163
|
-
messageHandler(t) {
|
|
164
|
-
var s, e;
|
|
165
|
-
(s = t == null ? void 0 : t.data) != null && s.status && ((e = t == null ? void 0 : t.data) == null ? void 0 : e.status) !== "tokenise-card-failure" && (t.data.status === "3ds_method_invocation_complete" ? (t.stopPropagation(), this.invocationComplete(t)) : t.data.status === "3ds_challenge_complete" && (t.stopPropagation(), this.challengeComplete(t)));
|
|
166
|
-
}
|
|
167
|
-
invocationComplete(t) {
|
|
168
|
-
this.log(`[${this.getType()}]: 3Ds Method invocation complete`), this.onAuth(!0, "");
|
|
169
|
-
}
|
|
170
|
-
challengeComplete(t) {
|
|
171
|
-
this.log(`[${this.getType()}]: 3Ds Challenge complete`, t.data), this.closeChallenge();
|
|
172
|
-
let s = JSON.parse(window.atob(t.data.cres));
|
|
173
|
-
this.log(`[${this.getType()}]: cresData`, s), ["Y", "A"].includes(s.transStatus) ? this.onPostAuth() : [
|
|
174
|
-
"N",
|
|
175
|
-
"U",
|
|
176
|
-
"R"
|
|
177
|
-
].includes(s.transStatus) && (this.log(`[${this.getType()}]: Failed 3DS Challenge`, t.data), this.onError(400, "Failed 3DS Challenge"));
|
|
178
|
-
}
|
|
179
|
-
setChallengeFrameVisible(t) {
|
|
180
|
-
window.self !== window.top && window.parent.postMessage({ status: t ? p : m }, "*");
|
|
181
|
-
}
|
|
182
|
-
doChallenge(t, s, e) {
|
|
183
|
-
this.log(`[${this.getType()}][doChallenge]`), d(), this.setChallengeFrameVisible(!0);
|
|
184
|
-
let { destroy: a } = T({
|
|
185
|
-
el: document.body,
|
|
186
|
-
component: _,
|
|
187
|
-
props: {
|
|
188
|
-
threeDSServerTransID: this.threeDSServerTransID,
|
|
189
|
-
acsTransID: s,
|
|
190
|
-
formAction: t,
|
|
191
|
-
authenticationValue: e
|
|
192
|
-
},
|
|
193
|
-
on: { close: () => {
|
|
194
|
-
var n;
|
|
195
|
-
a(), this.threeDSDestroy = () => {
|
|
196
|
-
}, (n = this.threeDsProcessor) == null || n.onError({ error: "Challenge cancelled" });
|
|
197
|
-
} }
|
|
198
|
-
});
|
|
199
|
-
this.threeDSDestroy = a;
|
|
200
|
-
}
|
|
201
|
-
closeChallenge() {
|
|
202
|
-
var t;
|
|
203
|
-
(t = this.threeDSDestroy) == null || t.call(this), this.setChallengeFrameVisible(!1), window.removeEventListener("message", this.internalMessageHandler);
|
|
204
|
-
}
|
|
205
|
-
threeDsMethodInvoke(t, s) {
|
|
206
|
-
this.log(`[${this.getType()}][threeDsMethodInvoke]`, {
|
|
207
|
-
threeDSServerTransID: t,
|
|
208
|
-
threeDSMethodURL: s
|
|
209
|
-
});
|
|
210
|
-
let e = {
|
|
211
|
-
threeDSServerTransID: t,
|
|
212
|
-
threeDSMethodNotificationURL: this.options.apiUrl + "/3ds/method_invocation"
|
|
213
|
-
}, a = encodeURI(window.btoa(JSON.stringify(e)).replace(/=*$/, ""));
|
|
214
|
-
new q().invoke(s, "POST", { threeDSMethodData: a });
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
export {
|
|
218
|
-
J as O
|
|
219
|
-
};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
var m = Object.defineProperty;
|
|
2
|
-
var g = (t, e, r) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
-
var i = (t, e, r) => g(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { f as b, m as A, l as v } from "./index-CL6hUU-f.js";
|
|
5
|
-
var l = {
|
|
6
|
-
CHECKOUT: "CHECKOUT",
|
|
7
|
-
CHARGE: "CHARGE"
|
|
8
|
-
}, p = (t) => ({
|
|
9
|
-
[l.CHECKOUT]: {
|
|
10
|
-
url: t + "/payment_method/checkout",
|
|
11
|
-
method: "POST"
|
|
12
|
-
},
|
|
13
|
-
[l.CHARGE]: {
|
|
14
|
-
url: t + "/charge/checkout",
|
|
15
|
-
method: "POST"
|
|
16
|
-
}
|
|
17
|
-
}), k = class {
|
|
18
|
-
constructor(t, e, r, a, o, s) {
|
|
19
|
-
i(this, "log");
|
|
20
|
-
i(this, "container");
|
|
21
|
-
i(this, "button", null);
|
|
22
|
-
i(this, "validator", null);
|
|
23
|
-
i(this, "validationError", null);
|
|
24
|
-
i(this, "providerId");
|
|
25
|
-
i(this, "apiUrl");
|
|
26
|
-
i(this, "amount");
|
|
27
|
-
i(this, "currency");
|
|
28
|
-
i(this, "clientParameters");
|
|
29
|
-
i(this, "billingAddress", null);
|
|
30
|
-
i(this, "customer", null);
|
|
31
|
-
i(this, "order", null);
|
|
32
|
-
i(this, "buttonId", "apple-pay-payway-button");
|
|
33
|
-
i(this, "validatorId", "apple-pay-payway-button-validator");
|
|
34
|
-
i(this, "onLoad", () => {
|
|
35
|
-
});
|
|
36
|
-
i(this, "onSuccess");
|
|
37
|
-
i(this, "onFailure");
|
|
38
|
-
i(this, "userOnValidate");
|
|
39
|
-
i(this, "httpInvoker", null);
|
|
40
|
-
this.log = t, this.apiUrl = s.apiUrl, this.container = e || document.body, this.clientParameters = s.clientParameters, this.providerId = s.providerId, this.amount = Number(a), this.currency = o, this.providerId = r, this.onSuccess = s.onSuccess || null, this.onFailure = s.onFailure || null, this.userOnValidate = s.onValidate;
|
|
41
|
-
let c = new b(s.environment, A(s.publicKey));
|
|
42
|
-
this.httpInvoker = new v(s.publicKey, s.version, c), this.init(), setInterval(() => {
|
|
43
|
-
var d;
|
|
44
|
-
this.validator && (((d = this.userOnValidate) == null ? void 0 : d.call(this)) === !1 ? this.validator.style.display = "block" : (this.validator.style.display = "none", this.validationError && (this.validationError.style.display = "none")));
|
|
45
|
-
}, 1e3);
|
|
46
|
-
}
|
|
47
|
-
draw() {
|
|
48
|
-
let t = () => {
|
|
49
|
-
this.onLoad = () => {
|
|
50
|
-
};
|
|
51
|
-
let e = {
|
|
52
|
-
container: this.buttonId,
|
|
53
|
-
publishableApiKey: this.clientParameters.PublishableApiKey,
|
|
54
|
-
principalAmount: this.amount,
|
|
55
|
-
currency: String(this.currency).toLowerCase(),
|
|
56
|
-
buttonMode: "callback"
|
|
57
|
-
};
|
|
58
|
-
this.log("[createPaymentRequestButton]", e), window.payway.createPaymentRequestButton(e, (r, a) => {
|
|
59
|
-
var o;
|
|
60
|
-
this.log("[createPaymentRequestButton]", r, a), r ? (o = this.onFailure) == null || o.call(this, r) : this.checkout(a.singleUseTokenId);
|
|
61
|
-
}), this.addValidator();
|
|
62
|
-
};
|
|
63
|
-
window.payway ? t() : this.onLoad = t;
|
|
64
|
-
}
|
|
65
|
-
show() {
|
|
66
|
-
this.button && (this.button.style.display = "block");
|
|
67
|
-
}
|
|
68
|
-
hide() {
|
|
69
|
-
this.button && (this.button.style.display = "none");
|
|
70
|
-
}
|
|
71
|
-
init() {
|
|
72
|
-
let t = document.createElement("div");
|
|
73
|
-
t.id = this.buttonId, t.style.position = "relative", this.container.appendChild(t), this.button = t, this.initScript();
|
|
74
|
-
}
|
|
75
|
-
addValidator() {
|
|
76
|
-
var e;
|
|
77
|
-
if (document.getElementById(this.validatorId)) return;
|
|
78
|
-
let t = document.createElement("div");
|
|
79
|
-
t.id = this.validatorId, t.style.width = "100%", t.style.height = "100%", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.display = "none", (e = this.button) == null || e.appendChild(t), this.validator = t;
|
|
80
|
-
}
|
|
81
|
-
initScript() {
|
|
82
|
-
let t = document.createElement("script");
|
|
83
|
-
t.src = "https://api.payway.com.au/rest/v1/payway.js", t.onload = () => {
|
|
84
|
-
this.onLoad && this.onLoad();
|
|
85
|
-
}, document.head.appendChild(t);
|
|
86
|
-
}
|
|
87
|
-
checkout(t) {
|
|
88
|
-
var r, a, o, s, c, d;
|
|
89
|
-
let e = {
|
|
90
|
-
providerId: this.providerId,
|
|
91
|
-
amount: this.amount,
|
|
92
|
-
currency: this.currency,
|
|
93
|
-
reference: (r = this.order) == null ? void 0 : r.orderNumber,
|
|
94
|
-
options: { ProviderToken: t },
|
|
95
|
-
customer: {
|
|
96
|
-
firstName: (a = this.customer) == null ? void 0 : a.firstName,
|
|
97
|
-
lastName: (o = this.customer) == null ? void 0 : o.lastName,
|
|
98
|
-
email: (s = this.customer) == null ? void 0 : s.email,
|
|
99
|
-
phone: (c = this.customer) == null ? void 0 : c.phoneNumber,
|
|
100
|
-
billingAddress: this.billingAddress && {
|
|
101
|
-
name: `${this.billingAddress.firstName} ${this.billingAddress.lastName}`,
|
|
102
|
-
addressLine1: this.billingAddress.streetAddress,
|
|
103
|
-
addressLine2: this.billingAddress.streetAddress2,
|
|
104
|
-
suburb: this.billingAddress.city,
|
|
105
|
-
countryCode: this.billingAddress.country,
|
|
106
|
-
postcode: this.billingAddress.postalCode,
|
|
107
|
-
state: this.billingAddress.state
|
|
108
|
-
} || void 0
|
|
109
|
-
},
|
|
110
|
-
items: this.order && this.order.orderItems.map((n) => ({
|
|
111
|
-
name: n.name,
|
|
112
|
-
reference: n.sku,
|
|
113
|
-
quantity: Number(n.quantity),
|
|
114
|
-
amount: Number(n.unitPrice)
|
|
115
|
-
})) || []
|
|
116
|
-
};
|
|
117
|
-
this.log("[PayWayAppleButton][checkout]", e), (d = this.httpInvoker) == null || d.invoke(p(this.apiUrl)[l.CHECKOUT].url, p(this.apiUrl)[l.CHECKOUT].method, JSON.stringify(e), (n, h) => {
|
|
118
|
-
this.log("[PayWayAppleButton][checkout]: successCheckoutHandler", n, h);
|
|
119
|
-
let y = JSON.parse(h), u = JSON.parse(window.atob(y.checkoutData));
|
|
120
|
-
this.log("[PayWayAppleButton][checkout]: decodedData", u), this.charge(u.checkoutId);
|
|
121
|
-
}, (n, h) => {
|
|
122
|
-
var u;
|
|
123
|
-
this.log("[PayWayAppleButton][checkout]: failureCheckoutHandler", n, h);
|
|
124
|
-
let y = JSON.parse(h);
|
|
125
|
-
(u = this.onFailure) == null || u.call(this, { error: y.message });
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
charge(t) {
|
|
129
|
-
var e;
|
|
130
|
-
this.log("[PayWayAppleButton][charge]", { checkoutId: t }), (e = this.httpInvoker) == null || e.invoke(p(this.apiUrl)[l.CHARGE].url, p(this.apiUrl)[l.CHARGE].method, JSON.stringify({ checkoutId: t }), (r, a) => {
|
|
131
|
-
var s;
|
|
132
|
-
this.log("[PayWayAppleButton][charge]: successChargeHandler", r, a);
|
|
133
|
-
let o = JSON.parse(a);
|
|
134
|
-
(s = this.onSuccess) == null || s.call(this, { transactionId: o == null ? void 0 : o.chargeId });
|
|
135
|
-
}, (r, a) => {
|
|
136
|
-
var s;
|
|
137
|
-
this.log("[PayWayAppleButton][charge]: failureChargeHandler", r, a);
|
|
138
|
-
let o = JSON.parse(a);
|
|
139
|
-
(s = this.onFailure) == null || s.call(this, { error: o.message });
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
redraw() {
|
|
143
|
-
this.button && (this.button.innerHTML = "", this.draw());
|
|
144
|
-
}
|
|
145
|
-
setAmount(t) {
|
|
146
|
-
this.log("[PayWayAppleButton][setAmount]", t), this.amount = t, this.redraw();
|
|
147
|
-
}
|
|
148
|
-
setCurrency(t) {
|
|
149
|
-
this.log("[PayWayAppleButton][setCurrency]", t), this.currency = t, this.redraw();
|
|
150
|
-
}
|
|
151
|
-
setCustomerInfo(t) {
|
|
152
|
-
this.log("[PayWayAppleButton][setCustomerInfo]", t), this.customer = { ...t };
|
|
153
|
-
}
|
|
154
|
-
setBillingAddress(t) {
|
|
155
|
-
this.log("[PayWayAppleButton][setBillingAddress]", t), this.billingAddress = { ...t };
|
|
156
|
-
}
|
|
157
|
-
setOrderInfo(t) {
|
|
158
|
-
this.log("[PayWayAppleButton][setOrderInfo]", t), this.order = { ...t };
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
export {
|
|
162
|
-
k as PayWayAppleButton
|
|
163
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var l = Object.defineProperty;
|
|
2
|
-
var d = (t, e, s) => e in t ? l(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
-
var h = (t, e, s) => d(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { O as c } from "./DefaultThreeDsProvider-CzqbXEws-C21Rr7_5.js";
|
|
5
|
-
import { e as g, a as m, s as u } from "./managedOrders-ojoMZ0Ab-B94-Nsp-.js";
|
|
6
|
-
import { o as p } from "./index-CL6hUU-f.js";
|
|
7
|
-
var { hideSpinner: f } = p(), S = class extends c {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
h(this, "onDoAuthSuccess", (e, s) => {
|
|
11
|
-
var n;
|
|
12
|
-
let o = JSON.parse(s);
|
|
13
|
-
this.log(`[${this.getType()}][onDoAuthSuccess]`, o);
|
|
14
|
-
let a = ((n = this.options.clientParameters) == null ? void 0 : n.SiteId) || "", i = o.managedOrderToken;
|
|
15
|
-
!i || !g.test(a) ? this.onError(e, "3DS could not be started") : m(a).then(() => {
|
|
16
|
-
this.setChallengeFrameVisible(!0), f(), u(i, this.container, (r) => {
|
|
17
|
-
this.setChallengeFrameVisible(!1), r ? (this.log(`[${this.getType()}]: manageOrder failed`, r), this.onError(400, "3DS failed")) : this.onPostAuth();
|
|
18
|
-
});
|
|
19
|
-
}, (r) => {
|
|
20
|
-
this.log(`[${this.getType()}]: managedOrders.js failed to load`, r), this.onError(400, "3DS could not be started");
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
getType() {
|
|
25
|
-
return "Forter";
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
function b(t, e, s) {
|
|
29
|
-
return new S(t, e, s);
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
b as default
|
|
33
|
-
};
|