@payfurl/react-plugin 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -0
- package/dist/{DefaultThreeDsProvider-CzqbXEws-C21Rr7_5.js → DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js} +24 -23
- package/dist/{MetricsGlobalThreeDsProvider-B-EQQsEV-BYhakAA4.js → MetricsGlobalThreeDsProvider-C93ttqbB-SRsVMed4.js} +28 -28
- package/dist/{PayWayAppleButton-C-XfcgNS-rgWe-QJM.js → PayWayAppleButton-BzAwlGS--DB5BVl1o.js} +1 -1
- package/dist/components/PayfurlDropin.d.ts +8 -3
- package/dist/{cxpay-VbaQA3_P-DlS7yCqQ.js → cxpay-DblHb5vN-C-l0lncv.js} +1 -1
- package/dist/{default-Diji0SXY-ghmIvhgy.js → default-C7f86Fx--2njdEIN4.js} +1 -1
- package/dist/{ecentric-BlNDCZo_-Bd8Q_3ZG.js → ecentric-B3UohyO_-XSxfe46h.js} +19 -19
- package/dist/{epna-CxmJ_mqR-D4gbP4NT.js → epna-DwUg2IlB-60mxqUE4.js} +1 -1
- package/dist/{flashbanc-BAxvqtBB-DVXrWV0Z.js → flashbanc-LXs8bahL-z2X9avF_.js} +1 -1
- package/dist/forter-CLFaJUYa-0_gstIhb.js +36 -0
- package/dist/{gpayments-B5KWQV4S-QV7caEyB.js → gpayments-DoZug3PV-r91JBiIn.js} +6 -6
- package/dist/{index-CL6hUU-f.js → index-DxOlzt-Z.js} +4344 -3992
- package/dist/index.d.ts +1 -1
- package/dist/metrics_global-BM-ooge--CapUrY7a.js +7 -0
- package/dist/{nmi-Ch7qQ6Av-DbPjmA5v.js → nmi-BA3ZTdQa-DHWaU-52.js} +1 -1
- package/dist/{nuvei-DRmlfpTL-ByeKEnae.js → nuvei-DIWsLlLz-Dnx1Hmez.js} +4 -4
- package/dist/{payabli-CiBJ1-vC-BthvUlRk.js → payabli-DgrTI1Et-aNWdpC9M.js} +1 -1
- package/dist/payfurl-react.es.js +1 -1
- package/dist/payfurl-react.umd.js +19 -19
- package/dist/{payglocal-uAPlijwL-CvGatUVh.js → payglocal-ezp0MsaZ-CA7TeuKm.js} +13 -13
- package/dist/{payway_rest-CjgIP42z-7zwBGwnD.js → payway_rest-D8-T-ULx-Dt-XGc-v.js} +1 -1
- package/dist/{skybank-D7uRF17E-BXng_6yf.js → skybank-BgDLlFXX-BnauHbzw.js} +1 -1
- package/package.json +4 -3
- package/dist/forter-R2alfHeE-C5KHGNgt.js +0 -33
- package/dist/metrics_global-HMMDzPlb-CXHJ1NHy.js +0 -7
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @payfurl/react-plugin
|
|
2
|
+
|
|
3
|
+
The payFURL drop-in for React. `PayfurlDropin` renders payFURL's payment form: cards, Google Pay, Apple
|
|
4
|
+
Pay, PayPal, PayTo and the other payment methods your payFURL account offers. It collects the payment
|
|
5
|
+
details without them touching your servers. It wraps the payFURL Client SDK
|
|
6
|
+
([`@payfurl/client`](https://www.npmjs.com/package/@payfurl/client)), which it includes.
|
|
7
|
+
|
|
8
|
+
Full guide: [React on docs.payfurl.com](https://docs.payfurl.com/client_sdk/frameworks/react).
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @payfurl/react-plugin
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
React 18 is a peer dependency.
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { PayfurlDropin, type SuccessResponseType, type FailureResponseType } from "@payfurl/react-plugin";
|
|
22
|
+
|
|
23
|
+
export function Checkout() {
|
|
24
|
+
return (
|
|
25
|
+
<PayfurlDropin
|
|
26
|
+
environment="sandbox"
|
|
27
|
+
publicKey="<your public key>"
|
|
28
|
+
amount={20}
|
|
29
|
+
currency="AUD"
|
|
30
|
+
onSuccess={(message: SuccessResponseType) => console.log("token", message.token)}
|
|
31
|
+
onFailure={(message: FailureResponseType) => console.error(message.error)}
|
|
32
|
+
onLoaded={() => console.log("drop-in ready")}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Send the token from `onSuccess` to your server and charge it with payFURL's API.
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `environment` | `"sandbox"` or `"production"` | Required |
|
|
45
|
+
| `publicKey` | `string` | Required. Your account's public key |
|
|
46
|
+
| `amount` | `number` | Required. In the currency's major unit (`20` is $20.00) |
|
|
47
|
+
| `currency` | `string` | Required. A 3-letter ISO 4217 code, e.g. `"AUD"` |
|
|
48
|
+
| `options` | `DropInOptionsType` | Optional. See [Drop In UI options](https://docs.payfurl.com/client_sdk/payment_methods/drop_in) |
|
|
49
|
+
| `debug` | `boolean` | Optional. Logs the SDK's activity to the browser console |
|
|
50
|
+
| `successMessage` | `string` | Optional. Shown when the payment details are collected |
|
|
51
|
+
| `customer` | `CustomerInfoType` | Optional, 1.5.0+. The shopper: name, email, phone. See [Customer and order details](https://docs.payfurl.com/client_sdk/use_cases/customer_and_order) |
|
|
52
|
+
| `billingAddress` | `AddressInfoType` | Optional, 1.5.0+. The shopper's billing address |
|
|
53
|
+
| `order` | `OrderInfoType` | Optional, 1.5.0+. The order: items, tax, shipping, discount |
|
|
54
|
+
| `onSuccess` | `(message: SuccessResponseType) => void` | Required. The payment details were collected: `message.token`, or `message.transactionId` for payment methods that complete the payment themselves. In JavaScript without it, the SDK puts the token in a hidden `token` input and submits the `<form>` around the component; with neither, the console warns |
|
|
55
|
+
| `onFailure` | `(message: FailureResponseType) => void` | Required. `message.error`, and `message.errorDetails` when the provider declined |
|
|
56
|
+
| `onLoaded` | `() => void` | Optional (required before 1.5.0). The form, or a payment method's button, is ready |
|
|
57
|
+
| `onValidationStatusChange` | `(status: string, message: string) => void` | Optional (required before 1.5.0). The card form's validation changed |
|
|
58
|
+
| `onValidate` | `() => boolean` | Optional. Return `false` to stop the submission, e.g. while your terms checkbox is unchecked |
|
|
59
|
+
| `onPaymentMethodStatus` | `(status: PaymentMethodStatusType) => void` | Optional, 1.5.0+. A payment method's button rendered, or won't and why. See [Payment method status handler](https://docs.payfurl.com/client_sdk/handlers#payment-method-status-handler) |
|
|
60
|
+
| `onThreeDsProgress` | `(progress: ThreeDsProgressType) => void` | Optional, 1.5.0+. 3-D Secure started, showed a challenge, completed. See [3-D Secure progress handler](https://docs.payfurl.com/client_sdk/handlers#3-d-secure-progress-handler) |
|
|
61
|
+
|
|
62
|
+
3D Secure, fraud checks, Click to Pay and checkout providers use `customer`, `billingAddress` and `order`, so pass
|
|
63
|
+
what you know.
|
|
64
|
+
|
|
65
|
+
## Changing props
|
|
66
|
+
|
|
67
|
+
- **`amount`, `successMessage`, `customer`, `billingAddress`, `order`**: a new value updates the drop-in in place,
|
|
68
|
+
and the shopper keeps what they typed. To change the amount on the fly, change the `amount` prop: the
|
|
69
|
+
component calls the SDK's `setAmount()` for you.
|
|
70
|
+
- **`currency`, `options`**: a new value rebuilds the drop-in. PayPal loads its buttons for one currency.
|
|
71
|
+
- **`environment`, `publicKey`, `debug`**: read once, when the component mounts. The SDK runs one instance per
|
|
72
|
+
page, so switching account or environment takes a page reload.
|
|
73
|
+
- Objects are compared by value: a new object with the same values changes nothing.
|
|
74
|
+
- Handlers, `onValidate` included, are read when they fire, so passing new functions on every render changes
|
|
75
|
+
nothing.
|
|
76
|
+
|
|
77
|
+
Don't call `setAmount()` (or any other SDK method) on your own `import payfurl from "@payfurl/client"`: this
|
|
78
|
+
package includes its own copy of the SDK, so the call doesn't reach the drop-in. Change the props instead.
|
|
79
|
+
|
|
80
|
+
## Types
|
|
81
|
+
|
|
82
|
+
The package re-exports the SDK's types: `DropInOptionsType`, `UpiOptionsType`, `DropInGooglePayOptionsType`,
|
|
83
|
+
`DropInApplePayOptionsType`, `ClickToPayOptionsType`, `NetworkTokenOptionsType`, `SuccessResponseType`,
|
|
84
|
+
`FailureResponseType`, `PaymentMethodStatusType`, `ThreeDsProgressType`, `CustomerInfoType`, `AddressInfoType`
|
|
85
|
+
and `OrderInfoType`.
|
|
86
|
+
|
|
87
|
+
## Support
|
|
88
|
+
|
|
89
|
+
[Documentation](https://docs.payfurl.com/client_sdk/frameworks/react) ·
|
|
90
|
+
[SDK changelog](https://docs.payfurl.com/client_sdk/changelog) ·
|
|
91
|
+
[Support](https://docs.payfurl.com/support)
|
|
92
|
+
|
|
93
|
+
## Changelog
|
|
94
|
+
|
|
95
|
+
What changed in each version of `@payfurl/react-plugin`. Changes to the payment form itself are in the
|
|
96
|
+
[Client SDK changelog](https://docs.payfurl.com/client_sdk/changelog). This changelog starts with version 1.4.0.
|
|
97
|
+
|
|
98
|
+
### 1.5.0
|
|
99
|
+
|
|
100
|
+
#### Added
|
|
101
|
+
|
|
102
|
+
- `onPaymentMethodStatus` and `onThreeDsProgress` props: a payment method's button rendered or won't render
|
|
103
|
+
and why, and 3-D Secure's progress (started, challenge shown, completed).
|
|
104
|
+
- `customer`, `billingAddress` and `order` props: the shopper and the order, which 3-D Secure, fraud checks,
|
|
105
|
+
Click to Pay and checkout providers use. Before, the drop-in had no way to receive them. A changed value
|
|
106
|
+
updates the drop-in in place.
|
|
107
|
+
- The `PaymentMethodStatusType`, `ThreeDsProgressType`, `CustomerInfoType`, `AddressInfoType` and
|
|
108
|
+
`OrderInfoType` types.
|
|
109
|
+
|
|
110
|
+
#### Changed
|
|
111
|
+
|
|
112
|
+
- In JavaScript, leaving out `onSuccess` no longer throws and loses the token: the SDK puts the token in a hidden
|
|
113
|
+
`token` input and submits the `<form>` around the component, and with no form the console warns. Leaving out
|
|
114
|
+
`onFailure` no longer throws either. TypeScript still requires both.
|
|
115
|
+
- A new `environment`, `publicKey` or `debug` no longer re-runs the SDK's `init()`: they are read once, at mount.
|
|
116
|
+
The SDK keeps one instance per page, so it never switched account or environment, and it left the instance
|
|
117
|
+
half-changed. A new `options` object with the same values no longer rebuilds the drop-in.
|
|
118
|
+
- `onLoaded` and `onValidationStatusChange` are optional. Before, TypeScript required them and leaving one out
|
|
119
|
+
in JavaScript threw an error each time it would have been called.
|
|
120
|
+
- Depends on `@payfurl/client` 4.11.0 or later, which adds these handlers.
|
|
121
|
+
|
|
122
|
+
### 1.4.0
|
|
123
|
+
|
|
124
|
+
#### Added
|
|
125
|
+
|
|
126
|
+
- TypeScript types for every prop, from `@payfurl/client`, and the package's own type definitions now load.
|
|
127
|
+
|
|
128
|
+
#### Fixed
|
|
129
|
+
|
|
130
|
+
- `PayfurlDropin` no longer fails when it mounts, and no longer rebuilds the drop-in, losing what the shopper
|
|
131
|
+
typed, each time its parent re-renders. A new `amount` or `successMessage` updates the drop-in in place.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var g = (t, s, e) => s in t ? S(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
3
|
var r = (t, s, e) => g(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import {
|
|
5
|
-
var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" }, k = ["action"],
|
|
4
|
+
import { t as p, A as m, W as T, i as u, h as I, s as v, Z as f, a as y, Q as A, X as l, b as C, g as R, e as P, I as U, c as b, q as w, o as E } from "./index-DxOlzt-Z.js";
|
|
5
|
+
var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" }, k = ["action"], q = ["value"], V = /* @__PURE__ */ v(/* @__PURE__ */ f({
|
|
6
6
|
__name: "ThreeDsChallenge",
|
|
7
7
|
props: {
|
|
8
8
|
threeDSServerTransID: {},
|
|
@@ -11,7 +11,7 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
11
11
|
},
|
|
12
12
|
emits: ["close", "submit"],
|
|
13
13
|
setup(t, { emit: s }) {
|
|
14
|
-
let e = t, a = s,
|
|
14
|
+
let e = t, a = s, o = U(() => E(e.formAction) ? e.formAction : ""), n = b(null), c = JSON.stringify({
|
|
15
15
|
threeDSServerTransID: e.threeDSServerTransID,
|
|
16
16
|
acsTransID: e.acsTransID,
|
|
17
17
|
messageVersion: "2.2.0",
|
|
@@ -20,27 +20,27 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
20
20
|
}), D = encodeURI(window.btoa(c).replace(/=*$/, ""));
|
|
21
21
|
return y(() => {
|
|
22
22
|
var i;
|
|
23
|
-
|
|
24
|
-
}), (i, h) => (
|
|
23
|
+
o.value && ((i = n.value) == null || i.submit());
|
|
24
|
+
}), (i, h) => (w(), A("div", $, [l("div", M, [l("div", L, [
|
|
25
25
|
C(R, {
|
|
26
26
|
onClick: h[0] || (h[0] = (N) => a("close")),
|
|
27
27
|
id: "3ds-challenge-close"
|
|
28
28
|
}),
|
|
29
29
|
h[1] || (h[1] = l("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)),
|
|
30
30
|
l("form", {
|
|
31
|
-
action:
|
|
31
|
+
action: o.value,
|
|
32
32
|
target: "ThreeDsChallengeIFrame",
|
|
33
33
|
method: "post",
|
|
34
34
|
ref_key: "form",
|
|
35
|
-
ref:
|
|
35
|
+
ref: n
|
|
36
36
|
}, [l("input", {
|
|
37
37
|
type: "hidden",
|
|
38
38
|
name: "creq",
|
|
39
39
|
value: P(D)
|
|
40
|
-
}, null, 8,
|
|
40
|
+
}, null, 8, q)], 8, k)
|
|
41
41
|
])])]));
|
|
42
42
|
}
|
|
43
|
-
}), [["__scopeId", "data-v-07081e85"]]),
|
|
43
|
+
}), [["__scopeId", "data-v-07081e85"]]), _ = class {
|
|
44
44
|
constructor() {
|
|
45
45
|
r(this, "iframeId", "threeDsIframeMethod");
|
|
46
46
|
r(this, "containerId", "payfurlContainerFormInvoker");
|
|
@@ -50,18 +50,18 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
50
50
|
createIFrame() {
|
|
51
51
|
this.iframe || (this.container = document.createElement("div"), this.container.id = this.containerId, document.body.appendChild(this.container), this.iframe = document.createElement("iframe"), this.iframe.name = this.iframeId, this.iframe.style.display = "none", this.container.appendChild(this.iframe));
|
|
52
52
|
}
|
|
53
|
-
invoke(t, s, e, a,
|
|
53
|
+
invoke(t, s, e, a, o) {
|
|
54
54
|
var c;
|
|
55
55
|
this.createIFrame();
|
|
56
|
-
let
|
|
57
|
-
|
|
56
|
+
let n = document.createElement("form");
|
|
57
|
+
n.action = t, n.target = this.iframeId, n.method = "post", (c = this.container) == null || c.appendChild(n);
|
|
58
58
|
for (let D in e) {
|
|
59
59
|
let i = document.createElement("input");
|
|
60
|
-
i.type = "hidden", i.name = D, i.value = e[D],
|
|
60
|
+
i.type = "hidden", i.name = D, i.value = e[D], n.appendChild(i);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
n.submit();
|
|
63
63
|
}
|
|
64
|
-
}, { hideSpinner: d, showSpinner: F } = I(),
|
|
64
|
+
}, { hideSpinner: d, showSpinner: F } = I(), H = class {
|
|
65
65
|
constructor(t, s, e) {
|
|
66
66
|
r(this, "log");
|
|
67
67
|
r(this, "container");
|
|
@@ -82,10 +82,10 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
r(this, "onSuccess", (t, s) => {
|
|
85
|
-
var a,
|
|
85
|
+
var a, o;
|
|
86
86
|
this.closeChallenge(), d();
|
|
87
87
|
let e = JSON.parse(s);
|
|
88
|
-
["Y", "A"].includes(e.transStatus) ? (a = this.threeDsProcessor) == null || a.onSuccess(e) : (this.log(`[${this.getType()}]: ${u}`, e), (
|
|
88
|
+
["Y", "A"].includes(e.transStatus) ? (a = this.threeDsProcessor) == null || a.onSuccess(e) : (this.log(`[${this.getType()}]: ${u}`, e), (o = this.threeDsProcessor) == null || o.onError({ error: u }));
|
|
89
89
|
});
|
|
90
90
|
r(this, "onInitAuthSuccess", (t, s) => {
|
|
91
91
|
let e = JSON.parse(s);
|
|
@@ -177,13 +177,14 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
177
177
|
].includes(s.transStatus) && (this.log(`[${this.getType()}]: Failed 3DS Challenge`, t.data), this.onError(400, "Failed 3DS Challenge"));
|
|
178
178
|
}
|
|
179
179
|
setChallengeFrameVisible(t) {
|
|
180
|
-
|
|
180
|
+
var s;
|
|
181
|
+
t && ((s = this.threeDsProcessor) == null || s.challengeShown()), window.self !== window.top && window.parent.postMessage({ status: t ? p : m }, "*");
|
|
181
182
|
}
|
|
182
183
|
doChallenge(t, s, e) {
|
|
183
184
|
this.log(`[${this.getType()}][doChallenge]`), d(), this.setChallengeFrameVisible(!0);
|
|
184
185
|
let { destroy: a } = T({
|
|
185
186
|
el: document.body,
|
|
186
|
-
component:
|
|
187
|
+
component: V,
|
|
187
188
|
props: {
|
|
188
189
|
threeDSServerTransID: this.threeDSServerTransID,
|
|
189
190
|
acsTransID: s,
|
|
@@ -191,9 +192,9 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
191
192
|
authenticationValue: e
|
|
192
193
|
},
|
|
193
194
|
on: { close: () => {
|
|
194
|
-
var
|
|
195
|
+
var o;
|
|
195
196
|
a(), this.threeDSDestroy = () => {
|
|
196
|
-
}, (
|
|
197
|
+
}, (o = this.threeDsProcessor) == null || o.onError({ error: "Challenge cancelled" });
|
|
197
198
|
} }
|
|
198
199
|
});
|
|
199
200
|
this.threeDSDestroy = a;
|
|
@@ -211,9 +212,9 @@ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
|
|
|
211
212
|
threeDSServerTransID: t,
|
|
212
213
|
threeDSMethodNotificationURL: this.options.apiUrl + "/3ds/method_invocation"
|
|
213
214
|
}, a = encodeURI(window.btoa(JSON.stringify(e)).replace(/=*$/, ""));
|
|
214
|
-
new
|
|
215
|
+
new _().invoke(s, "POST", { threeDSMethodData: a });
|
|
215
216
|
}
|
|
216
217
|
};
|
|
217
218
|
export {
|
|
218
|
-
|
|
219
|
+
H as O
|
|
219
220
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
|
-
var _ = (
|
|
3
|
-
var
|
|
4
|
-
import { O as x } from "./DefaultThreeDsProvider-
|
|
5
|
-
import {
|
|
6
|
-
var
|
|
2
|
+
var _ = (h, s, e) => s in h ? L(h, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[s] = e;
|
|
3
|
+
var c = (h, s, e) => _(h, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import { O as x } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
|
|
5
|
+
import { j as d, p as I, W as G, h as N, s as H, Z as F, a as M, k as O, P as k, r as W, Q as Z, X as m, b as j, g as U, c as V, q } from "./index-DxOlzt-Z.js";
|
|
6
|
+
var J = { class: "mask" }, Q = { class: "wrapper" }, R = { class: "container" }, X = /* @__PURE__ */ H(/* @__PURE__ */ F({
|
|
7
7
|
__name: "MetricsGlobalThreeDsChallenge",
|
|
8
8
|
emits: ["close", "submit"],
|
|
9
|
-
setup(
|
|
10
|
-
let e = s, t =
|
|
11
|
-
function i(
|
|
9
|
+
setup(h, { emit: s }) {
|
|
10
|
+
let e = s, t = V(!1);
|
|
11
|
+
function i(n) {
|
|
12
12
|
var r;
|
|
13
|
-
["3DS_CHALLENGE_SHOW", "3DS_CHALLENGE_CLOSE"].includes((r =
|
|
13
|
+
["3DS_CHALLENGE_SHOW", "3DS_CHALLENGE_CLOSE"].includes((r = n.data) == null ? void 0 : r.message) && (t.value = n.data.message === "3DS_CHALLENGE_SHOW");
|
|
14
14
|
}
|
|
15
15
|
return M(() => {
|
|
16
16
|
window.addEventListener("message", i);
|
|
17
17
|
}), O(() => {
|
|
18
18
|
window.removeEventListener("message", i);
|
|
19
|
-
}), (
|
|
19
|
+
}), (n, r) => k((q(), Z("div", J, [m("div", Q, [m("div", R, [j(U, {
|
|
20
20
|
onClick: r[0] || (r[0] = (p) => e("close")),
|
|
21
21
|
id: "3ds-challenge-close"
|
|
22
|
-
}), r[1] || (r[1] = m("div", { id: "ThreeDsChallengeIFrame" }, null, -1))])])], 512)), [[
|
|
22
|
+
}), r[1] || (r[1] = m("div", { id: "ThreeDsChallengeIFrame" }, null, -1))])])], 512)), [[W, t.value]]);
|
|
23
23
|
}
|
|
24
|
-
}), [["__scopeId", "data-v-8a0b6dcb"]]), { hideSpinner: l, showSpinner:
|
|
24
|
+
}), [["__scopeId", "data-v-8a0b6dcb"]]), { hideSpinner: l, showSpinner: $ } = N(), u = 5, B = class extends x {
|
|
25
25
|
constructor(s, e, t) {
|
|
26
26
|
var i;
|
|
27
27
|
super(s, e, t);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
c(this, "gateway");
|
|
29
|
+
c(this, "threeDS");
|
|
30
|
+
c(this, "numAttempts", 0);
|
|
31
31
|
this.initScript(((i = t.clientParameters) == null ? void 0 : i.PublicKey) || "");
|
|
32
32
|
}
|
|
33
33
|
getType() {
|
|
@@ -55,23 +55,23 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
|
|
|
55
55
|
l(), d(this.container, "Payment information is missing");
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
let t = (w = this.threeDsProcessor) == null ? void 0 : w.getAddressInfo(), i = e.expiryDate.length === 4 ? e.expiryDate.slice(2, 4) : "",
|
|
60
|
-
if (!s && (!i || !
|
|
58
|
+
$();
|
|
59
|
+
let t = (w = this.threeDsProcessor) == null ? void 0 : w.getAddressInfo(), i = e.expiryDate.length === 4 ? e.expiryDate.slice(2, 4) : "", n = e.expiryDate.length === 4 ? e.expiryDate.slice(0, 2) : "", [r = "", p = ""] = ((C = e.cardholder) == null ? void 0 : C.split(/\s+/)) || [], A = ((S = this.threeDsProcessor) == null ? void 0 : S.getCurrency()) || "", f = ((b = this.threeDsProcessor) == null ? void 0 : b.getAmount()) || 0;
|
|
60
|
+
if (!s && (!i || !n)) {
|
|
61
61
|
l(), d(this.container, "Card expiry date is invalid"), (E = this.threeDsProcessor) == null || E.onError({ error: "Card expiry date is invalid" });
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
let D = (P = s == null ? void 0 : s.gatewayMetadata) == null ? void 0 : P.billing_id,
|
|
64
|
+
let D = (P = s == null ? void 0 : s.gatewayMetadata) == null ? void 0 : P.billing_id, T = {
|
|
65
65
|
...s ? {
|
|
66
66
|
customerVaultId: s.gatewayTokenId,
|
|
67
67
|
...D ? { billingId: D } : {}
|
|
68
68
|
} : {
|
|
69
69
|
cardNumber: e.cardNumber,
|
|
70
70
|
cardExpMonth: i,
|
|
71
|
-
cardExpYear: String(parseInt(
|
|
71
|
+
cardExpYear: String(parseInt(n, 10) + 2e3)
|
|
72
72
|
},
|
|
73
73
|
currency: A,
|
|
74
|
-
amount:
|
|
74
|
+
amount: f.toFixed(2),
|
|
75
75
|
email: (v = this.threeDsProcessor) == null ? void 0 : v.getEmail(),
|
|
76
76
|
phone: t == null ? void 0 : t.phoneNumber,
|
|
77
77
|
city: t == null ? void 0 : t.city,
|
|
@@ -90,16 +90,16 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
|
|
|
90
90
|
browserScreenWidth: String(screen.width),
|
|
91
91
|
browserTimeZone: String(Math.round((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60)),
|
|
92
92
|
userAgent: navigator.userAgent
|
|
93
|
-
},
|
|
94
|
-
|
|
93
|
+
}, g = this.threeDS.createUI(T);
|
|
94
|
+
g.start("#ThreeDsChallengeIFrame"), g.on("challenge", (a) => {
|
|
95
95
|
this.log(`[${this.getType()}][onChallenge]`, a), l(), this.showChallenge();
|
|
96
|
-
}),
|
|
96
|
+
}), g.on("complete", (a) => {
|
|
97
97
|
var o;
|
|
98
98
|
this.log(`[${this.getType()}][onComplete]`, a), this.removeChallenge(), (o = this.threeDsProcessor) == null || o.onSuccess({ externalThreeDsData: a });
|
|
99
|
-
}),
|
|
99
|
+
}), g.on("failure", (a) => {
|
|
100
100
|
var o;
|
|
101
101
|
this.log(`[${this.getType()}][onFailure]`, a), l(), this.closeChallenge(), (o = this.threeDsProcessor) == null || o.onError({ error: a.message });
|
|
102
|
-
}),
|
|
102
|
+
}), g.on("error", (a) => {
|
|
103
103
|
var o;
|
|
104
104
|
this.log(`[${this.getType()}][error]`, a), l(), this.closeChallenge(), (o = this.threeDsProcessor) == null || o.onError({ error: a.message });
|
|
105
105
|
});
|
|
@@ -119,7 +119,7 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
|
|
|
119
119
|
initChallenge() {
|
|
120
120
|
let { destroy: s } = G({
|
|
121
121
|
el: document.body,
|
|
122
|
-
component:
|
|
122
|
+
component: X,
|
|
123
123
|
on: { close: () => {
|
|
124
124
|
var e;
|
|
125
125
|
this.closeChallenge(), (e = this.threeDsProcessor) == null || e.onError({ error: "Challenge cancelled" });
|
|
@@ -139,5 +139,5 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
export {
|
|
142
|
-
|
|
142
|
+
B as w
|
|
143
143
|
};
|
package/dist/{PayWayAppleButton-C-XfcgNS-rgWe-QJM.js → PayWayAppleButton-BzAwlGS--DB5BVl1o.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
2
|
var g = (t, e, r) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var i = (t, e, r) => g(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { f as b, m as A, l as v } from "./index-
|
|
4
|
+
import { f as b, m as A, l as v } from "./index-DxOlzt-Z.js";
|
|
5
5
|
var l = {
|
|
6
6
|
CHECKOUT: "CHECKOUT",
|
|
7
7
|
CHARGE: "CHARGE"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DropInOptionsType, EnvironmentName, FailureResponseType, SuccessResponseType } from "@payfurl/client";
|
|
1
|
+
import type { AddressInfoType, CustomerInfoType, DropInOptionsType, EnvironmentName, FailureResponseType, OrderInfoType, PaymentMethodStatusType, SuccessResponseType, ThreeDsProgressType } from "@payfurl/client";
|
|
2
2
|
interface PayfurlDropinProps {
|
|
3
3
|
environment: EnvironmentName;
|
|
4
4
|
publicKey: string;
|
|
@@ -7,11 +7,16 @@ interface PayfurlDropinProps {
|
|
|
7
7
|
currency: string;
|
|
8
8
|
successMessage?: string;
|
|
9
9
|
options?: DropInOptionsType;
|
|
10
|
+
customer?: CustomerInfoType;
|
|
11
|
+
billingAddress?: AddressInfoType;
|
|
12
|
+
order?: OrderInfoType;
|
|
10
13
|
onSuccess: (message: SuccessResponseType) => void;
|
|
11
14
|
onFailure: (message: FailureResponseType) => void;
|
|
12
|
-
onLoaded
|
|
13
|
-
onValidationStatusChange
|
|
15
|
+
onLoaded?: () => void;
|
|
16
|
+
onValidationStatusChange?: (status: string, message: string) => void;
|
|
14
17
|
onValidate?: () => boolean;
|
|
18
|
+
onPaymentMethodStatus?: (status: PaymentMethodStatusType) => void;
|
|
19
|
+
onThreeDsProgress?: (progress: ThreeDsProgressType) => void;
|
|
15
20
|
}
|
|
16
21
|
declare const PayfurlDropin: (props: PayfurlDropinProps) => import("react").JSX.Element;
|
|
17
22
|
export default PayfurlDropin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var h = (
|
|
4
|
-
import { O as
|
|
5
|
-
import {
|
|
6
|
-
var A = { class: "mask" }, V = { class: "wrapper" }, F = { class: "container" }, _ = ["action"], R = ["value"],
|
|
2
|
+
var m = (s, e, a) => e in s ? u(s, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[e] = a;
|
|
3
|
+
var h = (s, e, a) => m(s, typeof e != "symbol" ? e + "" : e, a);
|
|
4
|
+
import { O as d } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
|
|
5
|
+
import { W as D, s as g, Z as p, a as S, Q as f, X as n, b as v, g as y, e as T, I, c as C, q as P, o as b } from "./index-DxOlzt-Z.js";
|
|
6
|
+
var A = { class: "mask" }, V = { class: "wrapper" }, F = { class: "container" }, _ = ["action"], R = ["value"], $ = /* @__PURE__ */ g(/* @__PURE__ */ p({
|
|
7
7
|
__name: "ecentric",
|
|
8
8
|
props: {
|
|
9
9
|
threeDSServerTransID: {},
|
|
@@ -12,28 +12,28 @@ var A = { class: "mask" }, V = { class: "wrapper" }, F = { class: "container" },
|
|
|
12
12
|
authenticationValue: {}
|
|
13
13
|
},
|
|
14
14
|
emits: ["close", "submit"],
|
|
15
|
-
setup(
|
|
16
|
-
let a =
|
|
15
|
+
setup(s, { emit: e }) {
|
|
16
|
+
let a = s, l = e, r = I(() => b(a.formAction) ? a.formAction : ""), o = C(null), c = a.authenticationValue;
|
|
17
17
|
return S(() => {
|
|
18
18
|
var i;
|
|
19
19
|
r.value && ((i = o.value) == null || i.submit());
|
|
20
|
-
}), (i,
|
|
21
|
-
y
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}), (i, t) => (P(), f("div", A, [n("div", V, [n("div", F, [
|
|
21
|
+
v(y, { onClick: t[0] || (t[0] = (E) => l("close")) }),
|
|
22
|
+
t[1] || (t[1] = n("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)),
|
|
23
|
+
n("form", {
|
|
24
24
|
action: r.value,
|
|
25
25
|
target: "ThreeDsChallengeIFrame",
|
|
26
26
|
method: "post",
|
|
27
27
|
ref_key: "form",
|
|
28
28
|
ref: o
|
|
29
|
-
}, [
|
|
29
|
+
}, [n("input", {
|
|
30
30
|
type: "hidden",
|
|
31
31
|
name: "PaReq",
|
|
32
32
|
value: T(c)
|
|
33
33
|
}, null, 8, R)], 8, _)
|
|
34
34
|
])])]));
|
|
35
35
|
}
|
|
36
|
-
}), [["__scopeId", "data-v-bdfafa40"]]),
|
|
36
|
+
}), [["__scopeId", "data-v-bdfafa40"]]), x = class extends d {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments);
|
|
39
39
|
h(this, "paResPayload", "");
|
|
@@ -51,16 +51,16 @@ var A = { class: "mask" }, V = { class: "wrapper" }, F = { class: "container" },
|
|
|
51
51
|
authenticationValue: this.paResPayload
|
|
52
52
|
}, this.onSuccess, this.onError);
|
|
53
53
|
}
|
|
54
|
-
doChallenge(e, a,
|
|
54
|
+
doChallenge(e, a, l) {
|
|
55
55
|
this.log(`[${this.getType()}][doChallenge]`), this.setChallengeFrameVisible(!0);
|
|
56
56
|
let { destroy: r } = D({
|
|
57
57
|
el: document.body,
|
|
58
|
-
component:
|
|
58
|
+
component: $,
|
|
59
59
|
props: {
|
|
60
60
|
threeDSServerTransID: this.threeDSServerTransID,
|
|
61
61
|
acsTransID: a,
|
|
62
62
|
formAction: e,
|
|
63
|
-
authenticationValue:
|
|
63
|
+
authenticationValue: l
|
|
64
64
|
},
|
|
65
65
|
on: { close: () => {
|
|
66
66
|
var o;
|
|
@@ -74,9 +74,9 @@ var A = { class: "mask" }, V = { class: "wrapper" }, F = { class: "container" },
|
|
|
74
74
|
this.log(`[${this.getType()}]: 3Ds Challenge complete`, e.data), this.closeChallenge(), this.log(`[${this.getType()}]: cresData`, e.data.cres), e.data.cres ? (this.paResPayload = e.data.cres, this.onPostAuth()) : (this.log(`[${this.getType()}]: Failed 3DS Challenge`, e.data), this.onError(400, "Failed 3DS Challenge"));
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
function
|
|
78
|
-
return new
|
|
77
|
+
function w(s, e, a) {
|
|
78
|
+
return new x(s, e, a);
|
|
79
79
|
}
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
w as default
|
|
82
82
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var u = (t, e, s) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var h = (t, e, s) => u(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { O as g } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
|
|
5
|
+
import { e as m, a as f, s as p } from "./managedOrders-ojoMZ0Ab-B94-Nsp-.js";
|
|
6
|
+
import { d as S, h as D } from "./index-DxOlzt-Z.js";
|
|
7
|
+
var { hideSpinner: O } = D(), T = class extends g {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
h(this, "onDoAuthSuccess", (e, s) => {
|
|
11
|
+
var n;
|
|
12
|
+
let o = JSON.parse(s);
|
|
13
|
+
this.log(`[${this.getType()}][onDoAuthSuccess]`, o);
|
|
14
|
+
let i = ((n = this.options.clientParameters) == null ? void 0 : n.SiteId) || "", a = o.managedOrderToken;
|
|
15
|
+
!a || !m.test(i) ? this.onError(e, "3DS could not be started") : f(i).then(() => {
|
|
16
|
+
let r = !1, d = S(this.container, () => {
|
|
17
|
+
r = !0, this.setChallengeFrameVisible(!0), O();
|
|
18
|
+
});
|
|
19
|
+
p(a, this.container, (l) => {
|
|
20
|
+
d(), r && this.setChallengeFrameVisible(!1), l ? (this.log(`[${this.getType()}]: manageOrder failed`, l), this.onError(400, "3DS failed")) : this.onPostAuth();
|
|
21
|
+
});
|
|
22
|
+
}, (r) => {
|
|
23
|
+
this.log(`[${this.getType()}]: managedOrders.js failed to load`, r), this.onError(400, "3DS could not be started");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getType() {
|
|
28
|
+
return "Forter";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function E(t, e, s) {
|
|
32
|
+
return new T(t, e, s);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
E as default
|
|
36
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var l = Object.defineProperty;
|
|
2
2
|
var o = (r, e, t) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var h = (r, e, t) => o(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { O as u } from "./DefaultThreeDsProvider-
|
|
5
|
-
import {
|
|
4
|
+
import { O as u } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
|
|
5
|
+
import { W as c, o as n, h as d, s as p, Z as g, Q as S, X as a, _ as i, I as D, q as m } from "./index-DxOlzt-Z.js";
|
|
6
6
|
var y = { class: "mask" }, f = { class: "wrapper" }, A = ["src"], C = /* @__PURE__ */ p(/* @__PURE__ */ g({
|
|
7
7
|
__name: "GPayments",
|
|
8
8
|
props: {
|
|
@@ -18,15 +18,15 @@ var y = { class: "mask" }, f = { class: "wrapper" }, A = ["src"], C = /* @__PURE
|
|
|
18
18
|
height: `${e.height || 400}px`
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
return (U,
|
|
21
|
+
return (U, I) => (m(), S("div", y, [a("div", f, [a("div", {
|
|
22
22
|
class: "container",
|
|
23
|
-
style:
|
|
23
|
+
style: i([s(), {
|
|
24
24
|
padding: "0",
|
|
25
25
|
margin: "0"
|
|
26
26
|
}])
|
|
27
|
-
}, [
|
|
27
|
+
}, [a("iframe", {
|
|
28
28
|
src: t.value,
|
|
29
|
-
style:
|
|
29
|
+
style: i(s())
|
|
30
30
|
}, null, 12, A)], 4)])]));
|
|
31
31
|
}
|
|
32
32
|
}), [["__scopeId", "data-v-cf5aa816"]]), { hideSpinner: v } = d(), T = class extends u {
|