@achyutlabsau/vue-payment-gateway 0.8.3 → 0.9.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/README.md CHANGED
@@ -26,6 +26,8 @@ app.use(VuePaymentGateway, {
26
26
  posRegisterName: "register-name", // Name of the POS register
27
27
  posBusinessName: "business name", // Name of the business using the POS system
28
28
  tyroApiKey: "tyro-api-key", // API key for Tyro integration
29
+ valpayApiKey: "valpay-api-key", // API key for Valpay (Adyen) integration
30
+ valpayMerchantAccount: "merchant-account", // Merchant account for Valpay
29
31
  environment: "development", // Set environment to 'development' or 'production'
30
32
  });
31
33
  ```
@@ -75,6 +77,31 @@ const linkly = useLinkly();
75
77
  await linkly.processPayment(amount, options);
76
78
  ```
77
79
 
80
+ ### Using Valpay (Adyen)
81
+
82
+ To use the Valpay (Adyen Terminal API) payment gateway, import and initialize it as shown below:
83
+
84
+ ```javascript
85
+ import { useValpay } from "@achyutlabsau/vue-payment-gateway/valpay";
86
+
87
+ const valpay = useValpay();
88
+
89
+ // Get connected terminals
90
+ const { success, terminals } = await valpay.getConnectedTerminals();
91
+
92
+ // Process a payment
93
+ const result = await valpay.processPayment(
94
+ 10050, // Amount in minor units (100.50)
95
+ "AUD", // Currency code
96
+ "V400m-324688179", // Terminal ID (POIID)
97
+ "transaction-12345", // Transaction ID
98
+ "POSSystemID12345" // Sale ID
99
+ );
100
+
101
+ // Cancel an ongoing payment
102
+ const cancelResult = await valpay.cancelPayment("MerchantAbort");
103
+ ```
104
+
78
105
  ## Payment Method API
79
106
 
80
107
  Each payment provider (Tyro, SmartPay, Linkly) provides methods to process payments. Here are some of the most commonly used methods:
@@ -8,6 +8,7 @@ var PaymentGateways = /* @__PURE__ */ ((PaymentGateways2) => {
8
8
  PaymentGateways2["Linkly"] = "linkly";
9
9
  PaymentGateways2["SmartPay"] = "smartpay";
10
10
  PaymentGateways2["ANZ"] = "anz-instore";
11
+ PaymentGateways2["Valpay"] = "adyen-instore";
11
12
  return PaymentGateways2;
12
13
  })(PaymentGateways || {});
