@achyutlabsau/vue-payment-gateway 0.2.12 → 0.2.13
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/PairInstructions.vue_vue_type_script_setup_true_lang-Bb-qOfVi.js +82 -0
- package/dist/index.js +1 -1
- package/dist/mx51.js +30 -49
- package/dist/tyro.d.ts +11 -0
- package/dist/tyro.js +150 -13
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref, Fragment, renderList, toDisplayString } from "vue";
|
|
2
|
+
import { QIcon, QBtn } from "quasar";
|
|
3
|
+
const mdiBarcode = "M2,6H4V18H2V6M5,6H6V18H5V6M7,6H10V18H7V6M11,6H12V18H11V6M14,6H16V18H14V6M17,6H20V18H17V6M21,6H22V18H21V6Z";
|
|
4
|
+
const mdiCheckCircle = "M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z";
|
|
5
|
+
const mdiChevronLeft = "M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z";
|
|
6
|
+
const mdiDevices = "M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z";
|
|
7
|
+
const mdiInformation = "M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";
|
|
8
|
+
const mdiLink = "M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z";
|
|
9
|
+
const mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
|
|
10
|
+
const _hoisted_1 = { class: "rounded-lg bg-white p-6 shadow-lg" };
|
|
11
|
+
const _hoisted_2 = { class: "mb-8 space-y-4" };
|
|
12
|
+
const _hoisted_3 = { class: "flex items-center justify-center" };
|
|
13
|
+
const _hoisted_4 = { class: "mb-8 space-y-4" };
|
|
14
|
+
const _hoisted_5 = { class: "text-primary flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-100 font-semibold" };
|
|
15
|
+
const _hoisted_6 = { class: "text-gray-700" };
|
|
16
|
+
const _hoisted_7 = { class: "mb-6 flex items-start space-x-3 rounded-lg bg-amber-50 p-4" };
|
|
17
|
+
const _hoisted_8 = { class: "flex justify-end" };
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "PairInstructions",
|
|
20
|
+
props: {
|
|
21
|
+
steps: {}
|
|
22
|
+
},
|
|
23
|
+
emits: ["next"],
|
|
24
|
+
setup(__props) {
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
27
|
+
createElementVNode("div", _hoisted_2, [
|
|
28
|
+
createElementVNode("div", _hoisted_3, [
|
|
29
|
+
createVNode(unref(QIcon), {
|
|
30
|
+
name: unref(mdiDevices),
|
|
31
|
+
size: "3rem",
|
|
32
|
+
class: "text-primary"
|
|
33
|
+
}, null, 8, ["name"])
|
|
34
|
+
]),
|
|
35
|
+
_cache[1] || (_cache[1] = createElementVNode("h2", { class: "text-center text-2xl font-bold text-gray-800" }, "Terminal Setup Instructions", -1)),
|
|
36
|
+
_cache[2] || (_cache[2] = createElementVNode("p", { class: "text-center text-gray-600" }, "Please follow these steps to pair your terminal", -1))
|
|
37
|
+
]),
|
|
38
|
+
createElementVNode("ul", _hoisted_4, [
|
|
39
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.steps, (step, index) => {
|
|
40
|
+
return openBlock(), createElementBlock("li", {
|
|
41
|
+
key: index,
|
|
42
|
+
class: "flex items-center space-x-3"
|
|
43
|
+
}, [
|
|
44
|
+
createElementVNode("span", _hoisted_5, toDisplayString(index + 1), 1),
|
|
45
|
+
createElementVNode("span", _hoisted_6, toDisplayString(step), 1)
|
|
46
|
+
]);
|
|
47
|
+
}), 128))
|
|
48
|
+
]),
|
|
49
|
+
createElementVNode("div", _hoisted_7, [
|
|
50
|
+
createVNode(unref(QIcon), {
|
|
51
|
+
name: unref(mdiInformation),
|
|
52
|
+
size: "sm",
|
|
53
|
+
class: "mt-0.5 text-amber-500"
|
|
54
|
+
}, null, 8, ["name"]),
|
|
55
|
+
_cache[3] || (_cache[3] = createElementVNode("div", { class: "flex-1" }, [
|
|
56
|
+
createElementVNode("div", { class: "font-medium text-amber-800" }, "Important Note"),
|
|
57
|
+
createElementVNode("div", { class: "text-amber-700" }, "Please refer to your terminal guide for the most up-to-date instructions.")
|
|
58
|
+
], -1))
|
|
59
|
+
]),
|
|
60
|
+
createElementVNode("div", _hoisted_8, [
|
|
61
|
+
createVNode(unref(QBtn), {
|
|
62
|
+
color: "primary",
|
|
63
|
+
unelevated: "",
|
|
64
|
+
"icon-right": "chevron_right",
|
|
65
|
+
label: "Next",
|
|
66
|
+
"no-caps": "",
|
|
67
|
+
ripple: false,
|
|
68
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("next"))
|
|
69
|
+
})
|
|
70
|
+
])
|
|
71
|
+
]);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
_sfc_main as _,
|
|
77
|
+
mdiRefresh as a,
|
|
78
|
+
mdiBarcode as b,
|
|
79
|
+
mdiChevronLeft as c,
|
|
80
|
+
mdiLink as d,
|
|
81
|
+
mdiCheckCircle as m
|
|
82
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { s as setState, a as setEnvironment, i as isPluginInitialized } from "./state-D014QcxX.js";
|
|
2
2
|
import "quasar";
|
|
3
3
|
import { T as TYRO_CONSTANTS } from "./tyro.enums-OZuKaM2C.js";
|
|
4
|
+
import "vue";
|
|
4
5
|
import { useScriptTag } from "@vueuse/core";
|
|
5
6
|
import { s as spi } from "./event-DqmWpDvf.js";
|
|
6
|
-
import "vue";
|
|
7
7
|
import "@mx51/spi-client-js";
|
|
8
8
|
import "uuid";
|
|
9
9
|
import { g } from "./index-C8vc_75e.js";
|
package/dist/mx51.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { l as log, s as spi, g as getPairingData, a as getTenants, r as receiptOptions } from "./event-DqmWpDvf.js";
|
|
2
|
-
import { defineComponent, ref, computed, onMounted, watch, resolveDirective, openBlock, createElementBlock,
|
|
2
|
+
import { defineComponent, ref, computed, onMounted, watch, resolveDirective, openBlock, createElementBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createCommentVNode, toDisplayString, withDirectives } from "vue";
|
|
3
3
|
import { QCard, QForm, QSelect, QInput, QCheckbox, QIcon, QBtn, QDialog, QCardSection, Dialog } from "quasar";
|
|
4
4
|
import { useEventListener, useLocalStorage } from "@vueuse/core";
|
|
5
5
|
import { SpiStatus, SuccessState, TransactionType } from "@mx51/spi-client-js";
|
|
6
6
|
import { b as state } from "./state-D014QcxX.js";
|
|
7
|
+
import { _ as _sfc_main$2 } from "./PairInstructions.vue_vue_type_script_setup_true_lang-Bb-qOfVi.js";
|
|
7
8
|
import { v4 } from "uuid";
|
|
8
9
|
async function pair(pairingInput) {
|
|
9
10
|
spi.SetTenantCode(pairingInput.tenantCode);
|
|
@@ -12,11 +13,10 @@ async function pair(pairingInput) {
|
|
|
12
13
|
spi.SetPosId(pairingInput.posId);
|
|
13
14
|
spi.SetAutoAddressResolution(pairingInput.autoAddressResolution);
|
|
14
15
|
spi.SetTestMode(pairingInput.testMode);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
16
|
+
const res = await spi.GetTerminalAddress();
|
|
17
|
+
if (!res) return false;
|
|
18
|
+
spi.SetEftposAddress(res);
|
|
19
|
+
localStorage.setItem("eftposAddress", res);
|
|
20
20
|
log("Pairing...");
|
|
21
21
|
return spi.Pair();
|
|
22
22
|
}
|
|
@@ -33,7 +33,7 @@ function cancelPairing() {
|
|
|
33
33
|
log("Pairing cancelled");
|
|
34
34
|
spi.PairingCancel();
|
|
35
35
|
}
|
|
36
|
-
const _hoisted_1$1 = { class: "
|
|
36
|
+
const _hoisted_1$1 = { class: "" };
|
|
37
37
|
const _hoisted_2$1 = { class: "mb-0 grid grid-cols-2 gap-x-3" };
|
|
38
38
|
const _hoisted_3$1 = { class: "rounded bg-gray-100 p-3" };
|
|
39
39
|
const _hoisted_4$1 = {
|
|
@@ -54,18 +54,23 @@ const _hoisted_9 = { class: "text-center font-semibold text-gray-500 uppercase"
|
|
|
54
54
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
55
55
|
__name: "PairMX51",
|
|
56
56
|
setup(__props) {
|
|
57
|
+
const SETUP_STEPS = [
|
|
58
|
+
"Select your payment provider.",
|
|
59
|
+
"On the terminal: Go to “Manage POS pairing” to create a new POS Pairing.",
|
|
60
|
+
"On the terminal: Select “Simple Payments Integration”.",
|
|
61
|
+
"Enter the serial number and IP address provided from the terminal.",
|
|
62
|
+
"Create a POS ID to identify the pairing connection.",
|
|
63
|
+
"Tap “Pair” to initiate the pairing on both devices."
|
|
64
|
+
];
|
|
65
|
+
const showInstructions = ref(!spi._currentStatus || spi._currentStatus === SpiStatus.Unpaired);
|
|
57
66
|
function isValidIP(str) {
|
|
58
|
-
|
|
59
|
-
const regex = new RegExp(`^${octet}\\.${octet}\\.${octet}\\.${octet}$`);
|
|
60
|
-
return regex.test(str);
|
|
67
|
+
return spi._regexItemsForEftposAddress.test(str);
|
|
61
68
|
}
|
|
62
69
|
function isValidFQDN(str) {
|
|
63
|
-
|
|
64
|
-
return fqdnRegex.test(str);
|
|
70
|
+
return spi._regexItemsForFqdnEftposAddress.test(str);
|
|
65
71
|
}
|
|
66
72
|
function isAlphanumeric(str) {
|
|
67
|
-
|
|
68
|
-
return alphanumericRegex.test(str);
|
|
73
|
+
return spi._regexItemsForPosId.test(str);
|
|
69
74
|
}
|
|
70
75
|
const tenants = ref([]);
|
|
71
76
|
const model = ref(false);
|
|
@@ -89,6 +94,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
89
94
|
confirmationCode: ""
|
|
90
95
|
});
|
|
91
96
|
const isOtherTenantSelected = computed(() => selectedTenant.value === "other");
|
|
97
|
+
const handleNext = () => {
|
|
98
|
+
showInstructions.value = false;
|
|
99
|
+
};
|
|
92
100
|
const resetPairForm = () => {
|
|
93
101
|
localStorage.removeItem("pairingData");
|
|
94
102
|
localStorage.removeItem("eftposAddress");
|
|
@@ -147,7 +155,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
147
155
|
pairInfo.value.confirmationCode = (_b = e == null ? void 0 : e.detail) == null ? void 0 : _b.ConfirmationCode;
|
|
148
156
|
if (((_c = e == null ? void 0 : e.detail) == null ? void 0 : _c.Successful) && ((_d = e == null ? void 0 : e.detail) == null ? void 0 : _d.Finished)) {
|
|
149
157
|
localStorage.setItem("pairingData", JSON.stringify(pairForm.value));
|
|
150
|
-
localStorage.setItem("eftposAddress", pairForm.value.eftposAddress);
|
|
151
158
|
}
|
|
152
159
|
if ((_e = e == null ? void 0 : e.detail) == null ? void 0 : _e.Finished) {
|
|
153
160
|
pairInfo.value.state = "FINISHED";
|
|
@@ -178,10 +185,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
178
185
|
return (_ctx, _cache) => {
|
|
179
186
|
const _directive_close_popup = resolveDirective("close-popup");
|
|
180
187
|
return openBlock(), createElementBlock("section", _hoisted_1$1, [
|
|
181
|
-
|
|
188
|
+
showInstructions.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
189
|
+
key: 0,
|
|
190
|
+
onNext: handleNext,
|
|
191
|
+
steps: SETUP_STEPS
|
|
192
|
+
})) : (openBlock(), createBlock(unref(QCard), {
|
|
193
|
+
key: 1,
|
|
182
194
|
flat: "",
|
|
183
195
|
bordered: "",
|
|
184
|
-
class: "
|
|
196
|
+
class: "w-full rounded-md p-6"
|
|
185
197
|
}, {
|
|
186
198
|
default: withCtx(() => [
|
|
187
199
|
_cache[14] || (_cache[14] = createElementVNode("div", { class: "text-lg font-semibold text-gray-600" }, "Pairing configuration", -1)),
|
|
@@ -387,38 +399,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
387
399
|
}, 8, ["modelValue"])
|
|
388
400
|
]),
|
|
389
401
|
_: 1
|
|
390
|
-
})
|
|
391
|
-
createVNode(unref(QCard), {
|
|
392
|
-
class: "h-fit max-w-sm",
|
|
393
|
-
flat: "",
|
|
394
|
-
bordered: ""
|
|
395
|
-
}, {
|
|
396
|
-
default: withCtx(() => [
|
|
397
|
-
createVNode(unref(QCardSection), null, {
|
|
398
|
-
default: withCtx(() => _cache[15] || (_cache[15] = [
|
|
399
|
-
createElementVNode("div", { class: "text-xl" }, [
|
|
400
|
-
createTextVNode(" Steps to pair for: "),
|
|
401
|
-
createElementVNode("br"),
|
|
402
|
-
createElementVNode("b", null, "Simple Payments Integration")
|
|
403
|
-
], -1),
|
|
404
|
-
createElementVNode("ul", { class: "mt-3 list-inside list-decimal space-y-2 text-base" }, [
|
|
405
|
-
createElementVNode("li", null, "Select your payment provider."),
|
|
406
|
-
createElementVNode("li", null, "On the terminal: Go to “Manage POS pairing” to create a new POS Pairing."),
|
|
407
|
-
createElementVNode("li", null, [
|
|
408
|
-
createTextVNode("On the terminal: Select "),
|
|
409
|
-
createElementVNode("b", null, "“Simple Payments Integration”"),
|
|
410
|
-
createTextVNode(".")
|
|
411
|
-
]),
|
|
412
|
-
createElementVNode("li", null, "Enter the serial number and IP address provided from the terminal."),
|
|
413
|
-
createElementVNode("li", null, "Create a POS ID to identify the pairing connection."),
|
|
414
|
-
createElementVNode("li", null, "Tap “Pair” to initiate the pairing on both devices.")
|
|
415
|
-
], -1)
|
|
416
|
-
])),
|
|
417
|
-
_: 1
|
|
418
|
-
})
|
|
419
|
-
]),
|
|
420
|
-
_: 1
|
|
421
|
-
})
|
|
402
|
+
}))
|
|
422
403
|
]);
|
|
423
404
|
};
|
|
424
405
|
}
|
package/dist/tyro.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
import { PublicProps } from 'vue';
|
|
5
|
+
|
|
6
|
+
declare type __VLS_Props = {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
1
10
|
export declare interface PairResponse {
|
|
2
11
|
/**
|
|
3
12
|
* Status of the pairing request, can be inProgress, success, failure. If inProgress then more responses will follow.
|
|
@@ -13,6 +22,8 @@ export declare interface PairResponse {
|
|
|
13
22
|
integrationKey: string;
|
|
14
23
|
}
|
|
15
24
|
|
|
25
|
+
export declare const PairTyro: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
|
|
16
27
|
export declare type PairTyroCallback = (response: PairResponse) => void;
|
|
17
28
|
|
|
18
29
|
export declare interface PurchaseRequestParams {
|
package/dist/tyro.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { QSpinnerHourglass, Dialog } from "quasar";
|
|
1
|
+
import { QSpinnerHourglass, Dialog, QIcon, QBtn, QInput } from "quasar";
|
|
2
2
|
import { c as checkPluginInitialized, e as environment, b as state } from "./state-D014QcxX.js";
|
|
3
3
|
import { T as TYRO_CONSTANTS } from "./tyro.enums-OZuKaM2C.js";
|
|
4
4
|
import { a } from "./tyro.enums-OZuKaM2C.js";
|
|
5
|
+
import { defineComponent, ref, unref, openBlock, createElementBlock, createElementVNode, createVNode, createTextVNode, toDisplayString, createBlock, withModifiers, isRef, withCtx } from "vue";
|
|
6
|
+
import { useLocalStorage } from "@vueuse/core";
|
|
7
|
+
import { m as mdiCheckCircle, a as mdiRefresh, _ as _sfc_main$1, b as mdiBarcode, c as mdiChevronLeft, d as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-Bb-qOfVi.js";
|
|
5
8
|
const dialogDefaultOpts = {
|
|
6
9
|
message: "Pairing in progress...",
|
|
7
10
|
class: "text-lg",
|
|
@@ -33,9 +36,6 @@ const responseReceivedCallbackImp = (dialog, response) => {
|
|
|
33
36
|
progress: false,
|
|
34
37
|
message: `<div class="text-gray-800 text-base">${response.message}</div>`
|
|
35
38
|
});
|
|
36
|
-
setTimeout(() => {
|
|
37
|
-
dialog == null ? void 0 : dialog.hide();
|
|
38
|
-
}, 4500);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
dialog == null ? void 0 : dialog.update({
|
|
@@ -48,12 +48,15 @@ const responseReceivedCallbackImp = (dialog, response) => {
|
|
|
48
48
|
const useTyro = () => {
|
|
49
49
|
checkPluginInitialized();
|
|
50
50
|
const { IFRAME_URL } = environment.value === "production" ? TYRO_CONSTANTS.URLS.PRODUCTION : TYRO_CONSTANTS.URLS.DEVELOPMENT;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
const createIclient = () => {
|
|
52
|
+
const iclient = new TYRO.IClientWithUI(state.tyroApiKey, {
|
|
53
|
+
posProductVendor: state.productVendorName,
|
|
54
|
+
posProductName: state.productName,
|
|
55
|
+
posProductVersion: state.productVersion,
|
|
56
|
+
siteReference: ""
|
|
57
|
+
});
|
|
58
|
+
return iclient;
|
|
59
|
+
};
|
|
57
60
|
const pairTyro = (merchantId, terminalId) => {
|
|
58
61
|
return new Promise((resolve, _reject) => {
|
|
59
62
|
const dialog = Dialog.create({ ...dialogDefaultOpts });
|
|
@@ -70,7 +73,7 @@ const useTyro = () => {
|
|
|
70
73
|
});
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
|
|
76
|
+
createIclient().pairTerminal(merchantId, terminalId, (res) => {
|
|
74
77
|
responseReceivedCallbackImp(dialog, res);
|
|
75
78
|
if (res.status !== "inProgress") {
|
|
76
79
|
resolve(res);
|
|
@@ -80,17 +83,151 @@ const useTyro = () => {
|
|
|
80
83
|
};
|
|
81
84
|
const initiateTyroPurchase = (requestParams, receiptCallback) => {
|
|
82
85
|
return new Promise((resolve, _reject) => {
|
|
83
|
-
|
|
86
|
+
createIclient().initiatePurchase(requestParams, { transactionCompleteCallback: resolve, receiptCallback });
|
|
84
87
|
});
|
|
85
88
|
};
|
|
86
89
|
const initiateTyroRefund = (requestParams, receiptCallback) => {
|
|
87
90
|
return new Promise((resolve, _reject) => {
|
|
88
|
-
|
|
91
|
+
createIclient().initiateRefund(requestParams, { transactionCompleteCallback: resolve, receiptCallback });
|
|
89
92
|
});
|
|
90
93
|
};
|
|
91
94
|
return { IFRAME_URL, pairTyro, initiateTyroPurchase, initiateTyroRefund };
|
|
92
95
|
};
|
|
96
|
+
const _hoisted_1 = {
|
|
97
|
+
key: "paired",
|
|
98
|
+
class: "flex items-center justify-center rounded-lg bg-white p-8 shadow-lg"
|
|
99
|
+
};
|
|
100
|
+
const _hoisted_2 = { class: "text-center" };
|
|
101
|
+
const _hoisted_3 = { class: "mb-6" };
|
|
102
|
+
const _hoisted_4 = { class: "mb-2 text-gray-600" };
|
|
103
|
+
const _hoisted_5 = { class: "font-mono font-medium" };
|
|
104
|
+
const _hoisted_6 = { class: "mb-6 text-sm text-gray-500" };
|
|
105
|
+
const _hoisted_7 = { class: "space-y-3" };
|
|
106
|
+
const _hoisted_8 = {
|
|
107
|
+
key: 1,
|
|
108
|
+
class: "p-6"
|
|
109
|
+
};
|
|
110
|
+
const _hoisted_9 = {
|
|
111
|
+
key: 1,
|
|
112
|
+
class: "rounded-lg bg-white p-8 shadow-lg"
|
|
113
|
+
};
|
|
114
|
+
const _hoisted_10 = { class: "flex items-center justify-end gap-3" };
|
|
115
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
116
|
+
__name: "PairTyro",
|
|
117
|
+
props: {
|
|
118
|
+
merchantId: {}
|
|
119
|
+
},
|
|
120
|
+
setup(__props) {
|
|
121
|
+
const SETUP_STEPS = [
|
|
122
|
+
'Press the "Menu" Button',
|
|
123
|
+
'Select "Configuration"',
|
|
124
|
+
'Select "Integrated EFTPOS"',
|
|
125
|
+
'Select "Pair with POS"',
|
|
126
|
+
'Press "Start"'
|
|
127
|
+
];
|
|
128
|
+
const { pairTyro } = useTyro();
|
|
129
|
+
const props = __props;
|
|
130
|
+
const isPaired = useLocalStorage("tyro.isPaired", false);
|
|
131
|
+
const lastPairedDate = useLocalStorage("tyro.lastPairedDate", "");
|
|
132
|
+
const terminalId = useLocalStorage("tyro.terminalId", "");
|
|
133
|
+
const showInstructions = ref(!isPaired.value);
|
|
134
|
+
const handleRepair = () => {
|
|
135
|
+
showInstructions.value = true;
|
|
136
|
+
isPaired.value = false;
|
|
137
|
+
};
|
|
138
|
+
const handleNext = () => {
|
|
139
|
+
showInstructions.value = false;
|
|
140
|
+
};
|
|
141
|
+
const doPairing = async () => {
|
|
142
|
+
const res = await pairTyro(props.merchantId, terminalId.value);
|
|
143
|
+
if (res.status === "success") {
|
|
144
|
+
lastPairedDate.value = /* @__PURE__ */ new Date();
|
|
145
|
+
isPaired.value = true;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return (_ctx, _cache) => {
|
|
149
|
+
return unref(isPaired) ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
150
|
+
createElementVNode("div", _hoisted_2, [
|
|
151
|
+
createElementVNode("div", _hoisted_3, [
|
|
152
|
+
createVNode(unref(QIcon), {
|
|
153
|
+
name: unref(mdiCheckCircle),
|
|
154
|
+
size: "4rem",
|
|
155
|
+
class: "text-green-500"
|
|
156
|
+
}, null, 8, ["name"])
|
|
157
|
+
]),
|
|
158
|
+
_cache[3] || (_cache[3] = createElementVNode("h2", { class: "mb-4 text-3xl font-bold text-gray-800" }, "Terminal Connected", -1)),
|
|
159
|
+
createElementVNode("p", _hoisted_4, [
|
|
160
|
+
_cache[2] || (_cache[2] = createTextVNode(" Terminal ID: ")),
|
|
161
|
+
createElementVNode("span", _hoisted_5, toDisplayString(unref(terminalId)), 1)
|
|
162
|
+
]),
|
|
163
|
+
createElementVNode("p", _hoisted_6, "Last paired: " + toDisplayString(new Date(unref(lastPairedDate)).toLocaleString()), 1),
|
|
164
|
+
createElementVNode("div", _hoisted_7, [
|
|
165
|
+
createVNode(unref(QBtn), {
|
|
166
|
+
color: "primary",
|
|
167
|
+
unelevated: "",
|
|
168
|
+
"no-caps": "",
|
|
169
|
+
class: "w-full",
|
|
170
|
+
"icon-left": unref(mdiRefresh),
|
|
171
|
+
label: "Re-pair Terminal",
|
|
172
|
+
onClick: handleRepair
|
|
173
|
+
}, null, 8, ["icon-left"])
|
|
174
|
+
])
|
|
175
|
+
])
|
|
176
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
177
|
+
showInstructions.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
178
|
+
key: 0,
|
|
179
|
+
onNext: handleNext,
|
|
180
|
+
steps: SETUP_STEPS
|
|
181
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
182
|
+
_cache[4] || (_cache[4] = createElementVNode("h3", { class: "mb-6 text-xl font-semibold text-gray-800" }, "Enter Terminal Details", -1)),
|
|
183
|
+
createElementVNode("form", {
|
|
184
|
+
onSubmit: withModifiers(doPairing, ["prevent"]),
|
|
185
|
+
class: "space-y-6"
|
|
186
|
+
}, [
|
|
187
|
+
createVNode(unref(QInput), {
|
|
188
|
+
modelValue: unref(terminalId),
|
|
189
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(terminalId) ? terminalId.value = $event : null),
|
|
190
|
+
outlined: "",
|
|
191
|
+
dense: "",
|
|
192
|
+
label: "Terminal ID",
|
|
193
|
+
rules: [(val) => !!val || "Terminal ID is required"],
|
|
194
|
+
hint: "Enter the terminal ID shown on your device",
|
|
195
|
+
class: "w-full"
|
|
196
|
+
}, {
|
|
197
|
+
prepend: withCtx(() => [
|
|
198
|
+
createVNode(unref(QIcon), {
|
|
199
|
+
name: unref(mdiBarcode),
|
|
200
|
+
size: "sm",
|
|
201
|
+
class: "text-gray-400"
|
|
202
|
+
}, null, 8, ["name"])
|
|
203
|
+
]),
|
|
204
|
+
_: 1
|
|
205
|
+
}, 8, ["modelValue", "rules"]),
|
|
206
|
+
createElementVNode("div", _hoisted_10, [
|
|
207
|
+
createVNode(unref(QBtn), {
|
|
208
|
+
flat: "",
|
|
209
|
+
"no-caps": "",
|
|
210
|
+
label: "Back",
|
|
211
|
+
"icon-left": unref(mdiChevronLeft),
|
|
212
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showInstructions.value = true)
|
|
213
|
+
}, null, 8, ["icon-left"]),
|
|
214
|
+
createVNode(unref(QBtn), {
|
|
215
|
+
type: "submit",
|
|
216
|
+
color: "primary",
|
|
217
|
+
unelevated: "",
|
|
218
|
+
"no-caps": "",
|
|
219
|
+
"icon-right": unref(mdiLink),
|
|
220
|
+
label: "Pair Terminal"
|
|
221
|
+
}, null, 8, ["icon-right"])
|
|
222
|
+
])
|
|
223
|
+
], 32)
|
|
224
|
+
]))
|
|
225
|
+
]));
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
});
|
|
93
229
|
export {
|
|
230
|
+
_sfc_main as PairTyro,
|
|
94
231
|
TYRO_CONSTANTS,
|
|
95
232
|
a as TyroTransactionStatus,
|
|
96
233
|
useTyro
|