@achyutlabsau/vue-payment-gateway 0.8.2 → 0.8.4

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.
@@ -27,6 +27,7 @@ const getPairingData = () => {
27
27
  try {
28
28
  return JSON.parse(localStorage.getItem("pairingData") ?? "{}");
29
29
  } catch (error) {
30
+ console.error("Failed to fetch pairing data:", error);
30
31
  return {};
31
32
  }
32
33
  };
@@ -35,6 +36,7 @@ const getSecrets = () => {
35
36
  const secrets = localStorage.getItem("secrets");
36
37
  return secrets ? JSON.parse(secrets) : null;
37
38
  } catch (error) {
39
+ console.error("Failed to fetch secret:", error);
38
40
  return null;
39
41
  }
40
42
  };
@@ -133,7 +133,7 @@ class TillPaymentsApi {
133
133
  throw new Error("Please provide 'merchantId' & 'apiKey'.");
134
134
  }
135
135
  this.api = axios.create({
136
- baseURL: TillPaymentsApi.URLS[this.config.environment] + `/merchant/${this.config.merchantId}`,
136
+ baseURL: `${TillPaymentsApi.URLS[this.config.environment]}/merchant/${this.config.merchantId}`,
137
137
  timeout: this.config.timeout,
138
138
  headers: {
139
139
  "Content-Type": "application/json; charset=utf-8",
package/dist/index.d.ts CHANGED
@@ -34,8 +34,19 @@ declare interface InstallOptions extends POSConfig {
34
34
  onReceiptPrint?: (receipt: string, type: ReceiptTypes) => void;
35
35
  }
36
36
 
37
+ export declare const isPaymentGatewayConnected: (gateway: PaymentGateways) => boolean;
38
+
37
39
  export { PairingInterface }
38
40
 
41
+ declare enum PaymentGateways {
42
+ Tyro = "tyro",
43
+ TillPayment = "till-instore",
44
+ MX51 = "mx51-spi",
45
+ Linkly = "linkly",
46
+ SmartPay = "smartpay",
47
+ ANZ = "anz-instore"
48
+ }
49
+
39
50
  declare interface POSConfig {
40
51
  productName: string;
41
52
  productVersion: string;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import "quasar";
3
3
  import { T as TYRO_CONSTANTS, _ as _sfc_main$1 } from "./PairTyro.vue_vue_type_script_setup_true_lang-DWRqMKgQ.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-BXOxZgA9.js";
6
+ import { s as spi, _ as _sfc_main$2 } from "./PairMX51.vue_vue_type_script_setup_true_lang-ZTwAgJC1.js";
7
7
  import "@mx51/spi-client-js";
8
8
  import "uuid";
9
9
  import "./emitter-B70DsNvX.js";
@@ -13,7 +13,7 @@ import "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
13
13
  import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-T2pFHPfq.js";
14
14
  import { _ as _sfc_main$6 } from "./PairSmartPay.vue_vue_type_script_setup_true_lang-iDqycxJ6.js";
15
15
  import "dayjs";
16
- import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-BjQQ6JVC.js";
16
+ import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-D09L5Bf9.js";
17
17
  import { g } from "./index-e4lpzJsL.js";
18
18
  var ReceiptTypes = /* @__PURE__ */ ((ReceiptTypes2) => {
19
19
  ReceiptTypes2["MERCHANT_COPY"] = "MERCHANT_COPY";
@@ -141,8 +141,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
141
141
  };
142
142
  }
143
143
  });
144
+ const getLSItem = (key) => {
145
+ const data = localStorage.getItem(key);
146
+ if (!data) return null;
147
+ try {
148
+ return JSON.parse(data);
149
+ } catch (error) {
150
+ console.log(error);
151
+ return data;
152
+ }
153
+ };
154
+ const isPaymentGatewayConnected = (gateway) => {
155
+ switch (gateway) {
156
+ case PaymentGateways.ANZ:
157
+ return localStorage.getItem("timapi.isTerminalPaired") === "true";
158
+ case PaymentGateways.Linkly:
159
+ return !!getLSItem("linkly.pairConfig")?.isPaired;
160
+ case PaymentGateways.Tyro:
161
+ return !!getLSItem("tyro.pairConfig")?.isPaired;
162
+ case PaymentGateways.TillPayment:
163
+ return !!getLSItem("till.pairConfig")?.isPaired;
164
+ case PaymentGateways.SmartPay:
165
+ return !!getLSItem("smartpay.pairConfig")?.isPaired;
166
+ default:
167
+ return false;
168
+ }
169
+ };
144
170
  export {
145
171
  _sfc_main as PairingInterface,
146
172
  VuePaymentGateway as default,
147
- g as generateTransactionId
173
+ g as generateTransactionId,
174
+ isPaymentGatewayConnected
148
175
  };
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-BXOxZgA9.js";
2
- import { _, l } from "./PairMX51.vue_vue_type_script_setup_true_lang-BXOxZgA9.js";
1
+ import { s as spi, r as receiptOptions } from "./PairMX51.vue_vue_type_script_setup_true_lang-ZTwAgJC1.js";
2
+ import { _, l } from "./PairMX51.vue_vue_type_script_setup_true_lang-ZTwAgJC1.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";
@@ -8,7 +8,8 @@ import { useLocalStorage } from "@vueuse/core";
8
8
  import { e as emitter } from "./emitter-B70DsNvX.js";
9
9
  import { _ as _sfc_main$1 } from "./PBtn.vue_vue_type_script_setup_true_lang-BZRHAS0P.js";
10
10
  function posRefIdGenerator(type) {
11
- return (/* @__PURE__ */ new Date()).toISOString() + "-" + type + v4();
11
+ const isoDate = (/* @__PURE__ */ new Date()).toISOString();
12
+ return `${isoDate}-${type}${v4()}`;
12
13
  }
13
14
  function purchase({ purchaseAmount, tipAmount, cashoutAmount, promptForCashout, surchargeAmount }) {
14
15
  spi.AckFlowEndedAndBackToIdle();
@@ -1,4 +1,4 @@
1
- import { _, S, T, b, a, u } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-BjQQ6JVC.js";
1
+ import { _, S, T, b, a, u } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-D09L5Bf9.js";
2
2
  export {
3
3
  _ as PairTillPayment,
4
4
  S as SettlementTypes,
package/dist/worldline.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import dayjs from "dayjs";
2
- import Dexie, { liveQuery } from "dexie";
2
+ import { Dexie, liveQuery } from "dexie";
3
3
  import { e as emitter } from "./emitter-B70DsNvX.js";
4
4
  import { defineComponent, ref, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createElementVNode, createCommentVNode, toDisplayString, withDirectives, nextTick, createElementBlock, useModel, createTextVNode, Fragment, renderList } from "vue";
5
5
  import { QCard, QForm, QInput, QDialog, QCardSection, Dialog, QToolbar, QToolbarTitle, QIcon, QBtn } from "quasar";
@@ -28,7 +28,7 @@ class RotatingDatabase extends Dexie {
28
28
  }
29
29
  downloadLogs(fileName = "logs.txt") {
30
30
  this.items.toArray().then((items) => {
31
- const data = items.map((log) => `[${dayjs(log.timestamp)}] ` + log.data);
31
+ const data = items.map((log) => `[${dayjs(log.timestamp)}] ${log.data}`);
32
32
  downloadTxtFile(fileName, data);
33
33
  });
34
34
  }
@@ -78,7 +78,7 @@ const eventListener = () => {
78
78
  super.terminalStatusChanged(terminal);
79
79
  let terminalStatus = terminal.getTerminalStatus();
80
80
  emitter.emit("terminalStatusChanged", terminalStatus);
81
- console.log("Terminal Status: " + terminalStatus);
81
+ console.log("Terminal Status: ", terminalStatus);
82
82
  }
83
83
  /**
84
84
  * Called by all of the other request specific methods unless they are implemented differently.
@@ -88,12 +88,12 @@ const eventListener = () => {
88
88
  */
89
89
  requestCompleted(event, data) {
90
90
  super.requestCompleted(event, data);
91
- console.log("Request of type " + event.requestType + " completed...");
91
+ console.log("Request of type ", event.requestType, " completed...");
92
92
  if (event.exception !== void 0) {
93
- console.log("Exception:" + event.exception);
93
+ console.log("Exception:", event.exception);
94
94
  }
95
95
  if (data !== void 0) {
96
- console.log("Request data:" + data);
96
+ console.log("Request data:", data);
97
97
  }
98
98
  }
99
99
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@achyutlabsau/vue-payment-gateway",
3
3
  "private": false,
4
- "version": "0.8.2",
4
+ "version": "0.8.4",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -58,7 +58,7 @@
58
58
  "@mx51/spi-client-js": "^2.9.13",
59
59
  "@vueuse/core": "^14.0",
60
60
  "@vueuse/rxjs": "^14.0.0",
61
- "axios": "1.13.1",
61
+ "axios": "1.13.2",
62
62
  "dayjs": "1.11.19",
63
63
  "dexie": "^4.2.1",
64
64
  "uuid": "^13.0.0"
@@ -69,25 +69,25 @@
69
69
  "dayjs": "^1",
70
70
  "quasar": "^2",
71
71
  "uuid": ">=11",
72
- "vue": ">=3.3.0"
72
+ "vue": ">=3.5.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@microsoft/api-extractor": "^7.53.3",
75
+ "@microsoft/api-extractor": "^7.55.0",
76
76
  "@quasar/extras": "^1.17.0",
77
- "@tailwindcss/vite": "^4.1.16",
77
+ "@tailwindcss/vite": "^4.1.17",
78
78
  "@types/node": "*",
79
79
  "@vitejs/plugin-vue": "^6.0.1",
80
- "@vue/language-core": "^3.1.2",
81
- "oxlint": "^1.25.0",
80
+ "@vue/language-core": "^3.1.3",
81
+ "oxlint": "^1.28.0",
82
82
  "prettier": "^3.6.2",
83
83
  "prettier-plugin-tailwindcss": "^0.7.1",
84
84
  "quasar": "^2.18.5",
85
- "tailwindcss": "^4.1.16",
85
+ "tailwindcss": "^4.1.17",
86
86
  "typescript": "5.9.3",
87
87
  "unplugin-dts": "^1.0.0-beta.6",
88
- "vite": "^7.1.12",
88
+ "vite": "^7.2.2",
89
89
  "vitepress": "^2.0.0-alpha.8",
90
- "vue": "^3.5.22",
91
- "vue-tsc": "^3.1.2"
90
+ "vue": "^3.5.24",
91
+ "vue-tsc": "^3.1.3"
92
92
  }
93
93
  }