@payfurl/client 4.1.3 → 4.2.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.
@@ -2,8 +2,14 @@ const e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2
2
  __proto__: null
3
3
  }, Symbol.toStringTag, { value: "Module" })), t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4
4
  __proto__: null
5
+ }, Symbol.toStringTag, { value: "Module" })), o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6
+ __proto__: null
7
+ }, Symbol.toStringTag, { value: "Module" })), r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8
+ __proto__: null
5
9
  }, Symbol.toStringTag, { value: "Module" }));
6
10
  export {
11
+ o as T,
7
12
  t as a,
13
+ r as b,
8
14
  e as f
9
15
  };
@@ -0,0 +1,26 @@
1
+ function e() {
2
+ return {
3
+ acsRenderingType: {
4
+ acsInterface: "",
5
+ acsUiTemplate: ""
6
+ },
7
+ acsTransID: "",
8
+ authenticationType: "",
9
+ authenticationValue: "",
10
+ challengeCancel: "",
11
+ dsTransID: "",
12
+ eci: "",
13
+ interactionCounter: "",
14
+ messageCategory: "",
15
+ messageExtension: [],
16
+ messageType: "",
17
+ messageVersion: "",
18
+ threeDSRequestorTransID: "",
19
+ threeDSServerTransID: "",
20
+ transStatus: "Y",
21
+ transStatusReason: ""
22
+ };
23
+ }
24
+ export {
25
+ e as getEmptySuccessThreeDsPostAuthResponse
26
+ };
@@ -0,0 +1,179 @@
1
+ import { d as v, r as A, o as C, a as y, c as R, b as c, e as b, C as U, u as w, p as k, f as N, _ as E, F as L, g as V } from "./main-02ee9775.mjs";
2
+ const M = (t) => (k("data-v-fa2e3c62"), t = t(), N(), t), q = { class: "mask" }, x = { class: "wrapper" }, O = { class: "container" }, F = /* @__PURE__ */ M(() => /* @__PURE__ */ c("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), J = ["action"], B = ["value"], $ = /* @__PURE__ */ v({
3
+ __name: "ThreeDsChallenge",
4
+ props: {
5
+ threeDSServerTransID: null,
6
+ acsTransID: null,
7
+ formAction: null
8
+ },
9
+ emits: ["close", "submit"],
10
+ setup(t, { emit: n }) {
11
+ const e = t, o = A(null), u = JSON.stringify({
12
+ threeDSServerTransID: e.threeDSServerTransID,
13
+ acsTransID: e.acsTransID,
14
+ messageVersion: "2.1.0",
15
+ messageType: "CReq",
16
+ challengeWindowSize: "01"
17
+ }), T = encodeURI(window.btoa(u).replace(/=*$/, ""));
18
+ return C(() => {
19
+ var d;
20
+ (d = o.value) == null || d.submit();
21
+ }), (d, p) => (y(), R("div", q, [
22
+ c("div", x, [
23
+ c("div", O, [
24
+ b(U, {
25
+ onClick: p[0] || (p[0] = (Z) => n("close")),
26
+ id: "3ds-challenge-close"
27
+ }),
28
+ F,
29
+ c("form", {
30
+ action: e.formAction,
31
+ target: "ThreeDsChallengeIFrame",
32
+ method: "post",
33
+ ref_key: "form",
34
+ ref: o
35
+ }, [
36
+ c("input", {
37
+ type: "hidden",
38
+ name: "creq",
39
+ value: w(T)
40
+ }, null, 8, B)
41
+ ], 8, J)
42
+ ])
43
+ ])
44
+ ]));
45
+ }
46
+ });
47
+ const j = /* @__PURE__ */ E($, [["__scopeId", "data-v-fa2e3c62"]]);
48
+ let h = null, D, Y = null, a = null, m = "", i = "", g = "", z, l = null;
49
+ function s(t, ...n) {
50
+ h && h(t, n);
51
+ }
52
+ function H() {
53
+ s("init authentication"), a == null || a.onPreAuth(K, r), window.addEventListener("message", I);
54
+ }
55
+ function S(t) {
56
+ s("Do Authentication for transId", i, t), a == null || a.onAuth(g, m, i, t, Q, r);
57
+ }
58
+ function _() {
59
+ s("Do Post Authentication for transId", i), a == null || a.onPostAuth({ threeDSServerTransID: i }, G, r);
60
+ }
61
+ function W(t, n) {
62
+ const { destroy: e } = V({
63
+ el: document.body,
64
+ component: j,
65
+ props: {
66
+ threeDSServerTransID: i,
67
+ acsTransID: n,
68
+ formAction: t
69
+ },
70
+ on: {
71
+ close: () => {
72
+ e(), l = null, a == null || a.onError({ error: "Challenge cancelled" });
73
+ }
74
+ }
75
+ });
76
+ l = e;
77
+ }
78
+ function f() {
79
+ l == null || l(), window.removeEventListener("message", I);
80
+ }
81
+ const r = (t, n) => {
82
+ if (f(), t === 404) {
83
+ a == null || a.onError({ error: "This feature is only supported by ActiveServer v1.1.2+" });
84
+ return;
85
+ }
86
+ a == null || a.onError({ error: "3D Secure failed", body: n });
87
+ }, G = (t, n) => {
88
+ f();
89
+ const e = JSON.parse(n);
90
+ ["Y", "A"].includes(e.transStatus) ? a == null || a.onSuccess(e) : (s("3D Secure failed", e), a == null || a.onError({ error: "3D Secure failed" }));
91
+ }, K = (t, n) => {
92
+ const e = JSON.parse(n);
93
+ if (s("[onInitAuthSuccess]", e), m = e.threeDSRequestorTransID, i = e.threeDSServerTransID, e.threeDSMonitorURL, g = e.threeDSAuthURL, e.threeDSMethodURL) {
94
+ X(e.threeDSServerTransID, e.threeDSMethodURL);
95
+ return;
96
+ }
97
+ S(!1);
98
+ }, Q = (t, n) => {
99
+ const e = JSON.parse(n);
100
+ if (s("[onDoAuthSuccess]", e), !e.transStatus) {
101
+ r(t, "No transStatus specified");
102
+ return;
103
+ }
104
+ switch (e.transStatus) {
105
+ case "C":
106
+ if (!e.acsURL) {
107
+ r(t, "Invalid Challenge Url");
108
+ return;
109
+ }
110
+ W(e.acsURL, e.acsTransID);
111
+ break;
112
+ case "N":
113
+ s("[threeDsAuth], 3DS Verification failed, transaction denied"), r(400, "3DS Verification failed, transaction denied");
114
+ break;
115
+ case "U":
116
+ s("[threeDsAuth], Unable to perform 3DS verification"), r(400, "Unable to perform 3DS verification");
117
+ break;
118
+ case "R":
119
+ s("[threeDsAuth], Unable to perform 3DS verification, rejected at issuer"), r(400, "Unable to perform 3DS verification, rejected at issuer");
120
+ break;
121
+ default:
122
+ s("[threeDsAuth], 3DS challenge not required, tranStatus: " + e.transStatus), a == null || a.onSuccess({
123
+ threeDSServerTransID: e.threeDSServerTransID,
124
+ threeDSRequestorTransID: "",
125
+ acsRenderingType: e.acsRenderingType,
126
+ acsTransID: e.acsTransID,
127
+ authenticationType: e.authenticationType,
128
+ authenticationValue: e.authenticationValue,
129
+ challengeCancel: "",
130
+ dsTransID: e.dsTransID,
131
+ eci: e.eci,
132
+ interactionCounter: "",
133
+ messageCategory: "",
134
+ messageExtension: e.messageExtension,
135
+ messageType: e.messageType,
136
+ messageVersion: e.messageVersion,
137
+ transStatus: e.transStatus,
138
+ transStatusReason: e.transStatusReason
139
+ });
140
+ break;
141
+ }
142
+ };
143
+ function X(t, n) {
144
+ s("[threeDsMethodInvoke]", { threeDSServerTransID: t, threeDSMethodURL: n });
145
+ const e = {
146
+ threeDSServerTransID: t,
147
+ threeDSMethodNotificationURL: D + "/3ds/method_invocation"
148
+ }, o = encodeURI(window.btoa(JSON.stringify(e)).replace(/=*$/, ""));
149
+ new L().invoke(n, "POST", {
150
+ threeDSMethodData: o
151
+ });
152
+ }
153
+ function I(t) {
154
+ var n, e;
155
+ if (!(!((n = t == null ? void 0 : t.data) != null && n.status) || ((e = t == null ? void 0 : t.data) == null ? void 0 : e.status) === "failure")) {
156
+ if (t.data.status === "3ds_method_invocation_complete") {
157
+ s("3Ds Method invocation complete"), t.stopPropagation(), S(!0);
158
+ return;
159
+ }
160
+ if (t.data.status === "3ds_challenge_complete") {
161
+ s("3Ds Challenge complete", t.data), t.stopPropagation(), f();
162
+ const o = JSON.parse(window.atob(t.data.cres));
163
+ s("cresData", o), ["Y", "A"].includes(o.transStatus) ? _() : ["N", "U", "R"].includes(o.transStatus) && (s("Failed 3DS Challenge", t.data), r(400, "Failed 3DS Challenge"));
164
+ }
165
+ }
166
+ }
167
+ function ee(t, n, e, o) {
168
+ return h = t, Y = n, z = e || document.body, D = o, {
169
+ onPreAuth: H,
170
+ onAuth: S,
171
+ onPostAuth: _,
172
+ setThreeDsProcessor: (u) => {
173
+ a = u;
174
+ }
175
+ };
176
+ }
177
+ export {
178
+ ee as default
179
+ };
@@ -0,0 +1,166 @@
1
+ import { d as A, r as v, o as C, a as R, c as y, b as c, e as b, C as U, u as k, p as V, f as w, _ as E, F as L, g as N } from "./main-02ee9775.mjs";
2
+ const M = (t) => (V("data-v-a55c9c23"), t = t(), w(), t), x = { class: "mask" }, F = { class: "wrapper" }, q = { class: "container" }, O = /* @__PURE__ */ M(() => /* @__PURE__ */ c("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), J = ["action"], B = ["value"], j = /* @__PURE__ */ A({
3
+ __name: "ecentric",
4
+ props: {
5
+ threeDSServerTransID: null,
6
+ acsTransID: null,
7
+ formAction: null,
8
+ authenticationValue: null
9
+ },
10
+ emits: ["close", "submit"],
11
+ setup(t, { emit: n }) {
12
+ const e = t, s = v(null), l = e.authenticationValue;
13
+ return C(() => {
14
+ var d;
15
+ (d = s.value) == null || d.submit();
16
+ }), (d, m) => (R(), y("div", x, [
17
+ c("div", F, [
18
+ c("div", q, [
19
+ b(U, {
20
+ onClick: m[0] || (m[0] = (Z) => n("close"))
21
+ }),
22
+ O,
23
+ c("form", {
24
+ action: e.formAction,
25
+ target: "ThreeDsChallengeIFrame",
26
+ method: "post",
27
+ ref_key: "form",
28
+ ref: s
29
+ }, [
30
+ c("input", {
31
+ type: "hidden",
32
+ name: "PaReq",
33
+ value: k(l)
34
+ }, null, 8, B)
35
+ ], 8, J)
36
+ ])
37
+ ])
38
+ ]));
39
+ }
40
+ });
41
+ const $ = /* @__PURE__ */ E(j, [["__scopeId", "data-v-a55c9c23"]]);
42
+ let h = null, D, H = null, a = null, _ = "", i = "", g = "", Y, u = null, S = "";
43
+ function o(t, ...n) {
44
+ h && h(t, n);
45
+ }
46
+ function z() {
47
+ o("init authentication"), a == null || a.onPreAuth(Q, r), window.addEventListener("message", T);
48
+ }
49
+ function f(t) {
50
+ o("Do Authentication for transId", i, t), a == null || a.onAuth(g, _, i, t, W, r);
51
+ }
52
+ function I() {
53
+ o("Do Post Authentication for transId", i, S), a == null || a.onPostAuth({ threeDSServerTransID: i, authenticationValue: S }, K, r);
54
+ }
55
+ function G(t, n, e) {
56
+ const { destroy: s } = N({
57
+ el: document.body,
58
+ component: $,
59
+ props: {
60
+ threeDSServerTransID: i,
61
+ acsTransID: n,
62
+ formAction: t,
63
+ authenticationValue: e
64
+ },
65
+ on: {
66
+ close: () => {
67
+ s(), u = null, a == null || a.onError({ error: "Challenge cancelled" });
68
+ }
69
+ }
70
+ });
71
+ u = s;
72
+ }
73
+ function p() {
74
+ u == null || u(), window.removeEventListener("message", T);
75
+ }
76
+ const r = (t, n) => {
77
+ p(), a == null || a.onError({ error: "3D Secure failed", body: n });
78
+ }, K = (t, n) => {
79
+ p();
80
+ const e = JSON.parse(n);
81
+ ["Y", "A"].includes(e.transStatus) ? a == null || a.onSuccess(e) : (o("3D Secure failed", e), a == null || a.onError({ error: "3D Secure failed" }));
82
+ }, Q = (t, n) => {
83
+ const e = JSON.parse(n);
84
+ if (o("[onInitAuthSuccess]", e), _ = e.threeDSRequestorTransID, i = e.threeDSServerTransID, e.threeDSMonitorURL, g = e.threeDSAuthURL, e.threeDSMethodURL) {
85
+ X(e.threeDSServerTransID, e.threeDSMethodURL);
86
+ return;
87
+ }
88
+ f(!1);
89
+ }, W = (t, n) => {
90
+ const e = JSON.parse(n);
91
+ if (o("[onDoAuthSuccess]", e), !e.transStatus) {
92
+ r(t, "No transStatus specified");
93
+ return;
94
+ }
95
+ switch (e.transStatus) {
96
+ case "C":
97
+ if (!e.acsURL) {
98
+ r(t, "Invalid Challenge Url");
99
+ return;
100
+ }
101
+ G(e.acsURL, e.acsTransID, e.authenticationValue);
102
+ break;
103
+ case "N":
104
+ o("[threeDsAuth], 3DS Verification failed, transaction denied"), r(400, "3DS Verification failed, transaction denied");
105
+ break;
106
+ case "U":
107
+ o("[threeDsAuth], Unable to perform 3DS verification"), r(400, "Unable to perform 3DS verification");
108
+ break;
109
+ case "R":
110
+ o("[threeDsAuth], Unable to perform 3DS verification, rejected at issuer"), r(400, "Unable to perform 3DS verification, rejected at issuer");
111
+ break;
112
+ default:
113
+ o("[threeDsAuth], 3DS challenge not required, tranStatus: " + e.transStatus), a == null || a.onSuccess({
114
+ threeDSServerTransID: e.threeDSServerTransID,
115
+ threeDSRequestorTransID: "",
116
+ acsRenderingType: e.acsRenderingType,
117
+ acsTransID: e.acsTransID,
118
+ authenticationType: e.authenticationType,
119
+ authenticationValue: e.authenticationValue,
120
+ challengeCancel: "",
121
+ dsTransID: e.dsTransID,
122
+ eci: e.eci,
123
+ interactionCounter: "",
124
+ messageCategory: "",
125
+ messageExtension: e.messageExtension,
126
+ messageType: e.messageType,
127
+ messageVersion: e.messageVersion,
128
+ transStatus: e.transStatus,
129
+ transStatusReason: e.transStatusReason
130
+ });
131
+ break;
132
+ }
133
+ };
134
+ function X(t, n) {
135
+ o("[threeDsMethodInvoke]", { threeDSServerTransID: t, threeDSMethodURL: n });
136
+ const e = {
137
+ threeDSServerTransID: t,
138
+ threeDSMethodNotificationURL: D + "/3ds/method_invocation"
139
+ }, s = encodeURI(window.btoa(JSON.stringify(e)).replace(/=*$/, ""));
140
+ new L().invoke(n, "POST", {
141
+ threeDSMethodData: s
142
+ });
143
+ }
144
+ function T(t) {
145
+ var n, e;
146
+ if (!(!((n = t == null ? void 0 : t.data) != null && n.status) || ((e = t == null ? void 0 : t.data) == null ? void 0 : e.status) === "failure")) {
147
+ if (t.data.status === "3ds_method_invocation_complete") {
148
+ o("3Ds Method invocation complete"), t.stopPropagation(), f(!0);
149
+ return;
150
+ }
151
+ t.data.status === "3ds_challenge_complete" && (o("3Ds Challenge complete", t.data), t.stopPropagation(), p(), o("cresData", t.data.cres), t.data.cres ? (S = t.data.cres, I()) : (o("Failed 3DS Challenge", t.data), r(400, "Failed 3DS Challenge")));
152
+ }
153
+ }
154
+ function ee(t, n, e, s) {
155
+ return h = t, H = n, Y = e || document.body, D = s, {
156
+ onPreAuth: z,
157
+ onAuth: f,
158
+ onPostAuth: I,
159
+ setThreeDsProcessor: (l) => {
160
+ a = l;
161
+ }
162
+ };
163
+ }
164
+ export {
165
+ ee as default
166
+ };
@@ -0,0 +1,141 @@
1
+ import { d as v, a as I, c as R, b as f, _ as g, g as y, H as D } from "./main-02ee9775.mjs";
2
+ import { getEmptySuccessThreeDsPostAuthResponse as U } from "./ThreeDsPostAuthResponse.type-3091950f.mjs";
3
+ const T = { class: "mask" }, k = { class: "wrapper" }, L = { class: "container" }, N = ["src"], b = /* @__PURE__ */ v({
4
+ __name: "GPayments",
5
+ props: {
6
+ url: null
7
+ },
8
+ setup(e) {
9
+ const a = e;
10
+ return (t, u) => (I(), R("div", T, [
11
+ f("div", k, [
12
+ f("div", L, [
13
+ f("iframe", {
14
+ src: a.url
15
+ }, null, 8, N)
16
+ ])
17
+ ])
18
+ ]));
19
+ }
20
+ });
21
+ const E = /* @__PURE__ */ g(b, [["__scopeId", "data-v-7e1050e4"]]);
22
+ let p = null, C, w = null, n = null, S = "", c = "", _ = "", x, i = null;
23
+ function r(e, ...a) {
24
+ p && p(e, a);
25
+ }
26
+ function M() {
27
+ r("init authentication"), n == null || n.onPreAuth(H, o);
28
+ }
29
+ function m() {
30
+ r("Do Authentication for transId", c), n == null || n.onAuth(_, S, c, !0, J, o);
31
+ }
32
+ function d() {
33
+ r("Do Post Authentication for transId", c), n == null || n.onPostAuth({ threeDSServerTransID: c }, G, o);
34
+ }
35
+ function O(e) {
36
+ const { destroy: a } = y({
37
+ el: document.body,
38
+ component: E,
39
+ props: {
40
+ url: e
41
+ },
42
+ on: {
43
+ close: () => {
44
+ a(), i = null;
45
+ }
46
+ }
47
+ });
48
+ i = a, window.addEventListener("message", A);
49
+ }
50
+ function h() {
51
+ i == null || i(), window.removeEventListener("message", A);
52
+ }
53
+ const o = (e, a) => {
54
+ if (h(), e === 404) {
55
+ n == null || n.onError({ error: "This feature is only supported by ActiveServer v1.1.2+" });
56
+ return;
57
+ }
58
+ n == null || n.onError({ error: "3D Secure failed", body: a });
59
+ }, G = (e, a) => {
60
+ h();
61
+ const t = JSON.parse(a);
62
+ ["Y", "A"].includes(t.transStatus) ? n == null || n.onSuccess(t) : (r("3D Secure failed", t), n == null || n.onError({ error: "3D Secure failed" }));
63
+ }, H = (e, a) => {
64
+ const t = JSON.parse(a);
65
+ if (r("[onInitAuthSuccess]", t), !t.threeDSMethodAvailable) {
66
+ r("3DS Check is NOT available"), n == null || n.onSuccess(U());
67
+ return;
68
+ }
69
+ if (!t.threeDSAuthURL) {
70
+ o(e, "No AuthUrl specified");
71
+ return;
72
+ }
73
+ S = t.threeDSRequestorTransID, c = t.threeDSServerTransID, t.threeDSMonitorURL, _ = t.threeDSAuthURL, m();
74
+ }, J = (e, a) => {
75
+ const t = JSON.parse(a);
76
+ if (r("[onDoAuthSuccess]", t), !t.transStatus) {
77
+ o(e, "No transStatus specified");
78
+ return;
79
+ }
80
+ switch (t.transStatus) {
81
+ case "C":
82
+ if (!t.acsURL) {
83
+ o(e, "Invalid Challenge Url");
84
+ return;
85
+ }
86
+ O(t.acsURL);
87
+ break;
88
+ case "D":
89
+ if (!t.threeDSMonitorURL) {
90
+ o(e, "Invalid Result Mon Url");
91
+ return;
92
+ }
93
+ B(t.threeDSMonitorURL);
94
+ break;
95
+ default:
96
+ d();
97
+ break;
98
+ }
99
+ };
100
+ let l = null;
101
+ function B(e) {
102
+ if (l)
103
+ return;
104
+ const a = new D("", "", null);
105
+ l = setInterval(() => {
106
+ a.invoke(e, "GET", {}, (t, u) => {
107
+ const s = JSON.parse(u);
108
+ if (!s.event) {
109
+ r("Invalid mon url result", u);
110
+ return;
111
+ }
112
+ if (s.event === "AuthResultNotReady") {
113
+ r("AuthResultNotReady, retry in 2 seconds");
114
+ return;
115
+ } else
116
+ s.event === "AuthResultReady" ? (r("AuthResultReady", s), d()) : r("Invalid mon url result", s);
117
+ }, (t, u) => {
118
+ l && (clearInterval(l), l = null), o(t, "Invalid mon url result");
119
+ });
120
+ }, 2e3);
121
+ }
122
+ function A(e) {
123
+ var a, t;
124
+ if (!(!((a = e == null ? void 0 : e.data) != null && a.status) || ((t = e == null ? void 0 : e.data) == null ? void 0 : t.status) === "failure") && e.data.status === "3ds_challenge_complete") {
125
+ e.stopPropagation(), h(), r("3Ds Challenge complete", e.data), d();
126
+ return;
127
+ }
128
+ }
129
+ function Y(e, a, t, u) {
130
+ return p = e, w = a, x = t || document.body, C = u, {
131
+ onPreAuth: M,
132
+ onAuth: m,
133
+ onPostAuth: d,
134
+ setThreeDsProcessor: (s) => {
135
+ n = s;
136
+ }
137
+ };
138
+ }
139
+ export {
140
+ Y as default
141
+ };