@achyutlabsau/vue-payment-gateway 1.0.0-beta.0 → 1.0.0-beta.2
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 +119 -97
- package/dist/PairInstructions-Dt9aD4Qn.js +46 -0
- package/dist/index.js +62 -59
- package/dist/{linkly-DJIQ0uir.js → linkly-C9NDmzIU.js} +157 -157
- package/dist/linkly.js +1 -1
- package/dist/logger-Chsffh2c.js +710 -0
- package/dist/logger.d.ts +4 -1
- package/dist/logger.js +2 -2
- package/dist/mx51-CYfhvzmv.js +621 -0
- package/dist/mx51.js +1 -1
- package/dist/{smartpay-DAyaqvId.js → smartpay-BlPtSJAm.js} +31 -31
- package/dist/smartpay.js +1 -1
- package/dist/{till-payment-ooytbfnP.js → till-payment-DFyssYl7.js} +146 -146
- package/dist/till-payment.js +1 -1
- package/dist/tyro-P_beqaoJ.js +228 -0
- package/dist/tyro.js +1 -1
- package/dist/{valpay-D8GbM2Iv.js → valpay-C31V13Nz.js} +43 -43
- package/dist/valpay.js +1 -1
- package/dist/{worldline-BHzSNXMN.js → worldline-bWeQvvEs.js} +125 -141
- package/dist/worldline.d.ts +0 -12
- package/dist/worldline.js +2 -2
- package/package.json +1 -1
- package/dist/PairInstructions-CzbeFfD_.js +0 -45
- package/dist/logger-c0YCqJje.js +0 -589
- package/dist/mx51-Cx-QU9ms.js +0 -621
- package/dist/tyro-SIziM17_.js +0 -228
package/README.md
CHANGED
|
@@ -1,22 +1,42 @@
|
|
|
1
1
|
# Vue Payment Gateway
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**@achyutlabsau/vue-payment-gateway** is a Vue 3 library that provides unified integration with multiple payment
|
|
4
|
+
terminal providers — in-store EFTPOS terminals and cloud-based payment APIs — behind a small, consistent Vue
|
|
5
|
+
composable API per provider.
|
|
6
|
+
|
|
7
|
+
Full documentation, including a step-by-step guide, install options reference, and per-gateway details, lives in the
|
|
8
|
+
[docs site](https://achyut-labs.github.io/al-pay-npm-pkg/) (or run `npm run docs:dev` locally). This README is a
|
|
9
|
+
quick-reference summary.
|
|
10
|
+
|
|
11
|
+
## Supported Providers
|
|
12
|
+
|
|
13
|
+
| Provider | Type | Composable / Entry |
|
|
14
|
+
| ------------------ | ------------------------ | ---------------------------------- |
|
|
15
|
+
| **Tyro** | In-store EFTPOS (iframe) | `useTyro` (`/tyro`) |
|
|
16
|
+
| **Linkly** | In-store (Linkly Cloud) | `useLinkly` (`/linkly`) |
|
|
17
|
+
| **SmartPay** | In-store (cloud polling) | `useSmartPay` (`/smartpay`) |
|
|
18
|
+
| **Till Payments** | In-store (REST intents) | `useTillPayment` (`/till-payment`) |
|
|
19
|
+
| **MX51 SPI** | In-store (SPI, events) | `useMX51` (`/mx51`) |
|
|
20
|
+
| **ANZ Worldline** | In-store (TimAPI / WASM) | `timApi` (`/worldline`) |
|
|
21
|
+
| **Valpay (Adyen)** | Cloud Terminal API | `useValpay` (`/valpay`) |
|
|
4
22
|
|
|
5
23
|
## Installation
|
|
6
24
|
|
|
7
|
-
To install the library, run the following command:
|
|
8
|
-
|
|
9
25
|
```bash
|
|
10
26
|
npm install @achyutlabsau/vue-payment-gateway
|
|
11
27
|
```
|
|
12
28
|
|
|
13
|
-
|
|
29
|
+
Peer dependencies your app must also install: `@vueuse/core`, `@vueuse/rxjs`, `axios`, `dayjs`, `dexie`, `quasar`,
|
|
30
|
+
`uuid`, `vue`. See [Installation](docs/installation.md) for versions and full setup.
|
|
14
31
|
|
|
15
|
-
|
|
32
|
+
## Plugin Initialization
|
|
16
33
|
|
|
17
|
-
```
|
|
34
|
+
```ts
|
|
35
|
+
import { createApp } from "vue";
|
|
18
36
|
import VuePaymentGateway from "@achyutlabsau/vue-payment-gateway";
|
|
19
37
|
|
|
38
|
+
const app = createApp(App);
|
|
39
|
+
|
|
20
40
|
app.use(VuePaymentGateway, {
|
|
21
41
|
currencyCode: "AUD",
|
|
22
42
|
productName: "Pratham Respos", // Name of your product
|
|
@@ -27,142 +47,144 @@ app.use(VuePaymentGateway, {
|
|
|
27
47
|
posRegisterName: "register-name", // Name of the POS register
|
|
28
48
|
posBusinessName: "business name", // Name of the business using the POS system
|
|
29
49
|
tyroApiKey: "tyro-api-key", // API key for Tyro integration
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
environment: "development", // "development" | "production"
|
|
51
|
+
onReceiptPrint: (receipt, type) => {
|
|
52
|
+
// Unified across every provider — see docs/features/receipts.md
|
|
53
|
+
},
|
|
32
54
|
});
|
|
55
|
+
|
|
56
|
+
app.mount("#app");
|
|
33
57
|
```
|
|
34
58
|
|
|
35
|
-
>
|
|
59
|
+
> Only set the credentials for the providers you actually use — see the [Install Options Reference](docs/installation.md#install-options-reference).
|
|
36
60
|
|
|
37
61
|
## Using the Payment Gateway
|
|
38
62
|
|
|
39
|
-
|
|
63
|
+
Provider composables are **not** identical — method names mirror each vendor's own terminology rather than being
|
|
64
|
+
forced into one generic shape, because the underlying protocols differ (event-driven SPI vs. cloud polling vs. an
|
|
65
|
+
iframe SDK). SmartPay, Till Payments and Valpay have converged on a shared `PaymentTerminal` contract
|
|
66
|
+
(`pair` / `unpair` / `isPaired` / `purchase` / `refund`); Tyro, Linkly, MX51 and Worldline still expose their own
|
|
67
|
+
surface. See [Transaction Processing](docs/features/transactions.md) for the full per-provider reference, and
|
|
68
|
+
[migration-v1.md](docs/migration-v1.md) if you're upgrading from a pre-1.0 release.
|
|
40
69
|
|
|
41
|
-
###
|
|
70
|
+
### SmartPay, Till Payments, Valpay (shared contract)
|
|
42
71
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
import { useTyro } from "@achyutlabsau/vue-payment-gateway/tyro";
|
|
47
|
-
|
|
48
|
-
const tyro = useTyro();
|
|
49
|
-
|
|
50
|
-
// Example usage
|
|
51
|
-
await tyro.processPayment(amount, options);
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Using SmartPay
|
|
55
|
-
|
|
56
|
-
To use the SmartPay payment gateway, import and initialize it as shown below:
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
72
|
+
```ts
|
|
59
73
|
import { useSmartPay } from "@achyutlabsau/vue-payment-gateway/smartpay";
|
|
60
74
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
// Example usage
|
|
64
|
-
await smartPay.processPayment(amount, options);
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Using Linkly
|
|
75
|
+
const smartpay = useSmartPay();
|
|
68
76
|
|
|
69
|
-
|
|
77
|
+
await smartpay.pair({ pairingCode: "123456" });
|
|
78
|
+
smartpay.isPaired(); // boolean
|
|
70
79
|
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
const res = await smartpay.purchase(1000); // $10.00, amounts are in cents
|
|
81
|
+
// res.success, res.status, res.amount, res.tipAmount, res.maskedCard, res.cardScheme, res.receipts
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// Example usage
|
|
77
|
-
await linkly.processPayment(amount, options);
|
|
83
|
+
await smartpay.refund(1000);
|
|
84
|
+
smartpay.unpair();
|
|
78
85
|
```
|
|
79
86
|
|
|
80
|
-
|
|
87
|
+
`useTillPayment()` and `useValpay()` follow the same `pair`/`unpair`/`isPaired`/`purchase`/`refund` shape and both
|
|
88
|
+
resolve with the same `PaymentResult`. Till and Valpay additionally support **referenced (linked) refunds** via
|
|
89
|
+
`refund(cents, { originalTransactionId })`.
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
### Tyro
|
|
83
92
|
|
|
84
|
-
```
|
|
85
|
-
import {
|
|
93
|
+
```ts
|
|
94
|
+
import { useTyro } from "@achyutlabsau/vue-payment-gateway/tyro";
|
|
86
95
|
|
|
87
|
-
const
|
|
96
|
+
const tyro = useTyro();
|
|
88
97
|
|
|
89
|
-
|
|
90
|
-
const { success, terminals } = await valpay.getConnectedTerminals();
|
|
98
|
+
await tyro.pairTyro(merchantId, terminalId);
|
|
91
99
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
10050, // Amount in minor units (100.50)
|
|
95
|
-
"AUD", // Currency code
|
|
96
|
-
"V400m-324688179", // Terminal ID (POIID)
|
|
97
|
-
"transaction-12345", // Transaction ID
|
|
98
|
-
"POSSystemID12345", // Sale ID
|
|
99
|
-
);
|
|
100
|
+
const res = await tyro.initiateTyroPurchase({ integratedReceipt: true, amount: "1000" }, receiptCallback);
|
|
101
|
+
// res.result is a TyroTransactionStatus, e.g. "APPROVED"
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
const cancelResult = await valpay.cancelPayment("MerchantAbort");
|
|
103
|
+
await tyro.initiateTyroRefund({ integratedReceipt: true, amount: "1000" }, receiptCallback);
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
### Linkly
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
```ts
|
|
109
|
+
import { useLinkly, ReceiptAutoPrint } from "@achyutlabsau/vue-payment-gateway/linkly";
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
const linkly = useLinkly();
|
|
110
112
|
|
|
111
|
-
|
|
113
|
+
await linkly.pairPinpad({ username, password, pairCode: "123456" });
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
const res = await linkly.initiatePurchase({
|
|
116
|
+
AmtPurchase: 1000,
|
|
117
|
+
ReceiptAutoPrint: ReceiptAutoPrint.ReturnToPOS,
|
|
118
|
+
});
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
// Referenced (linked) refund — pass the original purchase's RFN:
|
|
121
|
+
await linkly.initiateRefund({
|
|
122
|
+
AmtPurchase: 1000,
|
|
123
|
+
ReceiptAutoPrint: ReceiptAutoPrint.ReturnToPOS,
|
|
124
|
+
referenceNumber: rfn,
|
|
125
|
+
});
|
|
126
|
+
```
|
|
117
127
|
|
|
118
|
-
###
|
|
128
|
+
### MX51 SPI
|
|
119
129
|
|
|
120
|
-
|
|
130
|
+
MX51 is event-driven: `initiatePurchase`/`initiateRefund` start the flow but resolve with `void`. Subscribe to the
|
|
131
|
+
`TxFlowStateChanged` document event (or use the bundled `TransactionDialog`) to observe the outcome. See
|
|
132
|
+
[Transaction Processing](docs/features/transactions.md#mx51-spi).
|
|
121
133
|
|
|
122
|
-
###
|
|
134
|
+
### ANZ Worldline (TimAPI)
|
|
123
135
|
|
|
124
|
-
|
|
136
|
+
Worldline is driven directly through the `timApi` instance rather than a composable:
|
|
125
137
|
|
|
126
|
-
|
|
138
|
+
```ts
|
|
139
|
+
import { timApi } from "@achyutlabsau/vue-payment-gateway/worldline";
|
|
127
140
|
|
|
128
|
-
|
|
141
|
+
timApi.actionPurchase(1000); // cents
|
|
142
|
+
timApi.actionRefund(1000); // unreferenced (standalone) refund
|
|
143
|
+
timApi.actionRefund(1000, lastTransactionSeq); // referenced (linked) refund
|
|
144
|
+
```
|
|
129
145
|
|
|
130
|
-
|
|
146
|
+
## Checking Pairing Status
|
|
131
147
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
...
|
|
135
|
-
environment: "production", // Set to 'production' in a live environment
|
|
136
|
-
});
|
|
137
|
-
```
|
|
148
|
+
```ts
|
|
149
|
+
import { isPaymentGatewayConnected, PaymentGateways } from "@achyutlabsau/vue-payment-gateway";
|
|
138
150
|
|
|
139
|
-
|
|
151
|
+
isPaymentGatewayConnected(PaymentGateways.Linkly); // reads linkly.pairConfig from localStorage
|
|
152
|
+
```
|
|
140
153
|
|
|
141
|
-
|
|
154
|
+
## Logging
|
|
142
155
|
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
Every provider logs through one shared, IndexedDB-backed logger (`./logger` subpath) — persistent across reloads,
|
|
157
|
+
attributable to a gateway, correlated by transaction, and with secrets/PANs redacted centrally. See
|
|
158
|
+
[Logging](docs/features/logging.md) for configuration, the `LogViewer` component, and how to query/export logs.
|
|
145
159
|
|
|
146
|
-
|
|
160
|
+
## Shared Utilities
|
|
147
161
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
```ts
|
|
163
|
+
import {
|
|
164
|
+
toCents,
|
|
165
|
+
toMajorUnits,
|
|
166
|
+
formatCents,
|
|
167
|
+
maskPan,
|
|
168
|
+
normalizeCardScheme,
|
|
169
|
+
CardScheme,
|
|
170
|
+
} from "@achyutlabsau/vue-payment-gateway/utils";
|
|
156
171
|
```
|
|
157
172
|
|
|
173
|
+
Available from the root entry too, alongside `generateTransactionId()`, `setState()`, and `setCurrencyCode()`.
|
|
174
|
+
|
|
158
175
|
## Troubleshooting
|
|
159
176
|
|
|
160
|
-
- **
|
|
161
|
-
|
|
162
|
-
- **
|
|
177
|
+
- **"Plugin not initialized" errors** — provider composables throw if called before `app.use(VuePaymentGateway, …)`
|
|
178
|
+
has run. Call `use*` inside components/handlers, not at module load time.
|
|
179
|
+
- **Environment issues** — make sure `environment` is set correctly (`"development"` or `"production"`); it selects
|
|
180
|
+
each provider's SDK/endpoint URLs.
|
|
181
|
+
- **Invalid API key** — confirm the provider's API key/merchant credentials are set in the plugin options.
|
|
182
|
+
- **Diagnosing a failed transaction** — check the [Logging](docs/features/logging.md) guide; every gateway's request,
|
|
183
|
+
response and retry history is queryable through `logger.query()` or the `LogViewer` component.
|
|
163
184
|
|
|
164
185
|
## Additional Resources
|
|
165
186
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
187
|
+
- [Full documentation](docs/index.md)
|
|
188
|
+
- [Changelog](CHANGELOG.md)
|
|
189
|
+
- [Migration guide (pre-1.0 → v1)](docs/migration-v1.md)
|
|
190
|
+
- [Achyutlabs](https://achyutlabs.com/)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { t as e } from "./PBtn-B_JOD69N.js";
|
|
2
|
+
import { a as t, c as n, l as r } from "./logger-Chsffh2c.js";
|
|
3
|
+
import { Fragment as i, createBlock as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, openBlock as u, renderList as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
|
|
4
|
+
import { QCard as h, QIcon as g } from "quasar";
|
|
5
|
+
//#region src/components/PairInstructions.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var _ = { class: "mb-8 space-y-4" }, v = { class: "flex items-center justify-center" }, y = { class: "mb-8 space-y-4" }, b = { class: "h-8 w-8 bg-gray-100 font-semibold dark:bg-gray-700 flex shrink-0 items-center justify-center rounded-full" }, x = { class: "text-gray-700 dark:text-gray-200" }, S = { class: "mb-6 space-x-3 rounded-lg bg-amber-50 p-4 text-base dark:bg-slate-700 flex items-start" }, C = { class: "flex justify-end" }, w = /* @__PURE__ */ l({
|
|
7
|
+
__name: "PairInstructions",
|
|
8
|
+
props: { steps: {} },
|
|
9
|
+
emits: ["next"],
|
|
10
|
+
setup(l) {
|
|
11
|
+
return (w, T) => (u(), a(p(h), {
|
|
12
|
+
class: "rounded-lg p-6",
|
|
13
|
+
flat: "",
|
|
14
|
+
bordered: ""
|
|
15
|
+
}, {
|
|
16
|
+
default: m(() => [
|
|
17
|
+
s("div", _, [
|
|
18
|
+
s("div", v, [c(p(g), {
|
|
19
|
+
name: p(n),
|
|
20
|
+
size: "4rem",
|
|
21
|
+
class: "text-primary"
|
|
22
|
+
}, null, 8, ["name"])]),
|
|
23
|
+
T[1] ||= s("h2", { class: "text-2xl !font-medium text-center" }, "Terminal Setup Instructions", -1),
|
|
24
|
+
T[2] ||= s("p", { class: "text-base text-gray-600 dark:text-gray-200 text-center" }, " Please follow these steps to pair your terminal ", -1)
|
|
25
|
+
]),
|
|
26
|
+
s("ul", y, [(u(!0), o(i, null, d(l.steps, (e, t) => (u(), o("li", {
|
|
27
|
+
key: t,
|
|
28
|
+
class: "space-x-3 text-base flex flex-nowrap items-center"
|
|
29
|
+
}, [s("span", b, f(t + 1), 1), s("span", x, f(e), 1)]))), 128))]),
|
|
30
|
+
s("div", S, [c(p(g), {
|
|
31
|
+
name: p(r),
|
|
32
|
+
size: "md",
|
|
33
|
+
class: "mt-0.5 text-amber-500 dark:text-white"
|
|
34
|
+
}, null, 8, ["name"]), T[3] ||= s("div", { class: "flex-1" }, [s("div", { class: "font-medium text-amber-800 dark:text-white" }, "Important Note"), s("div", { class: "text-amber-700 dark:text-gray-300" }, " Please refer to your terminal guide for the most up-to-date instructions. ")], -1)]),
|
|
35
|
+
s("div", C, [c(e, {
|
|
36
|
+
"icon-right": p(t),
|
|
37
|
+
label: "Next",
|
|
38
|
+
onClick: T[0] ||= (e) => w.$emit("next")
|
|
39
|
+
}, null, 8, ["icon-right"])])
|
|
40
|
+
]),
|
|
41
|
+
_: 1
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { w as t };
|
package/dist/index.js
CHANGED
|
@@ -1,89 +1,92 @@
|
|
|
1
1
|
import { c as e, l as t, n, o as r, s as i } from "./PBtn-B_JOD69N.js";
|
|
2
|
-
import { a,
|
|
3
|
-
import { f
|
|
4
|
-
import { CardScheme as
|
|
5
|
-
import { a as
|
|
6
|
-
import { o as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { createBlock as
|
|
12
|
-
import { useEventListener as
|
|
2
|
+
import { D as a, E as o, T as s, h as c, p as l, t as u, x as d } from "./logger-Chsffh2c.js";
|
|
3
|
+
import { f, m as p } from "./mx51-CYfhvzmv.js";
|
|
4
|
+
import { CardScheme as m, formatCents as h, generateTransactionId as g, maskPan as _, normalizeCardScheme as v, toCents as y, toMajorUnits as b } from "./utils.js";
|
|
5
|
+
import { a as x, i as S, r as C } from "./worldline-bWeQvvEs.js";
|
|
6
|
+
import { o as w, t as T } from "./tyro-P_beqaoJ.js";
|
|
7
|
+
import { t as E } from "./linkly-C9NDmzIU.js";
|
|
8
|
+
import { t as D } from "./smartpay-BlPtSJAm.js";
|
|
9
|
+
import { t as O } from "./till-payment-DFyssYl7.js";
|
|
10
|
+
import { t as k } from "./valpay-C31V13Nz.js";
|
|
11
|
+
import { createBlock as A, createCommentVNode as j, createElementBlock as M, defineComponent as N, openBlock as P, unref as F } from "vue";
|
|
12
|
+
import { useEventListener as I, useScriptTag as L } from "@vueuse/core";
|
|
13
13
|
//#region src/plugin/types.ts
|
|
14
|
-
var
|
|
14
|
+
var R = /* @__PURE__ */ function(e) {
|
|
15
15
|
return e.MERCHANT_COPY = "MERCHANT_COPY", e.CUSTOMER_COPY = "CUSTOMER_COPY", e.SIGNATURE_RECEIPT = "SIGNATURE_RECEIPT", e;
|
|
16
|
-
}({}),
|
|
17
|
-
function
|
|
16
|
+
}({}), z = c.child({ gateway: a.Plugin });
|
|
17
|
+
function B(e) {
|
|
18
18
|
let t = (e.environment ?? "development") === "development";
|
|
19
|
-
|
|
20
|
-
level: t ?
|
|
19
|
+
c.configure({
|
|
20
|
+
level: t ? o.Debug : o.Info,
|
|
21
21
|
consoleMirror: t,
|
|
22
22
|
...e.logging
|
|
23
|
-
}),
|
|
23
|
+
}), c.rotate();
|
|
24
|
+
try {
|
|
25
|
+
indexedDB?.deleteDatabase(d);
|
|
26
|
+
} catch {}
|
|
24
27
|
}
|
|
25
|
-
function
|
|
28
|
+
function V(e) {
|
|
26
29
|
let t = (t, n) => {
|
|
27
|
-
|
|
30
|
+
z.debug(s.ReceiptEmit, `Emitting ${n} receipt`, {
|
|
28
31
|
type: n,
|
|
29
32
|
length: t?.length ?? 0,
|
|
30
33
|
handled: !!e.onReceiptPrint
|
|
31
34
|
}), e.onReceiptPrint && e.onReceiptPrint(t, n);
|
|
32
35
|
}, n = (e) => {
|
|
33
36
|
let n = e.detail;
|
|
34
|
-
if (n.AwaitingSignatureCheck) t(n.SignatureRequiredMessage._receiptToSign,
|
|
37
|
+
if (n.AwaitingSignatureCheck) t(n.SignatureRequiredMessage._receiptToSign, R.SIGNATURE_RECEIPT);
|
|
35
38
|
else if (n.Finished) {
|
|
36
39
|
let e = n?.Response?.Data;
|
|
37
|
-
e?.merchant_receipt && !e?.merchant_receipt_printed && t(e.merchant_receipt,
|
|
40
|
+
e?.merchant_receipt && !e?.merchant_receipt_printed && t(e.merchant_receipt, R.MERCHANT_COPY), e?.customer_receipt && !e?.customer_receipt_printed && t(e.customer_receipt, R.CUSTOMER_COPY);
|
|
38
41
|
}
|
|
39
42
|
}, r = (e) => {
|
|
40
43
|
let { data: n, event: r } = e.detail;
|
|
41
44
|
if (r.exception) {
|
|
42
|
-
|
|
45
|
+
z.error(s.ReceiptEmit, "Worldline TimApi receipt error", { exception: r.exception });
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
n?.printData?.receipts && Array.isArray(n.printData.receipts) && n.printData.receipts.forEach((e) => {
|
|
46
49
|
let n = {
|
|
47
|
-
[timapi.constants.Recipient.cardholder]:
|
|
48
|
-
[timapi.constants.Recipient.merchant]:
|
|
49
|
-
}[e.recipient] ||
|
|
50
|
+
[timapi.constants.Recipient.cardholder]: R.CUSTOMER_COPY,
|
|
51
|
+
[timapi.constants.Recipient.merchant]: R.MERCHANT_COPY
|
|
52
|
+
}[e.recipient] || R.CUSTOMER_COPY;
|
|
50
53
|
t(e.value, n);
|
|
51
54
|
});
|
|
52
55
|
};
|
|
53
|
-
|
|
56
|
+
I(document, "TxFlowStateChanged", n), I(document, x.TxnCompleted, r), I(document, x.BalanceCompleted, r);
|
|
54
57
|
}
|
|
55
|
-
function
|
|
58
|
+
function H(e) {
|
|
56
59
|
try {
|
|
57
|
-
|
|
60
|
+
p.SetPosInfo(e.productVendorName, e.productVersion), p.SetDeviceApiKey(e.mx51DeviceApiKey), p.Start(), z.info(s.SdkInit, "MX51 SPI initialized");
|
|
58
61
|
} catch (e) {
|
|
59
|
-
|
|
62
|
+
z.error(s.SdkInitFailed, "Failed to initialize MX51 SPI", { error: e });
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
|
-
function
|
|
65
|
+
function U(e) {
|
|
63
66
|
try {
|
|
64
|
-
|
|
67
|
+
S.setInfo({
|
|
65
68
|
posId: "T1",
|
|
66
69
|
posName: e.productName,
|
|
67
70
|
posVendorName: e.productVendorName,
|
|
68
71
|
posVersion: e.productVersion,
|
|
69
72
|
integratorId: "3F507ED1-98C5-4CBF-A595-BFA5C34BC76C"
|
|
70
|
-
}),
|
|
73
|
+
}), S.Start(), z.info(s.SdkInit, "Worldline TimApi initialized");
|
|
71
74
|
} catch (e) {
|
|
72
|
-
|
|
75
|
+
z.error(s.SdkInitFailed, "Failed to initialize Worldline TimApi", { error: e });
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
function
|
|
76
|
-
t(n), n.environment && e(n.environment),
|
|
78
|
+
function W(n) {
|
|
79
|
+
t(n), n.environment && e(n.environment), L(w(n.environment)), H(n), U(n);
|
|
77
80
|
}
|
|
78
|
-
var
|
|
81
|
+
var G = { install: (e, t) => {
|
|
79
82
|
if (!t) throw Error("Payment terminal plugin requires options");
|
|
80
|
-
|
|
83
|
+
B(t), V(t), W(t), i(t.currencyCode || "AUD"), r.value = !0, z.info(s.SdkInit, "Payment gateway plugin initialized", {
|
|
81
84
|
environment: t.environment ?? "development",
|
|
82
85
|
currencyCode: t.currencyCode || "AUD",
|
|
83
86
|
product: t.productName,
|
|
84
87
|
version: t.productVersion
|
|
85
88
|
});
|
|
86
|
-
} },
|
|
89
|
+
} }, K = { class: "" }, q = /* @__PURE__ */ N({
|
|
87
90
|
__name: "PairingInterface",
|
|
88
91
|
props: {
|
|
89
92
|
gateway: {},
|
|
@@ -95,45 +98,45 @@ var W = { install: (e, t) => {
|
|
|
95
98
|
let r = t, i = (e, t) => {
|
|
96
99
|
r("pairing-success", e, t);
|
|
97
100
|
};
|
|
98
|
-
return (t, r) => (
|
|
99
|
-
e.gateway ===
|
|
101
|
+
return (t, r) => (P(), M("div", K, [
|
|
102
|
+
e.gateway === F(n).Tyro ? (P(), A(F(T), {
|
|
100
103
|
key: 0,
|
|
101
104
|
"merchant-id": e.merchantId
|
|
102
|
-
}, null, 8, ["merchant-id"])) :
|
|
103
|
-
e.gateway ===
|
|
104
|
-
e.gateway ===
|
|
105
|
+
}, null, 8, ["merchant-id"])) : j("", !0),
|
|
106
|
+
e.gateway === F(n).MX51 ? (P(), A(F(f), { key: 1 })) : j("", !0),
|
|
107
|
+
e.gateway === F(n).Linkly ? (P(), A(F(E), {
|
|
105
108
|
key: 2,
|
|
106
|
-
onPairingSuccess: r[0] ||= (e) => i(e,
|
|
107
|
-
})) :
|
|
108
|
-
e.gateway ===
|
|
109
|
-
e.gateway ===
|
|
110
|
-
e.gateway ===
|
|
111
|
-
e.gateway ===
|
|
109
|
+
onPairingSuccess: r[0] ||= (e) => i(e, F(n).Linkly)
|
|
110
|
+
})) : j("", !0),
|
|
111
|
+
e.gateway === F(n).ANZ ? (P(), A(C, { key: 3 })) : j("", !0),
|
|
112
|
+
e.gateway === F(n).TillPayment ? (P(), A(F(O), { key: 4 })) : j("", !0),
|
|
113
|
+
e.gateway === F(n).SmartPay ? (P(), A(F(D), { key: 5 })) : j("", !0),
|
|
114
|
+
e.gateway === F(n).ADYEN ? (P(), A(F(k), {
|
|
112
115
|
key: 6,
|
|
113
116
|
"merchant-id": e.merchantId,
|
|
114
117
|
"account-id": e.accountId
|
|
115
|
-
}, null, 8, ["merchant-id", "account-id"])) :
|
|
118
|
+
}, null, 8, ["merchant-id", "account-id"])) : j("", !0)
|
|
116
119
|
]));
|
|
117
120
|
}
|
|
118
|
-
}),
|
|
121
|
+
}), J = (e) => {
|
|
119
122
|
let t = localStorage.getItem(e);
|
|
120
123
|
if (!t) return null;
|
|
121
124
|
try {
|
|
122
125
|
return JSON.parse(t);
|
|
123
126
|
} catch (n) {
|
|
124
|
-
return
|
|
127
|
+
return c.child({ gateway: a.Core }).warn(s.LoggerError, `Could not parse localStorage key "${e}"`, { error: n }), t;
|
|
125
128
|
}
|
|
126
|
-
},
|
|
129
|
+
}, Y = (e) => {
|
|
127
130
|
switch (e) {
|
|
128
131
|
case n.ANZ: return localStorage.getItem("timapi.isTerminalPaired") === "true";
|
|
129
|
-
case n.Linkly: return !!
|
|
130
|
-
case n.Tyro: return !!
|
|
131
|
-
case n.TillPayment: return !!
|
|
132
|
-
case n.SmartPay: return !!
|
|
132
|
+
case n.Linkly: return !!J("linkly.pairConfig")?.isPaired;
|
|
133
|
+
case n.Tyro: return !!J("tyro.pairConfig")?.isPaired;
|
|
134
|
+
case n.TillPayment: return !!J("till.pairConfig")?.isPaired;
|
|
135
|
+
case n.SmartPay: return !!J("smartpay.pairConfig")?.isPaired;
|
|
133
136
|
case n.ADYEN: return !0;
|
|
134
137
|
case n.MX51: return !0;
|
|
135
138
|
default: return !1;
|
|
136
139
|
}
|
|
137
|
-
},
|
|
140
|
+
}, X = G;
|
|
138
141
|
//#endregion
|
|
139
|
-
export {
|
|
142
|
+
export { m as CardScheme, s as LogEvent, o as LogLevel, a as LogSource, u as LogViewer, l as Logger, q as PairingInterface, X as default, h as formatCents, g as generateTransactionId, Y as isPaymentGatewayConnected, c as logger, _ as maskPan, v as normalizeCardScheme, i as setCurrencyCode, t as setState, y as toCents, b as toMajorUnits };
|