13
14
  const state = reactive({
@@ -21,7 +22,9 @@ const state = reactive({
21
22
  tyroApiKey: "",
22
23
  tillPaymentApiKey: "",
23
24
  tillPaymentMerchantId: "",
24
- mx51DeviceApiKey: ""
25
+ mx51DeviceApiKey: "",
26
+ valpayApiKey: "",
27
+ valpayMerchantAccount: ""
25
28
  });
26
29
  const environment = ref("production");
27
30
  const isDense = ref(true);
@@ -38,6 +41,8 @@ const setState = (options) => {
38
41
  options.tillPaymentApiKey && (state.tillPaymentApiKey = options.tillPaymentApiKey);
39
42
  options.tillPaymentMerchantId && (state.tillPaymentMerchantId = options.tillPaymentMerchantId);
40
43
  options.mx51DeviceApiKey && (state.mx51DeviceApiKey = options.mx51DeviceApiKey);
44
+ options.valpayApiKey && (state.valpayApiKey = options.valpayApiKey);
45
+ options.valpayMerchantAccount && (state.valpayMerchantAccount = options.valpayMerchantAccount);
41
46
  };
42
47
  const setEnvironment = (env) => environment.value = env;
43
48
  const checkPluginInitialized = () => {
@@ -87,7 +92,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
92
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.steps, (step, index) => {
88
93
  return openBlock(), createElementBlock("li", {
89
94
  key: index,
90
- class: "flex items-center space-x-3 text-base"
95
+ class: "flex flex-nowrap items-center space-x-3 text-base"
91
96
  }, [
92
97
  createElementVNode("span", _hoisted_4, toDisplayString(index + 1), 1),
93
98
  createElementVNode("span", _hoisted_5, toDisplayString(step), 1)
@@ -4,7 +4,7 @@ import { i as isNetworkError, a as isServerError, d as delay, g as generateTrans
4
4
  import axios, { isAxiosError, HttpStatusCode } from "axios";
5
5
  import { v7 } from "uuid";
6
6
  import { d as dialogDefaultOpts } from "./utils-GrbVNAXw.js";
7
- import { e as environment, c as state, m as mdiCheckCircle, f as mdiChevronLeft, d as mdiRefresh, _ as _sfc_main$3, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-D1m0sTpb.js";
7
+ import { e as environment, c as state, m as mdiCheckCircle, f as mdiChevronLeft, d as mdiRefresh, _ as _sfc_main$3, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-mfX7jhRY.js";
8
8
  import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
9
9
  import { useLocalStorage } from "@vueuse/core";
10
10
  const LINKLY_CONSTANTS = {
@@ -2,7 +2,7 @@ import { defineComponent, ref, computed, onMounted, watch, resolveDirective, cre
2
2
  import { QCard, QForm, QSelect, QInput, QIcon, QDialog, QCardSection, Dialog } from "quasar";
3
3
  import { Spi, TransactionOptions, SuccessState, TransactionType, SpiStatus } from "@mx51/spi-client-js";
4
4
  import { useEventListener } from "@vueuse/core";
5
- import { c as state, _ as _sfc_main$1 } from "./PairInstructions.vue_vue_type_script_setup_true_lang-D1m0sTpb.js";
5
+ import { c as state, _ as _sfc_main$1 } from "./PairInstructions.vue_vue_type_script_setup_true_lang-mfX7jhRY.js";
6
6
  import { _ as _sfc_main$2 } from "./PBtn.vue_vue_type_script_setup_true_lang-BZRHAS0P.js";
7
7
  const spiSettings = {
8
8
  secureWebSockets: true,
@@ -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
  };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, createBlock, createElementBlock, unref, openBlock, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, withModifiers } from "vue";
2
2
  import { useLocalStorage } from "@vueuse/core";
3
3
  import { Dialog, QCard, QIcon, QBtn, QInput } from "quasar";
4
- import { c as state, e as environment, m as mdiCheckCircle, d as mdiRefresh, _ as _sfc_main$1, f as mdiChevronLeft, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-D1m0sTpb.js";
4
+ import { c as state, e as environment, m as mdiCheckCircle, d as mdiRefresh, _ as _sfc_main$1, f as mdiChevronLeft, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-mfX7jhRY.js";
5
5
  import axios, { HttpStatusCode, isAxiosError } from "axios";
6
6
  import { d as delay } from "./index-e4lpzJsL.js";
7
7
  import { d as dialogDefaultOpts } from "./utils-GrbVNAXw.js";
@@ -4,7 +4,7 @@ import axios, { isAxiosError, HttpStatusCode } from "axios";
4
4
  import dayjs from "dayjs";
5
5
  import { Loading, Dialog, QDialog, QCard, QForm, QToolbar, QToolbarTitle, QIcon, QCardSection, QInput, QCardActions, QBtn, Notify, QSelect } from "quasar";
6
6
  import { d as delay } from "./index-e4lpzJsL.js";
7
- import { c as state, m as mdiCheckCircle, f as mdiChevronLeft, d as mdiRefresh, _ as _sfc_main$3, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-D1m0sTpb.js";
7
+ import { c as state, m as mdiCheckCircle, f as mdiChevronLeft, d as mdiRefresh, _ as _sfc_main$3, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-mfX7jhRY.js";
8
8
  import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
9
9
  import { validate } from "uuid";
10
10
  var SettlementTypes = /* @__PURE__ */ ((SettlementTypes2) => {
@@ -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",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, useModel, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createElementVNode, withDirectives, createTextVNode, ref, createElementBlock, toDisplayString, withModifiers } from "vue";
2
2
  import { useLocalStorage } from "@vueuse/core";
3
3
  import { QSpinnerHourglass, Dialog, QDialog, QCard, QToolbar, QToolbarTitle, QIcon, QBtn, QInput } from "quasar";
4
- import { h as checkPluginInitialized, e as environment, c as state, m as mdiCheckCircle, d as mdiRefresh, _ as _sfc_main$2, j as mdiBarcode, f as mdiChevronLeft, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-D1m0sTpb.js";
4
+ import { h as checkPluginInitialized, e as environment, c as state, m as mdiCheckCircle, d as mdiRefresh, _ as _sfc_main$2, j as mdiBarcode, f as mdiChevronLeft, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-mfX7jhRY.js";
5
5
  const dialogDefaultOpts = {
6
6
  message: "Pairing in progress...",
7
7
  class: "text-lg",