@payfurl/client 4.9.2 → 4.9.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.
Files changed (26) hide show
  1. package/dist/sdk/{CloseIcon-CTY2bpwF.js → CloseIcon-_KV9iu0n.js} +980 -999
  2. package/dist/sdk/{DefaultThreeDsProvider-ChnRLzKI.js → DefaultThreeDsProvider-DreQM4fZ.js} +6 -23
  3. package/dist/sdk/{MetricsGlobalThreeDsProvider-DW-gsG6q.js → MetricsGlobalThreeDsProvider-UjlztqNp.js} +4 -12
  4. package/dist/sdk/{PayWayAppleButton-7Gi89Gij.js → PayWayAppleButton-wGK5SMiI.js} +3 -13
  5. package/dist/sdk/{alerts-DKbyC20w.js → alerts-xVUTwiZD.js} +1 -1
  6. package/dist/sdk/{cxpay-CGIndAf1.js → cxpay-2xgRySpM.js} +1 -1
  7. package/dist/sdk/{default-CgpOZU3K.js → default-C1jUec5H.js} +1 -1
  8. package/dist/sdk/{ecentric-F3nn_MwX.js → ecentric-H05aJpLn.js} +2 -2
  9. package/dist/sdk/{epna-uXpYJKOA.js → epna-DTN4buF_.js} +1 -1
  10. package/dist/sdk/{flashbanc-9XKA8Wrl.js → flashbanc-BeK15hvh.js} +1 -1
  11. package/dist/sdk/forter-B5mAsqh7.js +54 -0
  12. package/dist/sdk/forter-DH-MZghb.js +28 -0
  13. package/dist/sdk/{gpayments-DsXj9xbu.js → gpayments-B5l_XcOn.js} +5 -16
  14. package/dist/sdk/managedOrders-D8BtEsXf.js +23 -0
  15. package/dist/sdk/{metrics_global-L-Rm7bcl.js → metrics_global-B-VSDUV6.js} +1 -1
  16. package/dist/sdk/{nmi-BzHX8wqW.js → nmi-DqmyITL0.js} +1 -1
  17. package/dist/sdk/{nuvei-CS-nW8SB.js → nuvei-D4BRLq6t.js} +6 -15
  18. package/dist/sdk/{payabli-C4YuB7Sr.js → payabli-BuZpPAgS.js} +1 -1
  19. package/dist/sdk/payfurl.es.js +242 -474
  20. package/dist/sdk/payfurl.umd.js +8 -8
  21. package/dist/sdk/{payglocal-Cy6Qd8ve.js → payglocal--1ddjrp-.js} +26 -38
  22. package/dist/sdk/{payway_rest-ZMjPv2si.js → payway_rest-Dwo-Hfis.js} +1 -1
  23. package/dist/sdk/{skybank-C6ZmVyX6.js → skybank-DwVlGG-A.js} +1 -1
  24. package/dist/sdk/{strings-A3mXSUch.js → strings-CnX8240A.js} +13 -19
  25. package/package.json +1 -1
  26. package/dist/sdk/forter-Bm2GJ2Hs.js +0 -59
@@ -1,7 +1,7 @@
1
- import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, Dt as s, Et as c, F as l, Ft as u, H as d, Ht as f, I as p, It as m, K as h, L as g, Lt as _, M as v, Mt as y, Nt as b, Ot as x, P as S, Pt as C, Q as ee, R as te, Rt as ne, S as re, St as ie, Tt as w, U as ae, Vt as oe, W as se, X as ce, Y as le, Z as T, _t as ue, a as de, at as fe, b as pe, bt as E, c as me, ct as he, d as ge, dt as D, et as _e, f as ve, ft as ye, gt as O, ht as be, it as xe, j as Se, jt as Ce, kt as we, lt as Te, m as Ee, mt as De, n as Oe, nt as ke, o as Ae, ot as je, pt as Me, r as Ne, rt as k, st as Pe, t as Fe, tt as Ie, ut as A, v as Le, vt as j, wt as Re, x as ze, xt as M, y as Be, yt as Ve, z as He, zt as Ue } from "./CloseIcon-CTY2bpwF.js";
2
- import { a as We, c as Ge, i as Ke, l as qe, n as Je, o as N, r as P, s as F, t as Ye, u as Xe } from "./strings-A3mXSUch.js";
1
+ import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, Dt as s, Et as c, F as l, Ft as u, H as d, Ht as f, I as p, It as m, K as h, L as g, Lt as _, M as v, Mt as y, Nt as b, Ot as x, P as S, Pt as C, Q as ee, R as te, Rt as ne, S as re, St as ie, Tt as w, U as ae, Vt as oe, W as se, X as ce, Y as le, Z as T, _t as ue, a as de, at as fe, b as pe, bt as E, c as me, ct as he, d as ge, dt as D, et as _e, f as ve, ft as ye, gt as O, ht as be, it as xe, j as Se, jt as Ce, kt as we, lt as Te, m as Ee, mt as De, n as Oe, nt as ke, o as Ae, ot as je, pt as Me, r as Ne, rt as k, st as Pe, t as Fe, tt as Ie, ut as A, v as Le, vt as j, wt as Re, x as ze, xt as M, y as Be, yt as Ve, z as He, zt as Ue } from "./CloseIcon-_KV9iu0n.js";
2
+ import { a as We, c as Ge, i as Ke, l as qe, n as Je, o as N, r as P, s as F, t as Ye, u as Xe } from "./strings-CnX8240A.js";
3
3
  import { t as Ze } from "./screen-D7xBu0cj.js";
4
- import { n as Qe, t as I } from "./alerts-DKbyC20w.js";
4
+ import { n as Qe, t as I } from "./alerts-xVUTwiZD.js";
5
5
  //#region node_modules/tslib/tslib.es6.mjs
