@achyutlabsau/vue-payment-gateway 0.13.0 → 0.14.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.
@@ -0,0 +1,92 @@
1
+ import { t as e } from "./PBtn-CB98SoO5.js";
2
+ import { createBlock as t, createCommentVNode as n, createElementVNode as r, createVNode as i, defineComponent as a, openBlock as o, resolveDirective as s, toDisplayString as c, unref as l, withCtx as u, withDirectives as d } from "vue";
3
+ import { Dialog as f, QCard as p, QCardSection as m, QDialog as h, useDialogPluginComponent as g } from "quasar";
4
+ //#region src/core/types.ts
5
+ var _ = /* @__PURE__ */ function(e) {
6
+ return e.Approved = "approved", e.Declined = "declined", e.Cancelled = "cancelled", e.Failed = "failed", e.Timeout = "timeout", e;
7
+ }({}), v = { class: "text-center text-lg font-semibold text-gray-500 uppercase" }, y = { class: "text-center text-lg font-semibold text-gray-500 uppercase" }, b = { class: "text-center text-lg font-semibold text-gray-500 uppercase" }, x = /* @__PURE__ */ a({
8
+ __name: "TransactionDialog",
9
+ props: {
10
+ message: {},
11
+ title: {},
12
+ cancelTxn: { type: Function }
13
+ },
14
+ emits: [...g.emits],
15
+ setup(a) {
16
+ let { dialogRef: f, onDialogHide: _ } = g();
17
+ return (g, x) => {
18
+ let S = s("close-popup");
19
+ return o(), t(l(h), {
20
+ ref_key: "dialogRef",
21
+ ref: f,
22
+ onHide: l(_),
23
+ persistent: ""
24
+ }, {
25
+ default: u(() => [i(l(p), { class: "q-dialog-plugin px-6 py-3" }, {
26
+ default: u(() => [a.title === "INPROGRESS" ? (o(), t(l(m), { key: 0 }, {
27
+ default: u(() => [r("div", v, c(a.message), 1), i(e, {
28
+ label: "Cancel",
29
+ onClick: a.cancelTxn,
30
+ color: "primary",
31
+ outline: "",
32
+ class: "!mt-6 !w-full"
33
+ }, null, 8, ["onClick"])]),
34
+ _: 1
35
+ })) : a.title === "SUCCESS" ? (o(), t(l(m), { key: 1 }, {
36
+ default: u(() => [r("div", y, c(a.message), 1), d(i(e, {
37
+ label: "OK",
38
+ color: "primary",
39
+ outline: "",
40
+ class: "!mt-6 !w-full"
41
+ }, null, 512), [[S]])]),
42
+ _: 1
43
+ })) : a.title === "FAILED" ? (o(), t(l(m), { key: 2 }, {
44
+ default: u(() => [r("div", b, c(a.message), 1), d(i(e, {
45
+ label: "OK",
46
+ color: "primary",
47
+ outline: "",
48
+ class: "!mt-6 !w-full"
49
+ }, null, 512), [[S]])]),
50
+ _: 1
51
+ })) : n("", !0)]),
52
+ _: 1
53
+ })]),
54
+ _: 1
55
+ }, 8, ["onHide"]);
56
+ };
57
+ }
58
+ });
59
+ //#endregion
60
+ //#region src/core/dialog.ts
61
+ function S(e) {
62
+ let t = e.successHideDelay ?? 1e3, n = f.create({
63
+ component: x,
64
+ componentProps: {
65
+ title: "INPROGRESS",
66
+ message: e.message,
67
+ cancelTxn: () => e.onCancel?.()
68
+ }
69
+ }), r = (e) => n.update({
70
+ title: "INPROGRESS",
71
+ message: e
72
+ }), i = (e = "Transaction Accepted!") => {
73
+ n.update({
74
+ title: "SUCCESS",
75
+ message: e
76
+ }), setTimeout(() => n.hide(), t);
77
+ }, a = (e = "Transaction Failed!") => n.update({
78
+ title: "FAILED",
79
+ message: e
80
+ });
81
+ return {
82
+ progress: r,
83
+ success: i,
84
+ failed: a,
85
+ settle: (e, t) => {
86
+ e === _.Approved ? i(t) : a(t);
87
+ },
88
+ hide: () => n.hide()
89
+ };
90
+ }
91
+ //#endregion
92
+ export { S as t };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { d as e, f as t, m as n, p as r, s as i } from "./PairInstructions-BxzivULm.js";
2
2
  import { i as a, t as o } from "./tyro-CfOu7q7t.js";
3
- import { f as s, u as c } from "./mx51-BFqIkA9C.js";
3
+ import { f as s, m as c } from "./mx51-Df356gl0.js";
4
4
  import { a as l, i as u, r as d } from "./worldline-CEiMow5_.js";
5
5
  import { n as f } from "./utils-LqvcWjKL.js";
6
- import { t as p } from "./linkly-BP28IP8I.js";
7
- import { t as m } from "./smartpay-BsFTdLns.js";
8
- import { t as h } from "./till-payment-jo13Qysd.js";
9
- import { t as g } from "./valpay-BKcmIlzR.js";
6
+ import { t as p } from "./linkly-Bd7pRZfC.js";
7
+ import { t as m } from "./smartpay-BSvt0cIh.js";
8
+ import { t as h } from "./till-payment-CRvW9BhY.js";
9
+ import { t as g } from "./valpay-DVhZ6XFw.js";
10
10
  import { createBlock as _, createCommentVNode as v, createElementBlock as y, defineComponent as b, openBlock as x, unref as S } from "vue";
11
11
  import { useEventListener as C, useScriptTag as w } from "@vueuse/core";
12
12
  //#region src/plugin/types.ts
@@ -46,7 +46,7 @@ function D(e) {
46
46
  }
47
47
  function O(e) {
48
48
  try {
49
- s.SetPosInfo(e.productVendorName, e.productVersion), s.SetDeviceApiKey(e.mx51DeviceApiKey), s.Start();
49
+ c.SetPosInfo(e.productVendorName, e.productVersion), c.SetDeviceApiKey(e.mx51DeviceApiKey), c.Start();
50
50
  } catch (e) {
51
51
  console.error("Failed to initialize MX51 SPI:", e);
52
52
  }
@@ -87,7 +87,7 @@ var j = { install: (n, r) => {
87
87
  key: 0,
88
88
  "merchant-id": e.merchantId
89
89
  }, null, 8, ["merchant-id"])) : v("", !0),
90
- e.gateway === S(i).MX51 ? (x(), _(S(c), { key: 1 })) : v("", !0),
90
+ e.gateway === S(i).MX51 ? (x(), _(S(s), { key: 1 })) : v("", !0),
91
91
  e.gateway === S(i).Linkly ? (x(), _(S(p), {
92
92
  key: 2,
93
93
  onPairingSuccess: n[0] ||= (e) => r(e, S(i).Linkly)
@@ -118,6 +118,7 @@ var j = { install: (n, r) => {
118
118
  case i.TillPayment: return !!P("till.pairConfig")?.isPaired;
119
119
  case i.SmartPay: return !!P("smartpay.pairConfig")?.isPaired;
120
120
  case i.Valpay: return !0;
121
+ case i.MX51: return !0;
121
122
  default: return !1;
122
123
  }
123
124
  }, I = j;