@payfurl/client 4.5.8 → 4.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 +3 -1
- package/dist/sdk/DefaultThreeDsProvider-701637b0.mjs +215 -0
- package/dist/sdk/GPaymentsThreeDsProvider-740b4c21.mjs +103 -0
- package/dist/sdk/NmiThreeDsProvider-51bf6fff.mjs +135 -0
- package/dist/sdk/{ThreeDsInitResponse.type-06482849.mjs → ThreeDsProvider.interface-da0ab2aa.mjs} +3 -0
- package/dist/sdk/default-6f6c8e7c.mjs +8 -0
- package/dist/sdk/{ecentric-a38ee625.mjs → ecentric-45331775.mjs} +23 -23
- package/dist/sdk/gpayments-455eb705.mjs +9 -0
- package/dist/sdk/main-f2996bc2.mjs +18729 -0
- package/dist/sdk/nmi-dbb88036.mjs +9 -0
- package/dist/sdk/payfurl.es.js +1 -1
- package/dist/sdk/payfurl.umd.js +55 -11
- package/dist/sdk/style.css +1 -1
- package/package.json +2 -1
- package/dist/sdk/default-e9cbfb8c.mjs +0 -179
- package/dist/sdk/gpayments-ce2cc11d.mjs +0 -165
- package/dist/sdk/main-98c32247.mjs +0 -8717
package/README.md
CHANGED
|
@@ -30,9 +30,11 @@ Your `readme.md` file looks fine, but I can provide some improvements in formatt
|
|
|
30
30
|
cssUrl: "http://localhost:3001/dist/sdk/",
|
|
31
31
|
url: "http://localhost:3001/dist/iframe/",
|
|
32
32
|
apiUrl: "https://localhost:5001",
|
|
33
|
-
redirectUrl: "http://localhost:3001/checkout/redirect.html"
|
|
33
|
+
redirectUrl: "http://localhost:3001/checkout/redirect.html",
|
|
34
|
+
sentryUrl: "",
|
|
34
35
|
};
|
|
35
36
|
```
|
|
37
|
+
Sentry is disabled if `sentryUrl` value is empty.
|
|
36
38
|
|
|
37
39
|
2. Run the following commands in your project directory:
|
|
38
40
|
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var u = (a, e, s) => e in a ? D(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
|
|
3
|
+
var r = (a, e, s) => (u(a, typeof e != "symbol" ? e + "" : e, s), s);
|
|
4
|
+
import { d as S, r as d, o as p, a as g, c as T, b as n, e as _, C as I, u as m, p as f, f as y, _ as A, i as v, T as C, j as c, g as E, F as R } from "./main-f2996bc2.mjs";
|
|
5
|
+
const P = (a) => (f("data-v-c82daa22"), a = a(), y(), a), U = { class: "mask" }, $ = { class: "wrapper" }, L = { class: "container" }, b = /* @__PURE__ */ P(() => /* @__PURE__ */ n("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), M = ["action"], w = ["value"], N = /* @__PURE__ */ S({
|
|
6
|
+
__name: "ThreeDsChallenge",
|
|
7
|
+
props: {
|
|
8
|
+
threeDSServerTransID: null,
|
|
9
|
+
acsTransID: null,
|
|
10
|
+
formAction: null
|
|
11
|
+
},
|
|
12
|
+
emits: ["close", "submit"],
|
|
13
|
+
setup(a, { emit: e }) {
|
|
14
|
+
const s = a, t = d(null), o = JSON.stringify({
|
|
15
|
+
threeDSServerTransID: s.threeDSServerTransID,
|
|
16
|
+
acsTransID: s.acsTransID,
|
|
17
|
+
messageVersion: "2.1.0",
|
|
18
|
+
messageType: "CReq",
|
|
19
|
+
challengeWindowSize: "01"
|
|
20
|
+
}), i = encodeURI(window.btoa(o).replace(/=*$/, ""));
|
|
21
|
+
return p(() => {
|
|
22
|
+
var h;
|
|
23
|
+
(h = t.value) == null || h.submit();
|
|
24
|
+
}), (h, l) => (g(), T("div", U, [
|
|
25
|
+
n("div", $, [
|
|
26
|
+
n("div", L, [
|
|
27
|
+
_(I, {
|
|
28
|
+
onClick: l[0] || (l[0] = (V) => e("close")),
|
|
29
|
+
id: "3ds-challenge-close"
|
|
30
|
+
}),
|
|
31
|
+
b,
|
|
32
|
+
n("form", {
|
|
33
|
+
action: s.formAction,
|
|
34
|
+
target: "ThreeDsChallengeIFrame",
|
|
35
|
+
method: "post",
|
|
36
|
+
ref_key: "form",
|
|
37
|
+
ref: t
|
|
38
|
+
}, [
|
|
39
|
+
n("input", {
|
|
40
|
+
type: "hidden",
|
|
41
|
+
name: "creq",
|
|
42
|
+
value: m(i)
|
|
43
|
+
}, null, 8, w)
|
|
44
|
+
], 8, M)
|
|
45
|
+
])
|
|
46
|
+
])
|
|
47
|
+
]));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const k = /* @__PURE__ */ A(N, [["__scopeId", "data-v-c82daa22"]]), O = "3ds_method_invocation_complete", q = "3ds_challenge_complete";
|
|
51
|
+
class F {
|
|
52
|
+
constructor(e, s, t) {
|
|
53
|
+
r(this, "type", "default");
|
|
54
|
+
r(this, "log");
|
|
55
|
+
r(this, "container");
|
|
56
|
+
r(this, "options");
|
|
57
|
+
r(this, "threeDsProcessor", null);
|
|
58
|
+
r(this, "threeDSDestroy", () => {
|
|
59
|
+
});
|
|
60
|
+
r(this, "threeDSServerTransID", "");
|
|
61
|
+
r(this, "threeDSAuthURL", "");
|
|
62
|
+
r(this, "threeDSRequestorTransID", "");
|
|
63
|
+
r(this, "threeDSMonitorURL", "");
|
|
64
|
+
r(this, "internalMessageHandler", this.messageHandler.bind(this));
|
|
65
|
+
r(this, "onError", (e, s) => {
|
|
66
|
+
var t, o;
|
|
67
|
+
if (this.closeChallenge(), c(), e === 404) {
|
|
68
|
+
(t = this.threeDsProcessor) == null || t.onError({ error: "This feature is only supported by ActiveServer v1.1.2+" });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
(o = this.threeDsProcessor) == null || o.onError({ error: "3D Secure failed", body: s });
|
|
72
|
+
});
|
|
73
|
+
r(this, "onSuccess", (e, s) => {
|
|
74
|
+
var o, i;
|
|
75
|
+
this.closeChallenge(), c();
|
|
76
|
+
const t = JSON.parse(s);
|
|
77
|
+
["Y", "A"].includes(t.transStatus) ? (o = this.threeDsProcessor) == null || o.onSuccess(t) : (this.log(`[${this.type}]: 3D Secure failed`, t), (i = this.threeDsProcessor) == null || i.onError({ error: "3D Secure failed" }));
|
|
78
|
+
});
|
|
79
|
+
r(this, "onInitAuthSuccess", (e, s) => {
|
|
80
|
+
const t = JSON.parse(s);
|
|
81
|
+
if (this.log(`[${this.type}][onInitAuthSuccess]`, t), this.threeDSRequestorTransID = t.threeDSRequestorTransID, this.threeDSServerTransID = t.threeDSServerTransID, this.threeDSMonitorURL = t.threeDSMonitorURL, this.threeDSAuthURL = t.threeDSAuthURL, t.threeDSMethodURL) {
|
|
82
|
+
this.threeDsMethodInvoke(t.threeDSServerTransID, t.threeDSMethodURL);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.onAuth(!1, "");
|
|
86
|
+
});
|
|
87
|
+
r(this, "onDoAuthSuccess", (e, s) => {
|
|
88
|
+
var o;
|
|
89
|
+
const t = JSON.parse(s);
|
|
90
|
+
if (this.log(`[${this.type}][onDoAuthSuccess]`, t), !t.transStatus) {
|
|
91
|
+
this.onError(e, "No transStatus specified");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
switch (t.transStatus) {
|
|
95
|
+
case "C":
|
|
96
|
+
if (!t.acsURL) {
|
|
97
|
+
this.onError(e, "Invalid Challenge Url");
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.doChallenge(t.acsURL, t.acsTransID);
|
|
101
|
+
break;
|
|
102
|
+
case "N":
|
|
103
|
+
this.log(`[${this.type}][threeDsAuth], 3DS Verification failed, transaction denied`), this.onError(400, "3DS Verification failed, transaction denied");
|
|
104
|
+
break;
|
|
105
|
+
case "U":
|
|
106
|
+
this.log(`[${this.type}][threeDsAuth], Unable to perform 3DS verification`), this.onError(400, "Unable to perform 3DS verification");
|
|
107
|
+
break;
|
|
108
|
+
case "R":
|
|
109
|
+
this.log(`[${this.type}][threeDsAuth], Unable to perform 3DS verification, rejected at issuer`), this.onError(400, "Unable to perform 3DS verification, rejected at issuer");
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
this.log(`[${this.type}][threeDsAuth], 3DS challenge not required, tranStatus: ${t.transStatus}`), (o = this.threeDsProcessor) == null || o.onSuccess({
|
|
113
|
+
threeDSServerTransID: t.threeDSServerTransID,
|
|
114
|
+
threeDSRequestorTransID: "",
|
|
115
|
+
acsRenderingType: t.acsRenderingType,
|
|
116
|
+
acsTransID: t.acsTransID,
|
|
117
|
+
authenticationType: t.authenticationType,
|
|
118
|
+
authenticationValue: t.authenticationValue,
|
|
119
|
+
challengeCancel: "",
|
|
120
|
+
dsTransID: t.dsTransID,
|
|
121
|
+
eci: t.eci,
|
|
122
|
+
interactionCounter: "",
|
|
123
|
+
messageCategory: "",
|
|
124
|
+
messageExtension: t.messageExtension,
|
|
125
|
+
messageType: t.messageType,
|
|
126
|
+
messageVersion: t.messageVersion,
|
|
127
|
+
transStatus: t.transStatus,
|
|
128
|
+
transStatusReason: t.transStatusReason
|
|
129
|
+
});
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
this.log = e, this.container = s, this.options = t;
|
|
134
|
+
}
|
|
135
|
+
onPreAuth() {
|
|
136
|
+
this.log(`[${this.type}][onPreAuth]`), this.threeDsProcessor && (v(), this.threeDsProcessor.onPreAuth(this.onInitAuthSuccess, this.onError), window.addEventListener("message", this.internalMessageHandler));
|
|
137
|
+
}
|
|
138
|
+
onAuth(e, s) {
|
|
139
|
+
var t;
|
|
140
|
+
this.log(`[${this.type}][onAuth]`, {
|
|
141
|
+
threeDSAuthURL: this.threeDSAuthURL,
|
|
142
|
+
threeDSRequestorTransID: this.threeDSRequestorTransID,
|
|
143
|
+
threeDSServerTransID: this.threeDSServerTransID,
|
|
144
|
+
isMethodPerformed: e
|
|
145
|
+
}), (t = this.threeDsProcessor) == null || t.onAuth(this.threeDSAuthURL, this.threeDSRequestorTransID, this.threeDSServerTransID, e, "", this.onDoAuthSuccess, this.onError);
|
|
146
|
+
}
|
|
147
|
+
onPostAuth() {
|
|
148
|
+
var e;
|
|
149
|
+
this.log(`[${this.type}][onPostAuth]`, {
|
|
150
|
+
threeDSServerTransID: this.threeDSServerTransID
|
|
151
|
+
}), (e = this.threeDsProcessor) == null || e.onPostAuth({
|
|
152
|
+
threeDSServerTransID: this.threeDSServerTransID
|
|
153
|
+
}, this.onSuccess, this.onError);
|
|
154
|
+
}
|
|
155
|
+
setThreeDsProcessor(e) {
|
|
156
|
+
this.log(`[${this.type}][setThreeDsProcessor]`), this.threeDsProcessor = e;
|
|
157
|
+
}
|
|
158
|
+
messageHandler(e) {
|
|
159
|
+
var s, t;
|
|
160
|
+
if (!(!((s = e == null ? void 0 : e.data) != null && s.status) || ((t = e == null ? void 0 : e.data) == null ? void 0 : t.status) === C)) {
|
|
161
|
+
if (e.data.status === O) {
|
|
162
|
+
e.stopPropagation(), this.invocationComplete(e);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
e.data.status === q && (e.stopPropagation(), this.challengeComplete(e));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
invocationComplete(e) {
|
|
169
|
+
this.log(`[${this.type}]: 3Ds Method invocation complete`), this.onAuth(!0, "");
|
|
170
|
+
}
|
|
171
|
+
challengeComplete(e) {
|
|
172
|
+
this.log(`[${this.type}]: 3Ds Challenge complete`, e.data), this.closeChallenge();
|
|
173
|
+
const s = JSON.parse(window.atob(e.data.cres));
|
|
174
|
+
this.log(`[${this.type}]: cresData`, s), ["Y", "A"].includes(s.transStatus) ? this.onPostAuth() : ["N", "U", "R"].includes(s.transStatus) && (this.log(`[${this.type}]: Failed 3DS Challenge`, e.data), this.onError(400, "Failed 3DS Challenge"));
|
|
175
|
+
}
|
|
176
|
+
doChallenge(e, s) {
|
|
177
|
+
this.log(`[${this.type}][doChallenge]`), c();
|
|
178
|
+
const { destroy: t } = E({
|
|
179
|
+
el: document.body,
|
|
180
|
+
component: k,
|
|
181
|
+
props: {
|
|
182
|
+
threeDSServerTransID: this.threeDSServerTransID,
|
|
183
|
+
acsTransID: s,
|
|
184
|
+
formAction: e
|
|
185
|
+
},
|
|
186
|
+
on: {
|
|
187
|
+
close: () => {
|
|
188
|
+
var o;
|
|
189
|
+
t(), this.threeDSDestroy = () => {
|
|
190
|
+
}, (o = this.threeDsProcessor) == null || o.onError({ error: "Challenge cancelled" });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
this.threeDSDestroy = t;
|
|
195
|
+
}
|
|
196
|
+
closeChallenge() {
|
|
197
|
+
var e;
|
|
198
|
+
(e = this.threeDSDestroy) == null || e.call(this), window.removeEventListener("message", this.internalMessageHandler);
|
|
199
|
+
}
|
|
200
|
+
threeDsMethodInvoke(e, s) {
|
|
201
|
+
this.log(`[${this.type}][threeDsMethodInvoke]`, { threeDSServerTransID: e, threeDSMethodURL: s });
|
|
202
|
+
const t = {
|
|
203
|
+
threeDSServerTransID: e,
|
|
204
|
+
threeDSMethodNotificationURL: this.options.apiUrl + "/3ds/method_invocation"
|
|
205
|
+
}, o = encodeURI(window.btoa(JSON.stringify(t)).replace(/=*$/, ""));
|
|
206
|
+
new R().invoke(s, "POST", {
|
|
207
|
+
threeDSMethodData: o
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
export {
|
|
212
|
+
F as DefaultThreeDsProvider,
|
|
213
|
+
q as THREE_DS_CHALLENGE_COMPLETE,
|
|
214
|
+
O as THREE_DS_METHOD_INVOCATION_COMPLETE
|
|
215
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var l = (n, r, e) => r in n ? i(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
|
|
3
|
+
var o = (n, r, e) => (l(n, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
|
+
import { DefaultThreeDsProvider as c } from "./DefaultThreeDsProvider-701637b0.mjs";
|
|
5
|
+
import { d as u, a as d, c as p, b as a, n as h, _, g as m } from "./main-f2996bc2.mjs";
|
|
6
|
+
const D = { class: "mask" }, S = { class: "wrapper" }, y = ["src"], g = /* @__PURE__ */ u({
|
|
7
|
+
__name: "GPayments",
|
|
8
|
+
props: {
|
|
9
|
+
url: null,
|
|
10
|
+
width: null,
|
|
11
|
+
height: null
|
|
12
|
+
},
|
|
13
|
+
setup(n) {
|
|
14
|
+
const r = n;
|
|
15
|
+
function e() {
|
|
16
|
+
return {
|
|
17
|
+
width: `${r.width || 650}px`,
|
|
18
|
+
height: `${r.height || 400}px`
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return (s, t) => (d(), p("div", D, [
|
|
22
|
+
a("div", S, [
|
|
23
|
+
a("div", {
|
|
24
|
+
class: "container",
|
|
25
|
+
style: h([e(), { padding: "0", margin: "0" }])
|
|
26
|
+
}, [
|
|
27
|
+
a("iframe", {
|
|
28
|
+
src: r.url,
|
|
29
|
+
style: h(e())
|
|
30
|
+
}, null, 12, y)
|
|
31
|
+
], 4)
|
|
32
|
+
])
|
|
33
|
+
]));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const f = /* @__PURE__ */ _(g, [["__scopeId", "data-v-9b0ef3a8"]]);
|
|
37
|
+
class U extends c {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
o(this, "type", "gpayments");
|
|
41
|
+
o(this, "onDoAuthSuccess", (e, s) => {
|
|
42
|
+
const t = JSON.parse(s);
|
|
43
|
+
if (this.log(`[${this.type}][onDoAuthSuccess]`, t), !t.transStatus) {
|
|
44
|
+
this.onError(e, "No transStatus specified");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
switch (t.transStatus) {
|
|
48
|
+
case "C":
|
|
49
|
+
if (!t.acsURL) {
|
|
50
|
+
this.onError(e, "Invalid Challenge Url");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.doChallenge(t.acsURL);
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
this.log(`[${this.type}][threeDsAuth], 3DS challenge not required, tranStatus: ${t.transStatus}`), this.onPostAuth();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
o(this, "onInitAuthSuccess", (e, s) => {
|
|
61
|
+
const t = JSON.parse(s);
|
|
62
|
+
if (this.log(`[${this.type}][onInitAuthSuccess]`, t), !t.threeDSAuthURL) {
|
|
63
|
+
this.onError(e, "No AuthUrl specified");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.threeDSRequestorTransID = t.threeDSRequestorTransID, this.threeDSServerTransID = t.threeDSServerTransID, this.threeDSMonitorURL = t.threeDSMonitorURL, this.threeDSAuthURL = t.threeDSAuthURL, t.threeDsServerCallbackUrl) {
|
|
67
|
+
this.initFrame(t.threeDsServerCallbackUrl);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.onAuth(!1, "");
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
doChallenge(e) {
|
|
74
|
+
this.log(`[${this.type}][doChallenge]`);
|
|
75
|
+
const { destroy: s } = m({
|
|
76
|
+
el: document.body,
|
|
77
|
+
component: f,
|
|
78
|
+
props: {
|
|
79
|
+
url: e,
|
|
80
|
+
width: 390,
|
|
81
|
+
height: 400
|
|
82
|
+
},
|
|
83
|
+
on: {
|
|
84
|
+
close: () => {
|
|
85
|
+
s(), this.threeDSDestroy = () => {
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
this.threeDSDestroy = s;
|
|
91
|
+
}
|
|
92
|
+
challengeComplete(e) {
|
|
93
|
+
this.log(`[${this.type}]: 3Ds Challenge complete`, e.data), this.closeChallenge(), this.onPostAuth();
|
|
94
|
+
}
|
|
95
|
+
initFrame(e) {
|
|
96
|
+
this.log(`[${this.type}][init3DSFrame]`, e);
|
|
97
|
+
const s = document.createElement("iframe");
|
|
98
|
+
s.src = e, s.style.width = "1px", s.style.height = "1px", s.style.border = "0", document.body.appendChild(s);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
U as GPaymentsThreeDsProvider
|
|
103
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var C = (s, r, t) => r in s ? d(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
|
|
3
|
+
var h = (s, r, t) => (C(s, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { DefaultThreeDsProvider as w } from "./DefaultThreeDsProvider-701637b0.mjs";
|
|
5
|
+
import { d as S, r as N, o as f, h as v, w as E, v as I, a as P, c as A, b as l, e as x, C as L, p as M, f as T, _ as G, s as H, i as b, j as D, g as $ } from "./main-f2996bc2.mjs";
|
|
6
|
+
const O = (s) => (M("data-v-c937c2f5"), s = s(), T(), s), j = { class: "mask" }, k = { class: "wrapper" }, B = { class: "container" }, F = /* @__PURE__ */ O(() => /* @__PURE__ */ l("div", { id: "NmiThreeDsChallengeIFrame" }, null, -1)), W = /* @__PURE__ */ S({
|
|
7
|
+
__name: "NmiThreeDsChallenge",
|
|
8
|
+
emits: ["close", "submit"],
|
|
9
|
+
setup(s, { emit: r }) {
|
|
10
|
+
const t = N(!1);
|
|
11
|
+
function e(o) {
|
|
12
|
+
var n;
|
|
13
|
+
["NMI_3DS_CHALLENGE_SHOW", "NMI_3DS_CHALLENGE_CLOSE"].includes((n = o.data) == null ? void 0 : n.message) && (t.value = o.data.message === "NMI_3DS_CHALLENGE_SHOW");
|
|
14
|
+
}
|
|
15
|
+
return f(() => {
|
|
16
|
+
window.addEventListener("message", e);
|
|
17
|
+
}), v(() => {
|
|
18
|
+
window.removeEventListener("message", e);
|
|
19
|
+
}), (o, n) => E((P(), A("div", j, [
|
|
20
|
+
l("div", k, [
|
|
21
|
+
l("div", B, [
|
|
22
|
+
x(L, {
|
|
23
|
+
onClick: n[0] || (n[0] = (m) => r("close")),
|
|
24
|
+
id: "3ds-challenge-close"
|
|
25
|
+
}),
|
|
26
|
+
F
|
|
27
|
+
])
|
|
28
|
+
])
|
|
29
|
+
], 512)), [
|
|
30
|
+
[I, t.value]
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const U = /* @__PURE__ */ G(W, [["__scopeId", "data-v-c937c2f5"]]);
|
|
35
|
+
class q extends w {
|
|
36
|
+
constructor(t, e, o) {
|
|
37
|
+
var n;
|
|
38
|
+
super(t, e, o);
|
|
39
|
+
h(this, "type", "NMI");
|
|
40
|
+
h(this, "gateway");
|
|
41
|
+
h(this, "threeDS");
|
|
42
|
+
h(this, "numAttempts", 0);
|
|
43
|
+
this.initScript(((n = o.clientParameters) == null ? void 0 : n.PublicKey) || "");
|
|
44
|
+
}
|
|
45
|
+
onPreAuth() {
|
|
46
|
+
if (!this.threeDS && this.numAttempts < 5) {
|
|
47
|
+
this.numAttempts++, this.log(`[${this.type}]: 3DS not ready, retrying in 1s`), setTimeout(() => this.onPreAuth(), 1e3);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.startAuth();
|
|
51
|
+
}
|
|
52
|
+
onAuth(t, e) {
|
|
53
|
+
}
|
|
54
|
+
onPostAuth() {
|
|
55
|
+
}
|
|
56
|
+
startAuth() {
|
|
57
|
+
var p, g, u, _, y;
|
|
58
|
+
this.log(`[${this.type}]: startAuth`);
|
|
59
|
+
const t = (p = this.threeDsProcessor) == null ? void 0 : p.getPaymentInfo();
|
|
60
|
+
if (!t) {
|
|
61
|
+
H(this.container, "Payment information is missing");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
b();
|
|
65
|
+
const e = (g = this.threeDsProcessor) == null ? void 0 : g.getAddressInfo(), o = t.expiryDate.length === 4 ? t.expiryDate[2] + t.expiryDate[3] : "", n = t.expiryDate.length === 4 ? t.expiryDate[0] + t.expiryDate[1] : "", m = {
|
|
66
|
+
cardNumber: t.cardNumber,
|
|
67
|
+
cardExpMonth: o,
|
|
68
|
+
cardExpYear: parseInt(n) + 2e3,
|
|
69
|
+
currency: (u = this.threeDsProcessor) == null ? void 0 : u.getCurrency(),
|
|
70
|
+
amount: (_ = this.threeDsProcessor) == null ? void 0 : _.getAmount(),
|
|
71
|
+
email: (y = this.threeDsProcessor) == null ? void 0 : y.getEmail(),
|
|
72
|
+
phone: e == null ? void 0 : e.phoneNumber,
|
|
73
|
+
city: e == null ? void 0 : e.city,
|
|
74
|
+
state: e == null ? void 0 : e.state,
|
|
75
|
+
address1: e == null ? void 0 : e.streetAddress,
|
|
76
|
+
country: e == null ? void 0 : e.country,
|
|
77
|
+
firstName: e == null ? void 0 : e.firstName,
|
|
78
|
+
lastName: e == null ? void 0 : e.lastName,
|
|
79
|
+
postalCode: e == null ? void 0 : e.postalCode
|
|
80
|
+
}, c = this.threeDS.createUI(m);
|
|
81
|
+
c.start("#NmiThreeDsChallengeIFrame"), c.on("challenge", (a) => {
|
|
82
|
+
this.log(`[${this.type}][onChallenge]`, a), D(), this.showChallenge();
|
|
83
|
+
}), c.on("complete", (a) => {
|
|
84
|
+
var i;
|
|
85
|
+
this.log(`[${this.type}][onComplete]`, a), this.removeChallenge(), (i = this.threeDsProcessor) == null || i.onSuccess({
|
|
86
|
+
externalThreeDsData: a
|
|
87
|
+
});
|
|
88
|
+
}), c.on("failure", (a) => {
|
|
89
|
+
var i;
|
|
90
|
+
this.log(`[${this.type}][onFailure]`, a), D(), this.closeChallenge(), (i = this.threeDsProcessor) == null || i.onError({ error: a.message });
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
initScript(t) {
|
|
94
|
+
const e = document.createElement("script");
|
|
95
|
+
e.type = "text/javascript", e.src = "https://secure.nmi.com/js/v1/Gateway.js", e.onload = () => {
|
|
96
|
+
this.initGateway(t), this.initChallenge();
|
|
97
|
+
}, document.head.appendChild(e);
|
|
98
|
+
}
|
|
99
|
+
initGateway(t) {
|
|
100
|
+
this.gateway = window.Gateway.create(t), this.threeDS = this.gateway.get3DSecure(), this.gateway.on("error", (e) => {
|
|
101
|
+
var o;
|
|
102
|
+
this.log(`[${this.type}]: gateway error`, e), (o = this.threeDsProcessor) == null || o.onError({ error: e.message });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
initChallenge() {
|
|
106
|
+
const { destroy: t } = $({
|
|
107
|
+
el: document.body,
|
|
108
|
+
component: U,
|
|
109
|
+
on: {
|
|
110
|
+
close: () => {
|
|
111
|
+
var e;
|
|
112
|
+
this.closeChallenge(), (e = this.threeDsProcessor) == null || e.onError({ error: "Challenge cancelled" });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
this.threeDSDestroy = t;
|
|
117
|
+
}
|
|
118
|
+
showChallenge() {
|
|
119
|
+
window.postMessage({
|
|
120
|
+
message: "NMI_3DS_CHALLENGE_SHOW"
|
|
121
|
+
}, "*");
|
|
122
|
+
}
|
|
123
|
+
closeChallenge() {
|
|
124
|
+
window.postMessage({
|
|
125
|
+
message: "NMI_3DS_CHALLENGE_CLOSE"
|
|
126
|
+
}, "*");
|
|
127
|
+
}
|
|
128
|
+
removeChallenge() {
|
|
129
|
+
var t;
|
|
130
|
+
(t = this.threeDSDestroy) == null || t.call(this);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
q as NmiThreeDsProvider
|
|
135
|
+
};
|
package/dist/sdk/{ThreeDsInitResponse.type-06482849.mjs → ThreeDsProvider.interface-da0ab2aa.mjs}
RENAMED
|
@@ -6,10 +6,13 @@ const e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
6
6
|
__proto__: null
|
|
7
7
|
}, Symbol.toStringTag, { value: "Module" })), r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
8
|
__proto__: null
|
|
9
|
+
}, Symbol.toStringTag, { value: "Module" })), l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10
|
+
__proto__: null
|
|
9
11
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10
12
|
export {
|
|
11
13
|
o as T,
|
|
12
14
|
t as a,
|
|
13
15
|
r as b,
|
|
16
|
+
l as c,
|
|
14
17
|
e as f
|
|
15
18
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as T, r as A, o as
|
|
2
|
-
const M = (t) => (k("data-v-82a75009"), t = t(), E(), t), F = { class: "mask" }, x = { class: "wrapper" }, O = { class: "container" }, q = /* @__PURE__ */ M(() => /* @__PURE__ */
|
|
1
|
+
import { d as T, r as A, o as v, a as R, c as C, b as c, e as y, C as U, u as b, p as k, f as E, _ as V, F as w, T as L, g as N } from "./main-f2996bc2.mjs";
|
|
2
|
+
const M = (t) => (k("data-v-82a75009"), t = t(), E(), t), F = { class: "mask" }, x = { class: "wrapper" }, O = { class: "container" }, q = /* @__PURE__ */ M(() => /* @__PURE__ */ c("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), J = ["action"], B = ["value"], j = /* @__PURE__ */ T({
|
|
3
3
|
__name: "ecentric",
|
|
4
4
|
props: {
|
|
5
5
|
threeDSServerTransID: null,
|
|
@@ -9,24 +9,24 @@ const M = (t) => (k("data-v-82a75009"), t = t(), E(), t), F = { class: "mask" },
|
|
|
9
9
|
},
|
|
10
10
|
setup(t) {
|
|
11
11
|
const n = t, e = A(null), r = n.authenticationValue;
|
|
12
|
-
return
|
|
13
|
-
var
|
|
14
|
-
(
|
|
15
|
-
}), (
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
return v(() => {
|
|
13
|
+
var l;
|
|
14
|
+
(l = e.value) == null || l.submit();
|
|
15
|
+
}), (l, p) => (R(), C("div", F, [
|
|
16
|
+
c("div", x, [
|
|
17
|
+
c("div", O, [
|
|
18
18
|
y(U, {
|
|
19
|
-
onClick: p[0] || (p[0] = (Z) =>
|
|
19
|
+
onClick: p[0] || (p[0] = (Z) => l.emit("close"))
|
|
20
20
|
}),
|
|
21
21
|
q,
|
|
22
|
-
|
|
22
|
+
c("form", {
|
|
23
23
|
action: n.formAction,
|
|
24
24
|
target: "ThreeDsChallengeIFrame",
|
|
25
25
|
method: "post",
|
|
26
26
|
ref_key: "form",
|
|
27
27
|
ref: e
|
|
28
28
|
}, [
|
|
29
|
-
|
|
29
|
+
c("input", {
|
|
30
30
|
type: "hidden",
|
|
31
31
|
name: "PaReq",
|
|
32
32
|
value: b(r)
|
|
@@ -38,7 +38,7 @@ const M = (t) => (k("data-v-82a75009"), t = t(), E(), t), F = { class: "mask" },
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const $ = /* @__PURE__ */ V(j, [["__scopeId", "data-v-82a75009"]]);
|
|
41
|
-
let d = null, m, G = null, a = null, D = "",
|
|
41
|
+
let d = null, m, G = null, a = null, D = "", i = "", _ = "", H, u = null, h = "";
|
|
42
42
|
function o(t, ...n) {
|
|
43
43
|
d && d(t, n);
|
|
44
44
|
}
|
|
@@ -46,31 +46,31 @@ function K() {
|
|
|
46
46
|
o("init authentication"), a == null || a.onPreAuth(Q, s), window.addEventListener("message", g);
|
|
47
47
|
}
|
|
48
48
|
function S(t) {
|
|
49
|
-
o("Do Authentication for transId",
|
|
49
|
+
o("Do Authentication for transId", i, t), a == null || a.onAuth(_, D, i, t, "", W, s);
|
|
50
50
|
}
|
|
51
51
|
function I() {
|
|
52
|
-
o("Do Post Authentication for transId",
|
|
52
|
+
o("Do Post Authentication for transId", i, h), a == null || a.onPostAuth({ threeDSServerTransID: i, authenticationValue: h }, z, s);
|
|
53
53
|
}
|
|
54
54
|
function Y(t, n, e) {
|
|
55
55
|
const { destroy: r } = N({
|
|
56
56
|
el: document.body,
|
|
57
57
|
component: $,
|
|
58
58
|
props: {
|
|
59
|
-
threeDSServerTransID:
|
|
59
|
+
threeDSServerTransID: i,
|
|
60
60
|
acsTransID: n,
|
|
61
61
|
formAction: t,
|
|
62
62
|
authenticationValue: e
|
|
63
63
|
},
|
|
64
64
|
on: {
|
|
65
65
|
close: () => {
|
|
66
|
-
r(),
|
|
66
|
+
r(), u = null, a == null || a.onError({ error: "Challenge cancelled" });
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
|
|
70
|
+
u = r;
|
|
71
71
|
}
|
|
72
72
|
function f() {
|
|
73
|
-
|
|
73
|
+
u == null || u(), window.removeEventListener("message", g);
|
|
74
74
|
}
|
|
75
75
|
const s = (t, n) => {
|
|
76
76
|
f(), a == null || a.onError({ error: "3D Secure failed", body: n });
|
|
@@ -80,7 +80,7 @@ const s = (t, n) => {
|
|
|
80
80
|
["Y", "A"].includes(e.transStatus) ? a == null || a.onSuccess(e) : (o("3D Secure failed", e), a == null || a.onError({ error: "3D Secure failed" }));
|
|
81
81
|
}, Q = (t, n) => {
|
|
82
82
|
const e = JSON.parse(n);
|
|
83
|
-
if (o("[onInitAuthSuccess]", e), D = e.threeDSRequestorTransID,
|
|
83
|
+
if (o("[onInitAuthSuccess]", e), D = e.threeDSRequestorTransID, i = e.threeDSServerTransID, e.threeDSMonitorURL, _ = e.threeDSAuthURL, e.threeDSMethodURL) {
|
|
84
84
|
X(e.threeDSServerTransID, e.threeDSMethodURL);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
@@ -150,13 +150,13 @@ function g(t) {
|
|
|
150
150
|
t.data.status === "3ds_challenge_complete" && (o("3Ds Challenge complete", t.data), t.stopPropagation(), f(), o("cresData", t.data.cres), t.data.cres ? (h = t.data.cres, I()) : (o("Failed 3DS Challenge", t.data), s(400, "Failed 3DS Challenge")));
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
function ee(t, n, e
|
|
154
|
-
return d = t, G =
|
|
153
|
+
function ee(t, n, e) {
|
|
154
|
+
return d = t, G = e.environment, H = n || document.body, m = e.apiUrl, {
|
|
155
155
|
onPreAuth: K,
|
|
156
156
|
onAuth: S,
|
|
157
157
|
onPostAuth: I,
|
|
158
|
-
setThreeDsProcessor: (
|
|
159
|
-
a =
|
|
158
|
+
setThreeDsProcessor: (r) => {
|
|
159
|
+
a = r;
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
}
|