@achyutlabsau/vue-payment-gateway 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import axios, { isAxiosError, HttpStatusCode } from "axios";
5
5
  import { v7 } from "uuid";
6
6
  import { d as dialogDefaultOpts } from "./utils-GrbVNAXw.js";
7
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
- import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
8
+ import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-BM8zZxH8.js";
9
9
  import { useLocalStorage } from "@vueuse/core";
10
10
  const LINKLY_CONSTANTS = {
11
11
  PATHS: {
@@ -5,7 +5,7 @@ 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
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
- import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
8
+ import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-BM8zZxH8.js";
9
9
  import { validate } from "uuid";
10
10
  var SettlementTypes = /* @__PURE__ */ ((SettlementTypes2) => {
11
11
  SettlementTypes2["SETTLEMENT"] = "SETTLEMENT";
@@ -1,13 +1,12 @@
1
- import { defineComponent, ref, createElementBlock, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, ref, onMounted, createElementBlock, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString } from "vue";
2
2
  import { useLocalStorage } from "@vueuse/core";
3
3
  import axios, { isAxiosError } from "axios";
4
4
  import { v7 } from "uuid";
5
5
  import { Dialog, QCard, QIcon, QBtn, QCardSection, QForm, QInput, QSelect, Loading, Notify } from "quasar";
6
6
  import { h as checkPluginInitialized, e as environment, c as state, m as mdiCheckCircle, d as mdiRefresh, _ as _sfc_main$2, f as mdiChevronLeft, g as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-mfX7jhRY.js";
7
- import { d as dialogDefaultOpts } from "./utils-GrbVNAXw.js";
8
- import { _ as _sfc_main$1 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
7
+ import { _ as _sfc_main$1 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-BM8zZxH8.js";
9
8
  const TEST_URL = {
10
- TERMINAL: "https://terminal-api-test.adyen.com"
9
+ TERMINAL: "http://localhost:3000/adyen"
11
10
  //http://localhost:3000/adyen| "https://terminal-api-test.adyen.com",
12
11
  };
13
12
  const PROD_URL = {
@@ -15,9 +14,7 @@ const PROD_URL = {
15
14
  };
16
15
  class ValpayAPI {
17
16
  terminalApi;
18
- config;
19
17
  constructor(config) {
20
- this.config = config;
21
18
  const terminalBaseURL = config.environment === "production" ? PROD_URL.TERMINAL : TEST_URL.TERMINAL;
22
19
  this.terminalApi = axios.create({
23
20
  baseURL: terminalBaseURL,
@@ -126,10 +123,10 @@ class ValpayAPI {
126
123
  * Fetches all connected terminals for the merchant account
127
124
  * @returns Promise with connected terminals data
128
125
  */
129
- async getConnectedTerminals() {
126
+ async getConnectedTerminals(merchantAccount) {
130
127
  try {
131
128
  const response = await this.terminalApi.post("/connectedTerminals", {
132
- merchantAccount: this.config.merchantAccount
129
+ merchantAccount
133
130
  });
134
131
  return {
135
132
  success: true,
@@ -157,12 +154,6 @@ class ValpayAPI {
157
154
  message: "Terminal not paired. Please call pairTerminal() first."
158
155
  };
159
156
  }
160
- if (!this.config.merchantAccount) {
161
- return {
162
- success: false,
163
- message: "Merchant account is required for Cloud device API"
164
- };
165
- }
166
157
  if (!amount || amount <= 0) {
167
158
  return {
168
159
  success: false,
@@ -251,12 +242,6 @@ class ValpayAPI {
251
242
  message: "Terminal not paired. Please call pairTerminal() first."
252
243
  };
253
244
  }
254
- if (!this.config.merchantAccount) {
255
- return {
256
- success: false,
257
- message: "Merchant account is required for Cloud device API"
258
- };
259
- }
260
245
  if (!amount || amount <= 0) {
261
246
  return {
262
247
  success: false,
@@ -399,7 +384,6 @@ const useValpay = () => {
399
384
  checkPluginInitialized();
400
385
  const valpayAPI = new ValpayAPI({
401
386
  apiKey: state.valpayApiKey,
402
- merchantAccount: state.valpayMerchantAccount,
403
387
  environment: environment.value
404
388
  });
405
389
  const pairTerminal = (saleId, terminalId) => {
@@ -411,29 +395,6 @@ const useValpay = () => {
411
395
  const isPaired = () => {
412
396
  return valpayAPI.isPaired();
413
397
  };
414
- const getConnectedTerminals = async () => {
415
- const dialog = Dialog.create({ ...dialogDefaultOpts, message: "Fetching connected terminals..." });
416
- try {
417
- const res = await valpayAPI.getConnectedTerminals();
418
- dialog.update({
419
- title: res.success ? "Success!" : "Failed!",
420
- class: res.success ? "text-green-500" : "text-red-500",
421
- message: res.success ? `Found ${res.data?.uniqueTerminalIds.length || 0} terminals` : res.message || "Failed to fetch terminals",
422
- progress: false
423
- });
424
- setTimeout(dialog.hide, 2e3);
425
- return res;
426
- } catch (error) {
427
- dialog.update({
428
- title: "Failed!",
429
- class: "text-red-500",
430
- progress: false,
431
- message: `Error! Message: ${error}`
432
- });
433
- setTimeout(dialog.hide, 3e3);
434
- return { success: false, message: `Error! Message: ${error}` };
435
- }
436
- };
437
398
  const initiateValpayPurchase = async (amount, currency) => {
438
399
  const cancelTxn = () => {
439
400
  dialog.update({
@@ -445,7 +406,7 @@ const useValpay = () => {
445
406
  const dialog = Dialog.create({
446
407
  component: _sfc_main$1,
447
408
  componentProps: {
448
- message: `Purchase of ${currency} ${amount / 100} in progress...`,
409
+ message: `Purchase of ${currency} ${amount} in progress...`,
449
410
  title: "INPROGRESS",
450
411
  cancelTxn: () => cancelTxn()
451
412
  }
@@ -484,7 +445,7 @@ const useValpay = () => {
484
445
  const dialog = Dialog.create({
485
446
  component: _sfc_main$1,
486
447
  componentProps: {
487
- message: `Refund of ${currency} ${amount / 100} in progress...`,
448
+ message: `Refund of ${currency} ${amount} in progress...`,
488
449
  title: "INPROGRESS",
489
450
  cancelTxn: () => cancelTxn()
490
451
  }
@@ -516,7 +477,6 @@ const useValpay = () => {
516
477
  pairTerminal,
517
478
  unpair,
518
479
  isPaired,
519
- getConnectedTerminals,
520
480
  initiateValpayPurchase,
521
481
  initiateValpayRefund,
522
482
  valpayAPI
@@ -532,6 +492,9 @@ const _hoisted_7 = { key: 1 };
532
492
  const _hoisted_8 = { class: "flex items-center justify-end gap-3" };
533
493
  const _sfc_main = /* @__PURE__ */ defineComponent({
534
494
  __name: "PairValpay",
495
+ props: {
496
+ merchantId: {}
497
+ },
535
498
  setup(__props) {
536
499
  const SETUP_STEPS = [
537
500
  "Ensure your Adyen terminal is connected to the internet and powered on.",
@@ -539,6 +502,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
539
502
  "Click 'Fetch Terminals' to retrieve available terminals from your merchant account.",
540
503
  "Enter your Sale ID (POS system identifier) and select a terminal to pair."
541
504
  ];
505
+ const props = __props;
542
506
  const { valpayAPI, pairTerminal, unpair } = useValpay();
543
507
  const pairConfig = useLocalStorage("valpay.pairConfig", {
544
508
  isPaired: false,
@@ -596,7 +560,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
596
560
  const getTerminals = async () => {
597
561
  try {
598
562
  loadingTerminals.value = true;
599
- const res = await valpayAPI.getConnectedTerminals();
563
+ const res = await valpayAPI.getConnectedTerminals(props.merchantId);
600
564
  if (!res.success || !res.data) {
601
565
  Notify.create({
602
566
  type: "negative",
@@ -625,6 +589,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
625
589
  loadingTerminals.value = false;
626
590
  }
627
591
  };
592
+ onMounted(getTerminals);
628
593
  return (_ctx, _cache) => {
629
594
  return openBlock(), createElementBlock("div", null, [
630
595
  unref(pairConfig).isPaired ? (openBlock(), createBlock(unref(QCard), {
@@ -1,9 +1,9 @@
1
1
  import { defineComponent, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createCommentVNode, createElementVNode, toDisplayString, withDirectives } from "vue";
2
2
  import { useDialogPluginComponent, QDialog, QCard, QCardSection } from "quasar";
3
3
  import { _ as _sfc_main$1 } from "./PBtn.vue_vue_type_script_setup_true_lang-BZRHAS0P.js";
4
- const _hoisted_1 = { class: "text-center text-lg font-semibold uppercase text-gray-500" };
5
- const _hoisted_2 = { class: "text-center text-lg font-semibold uppercase text-gray-500" };
6
- const _hoisted_3 = { class: "text-center text-lg font-semibold uppercase text-gray-500" };
4
+ const _hoisted_1 = { class: "text-center text-lg font-semibold text-gray-500 uppercase" };
5
+ const _hoisted_2 = { class: "text-center text-lg font-semibold text-gray-500 uppercase" };
6
+ const _hoisted_3 = { class: "text-center text-lg font-semibold text-gray-500 uppercase" };
7
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  __name: "TransactionDialog",
9
9
  props: {
package/dist/index.js CHANGED
@@ -9,12 +9,12 @@ 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
- import "./TransactionDialog.vue_vue_type_script_setup_true_lang-C6l6nnLB.js";
13
- import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-tAA6XiwD.js";
12
+ import "./TransactionDialog.vue_vue_type_script_setup_true_lang-BM8zZxH8.js";
13
+ import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-Bx-XSjv5.js";
14
14
  import { _ as _sfc_main$6 } from "./PairSmartPay.vue_vue_type_script_setup_true_lang-BcBbu7WF.js";
15
15
  import "dayjs";
16
- import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-006hTpVF.js";
17
- import { _ as _sfc_main$7 } from "./PairValpay.vue_vue_type_script_setup_true_lang-DkQtKqEz.js";
16
+ import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-F2K1_5yo.js";
17
+ import { _ as _sfc_main$7 } from "./PairValpay.vue_vue_type_script_setup_true_lang-B72-RmHL.js";
18
18
  import { g } from "./index-e4lpzJsL.js";
19
19
  var ReceiptTypes = /* @__PURE__ */ ((ReceiptTypes2) => {
20
20
  ReceiptTypes2["MERCHANT_COPY"] = "MERCHANT_COPY";
@@ -138,7 +138,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
138
138
  __props.gateway === unref(PaymentGateways).ANZ ? (openBlock(), createBlock(_sfc_main$4, { key: 3 })) : createCommentVNode("", true),
139
139
  __props.gateway === unref(PaymentGateways).TillPayment ? (openBlock(), createBlock(unref(_sfc_main$5), { key: 4 })) : createCommentVNode("", true),
140
140
  __props.gateway === unref(PaymentGateways).SmartPay ? (openBlock(), createBlock(unref(_sfc_main$6), { key: 5 })) : createCommentVNode("", true),
141
- __props.gateway === unref(PaymentGateways).Valpay ? (openBlock(), createBlock(unref(_sfc_main$7), { key: 6 })) : createCommentVNode("", true)
141
+ __props.gateway === unref(PaymentGateways).Valpay ? (openBlock(), createBlock(unref(_sfc_main$7), {
142
+ key: 6,
143
+ "merchant-id": __props.merchantId
144
+ }, null, 8, ["merchant-id"])) : createCommentVNode("", true)
142
145
  ]);
143
146
  };
144
147
  }
package/dist/linkly.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C, L, _, R, a, b, T, u } from "./PairLinkly.vue_vue_type_script_setup_true_lang-tAA6XiwD.js";
1
+ import { C, L, _, R, a, b, T, u } from "./PairLinkly.vue_vue_type_script_setup_true_lang-Bx-XSjv5.js";
2
2
  export {
3
3
  C as CurrencyCodes,
4
4
  L as LinklyKeyType,
@@ -1,4 +1,4 @@
1
- import { _, S, T, b, a, u } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-006hTpVF.js";
1
+ import { _, S, T, b, a, u } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-F2K1_5yo.js";
2
2
  export {
3
3
  _ as PairTillPayment,
4
4
  S as SettlementTypes,
package/dist/valpay.d.ts CHANGED
@@ -498,11 +498,6 @@ export declare const useValpay: () => {
498
498
  };
499
499
  unpair: () => void;
500
500
  isPaired: () => boolean;
501
- getConnectedTerminals: () => Promise<{
502
- success: boolean;
503
- data?: ConnectedTerminalsResponse;
504
- message?: string;
505
- }>;
506
501
  initiateValpayPurchase: (amount: number, currency: string) => Promise<ValpayPaymentReturn>;
507
502
  initiateValpayRefund: (amount: number, currency: string, transactionId?: string) => Promise<ValpayPaymentReturn>;
508
503
  valpayAPI: ValpayAPI;
@@ -510,7 +505,6 @@ export declare const useValpay: () => {
510
505
 
511
506
  export declare class ValpayAPI {
512
507
  private terminalApi;
513
- private config;
514
508
  constructor(config: ValpayConfig);
515
509
  private _setSaleId;
516
510
  private _getSaleId;
@@ -559,7 +553,7 @@ export declare class ValpayAPI {
559
553
  * Fetches all connected terminals for the merchant account
560
554
  * @returns Promise with connected terminals data
561
555
  */
562
- getConnectedTerminals(): Promise<{
556
+ getConnectedTerminals(merchantAccount: string | number): Promise<{
563
557
  success: boolean;
564
558
  data?: ConnectedTerminalsResponse;
565
559
  message?: string;
@@ -602,7 +596,6 @@ export declare class ValpayAPI {
602
596
 
603
597
  export declare interface ValpayConfig {
604
598
  apiKey: string;
605
- merchantAccount: string;
606
599
  environment: "production" | "development";
607
600
  }
608
601
 
package/dist/valpay.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P, _, T, V, u } from "./PairValpay.vue_vue_type_script_setup_true_lang-DkQtKqEz.js";
1
+ import { P, _, T, V, u } from "./PairValpay.vue_vue_type_script_setup_true_lang-B72-RmHL.js";
2
2
  export {
3
3
  P as PROD_URL,
4
4
  _ as PairValpay,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@achyutlabsau/vue-payment-gateway",
3
3
  "private": false,
4
- "version": "0.9.1",
4
+ "version": "0.9.3",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -60,8 +60,8 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@mx51/spi-client-js": "^2.9.13",
63
- "@vueuse/core": "^14.0",
64
- "@vueuse/rxjs": "^14.0.0",
63
+ "@vueuse/core": "^14.1",
64
+ "@vueuse/rxjs": "^14.1.0",
65
65
  "axios": "1.13.2",
66
66
  "dayjs": "1.11.19",
67
67
  "dexie": "^4.2.1",
@@ -76,22 +76,22 @@
76
76
  "vue": ">=3.5.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@microsoft/api-extractor": "^7.55.0",
79
+ "@microsoft/api-extractor": "^7.55.2",
80
80
  "@quasar/extras": "^1.17.0",
81
- "@tailwindcss/vite": "^4.1.17",
81
+ "@tailwindcss/vite": "^4.1.18",
82
82
  "@types/node": "*",
83
- "@vitejs/plugin-vue": "^6.0.1",
84
- "@vue/language-core": "^3.1.3",
85
- "oxlint": "^1.28.0",
86
- "prettier": "^3.6.2",
87
- "prettier-plugin-tailwindcss": "^0.7.1",
88
- "quasar": "^2.18.5",
89
- "tailwindcss": "^4.1.17",
83
+ "@vitejs/plugin-vue": "^6.0.3",
84
+ "@vue/language-core": "^3.1.8",
85
+ "oxlint": "^1.33.0",
86
+ "prettier": "^3.7.4",
87
+ "prettier-plugin-tailwindcss": "^0.7.2",
88
+ "quasar": "^2.18.6",
89
+ "tailwindcss": "^4.1.18",
90
90
  "typescript": "5.9.3",
91
91
  "unplugin-dts": "^1.0.0-beta.6",
92
- "vite": "^7.2.2",
93
- "vitepress": "^2.0.0-alpha.8",
94
- "vue": "^3.5.24",
95
- "vue-tsc": "^3.1.3"
92
+ "vite": "^7.3.0",
93
+ "vitepress": "^2.0.0-alpha.15",
94
+ "vue": "^3.5.26",
95
+ "vue-tsc": "^3.1.8"
96
96
  }
97
97
  }