@payfurl/react-plugin 1.0.2 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CxPayThreeDsProvider-qI6LA8iK-7hd6hU9V.js → CxPayThreeDsProvider-4BCpCsdK-5y-jJAUH.js} +1 -1
- package/dist/{DefaultThreeDsProvider-BKnpkX8X-Cz7DrRsl.js → DefaultThreeDsProvider-C8FSCo8b-Bifhwxc_.js} +9 -9
- package/dist/{EcentricThreeDsProvider-Dor61dsV-GhDmnDn-.js → EcentricThreeDsProvider-DMFPFtaO-B6oROY8T.js} +19 -19
- package/dist/{EpnaThreeDsProvider-6j4cBf2g-Cd_oxzGb.js → EpnaThreeDsProvider-B5S5hU_--Dsl9eOr2.js} +1 -1
- package/dist/{FlashBancThreeDsProvider-B1IMjfpm-DrqCM_Cb.js → FlashBancThreeDsProvider-luFjZ63i-BySOhThG.js} +1 -1
- package/dist/{GPaymentsThreeDsProvider-PKB94NB4-CNkJLCnl.js → GPaymentsThreeDsProvider-6qulsjP4-CfWQs-AG.js} +9 -9
- package/dist/{MetricsGlobalThreeDsProvider-CkIGiDkd-DUSl24lr.js → MetricsGlobalThreeDsProvider-CMbA70S4-DWNzNSwW.js} +37 -37
- package/dist/{NmiThreeDsProvider-CcMEqhmQ-CFas_kIM.js → NmiThreeDsProvider-CaDEfbnA-DS5gnDcf.js} +1 -1
- package/dist/{NuveiThreeDsProvider-CwXxM_h7-BITQd7Iq.js → NuveiThreeDsProvider-NHowIDoE-_Je2HZn5.js} +19 -19
- package/dist/{PayGLocalThreeDsProvider-sIfhhTia-CvvMuyyq.js → PayGLocalThreeDsProvider-BURFf-eJ-CffD4wbC.js} +13 -13
- package/dist/PayWayAppleButton-Kiqg1nWI-DlAdkLl4.js +157 -0
- package/dist/{PayabliThreeDsProvider-Dbril8Rp-3ZWzXe4X.js → PayabliThreeDsProvider-C6ourY3u-4S5vdBoa.js} +1 -1
- package/dist/{SkyBankThreeDsProvider-C07fNAvi-DkOg-Std.js → SkyBankThreeDsProvider-CocwPgj3-CSQSEtCI.js} +1 -1
- package/dist/{cxpay-CEQ4-BTN-DtdA08b6.js → cxpay-BCOYAnDK-BUEsu20K.js} +1 -1
- package/dist/{default-C_HQSLX4-DWKpaokp.js → default-B9fgGMCu-cvfbDfsL.js} +1 -1
- package/dist/{ecentric-BNc1h8Eo-wq39vDkR.js → ecentric-BdxLq2Fp-DpZS-ORt.js} +1 -1
- package/dist/{epna-B9Y2q1w--DGUu8ZJW.js → epna-VMfQGBHy-Db9GqDwv.js} +1 -1
- package/dist/{flashbanc-C0Ty8vp7-CIVRvn_D.js → flashbanc-C5_gW-Ru-BLtd2df2.js} +1 -1
- package/dist/{gpayments-rnHqXJDK-DoKIhXX0.js → gpayments-ta5TF0Vv-DjYWBYkx.js} +1 -1
- package/dist/{index-C07A5tMl.js → index-CwPndRAR.js} +5951 -5566
- package/dist/{metrics_global-B6yYoxRR-CP7W0f7G.js → metrics_global-B9vt1fuY-B-mFPkPv.js} +1 -1
- package/dist/nmi-7Noaj-hm-C8r_dvJq.js +7 -0
- package/dist/{nuvei-Bh2t9NPs-CeU1te1v.js → nuvei-BfNusJeN-C-yeYE1M.js} +1 -1
- package/dist/{payabli-NfqCrBOu-CjD5Swso.js → payabli-NvcAIz8a-CVrjJnVT.js} +1 -1
- package/dist/payfurl-react.es.js +1 -1
- package/dist/payfurl-react.umd.js +43 -24
- package/dist/{payglocal-D3sg1uGV-zrK77nM8.js → payglocal-XRSVL_Mu-xTaim_K3.js} +1 -1
- package/dist/payway_rest-DYhBIk_r-i9UWjHTv.js +7 -0
- package/dist/{skybank-CrMnPsZ3-Bz6P0PvB.js → skybank-CLI49-PQ-AY_KHOf-.js} +1 -1
- package/dist/src/sdk/types/DropInOptions.type.d.ts +2 -0
- package/dist/src/sdk/types/PaymentType.type.d.ts +15 -0
- package/package.json +2 -2
- package/dist/PayWayAppleButton-BhhFv3LB-C565KkXF.js +0 -141
- package/dist/nmi-2JLTZ129-DlW8mhIU.js +0 -7
- package/dist/payway_rest-B7rIKWt2-BQ72GP3z.js +0 -7
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { M as b, L as v, k as g } from "./index-CwPndRAR.js";
|
|
2
|
+
var A = Object.defineProperty, C = (n, t, e) => t in n ? A(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, i = (n, t, e) => C(n, typeof t != "symbol" ? t + "" : t, e);
|
|
3
|
+
const h = {
|
|
4
|
+
CHECKOUT: "CHECKOUT",
|
|
5
|
+
CHARGE: "CHARGE"
|
|
6
|
+
}, m = (n) => ({
|
|
7
|
+
[h.CHECKOUT]: {
|
|
8
|
+
url: n + "/payment_method/checkout",
|
|
9
|
+
method: "POST"
|
|
10
|
+
},
|
|
11
|
+
[h.CHARGE]: {
|
|
12
|
+
url: n + "/charge/checkout",
|
|
13
|
+
method: "POST"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
class k {
|
|
17
|
+
constructor(t, e, o, a, r, s) {
|
|
18
|
+
i(this, "log"), i(this, "container"), i(this, "button", null), i(this, "validator", null), i(this, "validationError", null), i(this, "providerId"), i(this, "apiUrl"), i(this, "amount"), i(this, "currency"), i(this, "clientParameters"), i(this, "billingAddress", null), i(this, "customer", null), i(this, "order", null), i(this, "buttonId", "apple-pay-payway-button"), i(this, "validatorId", "apple-pay-payway-button-validator"), i(this, "onLoad", () => {
|
|
19
|
+
}), i(this, "onSuccess"), i(this, "onFailure"), i(this, "userOnValidate"), i(this, "httpInvoker", null), this.log = t, this.apiUrl = s.apiUrl, this.container = e || document.body, this.clientParameters = s.clientParameters, this.providerId = s.providerId, this.amount = Number(a), this.currency = r, this.providerId = o, this.onSuccess = s.onSuccess || null, this.onFailure = s.onFailure || null, this.userOnValidate = s.onValidate;
|
|
20
|
+
const c = new b(s.environment, v(s.publicKey));
|
|
21
|
+
this.httpInvoker = new g(s.publicKey, s.version, c), this.init(), setInterval(() => {
|
|
22
|
+
var d;
|
|
23
|
+
if (this.validator) {
|
|
24
|
+
if (((d = this.userOnValidate) == null ? void 0 : d.call(this)) === !1) {
|
|
25
|
+
this.validator.style.display = "block";
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.validator.style.display = "none", this.validationError.style.display = "none";
|
|
29
|
+
}
|
|
30
|
+
}, 1e3);
|
|
31
|
+
}
|
|
32
|
+
draw() {
|
|
33
|
+
const t = () => {
|
|
34
|
+
this.onLoad = () => {
|
|
35
|
+
};
|
|
36
|
+
const e = {
|
|
37
|
+
container: this.buttonId,
|
|
38
|
+
publishableApiKey: this.clientParameters.PublishableApiKey,
|
|
39
|
+
principalAmount: this.amount,
|
|
40
|
+
currency: String(this.currency).toLowerCase(),
|
|
41
|
+
buttonMode: "callback"
|
|
42
|
+
};
|
|
43
|
+
this.log("[createPaymentRequestButton]", e), window.payway.createPaymentRequestButton(e, (o, a) => {
|
|
44
|
+
var r;
|
|
45
|
+
if (this.log("[createPaymentRequestButton]", o, a), o) {
|
|
46
|
+
(r = this.onFailure) == null || r.call(this, o);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.checkout(a.singleUseTokenId);
|
|
50
|
+
}), this.addValidator();
|
|
51
|
+
};
|
|
52
|
+
window.payway ? t() : this.onLoad = t;
|
|
53
|
+
}
|
|
54
|
+
show() {
|
|
55
|
+
this.button && (this.button.style.display = "block");
|
|
56
|
+
}
|
|
57
|
+
hide() {
|
|
58
|
+
this.button && (this.button.style.display = "none");
|
|
59
|
+
}
|
|
60
|
+
init() {
|
|
61
|
+
const t = document.createElement("div");
|
|
62
|
+
t.id = this.buttonId, t.style.position = "relative", this.container.appendChild(t), this.button = t, this.initScript();
|
|
63
|
+
}
|
|
64
|
+
addValidator() {
|
|
65
|
+
var t;
|
|
66
|
+
if (document.getElementById(this.validatorId))
|
|
67
|
+
return;
|
|
68
|
+
const e = document.createElement("div");
|
|
69
|
+
e.id = this.validatorId, e.style.width = "100%", e.style.height = "100%", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.display = "none", (t = this.button) == null || t.appendChild(e), this.validator = e;
|
|
70
|
+
}
|
|
71
|
+
initScript() {
|
|
72
|
+
const t = document.createElement("script");
|
|
73
|
+
t.src = "https://api.payway.com.au/rest/v1/payway.js", t.onload = () => {
|
|
74
|
+
this.onLoad && this.onLoad();
|
|
75
|
+
}, document.head.appendChild(t);
|
|
76
|
+
}
|
|
77
|
+
checkout(t) {
|
|
78
|
+
var e, o, a, r, s, c;
|
|
79
|
+
const d = {
|
|
80
|
+
providerId: this.providerId,
|
|
81
|
+
amount: this.amount,
|
|
82
|
+
currency: this.currency,
|
|
83
|
+
reference: (e = this.order) == null ? void 0 : e.orderNumber,
|
|
84
|
+
options: {
|
|
85
|
+
ProviderToken: t
|
|
86
|
+
},
|
|
87
|
+
customer: {
|
|
88
|
+
firstName: (o = this.customer) == null ? void 0 : o.firstName,
|
|
89
|
+
lastName: (a = this.customer) == null ? void 0 : a.lastName,
|
|
90
|
+
email: (r = this.customer) == null ? void 0 : r.email,
|
|
91
|
+
phone: (s = this.customer) == null ? void 0 : s.phoneNumber,
|
|
92
|
+
billingAddress: this.billingAddress && {
|
|
93
|
+
name: `${this.billingAddress.firstName} ${this.billingAddress.lastName}`,
|
|
94
|
+
addressLine1: this.billingAddress.streetAddress,
|
|
95
|
+
addressLine2: this.billingAddress.streetAddress2,
|
|
96
|
+
suburb: this.billingAddress.city,
|
|
97
|
+
countryCode: this.billingAddress.country,
|
|
98
|
+
postcode: this.billingAddress.postalCode,
|
|
99
|
+
state: this.billingAddress.state
|
|
100
|
+
} || void 0
|
|
101
|
+
},
|
|
102
|
+
items: this.order && this.order.orderItems.map((l) => ({
|
|
103
|
+
name: l.name,
|
|
104
|
+
reference: l.sku,
|
|
105
|
+
quantity: Number(l.quantity),
|
|
106
|
+
amount: Number(l.unitPrice)
|
|
107
|
+
})) || []
|
|
108
|
+
};
|
|
109
|
+
this.log("[PayWayAppleButton][checkout]", d), (c = this.httpInvoker) == null || c.invoke(m(this.apiUrl)[h.CHECKOUT].url, m(this.apiUrl)[h.CHECKOUT].method, JSON.stringify(d), (l, u) => {
|
|
110
|
+
this.log("[PayWayAppleButton][checkout]: successCheckoutHandler", l, u);
|
|
111
|
+
const p = JSON.parse(u), y = JSON.parse(window.atob(p.checkoutData));
|
|
112
|
+
this.log("[PayWayAppleButton][checkout]: decodedData", y), this.charge(y.checkoutId);
|
|
113
|
+
}, (l, u) => {
|
|
114
|
+
var p;
|
|
115
|
+
this.log("[PayWayAppleButton][checkout]: failureCheckoutHandler", l, u);
|
|
116
|
+
const y = JSON.parse(u);
|
|
117
|
+
(p = this.onFailure) == null || p.call(this, { error: y.message });
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
charge(t) {
|
|
121
|
+
var e;
|
|
122
|
+
this.log("[PayWayAppleButton][charge]", { checkoutId: t }), (e = this.httpInvoker) == null || e.invoke(m(this.apiUrl)[h.CHARGE].url, m(this.apiUrl)[h.CHARGE].method, JSON.stringify({ checkoutId: t }), (o, a) => {
|
|
123
|
+
var r;
|
|
124
|
+
this.log("[PayWayAppleButton][charge]: successChargeHandler", o, a);
|
|
125
|
+
const s = JSON.parse(a);
|
|
126
|
+
(r = this.onSuccess) == null || r.call(this, {
|
|
127
|
+
transactionId: s == null ? void 0 : s.chargeId
|
|
128
|
+
});
|
|
129
|
+
}, (o, a) => {
|
|
130
|
+
var r;
|
|
131
|
+
this.log("[PayWayAppleButton][charge]: failureChargeHandler", o, a);
|
|
132
|
+
const s = JSON.parse(a);
|
|
133
|
+
(r = this.onFailure) == null || r.call(this, { error: s.message });
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
redraw() {
|
|
137
|
+
this.button && (this.button.innerHTML = "", this.draw());
|
|
138
|
+
}
|
|
139
|
+
setAmount(t) {
|
|
140
|
+
this.log("[PayWayAppleButton][setAmount]", t), this.amount = t, this.redraw();
|
|
141
|
+
}
|
|
142
|
+
setCurrency(t) {
|
|
143
|
+
this.log("[PayWayAppleButton][setCurrency]", t), this.currency = t, this.redraw();
|
|
144
|
+
}
|
|
145
|
+
setCustomerInfo(t) {
|
|
146
|
+
this.log("[PayWayAppleButton][setCustomerInfo]", t), this.customer = { ...t };
|
|
147
|
+
}
|
|
148
|
+
setBillingAddress(t) {
|
|
149
|
+
this.log("[PayWayAppleButton][setBillingAddress]", t), this.billingAddress = { ...t };
|
|
150
|
+
}
|
|
151
|
+
setOrderInfo(t) {
|
|
152
|
+
this.log("[PayWayAppleButton][setOrderInfo]", t), this.order = { ...t };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
k as PayWayAppleButton
|
|
157
|
+
};
|