@achyutlabsau/vue-payment-gateway 0.6.0 → 0.7.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/dist/{PairLinkly.vue_vue_type_script_setup_true_lang-DWqh4Ld5.js → PairLinkly.vue_vue_type_script_setup_true_lang-DMoZH_qZ.js} +17 -24
- package/dist/{PairMX51.vue_vue_type_script_setup_true_lang-CuciFKhW.js → PairMX51.vue_vue_type_script_setup_true_lang-WOcvKdRl.js} +18 -18
- package/dist/{PairSmartPay.vue_vue_type_script_setup_true_lang-CSCNMtGm.js → PairSmartPay.vue_vue_type_script_setup_true_lang--WeZf2Sw.js} +8 -14
- package/dist/{PairTillPayment.vue_vue_type_script_setup_true_lang-B9NKKv_X.js → PairTillPayment.vue_vue_type_script_setup_true_lang-BZgsUFdv.js} +27 -36
- package/dist/{PairTyro.vue_vue_type_script_setup_true_lang-D_Im7c1b.js → PairTyro.vue_vue_type_script_setup_true_lang-_sTaWomK.js} +7 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -11
- package/dist/linkly.d.ts +2 -2
- package/dist/linkly.js +1 -1
- package/dist/mx51.d.ts +1 -1
- package/dist/mx51.js +13 -9
- package/dist/smartpay.d.ts +1 -1
- package/dist/smartpay.js +1 -1
- package/dist/till-payment.d.ts +1 -1
- package/dist/till-payment.js +1 -1
- package/dist/tyro.d.ts +4 -4
- package/dist/tyro.js +1 -1
- package/dist/worldline.d.ts +5 -5
- package/dist/worldline.js +62 -64
- package/package.json +28 -26
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
1
|
import { defineComponent, useModel, ref, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, withDirectives, renderSlot, createTextVNode, createElementVNode, onMounted, createElementBlock, toDisplayString } from "vue";
|
|
5
2
|
import { Dialog, QDialog, QCard, QToolbar, QToolbarTitle, QIcon, QCardSection, QInput, QCardActions, QBtn, Loading, Notify, QForm } from "quasar";
|
|
6
3
|
import { i as isNetworkError, a as isServerError, d as delay, g as generateTransactionId } from "./index-e4lpzJsL.js";
|
|
@@ -42,13 +39,13 @@ const BASE_INTERVAL = 2e3;
|
|
|
42
39
|
const INTERVAL_INCREMENT = 1e3;
|
|
43
40
|
const { PATHS, STORAGE_KEYS } = LINKLY_CONSTANTS;
|
|
44
41
|
class LinklyPaymentGateway {
|
|
42
|
+
_api;
|
|
43
|
+
_authApi;
|
|
44
|
+
token = null;
|
|
45
|
+
tokenExpiry = null;
|
|
46
|
+
pairingSecret = null;
|
|
47
|
+
_config;
|
|
45
48
|
constructor(config) {
|
|
46
|
-
__publicField(this, "_api");
|
|
47
|
-
__publicField(this, "_authApi");
|
|
48
|
-
__publicField(this, "token", null);
|
|
49
|
-
__publicField(this, "tokenExpiry", null);
|
|
50
|
-
__publicField(this, "pairingSecret", null);
|
|
51
|
-
__publicField(this, "_config");
|
|
52
49
|
const { environment: environment2 = "development", ...linklyConfig } = config;
|
|
53
50
|
const urlConfig = environment2 === "production" ? LINKLY_CONSTANTS.URLS.PRODUCTION : LINKLY_CONSTANTS.URLS.DEVELOPMENT;
|
|
54
51
|
this._config = {
|
|
@@ -83,16 +80,15 @@ class LinklyPaymentGateway {
|
|
|
83
80
|
});
|
|
84
81
|
}
|
|
85
82
|
_getErrorMessage(error, defaultMessage) {
|
|
86
|
-
var _a, _b, _c;
|
|
87
83
|
let message = defaultMessage ?? "An unexpected error occurred.";
|
|
88
84
|
if (isAxiosError(error)) {
|
|
89
|
-
const status =
|
|
85
|
+
const status = error.response?.status;
|
|
90
86
|
switch (status) {
|
|
91
87
|
case HttpStatusCode.Unauthorized:
|
|
92
88
|
message = "Looks like the username, password or pair code is no longer valid, or your account has been disabled. Try re-pairing the PIN pad or resetting the password.";
|
|
93
89
|
break;
|
|
94
90
|
case HttpStatusCode.BadRequest:
|
|
95
|
-
const errorMessage =
|
|
91
|
+
const errorMessage = error.response?.data[0]?.errorMessage;
|
|
96
92
|
message = errorMessage ?? "Invalid request! Correct the request and try again.";
|
|
97
93
|
break;
|
|
98
94
|
case HttpStatusCode.RequestTimeout:
|
|
@@ -162,7 +158,6 @@ class LinklyPaymentGateway {
|
|
|
162
158
|
return true;
|
|
163
159
|
}
|
|
164
160
|
async getLinklyAuthToken() {
|
|
165
|
-
var _a;
|
|
166
161
|
const { STORAGE_KEYS: STORAGE_KEYS2 } = LINKLY_CONSTANTS;
|
|
167
162
|
try {
|
|
168
163
|
const tokenData = {
|
|
@@ -177,7 +172,7 @@ class LinklyPaymentGateway {
|
|
|
177
172
|
return response.data;
|
|
178
173
|
} catch (error) {
|
|
179
174
|
console.error("Get token error:", error);
|
|
180
|
-
if (axios.isAxiosError(error) &&
|
|
175
|
+
if (axios.isAxiosError(error) && error.response?.status === HttpStatusCode.Unauthorized) {
|
|
181
176
|
this._clearCredentials();
|
|
182
177
|
throw new Error("Authentication failed. Pairing may have been reset or credentials changed.");
|
|
183
178
|
}
|
|
@@ -217,7 +212,6 @@ class LinklyPaymentGateway {
|
|
|
217
212
|
async getTransactionStatus(transactionId) {
|
|
218
213
|
let interval = BASE_INTERVAL;
|
|
219
214
|
const doRequest = async () => {
|
|
220
|
-
var _a;
|
|
221
215
|
try {
|
|
222
216
|
const response = await this._api.get(`${transactionId}/${PATHS.TRANSACTION}`, {
|
|
223
217
|
params: DEFAULT_REQUEST_PARAMS
|
|
@@ -228,7 +222,7 @@ class LinklyPaymentGateway {
|
|
|
228
222
|
return response.data;
|
|
229
223
|
} catch (error) {
|
|
230
224
|
if (axios.isAxiosError(error)) {
|
|
231
|
-
const status =
|
|
225
|
+
const status = error.response?.status ?? 0;
|
|
232
226
|
if (status === HttpStatusCode.RequestTimeout || isServerError(error)) {
|
|
233
227
|
if (interval < MAX_INTERVAL_TIME) {
|
|
234
228
|
await delay(BASE_INTERVAL);
|
|
@@ -254,15 +248,14 @@ class LinklyPaymentGateway {
|
|
|
254
248
|
return this.getTransactionStatus(txnId);
|
|
255
249
|
}
|
|
256
250
|
async reprintReceipt(data) {
|
|
257
|
-
var _a, _b, _c, _d;
|
|
258
251
|
const uuid = v7();
|
|
259
252
|
try {
|
|
260
253
|
await this._ensureValidToken();
|
|
261
254
|
const res = await this._api.post(`${uuid}/${PATHS.REPRINT_RECEIPT}`, data, {
|
|
262
255
|
params: DEFAULT_REQUEST_PARAMS
|
|
263
256
|
});
|
|
264
|
-
const isSuccess =
|
|
265
|
-
const message = isSuccess ? "Receipt printed successfully." : "Failed to print receipt: " +
|
|
257
|
+
const isSuccess = res.data?.response?.success ?? false;
|
|
258
|
+
const message = isSuccess ? "Receipt printed successfully." : "Failed to print receipt: " + res.data?.response?.responseText;
|
|
266
259
|
return {
|
|
267
260
|
success: isSuccess,
|
|
268
261
|
message,
|
|
@@ -397,7 +390,6 @@ const useLinkly = () => {
|
|
|
397
390
|
return res;
|
|
398
391
|
};
|
|
399
392
|
const _initiateTransaction = async (data, TxnType) => {
|
|
400
|
-
var _a, _b, _c, _d;
|
|
401
393
|
const cancelTxn = () => {
|
|
402
394
|
dialog.update({
|
|
403
395
|
message: "Trying to cancel transaction...",
|
|
@@ -427,7 +419,7 @@ const useLinkly = () => {
|
|
|
427
419
|
});
|
|
428
420
|
try {
|
|
429
421
|
const res = await linklyAPI.sendTransactionRequest(payload);
|
|
430
|
-
if (
|
|
422
|
+
if (res?.response?.responseCode === ResponseCodes.APPROVED || res?.response?.responseCode === ResponseCodes.Approved) {
|
|
431
423
|
dialog.update({
|
|
432
424
|
message: "Transaction Approved!",
|
|
433
425
|
title: "SUCCESS"
|
|
@@ -437,7 +429,7 @@ const useLinkly = () => {
|
|
|
437
429
|
data: res.response
|
|
438
430
|
};
|
|
439
431
|
}
|
|
440
|
-
if (
|
|
432
|
+
if (res?.response?.responseCode === ResponseCodes.GENERAL_DECLINE) {
|
|
441
433
|
dialog.update({
|
|
442
434
|
message: "Transaction Declined!",
|
|
443
435
|
title: "FAILED"
|
|
@@ -447,7 +439,7 @@ const useLinkly = () => {
|
|
|
447
439
|
data: res.response
|
|
448
440
|
};
|
|
449
441
|
}
|
|
450
|
-
if (
|
|
442
|
+
if (res?.response?.responseCode === ResponseCodes.CANCELLED) {
|
|
451
443
|
dialog.update({
|
|
452
444
|
message: "Transaction Cancelled!",
|
|
453
445
|
title: "FAILED"
|
|
@@ -778,7 +770,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
778
770
|
_: 1
|
|
779
771
|
})
|
|
780
772
|
]),
|
|
781
|
-
_: 1
|
|
773
|
+
_: 1,
|
|
774
|
+
__: [7]
|
|
782
775
|
}))
|
|
783
776
|
])),
|
|
784
777
|
createVNode(_sfc_main$1, {
|
|
@@ -63,21 +63,20 @@ function log(message, event) {
|
|
|
63
63
|
}
|
|
64
64
|
document.addEventListener("StatusChanged", (e) => {
|
|
65
65
|
log("Status changed", e.detail);
|
|
66
|
-
if (
|
|
66
|
+
if (e?.detail === "PairedConnected") ;
|
|
67
67
|
});
|
|
68
68
|
document.addEventListener("SecretsChanged", (e) => {
|
|
69
69
|
log("Secrets changed", e);
|
|
70
|
-
if (e
|
|
70
|
+
if (e?.detail) {
|
|
71
71
|
window.localStorage.setItem("secrets", JSON.stringify(e.detail));
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
document.addEventListener(spiEvents.spiPairingFlowStateChanged, (e) => {
|
|
75
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
76
75
|
log("Pairing flow state changed", e);
|
|
77
76
|
log(
|
|
78
|
-
|
|
77
|
+
e?.detail?.AwaitingCheckFromEftpos && e?.detail?.AwaitingCheckFromPos ? `${e?.detail?.Message}: ${e?.detail?.ConfirmationCode}` : e?.detail?.Message
|
|
79
78
|
);
|
|
80
|
-
if (
|
|
79
|
+
if (e?.detail?.Successful && e?.detail?.Finished) {
|
|
81
80
|
spi.AckFlowEndedAndBackToIdle();
|
|
82
81
|
}
|
|
83
82
|
});
|
|
@@ -104,9 +103,9 @@ document.addEventListener(spiEvents.spiTxFlowStateChanged, (e) => {
|
|
|
104
103
|
});
|
|
105
104
|
document.addEventListener("DeviceAddressChanged", (e) => {
|
|
106
105
|
log("Device address changed", e);
|
|
107
|
-
if (e
|
|
106
|
+
if (e?.detail.ip) {
|
|
108
107
|
window.localStorage.setItem("eftposAddress", e.detail.ip);
|
|
109
|
-
} else if (e
|
|
108
|
+
} else if (e?.detail.fqdn) {
|
|
110
109
|
window.localStorage.setItem("eftposAddress", e.detail.fqdn);
|
|
111
110
|
}
|
|
112
111
|
});
|
|
@@ -277,22 +276,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
277
276
|
pairStatus.value = e.detail;
|
|
278
277
|
});
|
|
279
278
|
useEventListener(document, "PairingFlowStateChanged", (e) => {
|
|
280
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
281
279
|
model.value = true;
|
|
282
|
-
pairInfo.value.message =
|
|
283
|
-
pairInfo.value.confirmationCode =
|
|
284
|
-
if (
|
|
280
|
+
pairInfo.value.message = e?.detail?.Message;
|
|
281
|
+
pairInfo.value.confirmationCode = e?.detail?.ConfirmationCode;
|
|
282
|
+
if (e?.detail?.Successful && e?.detail?.Finished) {
|
|
285
283
|
localStorage.setItem("pairingData", JSON.stringify(pairForm.value));
|
|
286
284
|
}
|
|
287
|
-
if (
|
|
285
|
+
if (e?.detail?.Finished) {
|
|
288
286
|
pairInfo.value.state = "FINISHED";
|
|
289
287
|
return;
|
|
290
288
|
}
|
|
291
|
-
if (
|
|
289
|
+
if (e?.detail?.AwaitingCheckFromEftpos && e?.detail?.AwaitingCheckFromPos) {
|
|
292
290
|
pairInfo.value.state = "CONFIRMATION";
|
|
293
291
|
return;
|
|
294
292
|
}
|
|
295
|
-
if (!
|
|
293
|
+
if (!e?.detail?.AwaitingCheckFromEftpos || !e?.detail?.AwaitingCheckFromPos) {
|
|
296
294
|
pairInfo.value.state = "INPROGRESS";
|
|
297
295
|
return;
|
|
298
296
|
}
|
|
@@ -303,9 +301,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
303
301
|
}
|
|
304
302
|
});
|
|
305
303
|
useEventListener(document, "DeviceAddressChanged", (e) => {
|
|
306
|
-
if (e
|
|
304
|
+
if (e?.detail.ip) {
|
|
307
305
|
pairForm.value.eftposAddress = e.detail.ip;
|
|
308
|
-
} else if (e
|
|
306
|
+
} else if (e?.detail.fqdn) {
|
|
309
307
|
pairForm.value.eftposAddress = e.detail.fqdn;
|
|
310
308
|
}
|
|
311
309
|
});
|
|
@@ -502,7 +500,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
502
500
|
createElementVNode("div", _hoisted_9, toDisplayString(pairInfo.value.confirmationCode), 1),
|
|
503
501
|
_cache[12] || (_cache[12] = createElementVNode("div", { class: "text-center text-sm text-gray-500 dark:text-gray-300" }, " Confirm the matching pairing code on the terminal ", -1))
|
|
504
502
|
]),
|
|
505
|
-
_: 1
|
|
503
|
+
_: 1,
|
|
504
|
+
__: [11, 12]
|
|
506
505
|
})) : pairInfo.value.state === "FINISHED" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
|
|
507
506
|
default: withCtx(() => [
|
|
508
507
|
createElementVNode("div", _hoisted_10, toDisplayString(pairInfo.value.message), 1),
|
|
@@ -527,7 +526,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
527
526
|
_: 1
|
|
528
527
|
}, 8, ["modelValue"])
|
|
529
528
|
]),
|
|
530
|
-
_: 1
|
|
529
|
+
_: 1,
|
|
530
|
+
__: [13]
|
|
531
531
|
}))
|
|
532
532
|
]);
|
|
533
533
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
1
|
import { defineComponent, ref, createBlock, createElementBlock, unref, openBlock, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, withModifiers } from "vue";
|
|
5
2
|
import { useLocalStorage } from "@vueuse/core";
|
|
6
3
|
import { Dialog, QCard, QIcon, QBtn, QInput } from "quasar";
|
|
@@ -44,9 +41,9 @@ var TransactionTypes = /* @__PURE__ */ ((TransactionTypes2) => {
|
|
|
44
41
|
const DEV_SMARTPAY_API_URL = "https://api-dev.smart-connect.cloud/POS";
|
|
45
42
|
const PROD_SMARTPAY_API_URL = "https://api.smart-connect.cloud/POS";
|
|
46
43
|
class SmartConnectAPI {
|
|
44
|
+
api;
|
|
45
|
+
pairingConfig;
|
|
47
46
|
constructor(config, environment2) {
|
|
48
|
-
__publicField(this, "api");
|
|
49
|
-
__publicField(this, "pairingConfig");
|
|
50
47
|
this.pairingConfig = {
|
|
51
48
|
...config
|
|
52
49
|
};
|
|
@@ -58,7 +55,6 @@ class SmartConnectAPI {
|
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
57
|
async sendPairingRequest(pairingCode) {
|
|
61
|
-
var _a, _b;
|
|
62
58
|
try {
|
|
63
59
|
if (!pairingCode) {
|
|
64
60
|
return { success: false, message: "A pairing code has to be supplied." };
|
|
@@ -74,7 +70,7 @@ class SmartConnectAPI {
|
|
|
74
70
|
message: res.status === HttpStatusCode.Ok ? "Pairing complete! Your device should now show it is paired." : "Failed to pair terminal"
|
|
75
71
|
};
|
|
76
72
|
} catch (error) {
|
|
77
|
-
const errorMessage = isAxiosError(error) ?
|
|
73
|
+
const errorMessage = isAxiosError(error) ? error.response?.data?.error : error;
|
|
78
74
|
return {
|
|
79
75
|
success: false,
|
|
80
76
|
message: errorMessage
|
|
@@ -82,7 +78,6 @@ class SmartConnectAPI {
|
|
|
82
78
|
}
|
|
83
79
|
}
|
|
84
80
|
async createTransaction(amount, transactionType) {
|
|
85
|
-
var _a, _b;
|
|
86
81
|
if (!Number.isInteger(amount) || amount <= 0) {
|
|
87
82
|
throw new Error("The amount must be a positive integer.");
|
|
88
83
|
}
|
|
@@ -102,7 +97,7 @@ class SmartConnectAPI {
|
|
|
102
97
|
null,
|
|
103
98
|
{ params: parameters }
|
|
104
99
|
);
|
|
105
|
-
if (response.status === HttpStatusCode.Ok &&
|
|
100
|
+
if (response.status === HttpStatusCode.Ok && response.data?.data?.PollingUrl) {
|
|
106
101
|
return response.data.data.PollingUrl;
|
|
107
102
|
} else {
|
|
108
103
|
throw new Error("Invalid response or missing Polling URL");
|
|
@@ -119,12 +114,11 @@ class SmartConnectAPI {
|
|
|
119
114
|
const MAX_INTERVAL_TIME = 10 * 60 * 1e3;
|
|
120
115
|
const endTime = Date.now() + MAX_INTERVAL_TIME;
|
|
121
116
|
const poll = async () => {
|
|
122
|
-
var _a;
|
|
123
117
|
console.log("Polling for outcome:", pollingUrl);
|
|
124
118
|
try {
|
|
125
119
|
const response = await this.api.get(pollingUrl);
|
|
126
120
|
console.log("Polling response:", response.data);
|
|
127
|
-
if (response.status === HttpStatusCode.Ok &&
|
|
121
|
+
if (response.status === HttpStatusCode.Ok && response.data?.data) {
|
|
128
122
|
const transactionStatus = response.data.transactionStatus;
|
|
129
123
|
const transactionResult = response.data.data.TransactionResult;
|
|
130
124
|
const result = response.data.data.Result;
|
|
@@ -254,11 +248,10 @@ const useSmartPay = () => {
|
|
|
254
248
|
});
|
|
255
249
|
return smartPayApi.pollForOutcome(pollingUrl, delayed);
|
|
256
250
|
}).then((response) => {
|
|
257
|
-
var _a, _b;
|
|
258
251
|
updateDialog(dialog, response.transactionOutcome);
|
|
259
252
|
resolve({
|
|
260
253
|
...response,
|
|
261
|
-
smartPayCustomerReceipt:
|
|
254
|
+
smartPayCustomerReceipt: response.responseData?.data?.Receipt
|
|
262
255
|
});
|
|
263
256
|
setTimeout(dialog.hide, 3e3);
|
|
264
257
|
}).catch((errorMessage) => {
|
|
@@ -399,7 +392,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
399
392
|
])
|
|
400
393
|
], 32)
|
|
401
394
|
]),
|
|
402
|
-
_: 1
|
|
395
|
+
_: 1,
|
|
396
|
+
__: [4]
|
|
403
397
|
}))
|
|
404
398
|
]));
|
|
405
399
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
1
|
import { defineComponent, useModel, ref, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, withDirectives, renderSlot, createTextVNode, createElementVNode, onMounted, createElementBlock, toDisplayString } from "vue";
|
|
5
2
|
import { useLocalStorage } from "@vueuse/core";
|
|
6
3
|
import axios, { isAxiosError, HttpStatusCode } from "axios";
|
|
@@ -35,17 +32,16 @@ var TransactionOutcome = /* @__PURE__ */ ((TransactionOutcome2) => {
|
|
|
35
32
|
return TransactionOutcome2;
|
|
36
33
|
})(TransactionOutcome || {});
|
|
37
34
|
const handleError = (error) => {
|
|
38
|
-
var _a;
|
|
39
35
|
console.error(error);
|
|
40
36
|
if (isAxiosError(error)) {
|
|
41
|
-
const errorRes =
|
|
42
|
-
const statusCode = errorRes
|
|
37
|
+
const errorRes = error.response?.data;
|
|
38
|
+
const statusCode = errorRes?.statusCode;
|
|
43
39
|
const isNetworkError = "ERR_NETWORK" === error.code;
|
|
44
40
|
const isForbidden = statusCode === HttpStatusCode.Forbidden;
|
|
45
41
|
return {
|
|
46
42
|
error: true,
|
|
47
|
-
message: isForbidden ? "Invalid merchantId or apiKey" : isNetworkError ? "Connection to terminal lost(404).Check internet connection." :
|
|
48
|
-
code: isNetworkError ? "ERR_NETWORK" : errorRes
|
|
43
|
+
message: isForbidden ? "Invalid merchantId or apiKey" : isNetworkError ? "Connection to terminal lost(404).Check internet connection." : errorRes?.message ?? "Something went wrong!",
|
|
44
|
+
code: isNetworkError ? "ERR_NETWORK" : errorRes?.code,
|
|
49
45
|
statusCode: statusCode ?? HttpStatusCode.BadRequest
|
|
50
46
|
};
|
|
51
47
|
}
|
|
@@ -56,14 +52,13 @@ const handleError = (error) => {
|
|
|
56
52
|
};
|
|
57
53
|
};
|
|
58
54
|
const generateReceipt = (receiptName, rawReceipt) => {
|
|
59
|
-
var _a;
|
|
60
55
|
const formatAmount = (amount) => (amount / 100).toFixed(2);
|
|
61
56
|
try {
|
|
62
57
|
if (!rawReceipt) return null;
|
|
63
58
|
const data = JSON.parse(rawReceipt);
|
|
64
59
|
const merchantId = data.maskedMerchantId || `...${data.merchantId.slice(-4)}`;
|
|
65
60
|
const terminalId = data.maskedTerminalId || data.terminalId;
|
|
66
|
-
const authMessageLines =
|
|
61
|
+
const authMessageLines = data.authMessage?.split("\\n") || [];
|
|
67
62
|
const authResponseCode = authMessageLines[0] || "";
|
|
68
63
|
const authResponseText = authMessageLines[1] || "";
|
|
69
64
|
const typeWidth = 14;
|
|
@@ -120,10 +115,14 @@ ${dayjs(data.dateTime).format("DD MMM YYYY [at] hh:mm A")}
|
|
|
120
115
|
return null;
|
|
121
116
|
}
|
|
122
117
|
};
|
|
123
|
-
|
|
118
|
+
class TillPaymentsApi {
|
|
119
|
+
api;
|
|
120
|
+
config;
|
|
121
|
+
static URLS = {
|
|
122
|
+
SANDBOX: "https://api-terminal-gateway.tillvision.show/devices",
|
|
123
|
+
PRODUCTION: "https://api-terminal-gateway.tillpayments.com/devices"
|
|
124
|
+
};
|
|
124
125
|
constructor(config) {
|
|
125
|
-
__publicField(this, "api");
|
|
126
|
-
__publicField(this, "config");
|
|
127
126
|
this.config = {
|
|
128
127
|
timeout: 3e4,
|
|
129
128
|
retryAttempts: 3,
|
|
@@ -134,7 +133,7 @@ const _TillPaymentsApi = class _TillPaymentsApi {
|
|
|
134
133
|
throw new Error("Please provide 'merchantId' & 'apiKey'.");
|
|
135
134
|
}
|
|
136
135
|
this.api = axios.create({
|
|
137
|
-
baseURL:
|
|
136
|
+
baseURL: TillPaymentsApi.URLS[this.config.environment] + `/merchant/${this.config.merchantId}`,
|
|
138
137
|
timeout: this.config.timeout,
|
|
139
138
|
headers: {
|
|
140
139
|
"Content-Type": "application/json; charset=utf-8",
|
|
@@ -217,13 +216,12 @@ const _TillPaymentsApi = class _TillPaymentsApi {
|
|
|
217
216
|
* @param intentId Intent Identifier.
|
|
218
217
|
*/
|
|
219
218
|
async getIntentById(intentId) {
|
|
220
|
-
var _a, _b;
|
|
221
219
|
try {
|
|
222
220
|
const res = await this.api.get(`/intent/${intentId}`);
|
|
223
221
|
return {
|
|
224
222
|
...res.data,
|
|
225
|
-
customerReceipt: generateReceipt("CUSTOMER COPY",
|
|
226
|
-
merchantReceipt: generateReceipt("MERCHANT COPY",
|
|
223
|
+
customerReceipt: generateReceipt("CUSTOMER COPY", res.data.transactionDetails?.rawReceipt),
|
|
224
|
+
merchantReceipt: generateReceipt("MERCHANT COPY", res.data.transactionDetails?.rawReceipt)
|
|
227
225
|
};
|
|
228
226
|
} catch (error) {
|
|
229
227
|
return handleError(error);
|
|
@@ -298,7 +296,6 @@ const _TillPaymentsApi = class _TillPaymentsApi {
|
|
|
298
296
|
}
|
|
299
297
|
}
|
|
300
298
|
async processTransaction(tid, intentId) {
|
|
301
|
-
var _a, _b, _c;
|
|
302
299
|
try {
|
|
303
300
|
this._setRunningTxnId(intentId);
|
|
304
301
|
const processed = await this.requestTerminalToProcessIntent(tid, intentId);
|
|
@@ -330,11 +327,11 @@ const _TillPaymentsApi = class _TillPaymentsApi {
|
|
|
330
327
|
transactionOutcome = TransactionOutcome.Timeout;
|
|
331
328
|
} else {
|
|
332
329
|
if (intent.status === "COMPLETED") {
|
|
333
|
-
if (
|
|
330
|
+
if (intent.transactionDetails?.status === "SUCCESS") {
|
|
334
331
|
transactionOutcome = TransactionOutcome.Accepted;
|
|
335
|
-
} else if (
|
|
332
|
+
} else if (intent.transactionDetails?.status === "CANCELLED") {
|
|
336
333
|
transactionOutcome = TransactionOutcome.Cancelled;
|
|
337
|
-
} else if (
|
|
334
|
+
} else if (intent.transactionDetails?.status === "DECLINED") {
|
|
338
335
|
transactionOutcome = TransactionOutcome.Declined;
|
|
339
336
|
} else {
|
|
340
337
|
transactionOutcome = TransactionOutcome.Failed;
|
|
@@ -403,12 +400,7 @@ const _TillPaymentsApi = class _TillPaymentsApi {
|
|
|
403
400
|
}
|
|
404
401
|
return this.getIntentById(transactionId);
|
|
405
402
|
}
|
|
406
|
-
}
|
|
407
|
-
__publicField(_TillPaymentsApi, "URLS", {
|
|
408
|
-
SANDBOX: "https://api-terminal-gateway.tillvision.show/devices",
|
|
409
|
-
PRODUCTION: "https://api-terminal-gateway.tillpayments.com/devices"
|
|
410
|
-
});
|
|
411
|
-
let TillPaymentsApi = _TillPaymentsApi;
|
|
403
|
+
}
|
|
412
404
|
const useTillPayment = () => {
|
|
413
405
|
const tillPayment = new TillPaymentsApi({
|
|
414
406
|
apiKey: state.tillPaymentApiKey,
|
|
@@ -416,7 +408,6 @@ const useTillPayment = () => {
|
|
|
416
408
|
environment: "SANDBOX"
|
|
417
409
|
});
|
|
418
410
|
const initiateTillPurchase = async (paymentAmount) => {
|
|
419
|
-
var _a, _b, _c, _d, _e;
|
|
420
411
|
const cancelTxn = () => {
|
|
421
412
|
dialog.update({
|
|
422
413
|
message: "Trying to cancel transaction...",
|
|
@@ -461,13 +452,12 @@ const useTillPayment = () => {
|
|
|
461
452
|
return {
|
|
462
453
|
success: res.transactionOutcome === TransactionOutcome.Accepted,
|
|
463
454
|
transactionId: res.data.intentId,
|
|
464
|
-
customerReceipt:
|
|
465
|
-
merchantReceipt:
|
|
466
|
-
surchargeAmount:
|
|
455
|
+
customerReceipt: res.data?.customerReceipt,
|
|
456
|
+
merchantReceipt: res.data?.merchantReceipt,
|
|
457
|
+
surchargeAmount: res.data?.transactionDetails?.amount?.surcharge ?? 0
|
|
467
458
|
};
|
|
468
459
|
};
|
|
469
460
|
const initiateTillRefund = async (paymentAmount) => {
|
|
470
|
-
var _a, _b, _c, _d, _e;
|
|
471
461
|
const cancelTxn = () => {
|
|
472
462
|
dialog.update({
|
|
473
463
|
message: "Trying to cancel transaction...",
|
|
@@ -511,9 +501,9 @@ const useTillPayment = () => {
|
|
|
511
501
|
return {
|
|
512
502
|
success: res.transactionOutcome === TransactionOutcome.Accepted,
|
|
513
503
|
transactionId: res.data.intentId,
|
|
514
|
-
customerReceipt:
|
|
515
|
-
merchantReceipt:
|
|
516
|
-
surchargeAmount:
|
|
504
|
+
customerReceipt: res.data?.customerReceipt,
|
|
505
|
+
merchantReceipt: res.data?.merchantReceipt,
|
|
506
|
+
surchargeAmount: res.data?.transactionDetails?.amount?.surcharge ?? 0
|
|
517
507
|
};
|
|
518
508
|
};
|
|
519
509
|
const reprintReceipt = async (txnId) => {
|
|
@@ -811,7 +801,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
811
801
|
_: 1
|
|
812
802
|
})
|
|
813
803
|
]),
|
|
814
|
-
_: 1
|
|
804
|
+
_: 1,
|
|
805
|
+
__: [7]
|
|
815
806
|
}))
|
|
816
807
|
]),
|
|
817
808
|
_: 1
|
|
@@ -23,11 +23,11 @@ const dialogDefaultOpts = {
|
|
|
23
23
|
const responseReceivedCallbackImp = (dialog, response) => {
|
|
24
24
|
console.log(response);
|
|
25
25
|
if (response.status === "inProgress") {
|
|
26
|
-
dialog
|
|
26
|
+
dialog?.update({ message: response.message });
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
if (response.status === "success") {
|
|
30
|
-
dialog
|
|
30
|
+
dialog?.update({
|
|
31
31
|
title: "Success!",
|
|
32
32
|
class: "text-green-500",
|
|
33
33
|
progress: false,
|
|
@@ -35,7 +35,7 @@ const responseReceivedCallbackImp = (dialog, response) => {
|
|
|
35
35
|
});
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
dialog
|
|
38
|
+
dialog?.update({
|
|
39
39
|
title: "Failed!",
|
|
40
40
|
class: "text-red-500",
|
|
41
41
|
progress: false,
|
|
@@ -141,7 +141,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
141
141
|
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
142
142
|
createTextVNode(" Tyro Client Logs ")
|
|
143
143
|
])),
|
|
144
|
-
_: 1
|
|
144
|
+
_: 1,
|
|
145
|
+
__: [1]
|
|
145
146
|
}),
|
|
146
147
|
withDirectives(createVNode(unref(QIcon), {
|
|
147
148
|
class: "float-right cursor-pointer rounded p-2 transition-colors",
|
|
@@ -316,7 +317,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
316
317
|
])
|
|
317
318
|
], 32)
|
|
318
319
|
]),
|
|
319
|
-
_: 1
|
|
320
|
+
_: 1,
|
|
321
|
+
__: [6]
|
|
320
322
|
}))
|
|
321
323
|
]));
|
|
322
324
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare type __VLS_Props = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
declare const _default: {
|
|
13
|
-
install: FunctionPlugin<InstallOptions>;
|
|
13
|
+
install: FunctionPlugin<[InstallOptions]>;
|
|
14
14
|
};
|
|
15
15
|
export default _default;
|
|
16
16
|
|
|
@@ -38,13 +38,13 @@ declare interface InstallOptions extends POSConfig {
|
|
|
38
38
|
onReceiptPrint?: (receipt: string, type: ReceiptTypes) => void;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export declare const PairingInterface: DefineComponent<__VLS_Props,
|
|
41
|
+
export declare const PairingInterface: DefineComponent<__VLS_Props, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
42
42
|
"pairing-success": (data: any, gateway: PaymentGateways) => any;
|
|
43
43
|
"pairing-failure": (data: any) => any;
|
|
44
44
|
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
45
45
|
"onPairing-success"?: ((data: any, gateway: PaymentGateways) => any) | undefined;
|
|
46
46
|
"onPairing-failure"?: ((data: any) => any) | undefined;
|
|
47
|
-
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {},
|
|
47
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
48
48
|
|
|
49
49
|
declare enum PaymentGateways {
|
|
50
50
|
Tyro = "tyro",
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { i as isPluginInitialized, s as setState, a as setEnvironment, P as PaymentGateways } from "./PairInstructions.vue_vue_type_script_setup_true_lang-gQoPMiBm.js";
|
|
2
2
|
import "quasar";
|
|
3
|
-
import { T as TYRO_CONSTANTS, _ as _sfc_main$1 } from "./PairTyro.vue_vue_type_script_setup_true_lang-
|
|
3
|
+
import { T as TYRO_CONSTANTS, _ as _sfc_main$1 } from "./PairTyro.vue_vue_type_script_setup_true_lang-_sTaWomK.js";
|
|
4
4
|
import { defineComponent, createElementBlock, openBlock, createBlock, createCommentVNode, unref } from "vue";
|
|
5
5
|
import { useEventListener, useScriptTag } from "@vueuse/core";
|
|
6
|
-
import { s as spi, _ as _sfc_main$2 } from "./PairMX51.vue_vue_type_script_setup_true_lang-
|
|
6
|
+
import { s as spi, _ as _sfc_main$2 } from "./PairMX51.vue_vue_type_script_setup_true_lang-WOcvKdRl.js";
|
|
7
7
|
import "@mx51/spi-client-js";
|
|
8
8
|
import "uuid";
|
|
9
9
|
import "./emitter-B70DsNvX.js";
|
|
10
10
|
import { TimApiEvents, timApi, PairTimapi as _sfc_main$4 } from "./worldline.js";
|
|
11
11
|
import "axios";
|
|
12
12
|
import "./TransactionDialog.vue_vue_type_script_setup_true_lang-DTIELKw0.js";
|
|
13
|
-
import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-
|
|
14
|
-
import { _ as _sfc_main$6 } from "./PairSmartPay.vue_vue_type_script_setup_true_lang
|
|
13
|
+
import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-DMoZH_qZ.js";
|
|
14
|
+
import { _ as _sfc_main$6 } from "./PairSmartPay.vue_vue_type_script_setup_true_lang--WeZf2Sw.js";
|
|
15
15
|
import "dayjs";
|
|
16
|
-
import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-
|
|
16
|
+
import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-BZgsUFdv.js";
|
|
17
17
|
import { g } from "./index-e4lpzJsL.js";
|
|
18
18
|
var ReceiptTypes = /* @__PURE__ */ ((ReceiptTypes2) => {
|
|
19
19
|
ReceiptTypes2["MERCHANT_COPY"] = "MERCHANT_COPY";
|
|
@@ -36,28 +36,26 @@ function setupEventHandlers(options) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
const spiEventHandler = (e) => {
|
|
39
|
-
var _a;
|
|
40
39
|
const detail = e.detail;
|
|
41
40
|
if (detail.AwaitingSignatureCheck) {
|
|
42
41
|
printEftPosReceipt(detail.SignatureRequiredMessage._receiptToSign, ReceiptTypes.SIGNATURE_RECEIPT);
|
|
43
42
|
} else if (detail.Finished) {
|
|
44
|
-
const responseData =
|
|
45
|
-
if (
|
|
43
|
+
const responseData = detail?.Response?.Data;
|
|
44
|
+
if (responseData?.merchant_receipt && !responseData?.merchant_receipt_printed) {
|
|
46
45
|
printEftPosReceipt(responseData.merchant_receipt, ReceiptTypes.MERCHANT_COPY);
|
|
47
46
|
}
|
|
48
|
-
if (
|
|
47
|
+
if (responseData?.customer_receipt && !responseData?.customer_receipt_printed) {
|
|
49
48
|
printEftPosReceipt(responseData.customer_receipt, ReceiptTypes.CUSTOMER_COPY);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
52
|
const worldlineReceiptHandler = (ev) => {
|
|
54
|
-
var _a;
|
|
55
53
|
const { data, event } = ev.detail;
|
|
56
54
|
if (event.exception) {
|
|
57
55
|
console.error("Worldline TimApi receipt error:", event.exception);
|
|
58
56
|
return;
|
|
59
57
|
}
|
|
60
|
-
if (
|
|
58
|
+
if (data?.printData?.receipts && Array.isArray(data.printData.receipts)) {
|
|
61
59
|
data.printData.receipts.forEach((receipt) => {
|
|
62
60
|
const recipientMapping = {
|
|
63
61
|
// @ts-expect-error - Using constants from external library
|
package/dist/linkly.d.ts
CHANGED
|
@@ -225,11 +225,11 @@ export declare type PairingClientRequestError = Array<{
|
|
|
225
225
|
field: string;
|
|
226
226
|
}>;
|
|
227
227
|
|
|
228
|
-
export declare const PairLinkly: DefineComponent< {},
|
|
228
|
+
export declare const PairLinkly: DefineComponent< {}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
229
229
|
"pairing-success": (data: PinpadPairingResult) => any;
|
|
230
230
|
}, string, PublicProps, Readonly<{}> & Readonly<{
|
|
231
231
|
"onPairing-success"?: ((data: PinpadPairingResult) => any) | undefined;
|
|
232
|
-
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {},
|
|
232
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
233
233
|
|
|
234
234
|
export declare type PinpadPairingResult = {
|
|
235
235
|
success: boolean;
|
package/dist/linkly.js
CHANGED
package/dist/mx51.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function getTransaction(posRefId?: string): void;
|
|
|
30
30
|
|
|
31
31
|
export declare function log(message: string, event?: any): void;
|
|
32
32
|
|
|
33
|
-
export declare const PairMX51: DefineComponent< {},
|
|
33
|
+
export declare const PairMX51: DefineComponent< {}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Initiates a purchase transaction
|
package/dist/mx51.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as spi, r as receiptOptions } from "./PairMX51.vue_vue_type_script_setup_true_lang-
|
|
2
|
-
import { _, l } from "./PairMX51.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { s as spi, r as receiptOptions } from "./PairMX51.vue_vue_type_script_setup_true_lang-WOcvKdRl.js";
|
|
2
|
+
import { _, l } from "./PairMX51.vue_vue_type_script_setup_true_lang-WOcvKdRl.js";
|
|
3
3
|
import { defineComponent, ref, onMounted, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createCommentVNode, createElementVNode, toDisplayString, withDirectives } from "vue";
|
|
4
4
|
import { SuccessState, TransactionType, SpiStatus } from "@mx51/spi-client-js";
|
|
5
5
|
import { v4 } from "uuid";
|
|
@@ -93,7 +93,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
93
93
|
runningTxData.value = { posRefId: "", txnAmount: 0, txType: "" };
|
|
94
94
|
}
|
|
95
95
|
document.addEventListener("TxFlowStateChanged", (e) => {
|
|
96
|
-
var _a, _b, _c;
|
|
97
96
|
model.value = true;
|
|
98
97
|
runningTxData.value.posRefId = e.detail.PosRefId;
|
|
99
98
|
runningTxData.value.txType = e.detail.Type;
|
|
@@ -118,7 +117,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
118
117
|
}
|
|
119
118
|
break;
|
|
120
119
|
case SuccessState.Failed:
|
|
121
|
-
pairInfo.value.message =
|
|
120
|
+
pairInfo.value.message = e.detail?.Response?.Data?.error_detail ?? e.detail.DisplayMessage;
|
|
122
121
|
pairInfo.value.state = "FAILED";
|
|
123
122
|
break;
|
|
124
123
|
case SuccessState.Unknown:
|
|
@@ -176,7 +175,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
176
175
|
_cache[5] || (_cache[5] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500 dark:text-gray-300" }, " Attempting to cancel transaction ", -1)),
|
|
177
176
|
createElementVNode("div", _hoisted_3, toDisplayString(pairInfo.value.message), 1)
|
|
178
177
|
]),
|
|
179
|
-
_: 1
|
|
178
|
+
_: 1,
|
|
179
|
+
__: [5]
|
|
180
180
|
})) : pairInfo.value.state === "MANUAL_RECOVERY" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
|
|
181
181
|
default: withCtx(() => [
|
|
182
182
|
_cache[6] || (_cache[6] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500 dark:text-gray-300" }, " Was the transaction successful ", -1)),
|
|
@@ -204,7 +204,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
204
204
|
})
|
|
205
205
|
])
|
|
206
206
|
]),
|
|
207
|
-
_: 1
|
|
207
|
+
_: 1,
|
|
208
|
+
__: [6, 7]
|
|
208
209
|
})) : pairInfo.value.state === "AWAITING_SIGNATURE_CHECK" ? (openBlock(), createBlock(unref(QCardSection), { key: 3 }, {
|
|
209
210
|
default: withCtx(() => [
|
|
210
211
|
_cache[8] || (_cache[8] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500 dark:text-gray-300" }, " Confirm the customer's signature ", -1)),
|
|
@@ -232,7 +233,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
232
233
|
})
|
|
233
234
|
])
|
|
234
235
|
]),
|
|
235
|
-
_: 1
|
|
236
|
+
_: 1,
|
|
237
|
+
__: [8]
|
|
236
238
|
})) : pairInfo.value.state === "SUCCESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 4 }, {
|
|
237
239
|
default: withCtx(() => [
|
|
238
240
|
_cache[9] || (_cache[9] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500 dark:text-gray-300" }, "Transaction Successful", -1)),
|
|
@@ -248,7 +250,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
248
250
|
[_directive_close_popup]
|
|
249
251
|
])
|
|
250
252
|
]),
|
|
251
|
-
_: 1
|
|
253
|
+
_: 1,
|
|
254
|
+
__: [9]
|
|
252
255
|
})) : pairInfo.value.state === "FAILED" ? (openBlock(), createBlock(unref(QCardSection), { key: 5 }, {
|
|
253
256
|
default: withCtx(() => [
|
|
254
257
|
_cache[10] || (_cache[10] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500 dark:text-gray-300" }, "Transaction Failed", -1)),
|
|
@@ -265,7 +268,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
265
268
|
[_directive_close_popup]
|
|
266
269
|
])
|
|
267
270
|
]),
|
|
268
|
-
_: 1
|
|
271
|
+
_: 1,
|
|
272
|
+
__: [10]
|
|
269
273
|
})) : createCommentVNode("", true)
|
|
270
274
|
]),
|
|
271
275
|
_: 1
|
package/dist/smartpay.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare interface PairingResponse {
|
|
|
23
23
|
result: "success";
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export declare const PairSmartPay: DefineComponent< {},
|
|
26
|
+
export declare const PairSmartPay: DefineComponent< {}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
27
27
|
|
|
28
28
|
export declare interface PollingResponseData {
|
|
29
29
|
transactionId: string;
|
package/dist/smartpay.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, P, _, R, S, T, b, a, c, u } from "./PairSmartPay.vue_vue_type_script_setup_true_lang
|
|
1
|
+
import { D, P, _, R, S, T, b, a, c, u } from "./PairSmartPay.vue_vue_type_script_setup_true_lang--WeZf2Sw.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEV_SMARTPAY_API_URL,
|
|
4
4
|
P as PROD_SMARTPAY_API_URL,
|
package/dist/till-payment.d.ts
CHANGED
|
@@ -122,7 +122,7 @@ export declare interface NftIntentRequestBody {
|
|
|
122
122
|
parentIntentId?: string;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
export declare const PairTillPayment: DefineComponent< {},
|
|
125
|
+
export declare const PairTillPayment: DefineComponent< {}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
126
126
|
|
|
127
127
|
export declare interface PaymentIntentRequestBody {
|
|
128
128
|
/**
|
package/dist/till-payment.js
CHANGED
package/dist/tyro.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ declare type __VLS_PublicProps = {
|
|
|
11
11
|
modelValue?: boolean;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export declare const ClientLogsDialog: DefineComponent<__VLS_PublicProps,
|
|
15
|
-
"update:modelValue": (value: boolean) => any;
|
|
14
|
+
export declare const ClientLogsDialog: DefineComponent<__VLS_PublicProps, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: boolean | undefined) => any;
|
|
16
16
|
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
-
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
18
18
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
19
19
|
|
|
20
20
|
export declare interface PairResponse {
|
|
@@ -32,7 +32,7 @@ export declare interface PairResponse {
|
|
|
32
32
|
integrationKey: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export declare const PairTyro: DefineComponent<__VLS_Props,
|
|
35
|
+
export declare const PairTyro: DefineComponent<__VLS_Props, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
36
36
|
|
|
37
37
|
export declare type PairTyroCallback = (response: PairResponse) => void;
|
|
38
38
|
|
package/dist/tyro.js
CHANGED
package/dist/worldline.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ declare interface PairingInput {
|
|
|
61
61
|
autoCommit?: boolean;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export declare const PairTimapi: DefineComponent< {},
|
|
64
|
+
export declare const PairTimapi: DefineComponent< {}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
|
|
66
66
|
export declare const timApi: AdvanceEcr;
|
|
67
67
|
|
|
@@ -73,17 +73,17 @@ declare interface TimApiConfig {
|
|
|
73
73
|
integratorId: string;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export declare const TimApiDialog: DefineComponent< {},
|
|
76
|
+
export declare const TimApiDialog: DefineComponent< {}, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
|
|
78
78
|
export declare const TimApiEvents: Readonly<{
|
|
79
79
|
TxnCompleted: "timTxnCompleted";
|
|
80
80
|
BalanceCompleted: "timBalanceCompleted";
|
|
81
81
|
}>;
|
|
82
82
|
|
|
83
|
-
export declare const TimApiLogs: DefineComponent<__VLS_PublicProps,
|
|
84
|
-
"update:modelValue": (value: boolean) => any;
|
|
83
|
+
export declare const TimApiLogs: DefineComponent<__VLS_PublicProps, void, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
84
|
+
"update:modelValue": (value: boolean | undefined) => any;
|
|
85
85
|
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
86
|
-
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
86
|
+
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
87
87
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
88
88
|
|
|
89
89
|
export declare const TransactionTypes: {
|
package/dist/worldline.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
1
|
import dayjs from "dayjs";
|
|
5
2
|
import Dexie, { liveQuery } from "dexie";
|
|
6
3
|
import { e as emitter } from "./emitter-B70DsNvX.js";
|
|
@@ -18,9 +15,9 @@ function downloadTxtFile(filename, dataArray) {
|
|
|
18
15
|
document.body.removeChild(link);
|
|
19
16
|
}
|
|
20
17
|
class RotatingDatabase extends Dexie {
|
|
18
|
+
items;
|
|
21
19
|
constructor(dbName, options = {}) {
|
|
22
20
|
super(dbName);
|
|
23
|
-
__publicField(this, "items");
|
|
24
21
|
this.version(1).stores({
|
|
25
22
|
items: "++id, timestamp"
|
|
26
23
|
});
|
|
@@ -144,12 +141,12 @@ const LS_KEYS = Object.freeze({
|
|
|
144
141
|
LAST_TXN_SEQ: "timapi.lastTxnSeq"
|
|
145
142
|
});
|
|
146
143
|
class AdvanceEcr {
|
|
144
|
+
_config;
|
|
145
|
+
isReady;
|
|
146
|
+
_isStarted;
|
|
147
|
+
requestInProgress;
|
|
148
|
+
terminal;
|
|
147
149
|
constructor(config) {
|
|
148
|
-
__publicField(this, "_config");
|
|
149
|
-
__publicField(this, "isReady");
|
|
150
|
-
__publicField(this, "_isStarted");
|
|
151
|
-
__publicField(this, "requestInProgress");
|
|
152
|
-
__publicField(this, "terminal");
|
|
153
150
|
this._config = { ...config };
|
|
154
151
|
this.isReady = false;
|
|
155
152
|
this._isStarted = false;
|
|
@@ -499,7 +496,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
499
496
|
ripple: false
|
|
500
497
|
}))
|
|
501
498
|
]),
|
|
502
|
-
_: 1
|
|
499
|
+
_: 1,
|
|
500
|
+
__: [3]
|
|
503
501
|
}),
|
|
504
502
|
createVNode(unref(QDialog), {
|
|
505
503
|
modelValue: model.value,
|
|
@@ -665,7 +663,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
665
663
|
_cache[2] || (_cache[2] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Attempting to cancel transaction", -1)),
|
|
666
664
|
createElementVNode("div", _hoisted_7, toDisplayString(pairInfo.value.message), 1)
|
|
667
665
|
]),
|
|
668
|
-
_: 1
|
|
666
|
+
_: 1,
|
|
667
|
+
__: [2]
|
|
669
668
|
})) : pairInfo.value.state === "SUCCESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
|
|
670
669
|
default: withCtx(() => [
|
|
671
670
|
createElementVNode("div", _hoisted_8, toDisplayString(pairInfo.value.message), 1),
|
|
@@ -690,7 +689,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
690
689
|
[_directive_close_popup]
|
|
691
690
|
])
|
|
692
691
|
]),
|
|
693
|
-
_: 1
|
|
692
|
+
_: 1,
|
|
693
|
+
__: [3]
|
|
694
694
|
})) : createCommentVNode("", true)
|
|
695
695
|
]),
|
|
696
696
|
_: 1
|
|
@@ -731,60 +731,58 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
731
731
|
}, {
|
|
732
732
|
default: withCtx(() => [
|
|
733
733
|
createVNode(unref(QCard), { class: "w-full" }, {
|
|
734
|
-
default: withCtx(() =>
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
[_directive_close_popup]
|
|
752
|
-
])
|
|
753
|
-
]),
|
|
754
|
-
_: 1
|
|
755
|
-
}),
|
|
756
|
-
createElementVNode("div", _hoisted_1, [
|
|
757
|
-
createElementVNode("div", _hoisted_2, [
|
|
758
|
-
createVNode(unref(QBtn), {
|
|
759
|
-
color: "primary",
|
|
760
|
-
unelevated: "",
|
|
761
|
-
onClick: _cache[0] || (_cache[0] = ($event) => showLogs.value = true),
|
|
762
|
-
label: "Show Logs"
|
|
763
|
-
}),
|
|
764
|
-
createVNode(unref(QBtn), {
|
|
765
|
-
color: "primary",
|
|
766
|
-
unelevated: "",
|
|
767
|
-
onClick: _cache[1] || (_cache[1] = ($event) => unref(timApiLogger).cleanAllItems()),
|
|
768
|
-
label: "Clear logs"
|
|
769
|
-
}),
|
|
770
|
-
createVNode(unref(QBtn), {
|
|
771
|
-
color: "primary",
|
|
772
|
-
unelevated: "",
|
|
773
|
-
onClick: _cache[2] || (_cache[2] = ($event) => unref(timApiLogger).downloadLogs("timapi_logs.txt")),
|
|
774
|
-
label: "Download logs"
|
|
775
|
-
})
|
|
776
|
-
]),
|
|
777
|
-
createElementVNode("div", null, [
|
|
778
|
-
createElementVNode("p", _hoisted_3, "Store contains " + toDisplayString(((_a = unref(logs)) == null ? void 0 : _a.length) ?? 0) + " logged events.", 1),
|
|
779
|
-
showLogs.value ? (openBlock(), createElementBlock("ol", _hoisted_4, [
|
|
780
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(logs) ?? [], (log) => {
|
|
781
|
-
return openBlock(), createElementBlock("li", null, toDisplayString(`${unref(dayjs)(log.timestamp)} `) + " " + toDisplayString(log.data), 1);
|
|
782
|
-
}), 256))
|
|
783
|
-
])) : createCommentVNode("", true)
|
|
734
|
+
default: withCtx(() => [
|
|
735
|
+
createVNode(unref(QToolbar), { class: "bg-primary text-white" }, {
|
|
736
|
+
default: withCtx(() => [
|
|
737
|
+
createVNode(unref(QToolbarTitle), null, {
|
|
738
|
+
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
739
|
+
createTextVNode(" Tim API Logs ")
|
|
740
|
+
])),
|
|
741
|
+
_: 1,
|
|
742
|
+
__: [4]
|
|
743
|
+
}),
|
|
744
|
+
withDirectives(createVNode(unref(QIcon), {
|
|
745
|
+
class: "float-right cursor-pointer rounded p-2 transition-colors",
|
|
746
|
+
color: "gray",
|
|
747
|
+
name: "close",
|
|
748
|
+
size: "md"
|
|
749
|
+
}, null, 512), [
|
|
750
|
+
[_directive_close_popup]
|
|
784
751
|
])
|
|
752
|
+
]),
|
|
753
|
+
_: 1
|
|
754
|
+
}),
|
|
755
|
+
createElementVNode("div", _hoisted_1, [
|
|
756
|
+
createElementVNode("div", _hoisted_2, [
|
|
757
|
+
createVNode(unref(QBtn), {
|
|
758
|
+
color: "primary",
|
|
759
|
+
unelevated: "",
|
|
760
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showLogs.value = true),
|
|
761
|
+
label: "Show Logs"
|
|
762
|
+
}),
|
|
763
|
+
createVNode(unref(QBtn), {
|
|
764
|
+
color: "primary",
|
|
765
|
+
unelevated: "",
|
|
766
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(timApiLogger).cleanAllItems()),
|
|
767
|
+
label: "Clear logs"
|
|
768
|
+
}),
|
|
769
|
+
createVNode(unref(QBtn), {
|
|
770
|
+
color: "primary",
|
|
771
|
+
unelevated: "",
|
|
772
|
+
onClick: _cache[2] || (_cache[2] = ($event) => unref(timApiLogger).downloadLogs("timapi_logs.txt")),
|
|
773
|
+
label: "Download logs"
|
|
774
|
+
})
|
|
775
|
+
]),
|
|
776
|
+
createElementVNode("div", null, [
|
|
777
|
+
createElementVNode("p", _hoisted_3, "Store contains " + toDisplayString(unref(logs)?.length ?? 0) + " logged events.", 1),
|
|
778
|
+
showLogs.value ? (openBlock(), createElementBlock("ol", _hoisted_4, [
|
|
779
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(logs) ?? [], (log) => {
|
|
780
|
+
return openBlock(), createElementBlock("li", null, toDisplayString(`${unref(dayjs)(log.timestamp)} `) + " " + toDisplayString(log.data), 1);
|
|
781
|
+
}), 256))
|
|
782
|
+
])) : createCommentVNode("", true)
|
|
785
783
|
])
|
|
786
|
-
]
|
|
787
|
-
|
|
784
|
+
])
|
|
785
|
+
]),
|
|
788
786
|
_: 1
|
|
789
787
|
})
|
|
790
788
|
]),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@achyutlabsau/vue-payment-gateway",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -55,36 +55,38 @@
|
|
|
55
55
|
"docs:preview": "vitepress preview docs"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"uuid": "^11.1.0",
|
|
59
|
-
"@vueuse/core": "^13.1.0",
|
|
60
|
-
"axios": "^1.8.4",
|
|
61
|
-
"dayjs": "^1.11.13",
|
|
62
58
|
"@mx51/spi-client-js": "^2.9.13",
|
|
63
|
-
"@vueuse/
|
|
64
|
-
"
|
|
59
|
+
"@vueuse/core": "^13.5",
|
|
60
|
+
"@vueuse/rxjs": "^13.5.0",
|
|
61
|
+
"axios": "1.10.0",
|
|
62
|
+
"dayjs": "1.11.13",
|
|
63
|
+
"dexie": "^4.0.11",
|
|
64
|
+
"uuid": "^11.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@vueuse/core": "
|
|
68
|
-
"axios": "
|
|
69
|
-
"dayjs": "^1
|
|
70
|
-
"quasar": "^2
|
|
71
|
-
"uuid": "
|
|
72
|
-
"vue": "
|
|
67
|
+
"@vueuse/core": ">=13",
|
|
68
|
+
"axios": ">=1.7",
|
|
69
|
+
"dayjs": "^1",
|
|
70
|
+
"quasar": "^2",
|
|
71
|
+
"uuid": ">=11",
|
|
72
|
+
"vue": ">=3.3.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"tailwindcss": "^
|
|
75
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
76
|
+
"@quasar/extras": "^1.17.0",
|
|
77
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
78
|
+
"@types/node": "*",
|
|
79
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
80
|
+
"@vue/language-core": "^3.0.3",
|
|
81
|
+
"prettier": "^3.6.2",
|
|
82
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
83
|
+
"quasar": "^2.18.2",
|
|
84
|
+
"tailwindcss": "^4.1.11",
|
|
83
85
|
"typescript": "5.8.3",
|
|
84
|
-
"
|
|
85
|
-
"vite
|
|
86
|
-
"vitepress": "^2.0.0-alpha.
|
|
87
|
-
"vue": "^3.5.
|
|
88
|
-
"vue-tsc": "^
|
|
86
|
+
"unplugin-dts": "^1.0.0-beta.4",
|
|
87
|
+
"vite": "^7.0.5",
|
|
88
|
+
"vitepress": "^2.0.0-alpha.8",
|
|
89
|
+
"vue": "^3.5.17",
|
|
90
|
+
"vue-tsc": "^3.0.3"
|
|
89
91
|
}
|
|
90
92
|
}
|