@achyutlabsau/vue-payment-gateway 1.0.0-alpha.2 → 1.0.0-alpha.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.
- package/README.md +193 -193
- package/dist/{PairInstructions-CDzvPsSD.js → PairInstructions-Cfz0eDzz.js} +8 -8
- package/dist/{PairedTerminal-Bbbce0Z-.js → PairedTerminal-CqM7haJt.js} +3 -3
- package/dist/{anz-D_SHOscL.js → anz-D-VDyrSq.js} +23 -24
- package/dist/anz.d.ts +1178 -1177
- package/dist/anz.js +1 -1
- package/dist/{core-zArHlLwR.js → core-DImZJZYW.js} +13 -14
- package/dist/index.d.ts +1178 -1178
- package/dist/index.js +18 -15
- package/dist/{linkly-477uK5Yb.js → linkly-DeWQ_woK.js} +118 -119
- package/dist/linkly.d.ts +1178 -1177
- package/dist/linkly.js +1 -1
- package/dist/{logger-C4IV3krr.js → logger-4FM6sy9j.js} +497 -404
- package/dist/logger.d.ts +1178 -1177
- package/dist/logger.js +2 -2
- package/dist/{mx51-kreyQm5S.js → mx51-i0NgIYcU.js} +94 -98
- package/dist/mx51.d.ts +1178 -1177
- package/dist/mx51.js +1 -1
- package/dist/{smartpay-8qRKMm6z.js → smartpay-DGSVYtYs.js} +91 -92
- package/dist/smartpay.d.ts +1178 -1177
- package/dist/smartpay.js +1 -1
- package/dist/{till-payment-CEXA9fqd.js → till-payment-DnkUZfJo.js} +211 -182
- package/dist/till-payment.d.ts +1193 -1179
- package/dist/till-payment.js +1 -1
- package/dist/{tyro-CJfSZGl_.js → tyro-DzmMghlz.js} +58 -59
- package/dist/tyro.d.ts +1178 -1177
- package/dist/tyro.js +1 -1
- package/dist/utils.d.ts +1178 -1177
- package/dist/{valpay-aKz-IJGA.js → valpay-BVpIGlOq.js} +153 -147
- package/dist/valpay.d.ts +1178 -1177
- package/dist/valpay.js +1 -1
- package/package.json +126 -126
package/README.md
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
# Vue Payment Gateway
|
|
2
|
-
|
|
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) | `useAnz` (`/anz`) |
|
|
21
|
-
| **Valpay (Adyen)** | Cloud Terminal API | `useValpay` (`/valpay`) |
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install @achyutlabsau/vue-payment-gateway
|
|
27
|
-
```
|
|
28
|
-
|
|
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.
|
|
31
|
-
|
|
32
|
-
## Plugin Initialization
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
import { createApp } from "vue";
|
|
36
|
-
import VuePaymentGateway from "@achyutlabsau/vue-payment-gateway";
|
|
37
|
-
|
|
38
|
-
const app = createApp(App);
|
|
39
|
-
|
|
40
|
-
app.use(VuePaymentGateway, {
|
|
41
|
-
currencyCode: "AUD",
|
|
42
|
-
productName: "Pratham Respos", // Name of your product
|
|
43
|
-
productVersion: "3.3.0", // Version of your product
|
|
44
|
-
productVendorName: "Achyutlabs", // Name of the product vendor
|
|
45
|
-
posId: "unique-pos-id", // Unique identifier for the POS system
|
|
46
|
-
posRegisterId: "pos-register-id", // Unique identifier for the POS register
|
|
47
|
-
posRegisterName: "register-name", // Name of the POS register
|
|
48
|
-
posBusinessName: "business name", // Name of the business using the POS system
|
|
49
|
-
tyroApiKey: "tyro-api-key", // API key for Tyro integration
|
|
50
|
-
environment: "development", // "development" | "production"
|
|
51
|
-
onReceiptPrint: (receipt, type) => {
|
|
52
|
-
// MX51 SPI only; other providers return receipts on the result — see docs/features/receipts.md
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
app.mount("#app");
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
> Only set the credentials for the providers you actually use — see the [Install Options Reference](docs/installation.md#install-options-reference).
|
|
60
|
-
|
|
61
|
-
## Using the Payment Gateway
|
|
62
|
-
|
|
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, Valpay and ANZ have converged on a shared `PaymentTerminal`
|
|
66
|
-
contract (`pair` / `unpair` / `isPaired` / `purchase` / `refund`); Tyro, Linkly and MX51 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.
|
|
69
|
-
|
|
70
|
-
### SmartPay, Till Payments, Valpay (shared contract)
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
import { useSmartPay } from "@achyutlabsau/vue-payment-gateway/smartpay";
|
|
74
|
-
|
|
75
|
-
const smartpay = useSmartPay();
|
|
76
|
-
|
|
77
|
-
await smartpay.pair({ pairingCode: "123456" });
|
|
78
|
-
smartpay.isPaired(); // boolean
|
|
79
|
-
|
|
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
|
|
82
|
-
|
|
83
|
-
await smartpay.refund(1000);
|
|
84
|
-
smartpay.unpair();
|
|
85
|
-
```
|
|
86
|
-
|
|
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 })`.
|
|
90
|
-
|
|
91
|
-
### Tyro
|
|
92
|
-
|
|
93
|
-
```ts
|
|
94
|
-
import { useTyro } from "@achyutlabsau/vue-payment-gateway/tyro";
|
|
95
|
-
|
|
96
|
-
const tyro = useTyro();
|
|
97
|
-
|
|
98
|
-
await tyro.pairTyro(merchantId, terminalId);
|
|
99
|
-
|
|
100
|
-
const res = await tyro.initiateTyroPurchase({ integratedReceipt: true, amount: "1000" }, receiptCallback);
|
|
101
|
-
// res.result is a TyroTransactionStatus, e.g. "APPROVED"
|
|
102
|
-
|
|
103
|
-
await tyro.initiateTyroRefund({ integratedReceipt: true, amount: "1000" }, receiptCallback);
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Linkly
|
|
107
|
-
|
|
108
|
-
```ts
|
|
109
|
-
import { useLinkly, ReceiptAutoPrint } from "@achyutlabsau/vue-payment-gateway/linkly";
|
|
110
|
-
|
|
111
|
-
const linkly = useLinkly();
|
|
112
|
-
|
|
113
|
-
await linkly.pairPinpad({ username, password, pairCode: "123456" });
|
|
114
|
-
|
|
115
|
-
const res = await linkly.initiatePurchase({
|
|
116
|
-
AmtPurchase: 1000,
|
|
117
|
-
ReceiptAutoPrint: ReceiptAutoPrint.ReturnToPOS,
|
|
118
|
-
});
|
|
119
|
-
|
|
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
|
-
```
|
|
127
|
-
|
|
128
|
-
### MX51 SPI
|
|
129
|
-
|
|
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).
|
|
133
|
-
|
|
134
|
-
### ANZ (Worldline)
|
|
135
|
-
|
|
136
|
-
ANZ implements the shared contract plus `settle()` for the daily closing. Worldline's TimAPI SDK ships with the
|
|
137
|
-
package — pass it through the `anz` install option (see [ANZ](docs/gateways/anz.md#setup)):
|
|
138
|
-
|
|
139
|
-
```ts
|
|
140
|
-
import { useAnz } from "@achyutlabsau/vue-payment-gateway/anz";
|
|
141
|
-
|
|
142
|
-
const anz = useAnz();
|
|
143
|
-
const res = await anz.purchase(1000); // cents → PaymentResult
|
|
144
|
-
await anz.refund(1000); // unreferenced (standalone) refund
|
|
145
|
-
await anz.refund(0, { originalTransactionId: res.transactionId! }); // referenced (linked) refund
|
|
146
|
-
await anz.settle(); // daily closing
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Checking Pairing Status
|
|
150
|
-
|
|
151
|
-
```ts
|
|
152
|
-
import { isPaymentGatewayConnected, PaymentGateways } from "@achyutlabsau/vue-payment-gateway";
|
|
153
|
-
|
|
154
|
-
isPaymentGatewayConnected(PaymentGateways.Linkly); // reads linkly.pairConfig from localStorage
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Logging
|
|
158
|
-
|
|
159
|
-
Every provider logs through one shared, IndexedDB-backed logger (`./logger` subpath) — persistent across reloads,
|
|
160
|
-
attributable to a gateway, correlated by transaction, and with secrets/PANs redacted centrally. See
|
|
161
|
-
[Logging](docs/features/logging.md) for configuration, the `LogViewer` component, and how to query/export logs.
|
|
162
|
-
|
|
163
|
-
## Shared Utilities
|
|
164
|
-
|
|
165
|
-
```ts
|
|
166
|
-
import {
|
|
167
|
-
toCents,
|
|
168
|
-
toMajorUnits,
|
|
169
|
-
formatCents,
|
|
170
|
-
maskPan,
|
|
171
|
-
normalizeCardScheme,
|
|
172
|
-
CardScheme,
|
|
173
|
-
} from "@achyutlabsau/vue-payment-gateway/utils";
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Available from the root entry too, alongside `generateTransactionId()`, `setState()`, and `setCurrencyCode()`.
|
|
177
|
-
|
|
178
|
-
## Troubleshooting
|
|
179
|
-
|
|
180
|
-
- **"Plugin not initialized" errors** — provider composables throw if called before `app.use(VuePaymentGateway, …)`
|
|
181
|
-
has run. Call `use*` inside components/handlers, not at module load time.
|
|
182
|
-
- **Environment issues** — make sure `environment` is set correctly (`"development"` or `"production"`); it selects
|
|
183
|
-
each provider's SDK/endpoint URLs.
|
|
184
|
-
- **Invalid API key** — confirm the provider's API key/merchant credentials are set in the plugin options.
|
|
185
|
-
- **Diagnosing a failed transaction** — check the [Logging](docs/features/logging.md) guide; every gateway's request,
|
|
186
|
-
response and retry history is queryable through `logger.query()` or the `LogViewer` component.
|
|
187
|
-
|
|
188
|
-
## Additional Resources
|
|
189
|
-
|
|
190
|
-
- [Full documentation](docs/index.md)
|
|
191
|
-
- [Changelog](CHANGELOG.md)
|
|
192
|
-
- [Migration guide (pre-1.0 → v1)](docs/migration-v1.md)
|
|
193
|
-
- [Achyutlabs](https://achyutlabs.com/)
|
|
1
|
+
# Vue Payment Gateway
|
|
2
|
+
|
|
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) | `useAnz` (`/anz`) |
|
|
21
|
+
| **Valpay (Adyen)** | Cloud Terminal API | `useValpay` (`/valpay`) |
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @achyutlabsau/vue-payment-gateway
|
|
27
|
+
```
|
|
28
|
+
|
|
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.
|
|
31
|
+
|
|
32
|
+
## Plugin Initialization
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { createApp } from "vue";
|
|
36
|
+
import VuePaymentGateway from "@achyutlabsau/vue-payment-gateway";
|
|
37
|
+
|
|
38
|
+
const app = createApp(App);
|
|
39
|
+
|
|
40
|
+
app.use(VuePaymentGateway, {
|
|
41
|
+
currencyCode: "AUD",
|
|
42
|
+
productName: "Pratham Respos", // Name of your product
|
|
43
|
+
productVersion: "3.3.0", // Version of your product
|
|
44
|
+
productVendorName: "Achyutlabs", // Name of the product vendor
|
|
45
|
+
posId: "unique-pos-id", // Unique identifier for the POS system
|
|
46
|
+
posRegisterId: "pos-register-id", // Unique identifier for the POS register
|
|
47
|
+
posRegisterName: "register-name", // Name of the POS register
|
|
48
|
+
posBusinessName: "business name", // Name of the business using the POS system
|
|
49
|
+
tyroApiKey: "tyro-api-key", // API key for Tyro integration
|
|
50
|
+
environment: "development", // "development" | "production"
|
|
51
|
+
onReceiptPrint: (receipt, type) => {
|
|
52
|
+
// MX51 SPI only; other providers return receipts on the result — see docs/features/receipts.md
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
app.mount("#app");
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
> Only set the credentials for the providers you actually use — see the [Install Options Reference](docs/installation.md#install-options-reference).
|
|
60
|
+
|
|
61
|
+
## Using the Payment Gateway
|
|
62
|
+
|
|
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, Valpay and ANZ have converged on a shared `PaymentTerminal`
|
|
66
|
+
contract (`pair` / `unpair` / `isPaired` / `purchase` / `refund`); Tyro, Linkly and MX51 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.
|
|
69
|
+
|
|
70
|
+
### SmartPay, Till Payments, Valpay (shared contract)
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { useSmartPay } from "@achyutlabsau/vue-payment-gateway/smartpay";
|
|
74
|
+
|
|
75
|
+
const smartpay = useSmartPay();
|
|
76
|
+
|
|
77
|
+
await smartpay.pair({ pairingCode: "123456" });
|
|
78
|
+
smartpay.isPaired(); // boolean
|
|
79
|
+
|
|
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
|
|
82
|
+
|
|
83
|
+
await smartpay.refund(1000);
|
|
84
|
+
smartpay.unpair();
|
|
85
|
+
```
|
|
86
|
+
|
|
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 })`.
|
|
90
|
+
|
|
91
|
+
### Tyro
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { useTyro } from "@achyutlabsau/vue-payment-gateway/tyro";
|
|
95
|
+
|
|
96
|
+
const tyro = useTyro();
|
|
97
|
+
|
|
98
|
+
await tyro.pairTyro(merchantId, terminalId);
|
|
99
|
+
|
|
100
|
+
const res = await tyro.initiateTyroPurchase({ integratedReceipt: true, amount: "1000" }, receiptCallback);
|
|
101
|
+
// res.result is a TyroTransactionStatus, e.g. "APPROVED"
|
|
102
|
+
|
|
103
|
+
await tyro.initiateTyroRefund({ integratedReceipt: true, amount: "1000" }, receiptCallback);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Linkly
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { useLinkly, ReceiptAutoPrint } from "@achyutlabsau/vue-payment-gateway/linkly";
|
|
110
|
+
|
|
111
|
+
const linkly = useLinkly();
|
|
112
|
+
|
|
113
|
+
await linkly.pairPinpad({ username, password, pairCode: "123456" });
|
|
114
|
+
|
|
115
|
+
const res = await linkly.initiatePurchase({
|
|
116
|
+
AmtPurchase: 1000,
|
|
117
|
+
ReceiptAutoPrint: ReceiptAutoPrint.ReturnToPOS,
|
|
118
|
+
});
|
|
119
|
+
|
|
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
|
+
```
|
|
127
|
+
|
|
128
|
+
### MX51 SPI
|
|
129
|
+
|
|
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).
|
|
133
|
+
|
|
134
|
+
### ANZ (Worldline)
|
|
135
|
+
|
|
136
|
+
ANZ implements the shared contract plus `settle()` for the daily closing. Worldline's TimAPI SDK ships with the
|
|
137
|
+
package — pass it through the `anz` install option (see [ANZ](docs/gateways/anz.md#setup)):
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import { useAnz } from "@achyutlabsau/vue-payment-gateway/anz";
|
|
141
|
+
|
|
142
|
+
const anz = useAnz();
|
|
143
|
+
const res = await anz.purchase(1000); // cents → PaymentResult
|
|
144
|
+
await anz.refund(1000); // unreferenced (standalone) refund
|
|
145
|
+
await anz.refund(0, { originalTransactionId: res.transactionId! }); // referenced (linked) refund
|
|
146
|
+
await anz.settle(); // daily closing
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Checking Pairing Status
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import { isPaymentGatewayConnected, PaymentGateways } from "@achyutlabsau/vue-payment-gateway";
|
|
153
|
+
|
|
154
|
+
isPaymentGatewayConnected(PaymentGateways.Linkly); // reads linkly.pairConfig from localStorage
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Logging
|
|
158
|
+
|
|
159
|
+
Every provider logs through one shared, IndexedDB-backed logger (`./logger` subpath) — persistent across reloads,
|
|
160
|
+
attributable to a gateway, correlated by transaction, and with secrets/PANs redacted centrally. See
|
|
161
|
+
[Logging](docs/features/logging.md) for configuration, the `LogViewer` component, and how to query/export logs.
|
|
162
|
+
|
|
163
|
+
## Shared Utilities
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
import {
|
|
167
|
+
toCents,
|
|
168
|
+
toMajorUnits,
|
|
169
|
+
formatCents,
|
|
170
|
+
maskPan,
|
|
171
|
+
normalizeCardScheme,
|
|
172
|
+
CardScheme,
|
|
173
|
+
} from "@achyutlabsau/vue-payment-gateway/utils";
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Available from the root entry too, alongside `generateTransactionId()`, `setState()`, and `setCurrencyCode()`.
|
|
177
|
+
|
|
178
|
+
## Troubleshooting
|
|
179
|
+
|
|
180
|
+
- **"Plugin not initialized" errors** — provider composables throw if called before `app.use(VuePaymentGateway, …)`
|
|
181
|
+
has run. Call `use*` inside components/handlers, not at module load time.
|
|
182
|
+
- **Environment issues** — make sure `environment` is set correctly (`"development"` or `"production"`); it selects
|
|
183
|
+
each provider's SDK/endpoint URLs.
|
|
184
|
+
- **Invalid API key** — confirm the provider's API key/merchant credentials are set in the plugin options.
|
|
185
|
+
- **Diagnosing a failed transaction** — check the [Logging](docs/features/logging.md) guide; every gateway's request,
|
|
186
|
+
response and retry history is queryable through `logger.query()` or the `LogViewer` component.
|
|
187
|
+
|
|
188
|
+
## Additional Resources
|
|
189
|
+
|
|
190
|
+
- [Full documentation](docs/index.md)
|
|
191
|
+
- [Changelog](CHANGELOG.md)
|
|
192
|
+
- [Migration guide (pre-1.0 → v1)](docs/migration-v1.md)
|
|
193
|
+
- [Achyutlabs](https://achyutlabs.com/)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, d as t,
|
|
1
|
+
import { _ as e, d as t, f as n, m as r, r as i, u as a, v as o } from "./logger-4FM6sy9j.js";
|
|
2
2
|
import { createBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, openBlock as f, unref as p, withCtx as m } from "vue";
|
|
3
3
|
//#region src/components/PairInstructions.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var h = { class: "gap-4 flex flex-nowrap items-start" }, g = {
|
|
@@ -9,22 +9,22 @@ var h = { class: "gap-4 flex flex-nowrap items-start" }, g = {
|
|
|
9
9
|
props: { steps: {} },
|
|
10
10
|
emits: ["next"],
|
|
11
11
|
setup(d) {
|
|
12
|
-
return (_, v) => (f(), s(p(
|
|
13
|
-
footer: m(() => [u(p(
|
|
12
|
+
return (_, v) => (f(), s(p(a), null, {
|
|
13
|
+
footer: m(() => [u(p(n), {
|
|
14
14
|
label: "Continue",
|
|
15
|
-
"icon-right": p(
|
|
15
|
+
"icon-right": p(e),
|
|
16
16
|
onClick: v[0] ||= (e) => _.$emit("next")
|
|
17
17
|
}, null, 8, ["icon-right"])]),
|
|
18
18
|
default: m(() => [
|
|
19
|
-
c("div", h, [c("span", g, [u(p(
|
|
20
|
-
name: p(
|
|
19
|
+
c("div", h, [c("span", g, [u(p(r), {
|
|
20
|
+
name: p(o),
|
|
21
21
|
size: 26
|
|
22
22
|
}, null, 8, ["name"])]), v[1] ||= c("div", { class: "min-w-0" }, [c("h2", { class: "text-lg font-semibold text-gray-900 dark:text-white" }, "Terminal setup"), c("p", { class: "mt-0.5 text-sm text-gray-500 dark:text-gray-400" }, " Follow these steps on the terminal, then continue to enter its details. ")], -1)]),
|
|
23
|
-
u(p(
|
|
23
|
+
u(p(i), {
|
|
24
24
|
steps: d.steps,
|
|
25
25
|
class: "mt-5"
|
|
26
26
|
}, null, 8, ["steps"]),
|
|
27
|
-
u(p(
|
|
27
|
+
u(p(t), {
|
|
28
28
|
tone: "warning",
|
|
29
29
|
title: "Before you start",
|
|
30
30
|
class: "mt-5"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e, p as t, u as n } from "./logger-4FM6sy9j.js";
|
|
2
2
|
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
|
|
3
3
|
//#region src/components/PairedTerminal.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var _ = { class: "gap-4 flex flex-nowrap items-start" }, v = { class: "min-w-0 flex-1" }, y = { class: "gap-2 flex flex-wrap items-center" }, b = { class: "text-lg font-semibold text-gray-900 dark:text-white" }, x = {
|
|
@@ -33,11 +33,11 @@ var _ = { class: "gap-4 flex flex-nowrap items-start" }, v = { class: "min-w-0 f
|
|
|
33
33
|
}), e;
|
|
34
34
|
});
|
|
35
35
|
return (i, E) => (d(), a(h(n), null, {
|
|
36
|
-
default: g(() => [c("div", _, [l(h(
|
|
36
|
+
default: g(() => [c("div", _, [l(h(e), {
|
|
37
37
|
status: "success",
|
|
38
38
|
size: "lg"
|
|
39
39
|
}), c("div", v, [
|
|
40
|
-
c("div", y, [c("h2", b, m(u.title), 1), l(h(
|
|
40
|
+
c("div", y, [c("h2", b, m(u.title), 1), l(h(t), {
|
|
41
41
|
tone: "success",
|
|
42
42
|
dot: "",
|
|
43
43
|
label: "Paired"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./core-
|
|
2
|
-
import {
|
|
3
|
-
import { formatCents as
|
|
4
|
-
import { computed as
|
|
5
|
-
import { QForm as w } from "quasar";
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./core-DImZJZYW.js";
|
|
2
|
+
import { D as c, L as l, b as u, f as d, o as f, p, s as m, u as ee, y as h } from "./logger-4FM6sy9j.js";
|
|
3
|
+
import { formatCents as g, normalizeCardScheme as _ } from "./utils.js";
|
|
4
|
+
import { computed as v, createBlock as y, createVNode as b, defineComponent as te, openBlock as x, ref as S, unref as C, withCtx as w } from "vue";
|
|
6
5
|
//#region src/library/anz/timapi.loader.ts
|
|
7
6
|
var T = c.child({ gateway: i.ANZ }), ne = 6e4, E = () => globalThis, D = () => E().timapi !== void 0, O = () => D() && E().Module?.calledRun === !0, k = null, A = null, j = () => {
|
|
8
7
|
E().onTimApiLog = (e) => {
|
|
@@ -140,8 +139,8 @@ var ie = (e) => {
|
|
|
140
139
|
timeouts;
|
|
141
140
|
pending = null;
|
|
142
141
|
_terminal = void 0;
|
|
143
|
-
paired =
|
|
144
|
-
connectionStatus =
|
|
142
|
+
paired = S(!1);
|
|
143
|
+
connectionStatus = S("disconnected");
|
|
145
144
|
constructor(e = {}, t = {}) {
|
|
146
145
|
this.config = {
|
|
147
146
|
...R,
|
|
@@ -456,7 +455,7 @@ var ie = (e) => {
|
|
|
456
455
|
tipAmount: q(r?.amountTip),
|
|
457
456
|
surchargeAmount: q(r?.amountSurcharge),
|
|
458
457
|
maskedCard: r?.cardData?.cardNumberPrintable ?? null,
|
|
459
|
-
cardScheme: r?.cardData?.brandName ?
|
|
458
|
+
cardScheme: r?.cardData?.brandName ? _(r.cardData.brandName) : null,
|
|
460
459
|
receipts: K(r?.printData),
|
|
461
460
|
message: J(t, n, "Transaction approved"),
|
|
462
461
|
raw: t
|
|
@@ -491,8 +490,8 @@ var ie = (e) => {
|
|
|
491
490
|
}, pe = () => {
|
|
492
491
|
W.disconnect();
|
|
493
492
|
}, me = () => W.paired.value, Z = async (e, n, r, i) => {
|
|
494
|
-
let o = i === void 0 ? "" : ` (+ ${
|
|
495
|
-
message: `${e} of ${
|
|
493
|
+
let o = i === void 0 ? "" : ` (+ ${g(i, t.value)} tip)`, s = a({
|
|
494
|
+
message: `${e} of ${g(n, t.value)}${o} in progress...`,
|
|
496
495
|
onCancel: () => {
|
|
497
496
|
s.progress(`Trying to cancel ${e.toLowerCase()}...`), W.cancel();
|
|
498
497
|
}
|
|
@@ -528,10 +527,10 @@ var ie = (e) => {
|
|
|
528
527
|
let n = $(), r = () => ({
|
|
529
528
|
connectionIPString: "",
|
|
530
529
|
connectionIPPort: "80"
|
|
531
|
-
}), i = F(), a =
|
|
530
|
+
}), i = F(), a = S(i ? {
|
|
532
531
|
connectionIPString: i.ip,
|
|
533
532
|
connectionIPPort: String(i.port)
|
|
534
|
-
} : r()), o =
|
|
533
|
+
} : r()), o = v(() => n.paired.value), c = v(() => o.value ? n.connectionStatus.value === "loggedIn" ? {
|
|
535
534
|
label: "Paired and connected",
|
|
536
535
|
tone: "success"
|
|
537
536
|
} : {
|
|
@@ -540,28 +539,28 @@ var ie = (e) => {
|
|
|
540
539
|
} : {
|
|
541
540
|
label: "Unpaired",
|
|
542
541
|
tone: "danger"
|
|
543
|
-
}), l = () => n.pair(a.value),
|
|
542
|
+
}), l = () => n.pair(a.value), g = () => {
|
|
544
543
|
n.unpair(), s({
|
|
545
544
|
title: "Successfully unpaired",
|
|
546
545
|
message: "Terminal is unpaired successfully.",
|
|
547
546
|
tone: "success"
|
|
548
547
|
});
|
|
549
548
|
};
|
|
550
|
-
return (e, n) => (
|
|
549
|
+
return (e, n) => (x(), y(C(ee), {
|
|
551
550
|
title: "ANZ terminal",
|
|
552
551
|
description: "Connect to the EFT terminal over the local network."
|
|
553
552
|
}, {
|
|
554
|
-
header:
|
|
553
|
+
header: w(() => [b(C(p), {
|
|
555
554
|
tone: c.value.tone,
|
|
556
555
|
label: c.value.label,
|
|
557
556
|
dot: ""
|
|
558
557
|
}, null, 8, ["tone", "label"])]),
|
|
559
|
-
default:
|
|
558
|
+
default: w(() => [b(C(m), {
|
|
560
559
|
class: "space-y-4",
|
|
561
560
|
onSubmit: l
|
|
562
561
|
}, {
|
|
563
|
-
default:
|
|
564
|
-
|
|
562
|
+
default: w(() => [
|
|
563
|
+
b(C(f), {
|
|
565
564
|
modelValue: a.value.connectionIPString,
|
|
566
565
|
"onUpdate:modelValue": n[0] ||= (e) => a.value.connectionIPString = e,
|
|
567
566
|
label: "Connection IP",
|
|
@@ -573,7 +572,7 @@ var ie = (e) => {
|
|
|
573
572
|
"disabled",
|
|
574
573
|
"rules"
|
|
575
574
|
]),
|
|
576
|
-
|
|
575
|
+
b(C(f), {
|
|
577
576
|
modelValue: a.value.connectionIPPort,
|
|
578
577
|
"onUpdate:modelValue": n[1] ||= (e) => a.value.connectionIPPort = e,
|
|
579
578
|
label: "Connection port",
|
|
@@ -585,18 +584,18 @@ var ie = (e) => {
|
|
|
585
584
|
"disabled",
|
|
586
585
|
"rules"
|
|
587
586
|
]),
|
|
588
|
-
o.value ? (
|
|
587
|
+
o.value ? (x(), y(C(d), {
|
|
589
588
|
key: 1,
|
|
590
589
|
block: "",
|
|
591
590
|
variant: "outline",
|
|
592
|
-
icon:
|
|
591
|
+
icon: C(u),
|
|
593
592
|
label: "Unpair",
|
|
594
|
-
onClick:
|
|
595
|
-
}, null, 8, ["icon"])) : (
|
|
593
|
+
onClick: g
|
|
594
|
+
}, null, 8, ["icon"])) : (x(), y(C(d), {
|
|
596
595
|
key: 0,
|
|
597
596
|
type: "submit",
|
|
598
597
|
block: "",
|
|
599
|
-
"icon-right":
|
|
598
|
+
"icon-right": C(h),
|
|
600
599
|
label: "Pair terminal"
|
|
601
600
|
}, null, 8, ["icon-right"]))
|
|
602
601
|
]),
|