6
6
  function L(e, t, n, r) {
7
7
  var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
@@ -274,7 +274,7 @@ var ut = ["id"], dt = ["id", "onClick"], ft = ["value", "id"], pt = { class: "co
274
274
  })), bt = /* @__PURE__ */ oe(((e) => {
275
275
  Object.defineProperty(e, "__esModule", { value: !0 }), e.getCrypto = e.getRootWebCrypto = e.getWebCrypto = e.getNodeCrypto = void 0;
276
276
  var t = function() {
277
- if (!(typeof window < "u" && window.crypto) && !(typeof window > "u" && typeof crypto < "u")) return yt();
277
+ if (!(typeof window < "u" && window.crypto) && (typeof window < "u" || typeof crypto > "u")) return yt();
278
278
  };
279
279
  e.getNodeCrypto = t;
280
280
  var n = function() {
@@ -1315,11 +1315,7 @@ var { hideSpinner: At, showSpinner: jt } = Oe(), V = {
1315
1315
  }
1316
1316
  tokeniseCard(e, t, n) {
1317
1317
  let r = this.getPaymentInfo();
1318
- if (!r.cardNumber || !r.expiryDate || !r.cardholder) {
1319
- n("Card information is missing");
1320
- return;
1321
- }
1322
- jt(), this.httpInvoker?.invoke(H(this.apiUrl)[V.TOKENISE_CARD].url, H(this.apiUrl)[V.TOKENISE_CARD].method, JSON.stringify({
1318
+ !r.cardNumber || !r.expiryDate || !r.cardholder ? n("Card information is missing") : (jt(), this.httpInvoker?.invoke(H(this.apiUrl)[V.TOKENISE_CARD].url, H(this.apiUrl)[V.TOKENISE_CARD].method, JSON.stringify({
1323
1319
  paymentInformation: {
1324
1320
  cardNumber: r.cardNumber,
1325
1321
  expiryDate: `${r.expiryDate.slice(2)}/${r.expiryDate.slice(0, 2)}`,
@@ -1332,7 +1328,7 @@ var { hideSpinner: At, showSpinner: jt } = Oe(), V = {
1332
1328
  this.log("tokeniseCardSuccessCallback", e, n), At(), t(JSON.parse(n));
1333
1329
  }), z(this, "[tokeniseCardFailureCallback]", (e, t) => {
1334
1330
  this.log("tokeniseCardFailureCallback", e, t), At(), n("Unable to tokenise payment information");
1335
- }), { providerId: e });
1331
+ }), { providerId: e }));
1336
1332
  }
1337
1333
  updateTokenExternal3dsData(e) {
1338
1334
  this.tokenId && e && Object.keys(e).length !== 0 && this.httpInvoker?.invoke(H(this.apiUrl, this.tokenId)[V.PUT_TOKEN_EXTERNAL_3DS_DATA].url, H(this.apiUrl, this.tokenId)[V.PUT_TOKEN_EXTERNAL_3DS_DATA].method, JSON.stringify(e), (e, t) => {
@@ -1413,11 +1409,7 @@ var Nt = { style: { position: "relative" } }, Pt = {
1413
1409
  },
1414
1410
  onInit(e, t) {
1415
1411
  t.disable(), p = setInterval(() => {
1416
- if (n.clickGate()?.() === !1) {
1417
- t.disable();
1418
- return;
1419
- }
1420
- t.enable();
1412
+ n.clickGate()?.() === !1 ? t.disable() : t.enable();
1421
1413
  }, 1e3);
1422
1414
  }
1423
1415
  }).render(n.el), window.postMessage({ status: ze }, "*"));
@@ -1527,28 +1519,18 @@ var { hideSpinner: zt, showSpinner: Bt } = Oe(), Vt = class {
1527
1519
  let r = n.order.get();
1528
1520
  this.log("[Paypal]: order", r);
1529
1521
  let i = setInterval(() => {
1530
- if (this.log("[Paypal]: setInterval resolved = " + r.resolved), r.resolved) {
1531
- if (clearInterval(i), !this.fraudProcessor) {
1532
- this.addCharge(e, null);
1533
- return;
1534
- }
1535
- this.fraudProcessor.setPaypalInfo({
1536
- payerId: r.value.payer.payer_id,
1537
- payerEmail: r.value.payer.email_address,
1538
- paymentMethod: "Instant Transfer",
1539
- paymentStatus: r.value.status,
1540
- payerAccountCountry: r.value.payer.address.country_code,
1541
- paymentId: r.value.id
1542
- }), Bt(), this.fraudProcessor.fraudCheck((t) => {
1543
- if (zt(), Rt(t)) {
1544
- I(e, "Payment couldn't be processed"), this.failureCallback?.({ error: "Payment couldn't be processed" });
1545
- return;
1546
- }
1547
- this.addCharge(e, t);
1548
- }, (t) => {
1549
- zt(), I(e, t.error), this.failureCallback?.(t);
1550
- });
1551
- }
1522
+ this.log("[Paypal]: setInterval resolved = " + r.resolved), r.resolved && (clearInterval(i), this.fraudProcessor ? (this.fraudProcessor.setPaypalInfo({
1523
+ payerId: r.value.payer.payer_id,
1524
+ payerEmail: r.value.payer.email_address,
1525
+ paymentMethod: "Instant Transfer",
1526
+ paymentStatus: r.value.status,
1527
+ payerAccountCountry: r.value.payer.address.country_code,
1528
+ paymentId: r.value.id
1529
+ }), Bt(), this.fraudProcessor.fraudCheck((t) => {
1530
+ zt(), Rt(t) ? (I(e, "Payment couldn't be processed"), this.failureCallback?.({ error: "Payment couldn't be processed" })) : this.addCharge(e, t);
1531
+ }, (t) => {
1532
+ zt(), I(e, t.error), this.failureCallback?.(t);
1533
+ })) : this.addCharge(e, null));
1552
1534
  }, 200);
1553
1535
  })
1554
1536
  }
@@ -1705,33 +1687,31 @@ var Ht = ["src"], Ut = {
1705
1687
  }
1706
1688
  startLoadingCardForm() {
1707
1689
  let e = this.getCardFormFrame();
1708
- if (!e) {
1709
- this.startLoadingCardFormHandler = setTimeout(() => {
1710
- this.startLoadingCardForm();
1711
- }, 200);
1712
- return;
1713
- }
1714
- this.startLoadingCardFormHandler = null, this.log("[startLoadingCardForm]");
1715
- try {
1716
- e.contentWindow?.postMessage({ status: d }, "*");
1717
- } catch (e) {
1718
- this.log("[startLoadingCardForm] iframe error", e);
1690
+ if (!e) this.startLoadingCardFormHandler = setTimeout(() => {
1691
+ this.startLoadingCardForm();
1692
+ }, 200);
1693
+ else {
1694
+ this.startLoadingCardFormHandler = null, this.log("[startLoadingCardForm]");
1695
+ try {
1696
+ e.contentWindow?.postMessage({ status: d }, "*");
1697
+ } catch (e) {
1698
+ this.log("[startLoadingCardForm] iframe error", e);
1699
+ }
1719
1700
  }
1720
1701
  }
1721
1702
  stopLoadingCardForm() {
1722
1703
  this.startLoadingCardFormHandler &&= (clearTimeout(this.startLoadingCardFormHandler), null);
1723
1704
  let e = this.getCardFormFrame();
1724
- if (!e) {
1725
- setTimeout(() => {
1726
- this.stopLoadingCardForm();
1727
- }, 200);
1728
- return;
1729
- }
1730
- this.log("[stopLoadingCardForm]");
1731
- try {
1732
- e.contentWindow?.postMessage({ status: ae }, "*");
1733
- } catch (e) {
1734
- this.log("[stopLoadingCardForm] iframe error", e);
1705
+ if (!e) setTimeout(() => {
1706
+ this.stopLoadingCardForm();
1707
+ }, 200);
1708
+ else {
1709
+ this.log("[stopLoadingCardForm]");
1710
+ try {
1711
+ e.contentWindow?.postMessage({ status: ae }, "*");
1712
+ } catch (e) {
1713
+ this.log("[stopLoadingCardForm] iframe error", e);
1714
+ }
1735
1715
  }
1736
1716
  }
1737
1717
  pauseLoadingCardForm() {
@@ -1828,19 +1808,14 @@ var { hideSpinner: Jt, showSpinner: Yt } = Oe(), Xt = { UPDATE: "UPDATE" }, Zt =
1828
1808
  }
1829
1809
  messageHandler(e) {
1830
1810
  if (e.data?.action) {
1831
- if (this.log("[MastercardTokenAuthenticationProcessor][messageHandler]", e), e.data.action === "Ready") {
1832
- this.isReady = !0, this.invokeHandler && this.invokeHandler();
1833
- return;
1834
- }
1835
- if (e.data.action === "Error") {
1811
+ if (this.log("[MastercardTokenAuthenticationProcessor][messageHandler]", e), e.data.action === "Ready") this.isReady = !0, this.invokeHandler && this.invokeHandler();
1812
+ else if (e.data.action === "Error") {
1836
1813
  if (this.modalHide(), e.data.payload.message === "NOT_SUPPORTED") {
1837
1814
  this.showMessage("This card is not supported token authentication. Please use another card."), this.onFailureCallback?.({ error: "This card is not supported token authentication. Please use another card." });
1838
1815
  return;
1839
1816
  }
1840
1817
  this.showMessage("Unknown error. Please try again later."), this.onFailureCallback?.({ error: "Unknown error. Please try again later." });
1841
- return;
1842
- }
1843
- if (e.data.action === "Success") {
1818
+ } else if (e.data.action === "Success") {
1844
1819
  if (e.data.payload.authenticationStatus === "CANCELLED") {
1845
1820
  this.modalHide(), this.showMessage("Cancelled 3DS Challenge"), this.onFailureCallback?.({ error: "Cancelled 3DS Challenge" });
1846
1821
  return;
@@ -2134,48 +2109,22 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2134
2109
  }
2135
2110
  messageHandler(e) {
2136
2111
  if (e?.data?.status) {
2137
- if (e.data.status === "secure-orchestrator-ready" && this.isTrustedSecureMessage(e)) {
2138
- this.secureReady = !0;
2139
- return;
2140
- }
2141
- if (e.data.status === "secure-orchestrator-tokenise" && this.isTrustedSecureMessage(e)) {
2112
+ if (e.data.status === "secure-orchestrator-ready" && this.isTrustedSecureMessage(e)) this.secureReady = !0;
2113
+ else if (e.data.status === "secure-orchestrator-tokenise" && this.isTrustedSecureMessage(e)) {
2142
2114
  let t = e.data.message || {};
2143
2115
  this.tokenise({
2144
2116
  threeDSServerTransID: t.threeDSServerTransID,
2145
2117
  fraudCheckResult: t.fraudCheckResult,
2146
2118
  externalThreeDsData: t.externalThreeDsData
2147
2119
  });
2148
- return;
2149
- }
2150
- if (e.data.status === "secure-orchestrator-click-to-pay-card" && this.isTrustedSecureMessage(e)) {
2151
- this.checkoutWithSecureClickToPayCard(e.data.message || {});
2152
- return;
2153
- }
2154
- if (e.data.status === "secure-orchestrator-click-to-pay-new-card" && this.isTrustedSecureMessage(e)) {
2155
- this.checkoutWithSecureClickToPayNewCard(e.data.message || {});
2156
- return;
2157
- }
2158
- if (e.data.status === "secure-orchestrator-failure" && this.isTrustedSecureMessage(e)) {
2159
- K(), this.showMessage(e.data.error || "Unable to process payment details"), this.failureCallback?.({ error: e.data.error || "Unable to process payment details" });
2160
- return;
2161
- }
2162
- if (e.data.status === "hide-spinner") {
2163
- this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K();
2164
- return;
2165
- }
2166
- if (e.data.status === "show-spinner") {
2167
- this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), $t();
2168
- return;
2169
- }
2170
- if (e.data.status === "card-form-validation-error") {
2171
- this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K(), this.failureCallback?.({ error: e.data.message });
2172
- return;
2173
- }
2174
- if (e.data.status === "card-form-validation-status-change") {
2175
- this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K(), this.validationStatusChangeCallback?.(e.data.message?.status, e.data.message?.message);
2176
- return;
2177
- }
2178
- if (e.data.status === "tokenise-card-failure") {
2120
+ } else if (e.data.status === "secure-orchestrator-click-to-pay-card" && this.isTrustedSecureMessage(e)) this.checkoutWithSecureClickToPayCard(e.data.message || {});
2121
+ else if (e.data.status === "secure-orchestrator-click-to-pay-new-card" && this.isTrustedSecureMessage(e)) this.checkoutWithSecureClickToPayNewCard(e.data.message || {});
2122
+ else if (e.data.status === "secure-orchestrator-failure" && this.isTrustedSecureMessage(e)) K(), this.showMessage(e.data.error || "Unable to process payment details"), this.failureCallback?.({ error: e.data.error || "Unable to process payment details" });
2123
+ else if (e.data.status === "hide-spinner") this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K();
2124
+ else if (e.data.status === "show-spinner") this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), $t();
2125
+ else if (e.data.status === "card-form-validation-error") this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K(), this.failureCallback?.({ error: e.data.message });
2126
+ else if (e.data.status === "card-form-validation-status-change") this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K(), this.validationStatusChangeCallback?.(e.data.message?.status, e.data.message?.message);
2127
+ else if (e.data.status === "tokenise-card-failure") {
2179
2128
  if (this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), K(), e.data.message === "3D Secure required" && this.isSecureFlowEnabled()) {
2180
2129
  this.postSecureMessage(v);
2181
2130
  return;
@@ -2193,9 +2142,7 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2193
2142
  error: e.data.message,
2194
2143
  body: e.data.body
2195
2144
  });
2196
- return;
2197
- }
2198
- if (e.data.status === "tokenise-card-success") {
2145
+ } else if (e.data.status === "tokenise-card-success") {
2199
2146
  this.log(`[sdk][cardProcessor]: message "${e.data.status}" received`, e.data), e.stopPropagation(), this.iframe = null;
2200
2147
  let t = { token: e.data.tokenId };
2201
2148
  if (e.data.options?.cardDetails && (t.cardDetails = e.data.options?.cardDetails), e.data.options?.iinData && (t.iinData = e.data.options?.iinData), e.data.options?.clickToPay && (t.clickToPayData = {
@@ -2216,7 +2163,6 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2216
2163
  }
2217
2164
  }
2218
2165
  K(), Qe(this.container, this.getSuccessMessage()), this.successCallback?.(t);
2219
- return;
2220
2166
  }
2221
2167
  }
2222
2168
  }
@@ -2249,46 +2195,26 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2249
2195
  return this.secureEnabled && !this.secureFallback;
2250
2196
  }
2251
2197
  requestCardDetails() {
2252
- if (this.isSecureFlowEnabled() && !this.secureReady) {
2253
- K(), this.showMessage("Secure payment flow is not ready. Please try again."), this.failureCallback?.({ error: "Secure payment flow is not ready" });
2254
- return;
2255
- }
2256
- if (this.isSecureFlowEnabled() && this.secureReady) {
2257
- this.secureConfig?.clickToPay && this.clickToPayProcessor && this.postSecureMessage(S, { clickToPay: {
2258
- ...this.secureConfig.clickToPay,
2259
- rememberMe: this.clickToPayProcessor.getRememberMe()
2260
- } }), this.postSecureMessage(Se);
2261
- return;
2262
- }
2263
- if (this.cardDetailsPort) {
2264
- this.cardDetailsPort.postMessage({ status: a });
2265
- return;
2266
- }
2267
- super.requestCardDetails();
2198
+ this.isSecureFlowEnabled() && !this.secureReady ? (K(), this.showMessage("Secure payment flow is not ready. Please try again."), this.failureCallback?.({ error: "Secure payment flow is not ready" })) : this.isSecureFlowEnabled() && this.secureReady ? (this.secureConfig?.clickToPay && this.clickToPayProcessor && this.postSecureMessage(S, { clickToPay: {
2199
+ ...this.secureConfig.clickToPay,
2200
+ rememberMe: this.clickToPayProcessor.getRememberMe()
2201
+ } }), this.postSecureMessage(Se)) : this.cardDetailsPort ? this.cardDetailsPort.postMessage({ status: a }) : super.requestCardDetails();
2268
2202
  }
2269
2203
  handleCardDetailsMessage(e) {
2270
2204
  if (!e?.message) return;
2271
2205
  this.log(`[sdk][cardProcessor]: "${Ne}" message received`, e);
2272
2206
  let t = !!(this.clickToPayProcessor?.isEnabled() && this.clickToPayProcessor?.getRememberMe()), n = !!(this.clickToPayProcessor?.isEnabled() && e.message.srcDigitalCardId), r = !!(t && !n && e.message.cardNumber);
2273
- if (r && !this.clickToPayProcessor?.isSchemeSupported(e.message.cardNumber)) {
2274
- this.log("[clickToPayProcessor]: checkoutWithNewCard - Scheme is not supported!"), K(), this.showMessage("Please use another card or use an alternative payment method");
2275
- return;
2276
- }
2277
- if (n) {
2278
- K(), this.clickToPayProcessor?.checkoutWithCard(e.message, (t) => {
2279
- this.log("[clickToPayProcessor]: checkoutWithCard", t), t.checkoutActionCode !== "CANCEL" && t.checkoutActionCode !== "CHANGE_CARD" && ($t(), this.tokenise({ clickToPayInfo: {
2280
- correlationId: t.checkoutResponseData.srcCorrelationId,
2281
- srcFlowId: t.headers["x-src-cx-flow-id"],
2282
- merchantTransactionId: t.headers["merchant-transaction-id"],
2283
- ccv: e.message.ccv,
2284
- digitalCardId: t.checkoutResponseData.maskedCard.srcDigitalCardId.replace(/^-/, "")
2285
- } }));
2286
- }, (e) => {
2287
- this.log("[clickToPayProcessor]: checkoutWithCard, error", e), K();
2288
- });
2289
- return;
2290
- }
2291
- if (this.fraudProcessor?.setPaymentInfo({
2207
+ r && !this.clickToPayProcessor?.isSchemeSupported(e.message.cardNumber) ? (this.log("[clickToPayProcessor]: checkoutWithNewCard - Scheme is not supported!"), K(), this.showMessage("Please use another card or use an alternative payment method")) : n ? (K(), this.clickToPayProcessor?.checkoutWithCard(e.message, (t) => {
2208
+ this.log("[clickToPayProcessor]: checkoutWithCard", t), t.checkoutActionCode !== "CANCEL" && t.checkoutActionCode !== "CHANGE_CARD" && ($t(), this.tokenise({ clickToPayInfo: {
2209
+ correlationId: t.checkoutResponseData.srcCorrelationId,
2210
+ srcFlowId: t.headers["x-src-cx-flow-id"],
2211
+ merchantTransactionId: t.headers["merchant-transaction-id"],
2212
+ ccv: e.message.ccv,
2213
+ digitalCardId: t.checkoutResponseData.maskedCard.srcDigitalCardId.replace(/^-/, "")
2214
+ } }));
2215
+ }, (e) => {
2216
+ this.log("[clickToPayProcessor]: checkoutWithCard, error", e), K();
2217
+ })) : (this.fraudProcessor?.setPaymentInfo({
2292
2218
  cardNumber: e.message.cardNumber,
2293
2219
  expiryDate: e.message.expiryDate,
2294
2220
  cardholder: e.message.cardholder,
@@ -2303,53 +2229,37 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2303
2229
  expiryDate: e.message.expiryDate,
2304
2230
  cardholder: e.message.cardholder,
2305
2231
  ccv: e.message.ccv
2306
- }), e.message.email && (this.threeDsProcessor?.setEmail(e.message.email), this.secondaryThreeDsProcessor?.setEmail(e.message.email)), this.fraudProcessor && !(n || r)) {
2307
- $t(), this.fraudProcessor.fraudCheck(z(this, "[fraudProcessor][fraudCheck], success", (t) => {
2308
- if (Rt(t)) {
2309
- K(), I(this.container, "Payment couldn't be processed"), this.failureCallback?.({ error: "Payment couldn't be processed" });
2310
- return;
2311
- }
2312
- this.onSubmit({
2313
- cardNumber: e.message.cardNumber,
2314
- expiryDate: e.message.expiryDate,
2315
- cardholder: e.message.cardholder,
2316
- ccv: e.message.ccv
2317
- }, t);
2318
- }), z(this, "[fraudProcessor][fraudCheck], error", (e) => {
2319
- K(), I(this.container, e.error), this.failureCallback?.(e);
2320
- }));
2321
- return;
2322
- }
2323
- this.onSubmit({
2232
+ }), e.message.email && (this.threeDsProcessor?.setEmail(e.message.email), this.secondaryThreeDsProcessor?.setEmail(e.message.email)), this.fraudProcessor && !(n || r) ? ($t(), this.fraudProcessor.fraudCheck(z(this, "[fraudProcessor][fraudCheck], success", (t) => {
2233
+ Rt(t) ? (K(), I(this.container, "Payment couldn't be processed"), this.failureCallback?.({ error: "Payment couldn't be processed" })) : this.onSubmit({
2234
+ cardNumber: e.message.cardNumber,
2235
+ expiryDate: e.message.expiryDate,
2236
+ cardholder: e.message.cardholder,
2237
+ ccv: e.message.ccv
2238
+ }, t);
2239
+ }), z(this, "[fraudProcessor][fraudCheck], error", (e) => {
2240
+ K(), I(this.container, e.error), this.failureCallback?.(e);
2241
+ }))) : this.onSubmit({
2324
2242
  cardNumber: e.message.cardNumber,
2325
2243
  expiryDate: e.message.expiryDate,
2326
2244
  cardholder: e.message.cardholder,
2327
2245
  ccv: e.message.ccv
2328
- });
2246
+ }));
2329
2247
  }
2330
2248
  onSubmit(e, t) {
2331
- if (this.log("[cardProcessor]: onSubmit", {
2249
+ this.log("[cardProcessor]: onSubmit", {
2332
2250
  cardInfo: {
2333
2251
  ...e,
2334
2252
  cardNumber: Ke(e.cardNumber),
2335
2253
  ccv: "***"
2336
2254
  },
2337
2255
  fraudCheckResult: t
2338
- }), this.clickToPayProcessor?.isEnabled() && this.clickToPayProcessor?.getRememberMe()) {
2339
- this.tokeniseWithClickToPay(e, void 0, t);
2340
- return;
2341
- }
2342
- if (this.threeDsProcessor) {
2343
- this.threeDsProcessor?.threeDSInvoke(this.container, !1, (e) => {
2344
- K(), this.log("[threeDSInvoke], postAuthData", e), this.tokenise({
2345
- threeDSServerTransID: e.threeDSServerTransID,
2346
- fraudCheckResult: t,
2347
- externalThreeDsData: e.externalThreeDsData
2348
- });
2256
+ }), t?.managedOrderToken ? (K(), I(this.container, "3DS challenge could not be started"), this.failureCallback?.({ error: "3DS challenge could not be started" })) : this.clickToPayProcessor?.isEnabled() && this.clickToPayProcessor?.getRememberMe() ? this.tokeniseWithClickToPay(e, void 0, t) : this.threeDsProcessor ? this.threeDsProcessor?.threeDSInvoke(this.container, !1, (e) => {
2257
+ K(), this.log("[threeDSInvoke], postAuthData", e), this.tokenise({
2258
+ threeDSServerTransID: e.threeDSServerTransID,
2259
+ fraudCheckResult: t,
2260
+ externalThreeDsData: e.externalThreeDsData
2349
2261
  });
2350
- return;
2351
- }
2352
- this.tokenise({ fraudCheckResult: t });
2262
+ }) : this.tokenise({ fraudCheckResult: t });
2353
2263
  }
2354
2264
  tokenise(e) {
2355
2265
  if (this.log("[cardProcessor]: tokenise", e), !this.iframe) return;
@@ -2403,11 +2313,7 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2403
2313
  }));
2404
2314
  }
2405
2315
  checkoutWithSecureClickToPayNewCard(e) {
2406
- if (!e.encryptedCard || !e.cardBrand) {
2407
- K(), this.showMessage("Unable to process Click to Pay card"), this.failureCallback?.({ error: "Unable to process Click to Pay card" });
2408
- return;
2409
- }
2410
- K(), this.clickToPayProcessor?.checkoutWithEncryptedNewCard(e.encryptedCard, e.cardBrand, z(this, "[clickToPayProcessor]: secure checkoutWithEncryptedNewCard", (e) => {
2316
+ !e.encryptedCard || !e.cardBrand ? (K(), this.showMessage("Unable to process Click to Pay card"), this.failureCallback?.({ error: "Unable to process Click to Pay card" })) : (K(), this.clickToPayProcessor?.checkoutWithEncryptedNewCard(e.encryptedCard, e.cardBrand, z(this, "[clickToPayProcessor]: secure checkoutWithEncryptedNewCard", (e) => {
2411
2317
  this.log("[clickToPayProcessor]: secure checkoutWithEncryptedNewCard", e), e.checkoutActionCode !== "CANCEL" && ($t(), this.tokenise({ clickToPayInfo: {
2412
2318
  correlationId: e.checkoutResponseData.srcCorrelationId,
2413
2319
  srcFlowId: e.headers["x-src-cx-flow-id"],
@@ -2416,7 +2322,7 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2416
2322
  } }));
2417
2323
  }), z(this, "[clickToPayProcessor]: secure checkoutWithEncryptedNewCard, error", (e) => {
2418
2324
  this.log("[clickToPayProcessor]: secure checkoutWithEncryptedNewCard, error", e), K(), I(this.container, e.message);
2419
- }));
2325
+ })));
2420
2326
  }
2421
2327
  setAmount(e) {
2422
2328
  this.amount = e, this.clickToPayProcessor?.setAmount(e), this.isSecureFlowEnabled() && this.postSecureMessage(S, { amount: e }), this.iframe && this.iframe.contentWindow?.postMessage({
@@ -2443,23 +2349,7 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2443
2349
  this.geolocation = { ...e }, this.isSecureFlowEnabled() && this.postSecureMessage(S, { geolocation: e });
2444
2350
  }
2445
2351
  tokeniseCard(e, t, n, r, i, a, o, s) {
2446
- if (!k(e)) {
2447
- this.log("missing parameter: providerId"), this.failureCallback?.({ error: "missing parameter: providerId" });
2448
- return;
2449
- }
2450
- if (!_e(t)) {
2451
- this.log("wrong parameter: cardNumber"), this.failureCallback?.({ error: "wrong parameter: cardNumber" });
2452
- return;
2453
- }
2454
- if (!xe(n)) {
2455
- this.log("wrong parameter: expiryDate"), this.failureCallback?.({ error: "wrong parameter: expiryDate" });
2456
- return;
2457
- }
2458
- if (!Ie(i)) {
2459
- this.log("wrong parameter: ccv"), this.failureCallback?.({ error: "wrong parameter: ccv" });
2460
- return;
2461
- }
2462
- this.httpInvoker?.invoke(tn(this.apiUrl, e)[en.TOKENISE_CARD].url, tn(this.apiUrl, e)[en.TOKENISE_CARD].method, JSON.stringify({
2352
+ k(e) ? _e(t) ? xe(n) ? Ie(i) ? this.httpInvoker?.invoke(tn(this.apiUrl, e)[en.TOKENISE_CARD].url, tn(this.apiUrl, e)[en.TOKENISE_CARD].method, JSON.stringify({
2463
2353
  paymentInformation: {
2464
2354
  cardNumber: t,
2465
2355
  expiryDate: n,
@@ -2495,7 +2385,7 @@ var { hideSpinner: K, showSpinner: $t } = Oe(), en = {
2495
2385
  error: "Unable to tokenise payment information",
2496
2386
  body: t
2497
2387
  });
2498
- }, { providerId: e });
2388
+ }, { providerId: e }) : (this.log("wrong parameter: ccv"), this.failureCallback?.({ error: "wrong parameter: ccv" })) : (this.log("wrong parameter: expiryDate"), this.failureCallback?.({ error: "wrong parameter: expiryDate" })) : (this.log("wrong parameter: cardNumber"), this.failureCallback?.({ error: "wrong parameter: cardNumber" })) : (this.log("missing parameter: providerId"), this.failureCallback?.({ error: "missing parameter: providerId" }));
2499
2389
  }
2500
2390
  initTokenAuthenticationProcessor(e, t, n, r, i, a) {
2501
2391
  this.log("[initTokenAuthenticationProcessor]", {
@@ -3463,12 +3353,9 @@ var yn = {
3463
3353
  if (i.data.status === "set-amount") {
3464
3354
  if (Number(e.amount) == Number(i.data.amount)) return;
3465
3355
  this.log(`[sdk][checkoutProcessor][${t}]: message received`, i.data), e.amount = Number(i.data.amount), this.checkout(e, t, n, r);
3466
- return;
3467
- }
3468
- if (i.data.status === "set-currency") {
3356
+ } else if (i.data.status === "set-currency") {
3469
3357
  if (e.currency == i.data.currency) return;
3470
3358
  this.log(`[sdk][checkoutProcessor][${t}]: message received`, i.data), e.currency = i.data.currency, this.checkout(e, t, n, r);
3471
- return;
3472
3359
  }
3473
3360
  }
3474
3361
  });
@@ -3478,7 +3365,7 @@ L([R], Pn.prototype, "cleanUp", null), L([R], Pn.prototype, "addCheckout", null)
3478
3365
  var Y = {
3479
3366
  name: "@payfurl/client",
3480
3367
  private: !1,
3481
- version: "4.9.2",
3368
+ version: "4.9.3",
3482
3369
  files: ["dist/sdk"],
3483
3370
  type: "module",
3484
3371
  main: "./dist/sdk/payfurl.umd.js",
@@ -4254,8 +4141,8 @@ var cr = { style: { position: "relative" } }, lr = {
4254
4141
  Jn(/* #__PURE__ */ Object.assign({
4255
4142
  "./applepay/ApplePayButton.interface.ts": () => import("./ApplePayButton.interface-BvRk9kiK.js"),
4256
4143
  "./applepay/ApplePayButtonOptions.type.ts": () => import("./ApplePayButtonOptions.type-BvRk9kiK.js"),
4257
- "./applepay/PayWayAppleButton.ts": () => import("./PayWayAppleButton-7Gi89Gij.js"),
4258
- "./applepay/payway_rest.ts": () => import("./payway_rest-ZMjPv2si.js")
4144
+ "./applepay/PayWayAppleButton.ts": () => import("./PayWayAppleButton-wGK5SMiI.js"),
4145
+ "./applepay/payway_rest.ts": () => import("./payway_rest-Dwo-Hfis.js")
4259
4146
  }), `./applepay/${i.providerType.toLowerCase()}.ts`, 3).then(z(this, "[localAddApplePay], then", (e) => {
4260
4147
  this.log(`Loading ${i.providerType}...`, e), s(e);
4261
4148
  })).catch(() => {
@@ -4579,33 +4466,21 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4579
4466
  setCards(e) {
4580
4467
  this.cards = e;
4581
4468
  let t = this.getCardFormFrame();
4582
- if (t) {
4583
- try {
4584
- t.contentWindow?.postMessage({
4585
- status: me,
4586
- cards: e
4587
- }, "*");
4588
- } catch (e) {
4589
- this.log("[setCards] iframe error", e);
4590
- }
4591
- return;
4469
+ if (t) try {
4470
+ t.contentWindow?.postMessage({
4471
+ status: me,
4472
+ cards: e
4473
+ }, "*");
4474
+ } catch (e) {
4475
+ this.log("[setCards] iframe error", e);
4592
4476
  }
4593
- this.log("[setCards] iframe not found");
4477
+ else this.log("[setCards] iframe not found");
4594
4478
  }
4595
4479
  isSchemeSupported(e) {
4596
4480
  return this.availableCardBrands.includes(Pe(e));
4597
4481
  }
4598
4482
  messageHandler(e) {
4599
- if (e?.data?.status) {
4600
- if (e.data.status === "click2pay-remember-me") {
4601
- this.log(`[clickToPayProcessor]: message "${e.data.status}" received`, e.data), this.setRememberMe(!!e.data.message);
4602
- return;
4603
- }
4604
- if (e.data.status === "click2pay-change-user" && (this.log(`[clickToPayProcessor]: message "${e.data.status}" received`, e.data), this.showChangeUserPopup()), e.data.status === "click2pay-show-learn-more") {
4605
- this.log(`[clickToPayProcessor]: message "${e.data.status}" received`, e.data), this.mcShowLearnMore();
4606
- return;
4607
- }
4608
- }
4483
+ e?.data?.status && (e.data.status === "click2pay-remember-me" ? (this.log(`[clickToPayProcessor]: message "${e.data.status}" received`, e.data), this.setRememberMe(!!e.data.message)) : (e.data.status === "click2pay-change-user" && (this.log(`[clickToPayProcessor]: message "${e.data.status}" received`, e.data), this.showChangeUserPopup()), e.data.status === "click2pay-show-learn-more" && (this.log(`[clickToPayProcessor]: message "${e.data.status}" received`, e.data), this.mcShowLearnMore())));
4609
4484
  }
4610
4485
  init() {
4611
4486
  this.initialized ||= (this.log("[ClickToPayProcessor] - INIT", this.getCustomerInfo()), this.startLoadingCardForm(), this.initCss(), this.createOtpInput(), this.createModalForm(), this.createLearnMore(), this.initScripts(), !0);
@@ -4736,12 +4611,11 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4736
4611
  left=${o}`);
4737
4612
  }
4738
4613
  hideModalForm() {
4739
- if (!this.tokenAuthenticationEnabled) {
4614
+ if (this.tokenAuthenticationEnabled) this.modal && this.modal.close();
4615
+ else {
4740
4616
  if (!this.mcModal) return;
4741
4617
  this.mcModal.style.display = "none";
4742
- return;
4743
4618
  }
4744
- this.modal && this.modal.close();
4745
4619
  }
4746
4620
  mcHideOtpInput() {
4747
4621
  let e = this;
@@ -4793,16 +4667,12 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4793
4667
  this.log("[LoginForm.close]"), this.stopLoadingCardForm(), e();
4794
4668
  }),
4795
4669
  submit: z(this, "[showLoginForm], onsubmit", ({ email: t, phone: n }) => {
4796
- if (this.log("[LoginForm.submit]", t, n), e(), this.customer || this.setCustomerInfo({
4670
+ this.log("[LoginForm.submit]", t, n), e(), this.customer || this.setCustomerInfo({
4797
4671
  firstName: "",
4798
4672
  lastName: "",
4799
4673
  email: "",
4800
4674
  phoneNumber: ""
4801
- }), this.customer.email = t, this.customer.phoneNumber = n, !t && !n) {
4802
- this.stopLoadingCardForm();
4803
- return;
4804
- }
4805
- this.setCards([]), this.mcIdLookup();
4675
+ }), this.customer.email = t, this.customer.phoneNumber = n, !t && !n ? this.stopLoadingCardForm() : (this.setCards([]), this.mcIdLookup());
4806
4676
  }),
4807
4677
  logout: z(this, "[showLoginForm], onlogout", () => {
4808
4678
  this.log("[LoginForm.logout]"), e(), this.stopLoadingCardForm(), this.setCards([]), this.mcLogout();
@@ -4850,11 +4720,7 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4850
4720
  }
4851
4721
  checkoutWithEncryptedNewCard(e, t, n, r) {
4852
4722
  let i = this, a = z(this, "[checkoutWithNewCard.promiseResolvedHandler]", (e) => {
4853
- if (i.log("[checkoutWithNewCard.promiseResolvedHandler]", e), i.hideModalForm(), e.checkoutActionCode === "SWITCH_CONSUMER") {
4854
- i.showLoginForm();
4855
- return;
4856
- }
4857
- ["CHANGE_CARD", "CANCEL"].includes(e.checkoutActionCode) || n(e);
4723
+ i.log("[checkoutWithNewCard.promiseResolvedHandler]", e), i.hideModalForm(), e.checkoutActionCode === "SWITCH_CONSUMER" ? i.showLoginForm() : ["CHANGE_CARD", "CANCEL"].includes(e.checkoutActionCode) || n(e);
4858
4724
  }), o = z(this, "[checkoutWithNewCard.promiseRejectedHandler]", (e) => {
4859
4725
  i.log("[checkoutWithNewCard.promiseRejectedHandler]", e), i.stopUsing(), i.showInfoMessage(zr), r(e), i.sendErrorNotification("checkoutWithNewCard error", [s, e]);
4860
4726
  });
@@ -4902,15 +4768,7 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4902
4768
  }
4903
4769
  this.customer?.email || (e = !0);
4904
4770
  let t = this, n = z(this, "[mcIdLookup.promiseResolvedHandler]", (n) => {
4905
- if (t.log("[mcIdLookup.promiseResolvedHandler]", n), n.consumerPresent) {
4906
- t.mcInitiateValidation();
4907
- return;
4908
- }
4909
- if (!n.consumerPresent && !e && t.customer?.phoneNumber) {
4910
- t.mcIdLookup(!0);
4911
- return;
4912
- }
4913
- t.stopLoadingCardForm();
4771
+ t.log("[mcIdLookup.promiseResolvedHandler]", n), n.consumerPresent ? t.mcInitiateValidation() : !n.consumerPresent && !e && t.customer?.phoneNumber ? t.mcIdLookup(!0) : t.stopLoadingCardForm();
4914
4772
  }), r = z(this, "[mcIdLookup.promiseRejectedHandler]", (e) => {
4915
4773
  t.log("[mcIdLookup.promiseRejectedHandler]", e), t.stopLoadingCardForm(), t.sendErrorNotification("mcIdLookup error", [a, e]), t.stopUsing();
4916
4774
  }), i = We(this.customer?.phoneNumber || ""), a = e ? { mobileNumber: {
@@ -4940,19 +4798,7 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4940
4798
  let t = this, n = z(this, "[mcValidate.promiseResolvedHandler]", (e) => {
4941
4799
  t.log("[mcValidate.promiseResolvedHandler]", e), e.cards ? (t.setCards(e.cards), t.stopLoadingCardForm()) : t.mcGetCards(), t.saveRecognitionToken(e.recognitionToken);
4942
4800
  }), r = z(this, "[mcValidate.promiseRejectedHandler]", (e) => {
4943
- if (t.log("[mcValidate.promiseRejectedHandler]", e), t.sendErrorNotification("mcValidate error", [i, e]), t.attempts++, t.attempts > 2) {
4944
- t.stopLoadingCardForm(), t.showMessage("Too many attempts to access your click to pay profile. Please check out as a guest.");
4945
- return;
4946
- }
4947
- if (!e?.reason || e.reason == "REQUEST_TIMEOUT") {
4948
- t.stopLoadingCardForm(), t.showMessage("Too many attempts to access your click to pay profile. Please check out as a guest.");
4949
- return;
4950
- }
4951
- if (e.reason === "CODE_INVALID" || e.reason === "RETRIES_EXCEEDED" || e.reason === "ACCT_INACCESSIBLE" || e.reason === "CODE_EXPIRED") {
4952
- t.mcShowOtpInput(t.supportedValidationChannels, t.validationChannelsNetwork, e.reason);
4953
- return;
4954
- }
4955
- t.stopUsing(), t.showInfoMessage(zr);
4801
+ t.log("[mcValidate.promiseRejectedHandler]", e), t.sendErrorNotification("mcValidate error", [i, e]), t.attempts++, t.attempts > 2 || !e?.reason || e.reason == "REQUEST_TIMEOUT" ? (t.stopLoadingCardForm(), t.showMessage("Too many attempts to access your click to pay profile. Please check out as a guest.")) : e.reason === "CODE_INVALID" || e.reason === "RETRIES_EXCEEDED" || e.reason === "ACCT_INACCESSIBLE" || e.reason === "CODE_EXPIRED" ? t.mcShowOtpInput(t.supportedValidationChannels, t.validationChannelsNetwork, e.reason) : (t.stopUsing(), t.showInfoMessage(zr));
4956
4802
  }), i = {
4957
4803
  value: e,
4958
4804
  recognitionTokenRequested: this.getRememberMe()
@@ -4961,11 +4807,7 @@ var zr = "Click to Pay is unavailable. Please proceed with an alternative paymen
4961
4807
  }
4962
4808
  runClickToPay() {
4963
4809
  let e = this, t = z(this, "[runClickToPay.promiseResolvedHandler]", (t) => {
4964
- if (e.log("[runClickToPay.promiseResolvedHandler]", t), !t || !t.length) {
4965
- e.mcIdLookup();
4966
- return;
4967
- }
4968
- e.setCards(t), e.stopLoadingCardForm();
4810
+ e.log("[runClickToPay.promiseResolvedHandler]", t), !t || !t.length ? e.mcIdLookup() : (e.setCards(t), e.stopLoadingCardForm());
4969
4811
  }), n = z(this, "[runClickToPay.promiseRejectedHandler]", (t) => {
4970
4812
  e.log("[runClickToPay.promiseRejectedHandler]", t), e.stopUsing(), e.stopLoadingCardForm(), e.sendErrorNotification("mcCheckoutService.getCards error", [t]);
4971
4813
  });
@@ -5202,17 +5044,13 @@ var Hr = {
5202
5044
  n.log?.("[PaymentMethods]: selected payment method", e), d.value = {}, o.value = e, r("select", e ? { ...e } : null);
5203
5045
  }
5204
5046
  function g() {
5205
- if (l.value.length > 0) {
5206
- h(l.value.find((e) => e.isDefault) || l.value[0]), window.postMessage({
5207
- status: de,
5208
- message: {
5209
- status: "success",
5210
- message: ""
5211
- }
5212
- }, "*");
5213
- return;
5214
- }
5215
- window.postMessage({
5047
+ l.value.length > 0 ? (h(l.value.find((e) => e.isDefault) || l.value[0]), window.postMessage({
5048
+ status: de,
5049
+ message: {
5050
+ status: "success",
5051
+ message: ""
5052
+ }
5053
+ }, "*")) : window.postMessage({
5216
5054
  status: de,
5217
5055
  message: {
5218
5056
  status: "error",
@@ -5300,31 +5138,19 @@ var Hr = {
5300
5138
  return this.currency;
5301
5139
  }
5302
5140
  setCustomerInfo(e) {
5303
- if (!e) {
5304
- this.customer = null;
5305
- return;
5306
- }
5307
- this.customer = { ...e };
5141
+ this.customer = e ? { ...e } : null;
5308
5142
  }
5309
5143
  getCustomerInfo() {
5310
5144
  return this.customer;
5311
5145
  }
5312
5146
  setBillingAddress(e) {
5313
- if (!e) {
5314
- this.billingAddress = null;
5315
- return;
5316
- }
5317
- this.billingAddress = { ...e };
5147
+ this.billingAddress = e ? { ...e } : null;
5318
5148
  }
5319
5149
  getBillingAddress() {
5320
5150
  return this.billingAddress;
5321
5151
  }
5322
5152
  setOrderInfo(e) {
5323
- if (!e) {
5324
- this.order = null;
5325
- return;
5326
- }
5327
- this.order = { ...e };
5153
+ this.order = e ? { ...e } : null;
5328
5154
  }
5329
5155
  getOrderInfo() {
5330
5156
  return this.order;
@@ -5346,11 +5172,7 @@ var Hr = {
5346
5172
  return this.paymentInfo;
5347
5173
  }
5348
5174
  setGeolocation(e) {
5349
- if (!e) {
5350
- this.geolocation = null;
5351
- return;
5352
- }
5353
- this.geolocation = { ...e };
5175
+ this.geolocation = e ? { ...e } : null;
5354
5176
  }
5355
5177
  getGeolocation() {
5356
5178
  return this.geolocation;
@@ -5556,15 +5378,9 @@ var { hideSpinner: ai, showSpinner: oi } = Oe(), si = {
5556
5378
  this.httpInvoker?.invoke(ci(this.apiUrl, e)[si.PAYMENT_METHODS_INFO].url, ci(this.apiUrl, e)[si.PAYMENT_METHODS_INFO].method, {}, r, i);
5557
5379
  }
5558
5380
  onSubmit(e, t, n, r, i) {
5559
- if (!i?.paymentMethodId) {
5560
- this.failureCallback?.({ error: "Invalid payment method" });
5561
- return;
5562
- }
5563
- if (!r?.tokenAuthenticationEnabled || !i.networkToken?.schemeTokenId) {
5564
- this.tokenise(e, i.paymentMethodId, t, n);
5565
- return;
5566
- }
5567
- if (r?.tokenAuthenticationEnabled && i.networkToken?.schemeTokenId) {
5381
+ if (!i?.paymentMethodId) this.failureCallback?.({ error: "Invalid payment method" });
5382
+ else if (!r?.tokenAuthenticationEnabled || !i.networkToken?.schemeTokenId) this.tokenise(e, i.paymentMethodId, t, n);
5383
+ else if (r?.tokenAuthenticationEnabled && i.networkToken?.schemeTokenId) {
5568
5384
  let a = {
5569
5385
  expiryDate: i.card?.expiryDate || "",
5570
5386
  cardholder: i.card?.cardholder || "",
@@ -5614,10 +5430,7 @@ var { hideSpinner: ai, showSpinner: oi } = Oe(), si = {
5614
5430
  }
5615
5431
  }
5616
5432
  messageHandler(e) {
5617
- if (e?.data?.status && e.data.status === "card-form-validation-status-change") {
5618
- this.log(`[sdk][paymentMethodProcessor]: message "${e.data.status}" received`, e.data), ai(), this.validationStatusChangeCallback?.(e.data.message?.status, e.data.message?.message);
5619
- return;
5620
- }
5433
+ e?.data?.status && e.data.status === "card-form-validation-status-change" && (this.log(`[sdk][paymentMethodProcessor]: message "${e.data.status}" received`, e.data), ai(), this.validationStatusChangeCallback?.(e.data.message?.status, e.data.message?.message));
5621
5434
  }
5622
5435
  };
5623
5436
  L([R], li.prototype, "addPaymentMethods", null), L([R], li.prototype, "tokenise", null), L([R], li.prototype, "getCustomerData", null), L([R], li.prototype, "getPaymentMethodsInfo", null), L([R], li.prototype, "onSubmit", null), L([R], li.prototype, "sendError", null), L([R], li.prototype, "initTokenAuthenticationProcessor", null), L([R], li.prototype, "messageHandler", null);
@@ -5641,19 +5454,20 @@ function ui(e) {
5641
5454
  //#endregion
5642
5455
  //#region src/sdk/utils/moduleLoader.ts
5643
5456
  var di = {
5644
- cxpay: () => import("./cxpay-CGIndAf1.js"),
5645
- default: () => import("./default-CgpOZU3K.js"),
5646
- ecentric: () => import("./ecentric-F3nn_MwX.js"),
5647
- epna: () => import("./epna-uXpYJKOA.js"),
5648
- flashbanc: () => import("./flashbanc-9XKA8Wrl.js"),
5649
- gpayments: () => import("./gpayments-DsXj9xbu.js"),
5650
- metrics_global: () => import("./metrics_global-L-Rm7bcl.js"),
5651
- nmi: () => import("./nmi-BzHX8wqW.js"),
5652
- nuvei: () => import("./nuvei-CS-nW8SB.js"),
5653
- payabli: () => import("./payabli-C4YuB7Sr.js"),
5654
- payglocal: () => import("./payglocal-Cy6Qd8ve.js"),
5655
- skybank: () => import("./skybank-C6ZmVyX6.js")
5656
- }, fi = { forter: () => import("./forter-Bm2GJ2Hs.js") };
5457
+ cxpay: () => import("./cxpay-2xgRySpM.js"),
5458
+ default: () => import("./default-C1jUec5H.js"),
5459
+ ecentric: () => import("./ecentric-H05aJpLn.js"),
5460
+ epna: () => import("./epna-DTN4buF_.js"),
5461
+ flashbanc: () => import("./flashbanc-BeK15hvh.js"),
5462
+ forter: () => import("./forter-DH-MZghb.js"),
5463
+ gpayments: () => import("./gpayments-B5l_XcOn.js"),
5464
+ metrics_global: () => import("./metrics_global-B-VSDUV6.js"),
5465
+ nmi: () => import("./nmi-DqmyITL0.js"),
5466
+ nuvei: () => import("./nuvei-D4BRLq6t.js"),
5467
+ payabli: () => import("./payabli-BuZpPAgS.js"),
5468
+ payglocal: () => import("./payglocal--1ddjrp-.js"),
5469
+ skybank: () => import("./skybank-DwVlGG-A.js")
5470
+ }, fi = { forter: () => import("./forter-B5mAsqh7.js") };
5657
5471
  async function pi(e) {
5658
5472
  let t = di[e.toLowerCase()];
5659
5473
  if (!t) throw Error(`Module ${e} not found`);
@@ -5828,19 +5642,11 @@ var { hideSpinner: hi } = Oe(), gi = {
5828
5642
  apiUrl: this.config.apiUrl,
5829
5643
  version: Y.version,
5830
5644
  onSuccess: z(this, "[applePayProcessor], success", (t) => {
5831
- if (this.log("[applePayProcessor], success", t), !this.userOnSuccess && t.transactionId) {
5832
- this._setToken(e, t.transactionId, "transactionId"), setTimeout(() => {
5833
- this.getForm(e)?.submit();
5834
- }, 500);
5835
- return;
5836
- }
5837
- if (!this.userOnSuccess && t.token) {
5838
- this._setToken(e, t.token), setTimeout(() => {
5839
- this.userOnSuccess || this.getForm(e)?.submit();
5840
- }, 500);
5841
- return;
5842
- }
5843
- this.userOnSuccess?.({
5645
+ this.log("[applePayProcessor], success", t), !this.userOnSuccess && t.transactionId ? (this._setToken(e, t.transactionId, "transactionId"), setTimeout(() => {
5646
+ this.getForm(e)?.submit();
5647
+ }, 500)) : !this.userOnSuccess && t.token ? (this._setToken(e, t.token), setTimeout(() => {
5648
+ this.userOnSuccess || this.getForm(e)?.submit();
5649
+ }, 500)) : this.userOnSuccess?.({
5844
5650
  transactionId: t.transactionId,
5845
5651
  token: t.token
5846
5652
  });
@@ -5852,7 +5658,7 @@ var { hideSpinner: hi } = Oe(), gi = {
5852
5658
  return this.amount && t.setAmount(this.amount), this.currency && t.setCurrency(this.currency), this.customer && t.setCustomerInfo(this.customer), this.billingAddress && t.setBillingAddress(this.billingAddress), this.order && t.setOrderInfo(this.order), t.setOnValidate(this.userOnValidate), this.applePayProcessor = t, this.applePayProcessor;
5853
5659
  }
5854
5660
  initPayToProcessor(e) {
5855
- return this.log("[initPayToProcessor]", { container: e }), this.payToProcessor ? this.payToProcessor : (this.payToProcessor = new vn(this.log.bind(this), {
5661
+ return this.log("[initPayToProcessor]", { container: e }), this.payToProcessor || (this.payToProcessor = new vn(this.log.bind(this), {
5856
5662
  debug: this.debug,
5857
5663
  environment: this.environment,
5858
5664
  publicKey: this.publicKey,
@@ -5867,10 +5673,10 @@ var { hideSpinner: hi } = Oe(), gi = {
5867
5673
  onFailure: z(this, "[payToProcessor], failure", (e) => {
5868
5674
  this.log("[payToProcessor], failure", e), this.userOnFailure?.({ error: e.error });
5869
5675
  })
5870
- }), this.payToProcessor.setOnValidate(this.userOnValidate), this.payToProcessor);
5676
+ }), this.payToProcessor.setOnValidate(this.userOnValidate)), this.payToProcessor;
5871
5677
  }
5872
5678
  initPaymentMethodProcessor(e) {
5873
- return this.log("[initPaymentMethodProcessor]", { container: e }), this.paymentMethodProcessor ? this.paymentMethodProcessor : (this.paymentMethodProcessor = new li(this.log.bind(this), {
5679
+ return this.log("[initPaymentMethodProcessor]", { container: e }), this.paymentMethodProcessor || (this.paymentMethodProcessor = new li(this.log.bind(this), {
5874
5680
  debug: this.debug,
5875
5681
  environment: this.environment,
5876
5682
  publicKey: this.publicKey,
@@ -5888,7 +5694,7 @@ var { hideSpinner: hi } = Oe(), gi = {
5888
5694
  onValidationStatusChangeCallback: z(this, "[paymentMethodProcessor], ValidationStatusChange", (e, t) => {
5889
5695
  this.log("[paymentMethodProcessor], ValidationStatusChange", e, t), this.userOnValidationStatusChange?.(e, t);
5890
5696
  })
5891
- }), this.initBaseProcessor(this.paymentMethodProcessor), this.paymentMethodProcessor);
5697
+ }), this.initBaseProcessor(this.paymentMethodProcessor)), this.paymentMethodProcessor;
5892
5698
  }
5893
5699
  loadCss() {
5894
5700
  let e = document.createElement("link");
@@ -5934,13 +5740,7 @@ var { hideSpinner: hi } = Oe(), gi = {
5934
5740
  let r = z(this, "[getSubmitFormHandler][handler]", (t) => {
5935
5741
  this.log("[sdk], submitForm", t), t.preventDefault();
5936
5742
  let n = this.getForm(e);
5937
- if (!n?.onsubmit || n.onsubmit(new SubmitEvent("submit"))) {
5938
- if (n && this.getInput(e, "token")?.value) {
5939
- n.submit();
5940
- return;
5941
- }
5942
- window.postMessage({ status: se }, "*");
5943
- }
5743
+ (!n?.onsubmit || n.onsubmit(new SubmitEvent("submit"))) && (n && this.getInput(e, "token")?.value ? n.submit() : window.postMessage({ status: se }, "*"));
5944
5744
  });
5945
5745
  return this._submitFormHandlers[n] = r, r;
5946
5746
  }
@@ -6001,19 +5801,26 @@ var { hideSpinner: hi } = Oe(), gi = {
6001
5801
  fraud: !(r?.clickToPayEnabled !== !1 && s.clickToPayEnabled) && u ? {
6002
5802
  providerId: u.providerId,
6003
5803
  providerType: u.providerType,
6004
- stopPaymentOnFailure: !!u.stopPaymentOnFailure
5804
+ stopPaymentOnFailure: !!u.stopPaymentOnFailure,
5805
+ clientParameters: u.clientParameters || {}
6005
5806
  } : void 0,
6006
5807
  threeDs: !(r?.clickToPayEnabled !== !1 && s.clickToPayEnabled) && c ? {
6007
5808
  providerId: c.providerId,
6008
5809
  providerType: c.providerType,
6009
5810
  cardProviderId: n,
6010
- clientParameters: t.clientParameters || {}
5811
+ clientParameters: {
5812
+ ...t.clientParameters,
5813
+ ...c.clientParameters
5814
+ }
6011
5815
  } : void 0,
6012
5816
  secondaryThreeDs: !(r?.clickToPayEnabled !== !1 && s.clickToPayEnabled) && l ? {
6013
5817
  providerId: l.providerId,
6014
5818
  providerType: l.providerType,
6015
5819
  cardProviderId: n,
6016
- clientParameters: t.clientParameters || {}
5820
+ clientParameters: {
5821
+ ...t.clientParameters,
5822
+ ...l.clientParameters
5823
+ }
6017
5824
  } : void 0
6018
5825
  }
6019
5826
  };
@@ -6075,19 +5882,26 @@ var { hideSpinner: hi } = Oe(), gi = {
6075
5882
  fraud: !(i?.clickToPayEnabled !== !1 && o.clickToPayEnabled) && l ? {
6076
5883
  providerId: l.providerId,
6077
5884
  providerType: l.providerType,
6078
- stopPaymentOnFailure: !!l.stopPaymentOnFailure
5885
+ stopPaymentOnFailure: !!l.stopPaymentOnFailure,
5886
+ clientParameters: l.clientParameters || {}
6079
5887
  } : void 0,
6080
5888
  threeDs: !(i?.clickToPayEnabled !== !1 && o.clickToPayEnabled) && s ? {
6081
5889
  providerId: s.providerId,
6082
5890
  providerType: s.providerType,
6083
5891
  cardProviderId: "",
6084
- clientParameters: t.clientParameters || {}
5892
+ clientParameters: {
5893
+ ...t.clientParameters,
5894
+ ...s.clientParameters
5895
+ }
6085
5896
  } : void 0,
6086
5897
  secondaryThreeDs: !(i?.clickToPayEnabled !== !1 && o.clickToPayEnabled) && c ? {
6087
5898
  providerId: c.providerId,
6088
5899
  providerType: c.providerType,
6089
5900
  cardProviderId: "",
6090
- clientParameters: t.clientParameters || {}
5901
+ clientParameters: {
5902
+ ...t.clientParameters,
5903
+ ...c.clientParameters
5904
+ }
6091
5905
  } : void 0
6092
5906
  }
6093
5907
  };
@@ -6167,19 +5981,26 @@ var { hideSpinner: hi } = Oe(), gi = {
6167
5981
  fraud: !(r?.clickToPayEnabled !== !1 && c.clickToPayEnabled) && c.fraudProviders?.[0] ? {
6168
5982
  providerId: c.fraudProviders[0].providerId,
6169
5983
  providerType: c.fraudProviders[0].providerType,
6170
- stopPaymentOnFailure: !!c.fraudProviders[0].stopPaymentOnFailure
5984
+ stopPaymentOnFailure: !!c.fraudProviders[0].stopPaymentOnFailure,
5985
+ clientParameters: c.fraudProviders[0].clientParameters || {}
6171
5986
  } : void 0,
6172
5987
  threeDs: !(r?.clickToPayEnabled !== !1 && c.clickToPayEnabled) && u ? {
6173
5988
  providerId: u.providerId,
6174
5989
  providerType: u.providerType,
6175
5990
  cardProviderId: r?.cardProviderId || "",
6176
- clientParameters: a.clientParameters || {}
5991
+ clientParameters: {
5992
+ ...a.clientParameters,
5993
+ ...u.clientParameters
5994
+ }
6177
5995
  } : void 0,
6178
5996
  secondaryThreeDs: !(r?.clickToPayEnabled !== !1 && c.clickToPayEnabled) && c.allThreeDsProviders?.[0] ? {
6179
5997
  providerId: c.allThreeDsProviders[0].providerId,
6180
5998
  providerType: c.allThreeDsProviders[0].providerType,
6181
5999
  cardProviderId: r?.cardProviderId || "",
6182
- clientParameters: a.clientParameters || {}
6000
+ clientParameters: {
6001
+ ...a.clientParameters,
6002
+ ...c.allThreeDsProviders[0].clientParameters
6003
+ }
6183
6004
  } : void 0
6184
6005
  }
6185
6006
  }, f = {
@@ -6227,17 +6048,9 @@ var { hideSpinner: hi } = Oe(), gi = {
6227
6048
  let r = e && document.getElementById(e) || null;
6228
6049
  this.initCardProcessor(r).addCard(r, this.getForm(r), s, t, n, d);
6229
6050
  }
6230
- return;
6231
- }
6232
- if (!l && c.hasPaypalProviders) {
6233
- o(Q.paypal) && this.addPaypal(e, t, n, c.paypalProviders[0], f);
6234
- return;
6235
- }
6236
- if (!l && c.hasPayToProviders) {
6237
- o(Q.payto) && this.addPayTo(e, t, c.payToProviders[0], p);
6238
- return;
6239
- }
6240
- if (!l && c.hasBnplProviders && yn[c.bnplProviders[0].providerType]) {
6051
+ } else if (!l && c.hasPaypalProviders) o(Q.paypal) && this.addPaypal(e, t, n, c.paypalProviders[0], f);
6052
+ else if (!l && c.hasPayToProviders) o(Q.payto) && this.addPayTo(e, t, c.payToProviders[0], p);
6053
+ else if (!l && c.hasBnplProviders && yn[c.bnplProviders[0].providerType]) {
6241
6054
  if (c.bnplProviders[0].providerType === "upi") o(Q.upi) && this.addUpi(e, t, c.bnplProviders[0].providerId, r?.upiOptions || {});
6242
6055
  else {
6243
6056
  let r = ui(c.bnplProviders[0].providerType);
@@ -6246,17 +6059,9 @@ var { hideSpinner: hi } = Oe(), gi = {
6246
6059
  ...c.bnplProviders[0].clientParameters
6247
6060
  });
6248
6061
  }
6249
- return;
6250
- }
6251
- if (!l && c.hasGooglePayProviders) {
6252
- o(Q.googlepay) && this.addGooglePay(e, t, n, c.googlePayProviders[0].providerId, g);
6253
- return;
6254
- }
6255
- if (!l && c.hasApplePayProviders && await this.isApplePayAvailable()) {
6256
- o(Q.applepay) && this.addApplePay(e, t, n, v.providerId || "", v);
6257
- return;
6258
- }
6259
- if (l) {
6062
+ } else if (!l && c.hasGooglePayProviders) o(Q.googlepay) && this.addGooglePay(e, t, n, c.googlePayProviders[0].providerId, g);
6063
+ else if (!l && c.hasApplePayProviders && await this.isApplePayAvailable()) o(Q.applepay) && this.addApplePay(e, t, n, v.providerId || "", v);
6064
+ else if (l) {
6260
6065
  let a = () => {
6261
6066
  window.postMessage({
6262
6067
  status: "deactivate",
@@ -6396,11 +6201,7 @@ var { hideSpinner: hi } = Oe(), gi = {
6396
6201
  if (!B(r)) throw this.showErrorMessage(o, "Missing parameter: currency"), this.userOnFailure?.({ error: "Missing parameter: currency" }), TypeError("Missing parameter: currency");
6397
6202
  return r &&= r.toUpperCase(), this._cleanUp(o), this._initForm(o), this.setAmount(n), this.setCurrency(r), this.initProcessors(o, n, r, i || "", "", {}, z(this, "[addPaypal][initProcessors], callback", (e, t) => {
6398
6203
  let s = t.paypalProviders[0] || i || "";
6399
- if (!s) {
6400
- this.showErrorMessage(o, "Missing parameter: Provider Id"), this.userOnFailure?.({ error: "Missing parameter: Provider Id" });
6401
- return;
6402
- }
6403
- this.initPaypalProcessor(o).addPaypal(o, this.getForm(o), n, r, s, a);
6204
+ s ? this.initPaypalProcessor(o).addPaypal(o, this.getForm(o), n, r, s, a) : (this.showErrorMessage(o, "Missing parameter: Provider Id"), this.userOnFailure?.({ error: "Missing parameter: Provider Id" }));
6404
6205
  })), this;
6405
6206
  }
6406
6207
  addPayTo(t, n, r, i) {
@@ -6473,11 +6274,7 @@ var { hideSpinner: hi } = Oe(), gi = {
6473
6274
  }
6474
6275
  addApplePay(e, t, n, r, i) {
6475
6276
  return this.isApplePayAvailable().then(z(this, "[addApplePay], available", (a) => {
6476
- if (!a) {
6477
- this.log("Your browser does not support ApplePay");
6478
- return;
6479
- }
6480
- this.renderApplePay(e, t, n, r, i);
6277
+ a ? this.renderApplePay(e, t, n, r, i) : this.log("Your browser does not support ApplePay");
6481
6278
  })).catch(() => {}), this;
6482
6279
  }
6483
6280
  renderApplePay(t, n, r, i, a) {
@@ -6592,11 +6389,7 @@ var { hideSpinner: hi } = Oe(), gi = {
6592
6389
  if (!e(o)) throw this.showErrorMessage(u, "Missing parameter: amount"), this.userOnFailure?.({ error: "Missing parameter: amount" }), TypeError("Missing parameter: amount");
6593
6390
  if (!B(s)) throw this.showErrorMessage(u, "Missing parameter: currency"), this.userOnFailure?.({ error: "Missing parameter: currency" }), TypeError("Missing parameter: currency");
6594
6391
  return s &&= s.toUpperCase(), this._cleanUp(u), this._initForm(u), this.setAmount(o), this.setCurrency(s), n = Ye(n), this.getPaymentOptions(o, s, z(this, "[addThreeDsWithFullParameters][getPaymentOptions], callback", (e) => {
6595
- if (!e.hasThreeDsProviders) {
6596
- this.log("No 3DS providers found"), this.userOnSuccess?.({});
6597
- return;
6598
- }
6599
- this.add3DsProcessor(u, e.threeDsProviders[0].providerId, e.threeDsProviders[0].providerType, "", {}, z(this, "[addThreeDsWithFullParameters][add3DsProcessor], onload", () => {
6392
+ e.hasThreeDsProviders ? this.add3DsProcessor(u, e.threeDsProviders[0].providerId, e.threeDsProviders[0].providerType, "", e.threeDsProviders[0].clientParameters || {}, z(this, "[addThreeDsWithFullParameters][add3DsProcessor], onload", () => {
6600
6393
  this.threeDsProcessor?.setEmail(a), this.threeDsProcessor?.setPaymentInfo({
6601
6394
  cardNumber: n,
6602
6395
  expiryDate: r,
@@ -6607,7 +6400,7 @@ var { hideSpinner: hi } = Oe(), gi = {
6607
6400
  });
6608
6401
  }), z(this, "[addThreeDsWithFullParameters][add3DsProcessor], onerror", () => {
6609
6402
  this.log(`Cannot load 3DS provider (${e.threeDsProviders[0].providerType})`), this.userOnSuccess?.({});
6610
- }));
6403
+ })) : (this.log("No 3DS providers found"), this.userOnSuccess?.({}));
6611
6404
  })), this;
6612
6405
  }
6613
6406
  tokeniseWith3Ds(t, n, r, i, a, o, s, c, l, u, d) {
@@ -6665,18 +6458,14 @@ var { hideSpinner: hi } = Oe(), gi = {
6665
6458
  if (!e(r)) throw this.userOnFailure?.({ error: "Missing parameter: amount" }), TypeError("Missing parameter: amount");
6666
6459
  if (!B(i)) throw this.userOnFailure?.({ error: "Missing parameter: currency" }), TypeError("Missing parameter: currency");
6667
6460
  return i &&= i.toUpperCase(), this.setAmount(r), this.setCurrency(i), this.initProcessors(null, r, i, "", t, { clickToPayEnabled: !1 }, z(this, "[addThreeDsWithToken][initProcessors], callback", () => {
6668
- if (!this.threeDsProcessor) {
6669
- this.userOnFailure?.({ error: "Cannot load 3DS provider" });
6670
- return;
6671
- }
6672
- this.threeDsProcessor?.setEmail(n), this.threeDsProcessor?.setTokenId(t), this.threeDsProcessor?.threeDSInvoke(null, !!o?.requireChallenge, (e) => {
6461
+ this.threeDsProcessor ? (this.threeDsProcessor?.setEmail(n), this.threeDsProcessor?.setTokenId(t), this.threeDsProcessor?.threeDSInvoke(null, !!o?.requireChallenge, (e) => {
6673
6462
  hi(), this.log("[threeDSInvoke], postAuthData", e), this.userOnSuccess?.({ threeDSServerTransID: e.threeDSServerTransID }), this.threeDsProcessor?.updateTokenExternal3dsData(e.externalThreeDsData);
6674
6463
  }), this.threeDsProcessor?.setPaymentInfo({
6675
6464
  cardNumber: "",
6676
6465
  expiryDate: "",
6677
6466
  cardholder: "",
6678
6467
  ccv: a
6679
- });
6468
+ })) : this.userOnFailure?.({ error: "Cannot load 3DS provider" });
6680
6469
  })), this;
6681
6470
  }
6682
6471
  getPaymentOptions(e, t, n) {
@@ -6719,16 +6508,16 @@ var { hideSpinner: hi } = Oe(), gi = {
6719
6508
  this.httpInvoker?.invoke(_i(this.config.apiUrl, e, r)[gi.PROVIDER_INFO].url + `?amount=${t}&currency=${n}`, _i(this.config.apiUrl, e, r)[gi.PROVIDER_INFO].method, {}, c, s);
6720
6509
  }
6721
6510
  setAmount(e) {
6722
- return Number(e) === Number(this.amount) || Number(e) < 0 ? this : (this.log("[setAmount]", Number(e)), this.amount = Number(e), this.cardProcessor?.setAmount(this.amount), this.threeDsProcessor?.setAmount(this.amount), this.secondaryThreeDsProcessor?.setAmount(this.amount), this.paypalProcessor?.setAmount(this.amount), this.fraudProcessor?.setAmount(this.amount), this.googlePayProcessor?.setAmount(this.amount), this.applePayProcessor?.setAmount(this.amount), this.paymentMethodProcessor?.setAmount(this.amount), window.postMessage({
6511
+ return Number(e) === Number(this.amount) || Number(e) < 0 || (this.log("[setAmount]", Number(e)), this.amount = Number(e), this.cardProcessor?.setAmount(this.amount), this.threeDsProcessor?.setAmount(this.amount), this.secondaryThreeDsProcessor?.setAmount(this.amount), this.paypalProcessor?.setAmount(this.amount), this.fraudProcessor?.setAmount(this.amount), this.googlePayProcessor?.setAmount(this.amount), this.applePayProcessor?.setAmount(this.amount), this.paymentMethodProcessor?.setAmount(this.amount), window.postMessage({
6723
6512
  status: l,
6724
6513
  amount: this.amount
6725
- }, "*"), this);
6514
+ }, "*")), this;
6726
6515
  }
6727
6516
  setCurrency(e) {
6728
- return e === this.currency ? this : (e &&= e.toUpperCase(), this.log("[setCurrency]", e), this.currency = e, this.cardProcessor?.setCurrency(e), this.threeDsProcessor?.setCurrency(e), this.secondaryThreeDsProcessor?.setCurrency(e), this.googlePayProcessor?.setCurrency(e), this.applePayProcessor?.setCurrency(e), this.paymentMethodProcessor?.setCurrency(e), window.postMessage({
6517
+ return e === this.currency || (e &&= e.toUpperCase(), this.log("[setCurrency]", e), this.currency = e, this.cardProcessor?.setCurrency(e), this.threeDsProcessor?.setCurrency(e), this.secondaryThreeDsProcessor?.setCurrency(e), this.googlePayProcessor?.setCurrency(e), this.applePayProcessor?.setCurrency(e), this.paymentMethodProcessor?.setCurrency(e), window.postMessage({
6729
6518
  status: g,
6730
6519
  currency: e
6731
- }, "*"), this);
6520
+ }, "*")), this;
6732
6521
  }
6733
6522
  onSuccess(e) {
6734
6523
  return this.log("[onSuccess]"), this.userOnSuccess = e, this;
@@ -6796,88 +6585,74 @@ var { hideSpinner: hi } = Oe(), gi = {
6796
6585
  return;
6797
6586
  }
6798
6587
  this.initProcessorsHandlers.push(o);
6799
- let s = {}, c = "", l = "", u = !1, d = "", f = "", p = "", m = "", h = !1, g = (e) => {
6588
+ let s = {}, c = "", l = "", u = !1, d = {}, f = "", p = "", m = {}, h = "", g = "", _ = {}, v = !1, y = (e) => {
6800
6589
  this.getProviderInfo(r, t, n, i || "", z(this, "[getProviderInfo], success", (t) => {
6801
- s = { ...t }, !h && t.threeDsProviderId && (d = t.threeDsProviderId, f = t.threeDsProviderType), e();
6590
+ s = { ...t }, !v && t.threeDsProviderId && (f = t.threeDsProviderId, p = t.threeDsProviderType, m = t.threeDsClientParameters || {}), e();
6802
6591
  }), z(this, "[getProviderInfo], error", (t) => {
6803
6592
  this.log("Unable to get provider information", t), e();
6804
6593
  }));
6805
- }, _ = z(this, "[initFraudProcessor]", (e, t, n, r) => {
6806
- if (!e || !t) {
6807
- r();
6808
- return;
6809
- }
6810
- this.addFraudProcessor(e, t, n, {}, z(this, "[addFraudProcessor], success", () => {
6811
- r();
6594
+ }, b = z(this, "[initFraudProcessor]", (e, t, n, r, i) => {
6595
+ !e || !t ? i() : this.addFraudProcessor(e, t, n, r, {}, z(this, "[addFraudProcessor], success", () => {
6596
+ i();
6812
6597
  }), z(this, "[addFraudProcessor], error", () => {
6813
- this.log("Error loading fraud provider", t), r();
6598
+ this.log("Error loading fraud provider", t), i();
6814
6599
  }));
6815
- }), v = z(this, "[initThreeDsProcessor]", (t, n, i) => {
6816
- if (!t || !n) {
6817
- i();
6818
- return;
6819
- }
6820
- this.add3DsProcessor(e, t, n, r, s.clientParameters || {}, z(this, "[add3DsProcessor], success", () => {
6600
+ }), x = z(this, "[initThreeDsProcessor]", (t, n, i) => {
6601
+ !t || !n ? i() : this.add3DsProcessor(e, t, n, r, {
6602
+ ...s.clientParameters,
6603
+ ...m
6604
+ }, z(this, "[add3DsProcessor], success", () => {
6821
6605
  i();
6822
6606
  }), z(this, "[add3DsProcessor], error", () => {
6823
6607
  this.log("Error loading 3ds provider", n), i();
6824
6608
  }));
6825
- }), y = z(this, "[initSecondaryThreeDsProcessor]", (t, n, i) => {
6826
- if (!t || !n) {
6827
- i();
6828
- return;
6829
- }
6830
- this.addSecondary3DsProcessor(e, t, n, r, s.clientParameters || {}, z(this, "[addSecondary3DsProcessor], success", () => {
6609
+ }), S = z(this, "[initSecondaryThreeDsProcessor]", (t, n, i) => {
6610
+ !t || !n ? i() : this.addSecondary3DsProcessor(e, t, n, r, {
6611
+ ...s.clientParameters,
6612
+ ..._
6613
+ }, z(this, "[addSecondary3DsProcessor], success", () => {
6831
6614
  i();
6832
6615
  }), z(this, "[addSecondary3DsProcessor], error", () => {
6833
6616
  this.log("Error loading 3ds provider", n), i();
6834
6617
  }));
6835
- }), b = z(this, "[callCallbackHandlers]", (e, t) => {
6618
+ }), C = z(this, "[callCallbackHandlers]", (e, t) => {
6836
6619
  for (let n of this.initProcessorsHandlers) n(e, t);
6837
6620
  this.initProcessorsHandlers = [];
6838
6621
  });
6839
6622
  this.getPaymentOptions(t, n, z(this, "[getPaymentOptions], callback", (t) => {
6840
- if (a?.createNetworkToken && !a?.tokenAuthenticationEnabled && (t.clickToPayEnabled = !1), t?.clickToPayEnabled && a?.clickToPayEnabled !== !1 && (h = !0), t?.hasNetworkTokenProviders && a?.tokenAuthenticationEnabled && (h = !0), !h && t.hasThreeDsProviders && (d = t.threeDsProviders[0].providerId, f = t.threeDsProviders[0].providerType), !h && t.allThreeDsProviders?.[0]?.providerId && (p = t.allThreeDsProviders[0].providerId, m = t.allThreeDsProviders[0].providerType), !h && t.hasFraudProviders && (c = t.fraudProviders[0].providerId, l = t.fraudProviders[0].providerType, u = t.fraudProviders[0].stopPaymentOnFailure), t.clickToPayEnabled && a?.clickToPayEnabled !== !1 && this.initClickToPayProcessor(e, {
6623
+ a?.createNetworkToken && !a?.tokenAuthenticationEnabled && (t.clickToPayEnabled = !1), t?.clickToPayEnabled && a?.clickToPayEnabled !== !1 && (v = !0), t?.hasNetworkTokenProviders && a?.tokenAuthenticationEnabled && (v = !0), !v && t.hasThreeDsProviders && (f = t.threeDsProviders[0].providerId, p = t.threeDsProviders[0].providerType, m = t.threeDsProviders[0].clientParameters || {}), !v && t.allThreeDsProviders?.[0]?.providerId && (h = t.allThreeDsProviders[0].providerId, g = t.allThreeDsProviders[0].providerType, _ = t.allThreeDsProviders[0].clientParameters || {}), !v && t.hasFraudProviders && (c = t.fraudProviders[0].providerId, l = t.fraudProviders[0].providerType, u = t.fraudProviders[0].stopPaymentOnFailure, d = t.fraudProviders[0].clientParameters || {}), t.clickToPayEnabled && a?.clickToPayEnabled !== !1 && this.initClickToPayProcessor(e, {
6841
6624
  ...t.clickToPayOptions,
6842
6625
  ...a?.clickToPayOptions,
6843
6626
  tokenAuthenticationEnabled: !!a?.tokenAuthenticationEnabled,
6844
6627
  networkTokenOptions: a?.networkTokenOptions
6845
- }), !r && !i) {
6846
- _(c, l, u, () => {
6847
- v(d, f, () => {
6848
- y(p, m, () => {
6849
- b(s, t);
6850
- });
6628
+ }), !r && !i ? b(c, l, u, d, () => {
6629
+ x(f, p, () => {
6630
+ S(h, g, () => {
6631
+ C(s, t);
6851
6632
  });
6852
6633
  });
6853
- return;
6854
- }
6855
- g(() => {
6856
- _(c, l, u, () => {
6857
- v(d, f, () => {
6858
- y(p, m, () => {
6859
- b(s, t);
6634
+ }) : y(() => {
6635
+ b(c, l, u, d, () => {
6636
+ x(f, p, () => {
6637
+ S(h, g, () => {
6638
+ C(s, t);
6860
6639
  });
6861
6640
  });
6862
6641
  });
6863
6642
  });
6864
6643
  }));
6865
6644
  }
6866
- addFraudProcessor(e, t, n, r, i, a) {
6867
- if (this.log("[addFraudProcessor]", e, t, r), !this.amount || !this.currency) {
6868
- this.log("[addFraudProcessor], NOT loaded", {
6869
- amount: this.amount,
6870
- currency: this.currency,
6871
- billingAddress: this.billingAddress,
6872
- customer: this.customer,
6873
- order: this.order
6874
- }), i?.();
6875
- return;
6876
- }
6877
- mi(t).then(z(this, "[addFraudProcessor], onload", (a) => {
6878
- this.log(`Loading ${t}...`, a);
6879
- let o = a.default();
6880
- o?.getFraudCheckData && (this.fraudProcessor = new Ln(this.log.bind(this), {
6645
+ addFraudProcessor(e, t, n, r, i, a, o) {
6646
+ this.log("[addFraudProcessor]", e, t, i), !this.amount || !this.currency ? (this.log("[addFraudProcessor], NOT loaded", {
6647
+ amount: this.amount,
6648
+ currency: this.currency,
6649
+ billingAddress: this.billingAddress,
6650
+ customer: this.customer,
6651
+ order: this.order
6652
+ }), a?.()) : mi(t).then(z(this, "[addFraudProcessor], onload", (o) => {
6653
+ this.log(`Loading ${t}...`, o);
6654
+ let s = o.default(r);
6655
+ s?.getFraudCheckData && (this.fraudProcessor = new Ln(this.log.bind(this), {
6881
6656
  debug: this.debug,
6882
6657
  environment: this.environment,
6883
6658
  publicKey: this.publicKey,
@@ -6885,23 +6660,24 @@ var { hideSpinner: hi } = Oe(), gi = {
6885
6660
  version: Y.version,
6886
6661
  providerId: e,
6887
6662
  stopPaymentOnFailure: n,
6888
- metadata: r,
6889
- getFraudCheckData: o.getFraudCheckData,
6663
+ metadata: i,
6664
+ getFraudCheckData: s.getFraudCheckData,
6890
6665
  onSuccess: (e) => {
6891
6666
  this.log("[fraudProcessor], success", e);
6892
6667
  },
6893
6668
  onFailure: (e) => {
6894
6669
  this.log("[fraudProcessor], failure", e);
6895
6670
  }
6896
- }), this.amount && this.fraudProcessor.setAmount(this.amount), this.currency && this.fraudProcessor.setCurrency(this.currency), this.billingAddress && this.fraudProcessor.setAddressInfo(this.billingAddress), this.customer && this.fraudProcessor.setCustomerInfo(this.customer), this.order && this.fraudProcessor.setOrderInfo(this.order), this.cardProcessor?.addFraudProcessor(this.fraudProcessor), this.paypalProcessor?.addFraudProcessor(this.fraudProcessor), i?.());
6671
+ }), this.amount && this.fraudProcessor.setAmount(this.amount), this.currency && this.fraudProcessor.setCurrency(this.currency), this.billingAddress && this.fraudProcessor.setAddressInfo(this.billingAddress), this.customer && this.fraudProcessor.setCustomerInfo(this.customer), this.order && this.fraudProcessor.setOrderInfo(this.order), this.cardProcessor?.addFraudProcessor(this.fraudProcessor), this.paypalProcessor?.addFraudProcessor(this.fraudProcessor), a?.());
6897
6672
  })).catch(z(this, "[addFraudProcessor], onerror", (e) => {
6898
- this.log(`Error loading ${t}`, e), a?.();
6673
+ this.log(`Error loading ${t}`, e), o?.();
6899
6674
  }));
6900
6675
  }
6901
6676
  resolveThreeDsProvider(e, t) {
6902
6677
  return e?.threeDsProviderId && e?.threeDsProviderType ? {
6903
6678
  providerId: e.threeDsProviderId,
6904
- providerType: e.threeDsProviderType
6679
+ providerType: e.threeDsProviderType,
6680
+ clientParameters: e.threeDsClientParameters
6905
6681
  } : t.threeDsProviders?.find((e) => e.providerId === t.required3dsProvider) || t.threeDsProviders?.[0];
6906
6682
  }
6907
6683
  add3DsProcessor(e, t, n, r, i, a, o) {
@@ -6933,11 +6709,7 @@ var { hideSpinner: hi } = Oe(), gi = {
6933
6709
  }
6934
6710
  }), this.amount && this.threeDsProcessor.setAmount(this.amount), this.currency && this.threeDsProcessor.setCurrency(this.currency), this.billingAddress && this.threeDsProcessor.setAddressInfo(this.billingAddress), this.cardProcessor?.addThreeDsProcessor(this.threeDsProcessor), s.setThreeDsProcessor(this.threeDsProcessor), a?.());
6935
6711
  })).catch(z(this, "[add3DsProcessor], onerror", (s) => {
6936
- if (this.log(`Error loading ${n}`, s), n !== "default") {
6937
- this.add3DsProcessor(e, t, "default", r, i, a, o);
6938
- return;
6939
- }
6940
- o?.();
6712
+ this.log(`Error loading ${n}`, s), n === "default" ? o?.() : this.add3DsProcessor(e, t, "default", r, i, a, o);
6941
6713
  }));
6942
6714
  }
6943
6715
  addSecondary3DsProcessor(e, t, n, r, i, a, o) {
@@ -6969,11 +6741,7 @@ var { hideSpinner: hi } = Oe(), gi = {
6969
6741
  }
6970
6742
  }), this.amount && this.secondaryThreeDsProcessor.setAmount(this.amount), this.currency && this.secondaryThreeDsProcessor.setCurrency(this.currency), this.billingAddress && this.secondaryThreeDsProcessor.setAddressInfo(this.billingAddress), this.cardProcessor?.addSecondaryThreeDsProcessor(this.secondaryThreeDsProcessor), s.setThreeDsProcessor(this.secondaryThreeDsProcessor), a?.());
6971
6743
  })).catch(z(this, "[addSecondary3DsProcessor], onerror", (s) => {
6972
- if (this.log(`Error loading ${n}`, s), n !== "default") {
6973
- this.addSecondary3DsProcessor(e, t, "default", r, i, a, o);
6974
- return;
6975
- }
6976
- o?.();
6744
+ this.log(`Error loading ${n}`, s), n === "default" ? o?.() : this.addSecondary3DsProcessor(e, t, "default", r, i, a, o);
6977
6745
  }));
6978
6746
  }
6979
6747
  preloadClickToPay(e) {