@achyutlabsau/vue-payment-gateway 0.3.7 → 0.4.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.
@@ -6,8 +6,9 @@ import { Dialog, QDialog, QCard, QToolbar, QToolbarTitle, QIcon, QCardSection, Q
6
6
  import { i as isNetworkError, a as isServerError, d as delay, g as generateTransactionId } from "./index-e4lpzJsL.js";
7
7
  import axios, { isAxiosError, HttpStatusCode } from "axios";
8
8
  import { v7 } from "uuid";
9
- import { R as ReceiptAutoPrint, T as TransactionTypes, d as dialogDefaultOpts, C as CurrencyCodes, a as ResponseCodes, u as updateDialog, b as TransactionOutcome } from "./utils-Bp5B61Zb.js";
10
- import { e as environment, b as state, m as mdiCheckCircle, d as mdiChevronLeft, c as mdiRefresh, _ as _sfc_main$2, f as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-BkPzOduD.js";
9
+ import { d as dialogDefaultOpts } from "./utils-GrbVNAXw.js";
10
+ import { e as environment, b as state, m as mdiCheckCircle, d as mdiChevronLeft, c as mdiRefresh, _ as _sfc_main$3, f as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-BkPzOduD.js";
11
+ import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-DTIELKw0.js";
11
12
  import { useLocalStorage } from "@vueuse/core";
12
13
  const LINKLY_CONSTANTS = {
13
14
  PATHS: {
@@ -294,7 +295,88 @@ class LinklyPaymentGateway {
294
295
  };
295
296
  }
296
297
  }
298
+ async sendKey(key) {
299
+ const uuid = v7();
300
+ try {
301
+ await this._ensureValidToken();
302
+ const payload = {
303
+ Request: {
304
+ Key: key
305
+ }
306
+ };
307
+ const res = await this._api.post(`${uuid}/sendkey`, payload, {
308
+ params: DEFAULT_REQUEST_PARAMS
309
+ });
310
+ const isSuccess = res.status === HttpStatusCode.Ok;
311
+ return {
312
+ success: isSuccess,
313
+ message: "Key sent successfully."
314
+ };
315
+ } catch (error) {
316
+ if (axios.isAxiosError(error) && error.response) {
317
+ const status = error.response.status;
318
+ if (status === HttpStatusCode.Unauthorized) {
319
+ try {
320
+ await this.getLinklyAuthToken();
321
+ return this.sendKey(key);
322
+ } catch {
323
+ return {
324
+ success: false,
325
+ message: "Failed to authenticate. Please check your Linkly account credentials."
326
+ };
327
+ }
328
+ }
329
+ if (status === HttpStatusCode.RequestTimeout || isServerError(error)) {
330
+ await delay();
331
+ return this.sendKey(key);
332
+ }
333
+ }
334
+ return {
335
+ success: false,
336
+ message: "Failed to send key."
337
+ };
338
+ }
339
+ }
297
340
  }
341
+ var TransactionTypes = /* @__PURE__ */ ((TransactionTypes2) => {
342
+ TransactionTypes2["Purchase"] = "P";
343
+ TransactionTypes2["Refund"] = "R";
344
+ return TransactionTypes2;
345
+ })(TransactionTypes || {});
346
+ var CurrencyCodes = /* @__PURE__ */ ((CurrencyCodes2) => {
347
+ CurrencyCodes2["AustralianDollar"] = "AUD";
348
+ return CurrencyCodes2;
349
+ })(CurrencyCodes || {});
350
+ var ReceiptAutoPrint = /* @__PURE__ */ ((ReceiptAutoPrint2) => {
351
+ ReceiptAutoPrint2["ReturnToPOS"] = "0";
352
+ ReceiptAutoPrint2["MixedPrint"] = "7";
353
+ ReceiptAutoPrint2["AllReceiptsFromPINPad"] = "9";
354
+ return ReceiptAutoPrint2;
355
+ })(ReceiptAutoPrint || {});
356
+ var ResponseCodes = /* @__PURE__ */ ((ResponseCodes2) => {
357
+ ResponseCodes2["APPROVED"] = "00";
358
+ ResponseCodes2["Approved"] = "08";
359
+ ResponseCodes2["TXN_CANCELLED"] = "HD";
360
+ ResponseCodes2["INSUFFICIENT_FUND"] = "HB";
361
+ ResponseCodes2["GENERAL_DECLINE"] = "99";
362
+ ResponseCodes2["CANCELLED"] = "TM";
363
+ ResponseCodes2["PINPAD_OFFLINE"] = "PF";
364
+ return ResponseCodes2;
365
+ })(ResponseCodes || {});
366
+ var LinklyKeyType = /* @__PURE__ */ ((LinklyKeyType2) => {
367
+ LinklyKeyType2["Cancel"] = "0";
368
+ LinklyKeyType2["Yes"] = "1";
369
+ LinklyKeyType2["No"] = "2";
370
+ LinklyKeyType2["Auth"] = "3";
371
+ return LinklyKeyType2;
372
+ })(LinklyKeyType || {});
373
+ var TransactionOutcome = /* @__PURE__ */ ((TransactionOutcome2) => {
374
+ TransactionOutcome2["APPROVED"] = "APPROVED";
375
+ TransactionOutcome2["CANCELLED"] = "CANCELLED";
376
+ TransactionOutcome2["DECLINED"] = "DECLINED";
377
+ TransactionOutcome2["UNKNOWN"] = "UNKNOWN";
378
+ return TransactionOutcome2;
379
+ })(TransactionOutcome || {});
298
380
  const useLinkly = () => {
299
381
  const linklyAPI = new LinklyPaymentGateway({
300
382
  posId: state.posId,
@@ -315,7 +397,14 @@ const useLinkly = () => {
315
397
  return res;
316
398
  };
317
399
  const _initiateTransaction = async (data, TxnType) => {
318
- var _a, _b, _c;
400
+ var _a, _b, _c, _d;
401
+ const cancelTxn = () => {
402
+ dialog.update({
403
+ message: "Trying to cancel transaction...",
404
+ title: "INPROGRESS"
405
+ });
406
+ linklyAPI.sendKey(LinklyKeyType.Cancel);
407
+ };
319
408
  const payload = {
320
409
  Request: {
321
410
  Merchant: "00",
@@ -328,30 +417,59 @@ const useLinkly = () => {
328
417
  ReceiptAutoPrint: data.ReceiptAutoPrint
329
418
  }
330
419
  };
331
- const dialog = Dialog.create({ ...dialogDefaultOpts });
420
+ const dialog = Dialog.create({
421
+ component: _sfc_main$2,
422
+ componentProps: {
423
+ message: `${TxnType === TransactionTypes.Purchase ? "Purchase" : "Refund"} of $${data.AmtPurchase / 100} in progress...`,
424
+ title: "INPROGRESS",
425
+ cancelTxn: () => cancelTxn()
426
+ }
427
+ });
332
428
  try {
333
429
  const res = await linklyAPI.sendTransactionRequest(payload);
334
- if (((_a = res == null ? void 0 : res.Response) == null ? void 0 : _a.ResponseCode) === ResponseCodes.APPROVED || ((_b = res == null ? void 0 : res.Response) == null ? void 0 : _b.ResponseCode) === ResponseCodes.Approved) {
335
- updateDialog(dialog, TransactionOutcome.APPROVED);
430
+ if (((_a = res == null ? void 0 : res.response) == null ? void 0 : _a.responseCode) === ResponseCodes.APPROVED || ((_b = res == null ? void 0 : res.response) == null ? void 0 : _b.responseCode) === ResponseCodes.Approved) {
431
+ dialog.update({
432
+ message: "Transaction Approved!",
433
+ title: "SUCCESS"
434
+ });
336
435
  return {
337
436
  result: TransactionOutcome.APPROVED,
338
- data: res.Response
437
+ data: res.response
339
438
  };
340
439
  }
341
- if (((_c = res == null ? void 0 : res.Response) == null ? void 0 : _c.ResponseCode) === ResponseCodes.GENERAL_DECLINE) {
342
- updateDialog(dialog, TransactionOutcome.DECLINED);
440
+ if (((_c = res == null ? void 0 : res.response) == null ? void 0 : _c.responseCode) === ResponseCodes.GENERAL_DECLINE) {
441
+ dialog.update({
442
+ message: "Transaction Declined!",
443
+ title: "FAILED"
444
+ });
343
445
  return {
344
446
  result: TransactionOutcome.DECLINED,
345
- data: res.Response
447
+ data: res.response
346
448
  };
347
449
  }
348
- updateDialog(dialog, TransactionOutcome.UNKNOWN);
450
+ if (((_d = res == null ? void 0 : res.response) == null ? void 0 : _d.responseCode) === ResponseCodes.CANCELLED) {
451
+ dialog.update({
452
+ message: "Transaction Cancelled!",
453
+ title: "FAILED"
454
+ });
455
+ return {
456
+ result: TransactionOutcome.CANCELLED,
457
+ data: res.response
458
+ };
459
+ }
460
+ dialog.update({
461
+ message: "Transaction Failed!",
462
+ title: "FAILED"
463
+ });
349
464
  return {
350
465
  result: TransactionOutcome.UNKNOWN,
351
- data: res.Response
466
+ data: res.response
352
467
  };
353
468
  } catch (error) {
354
- updateDialog(dialog, TransactionOutcome.UNKNOWN);
469
+ dialog.update({
470
+ message: "Transaction Failed!",
471
+ title: "FAILED"
472
+ });
355
473
  throw error;
356
474
  }
357
475
  };
@@ -587,7 +705,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
587
705
  ])
588
706
  ])
589
707
  ])) : (openBlock(), createElementBlock("section", _hoisted_7, [
590
- showInstructions.value ? (openBlock(), createBlock(_sfc_main$2, {
708
+ showInstructions.value ? (openBlock(), createBlock(_sfc_main$3, {
591
709
  key: 0,
592
710
  onNext: handleNext,
593
711
  steps: SETUP_STEPS
@@ -667,6 +785,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
667
785
  }
668
786
  });
669
787
  export {
788
+ CurrencyCodes as C,
789
+ LinklyKeyType as L,
790
+ ReceiptAutoPrint as R,
791
+ TransactionTypes as T,
670
792
  _sfc_main as _,
793
+ ResponseCodes as a,
794
+ TransactionOutcome as b,
671
795
  useLinkly as u
672
796
  };
@@ -166,9 +166,9 @@ const _hoisted_7 = {
166
166
  key: 2,
167
167
  class: "flex items-center gap-1 font-semibold"
168
168
  };
169
- const _hoisted_8 = { class: "text-center font-semibold text-gray-500 uppercase" };
170
- const _hoisted_9 = { class: "py-3 text-center text-2xl font-semibold text-slate-700 uppercase" };
171
- const _hoisted_10 = { class: "text-center font-semibold text-gray-500 uppercase" };
169
+ const _hoisted_8 = { class: "text-center font-semibold uppercase text-gray-500" };
170
+ const _hoisted_9 = { class: "py-3 text-center text-2xl font-semibold uppercase text-slate-700" };
171
+ const _hoisted_10 = { class: "text-center font-semibold uppercase text-gray-500" };
172
172
  const _sfc_main = /* @__PURE__ */ defineComponent({
173
173
  __name: "PairMX51",
174
174
  setup(__props) {
@@ -498,7 +498,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
498
498
  _: 1
499
499
  })) : pairInfo.value.state === "CONFIRMATION" ? (openBlock(), createBlock(unref(QCardSection), { key: 1 }, {
500
500
  default: withCtx(() => [
501
- _cache[11] || (_cache[11] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Confirm your pairing code", -1)),
501
+ _cache[11] || (_cache[11] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Confirm your pairing code", -1)),
502
502
  createElementVNode("div", _hoisted_9, toDisplayString(pairInfo.value.confirmationCode), 1),
503
503
  _cache[12] || (_cache[12] = createElementVNode("div", { class: "text-center text-sm text-gray-500" }, "Confirm the matching pairing code on the terminal", -1))
504
504
  ]),
@@ -7,7 +7,7 @@ import { Dialog, QIcon, QBtn, QInput } from "quasar";
7
7
  import { b as state, e as environment, m as mdiCheckCircle, c as mdiRefresh, _ as _sfc_main$1, d as mdiChevronLeft, f as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-BkPzOduD.js";
8
8
  import axios, { HttpStatusCode, isAxiosError } from "axios";
9
9
  import { d as delay } from "./index-e4lpzJsL.js";
10
- import { d as dialogDefaultOpts } from "./utils-Bp5B61Zb.js";
10
+ import { d as dialogDefaultOpts } from "./utils-GrbVNAXw.js";
11
11
  var TransactionOutcome = /* @__PURE__ */ ((TransactionOutcome2) => {
12
12
  TransactionOutcome2[TransactionOutcome2["Accepted"] = 1] = "Accepted";
13
13
  TransactionOutcome2[TransactionOutcome2["Declined"] = 2] = "Declined";
@@ -1,13 +1,14 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { defineComponent, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createCommentVNode, createElementVNode, toDisplayString, withDirectives, useModel, ref, renderSlot, createTextVNode, onMounted, createElementBlock } from "vue";
4
+ import { defineComponent, useModel, ref, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, withDirectives, renderSlot, createTextVNode, createElementVNode, onMounted, createElementBlock, toDisplayString } from "vue";
5
5
  import { useLocalStorage } from "@vueuse/core";
6
6
  import axios, { isAxiosError, HttpStatusCode } from "axios";
7
7
  import dayjs from "dayjs";
8
- import { useDialogPluginComponent, QDialog, QCard, QCardSection, QBtn, Loading, Dialog, QForm, QToolbar, QToolbarTitle, QIcon, QInput, QCardActions, Notify, QSelect } from "quasar";
8
+ import { Loading, Dialog, QDialog, QCard, QForm, QToolbar, QToolbarTitle, QIcon, QCardSection, QInput, QCardActions, QBtn, Notify, QSelect } from "quasar";
9
9
  import { d as delay } from "./index-e4lpzJsL.js";
10
10
  import { b as state, m as mdiCheckCircle, d as mdiChevronLeft, c as mdiRefresh, _ as _sfc_main$3, f as mdiLink } from "./PairInstructions.vue_vue_type_script_setup_true_lang-BkPzOduD.js";
11
+ import { _ as _sfc_main$2 } from "./TransactionDialog.vue_vue_type_script_setup_true_lang-DTIELKw0.js";
11
12
  import { validate } from "uuid";
12
13
  var SettlementTypes = /* @__PURE__ */ ((SettlementTypes2) => {
13
14
  SettlementTypes2["SETTLEMENT"] = "SETTLEMENT";
@@ -408,88 +409,6 @@ __publicField(_TillPaymentsApi, "URLS", {
408
409
  PRODUCTION: "https://api-terminal-gateway.tillpayments.com/devices"
409
410
  });
410
411
  let TillPaymentsApi = _TillPaymentsApi;
411
- const _hoisted_1$2 = { class: "text-center font-semibold text-gray-500 uppercase" };
412
- const _hoisted_2$1 = { class: "text-center font-semibold text-gray-500 uppercase" };
413
- const _hoisted_3$1 = { class: "text-center font-semibold text-gray-500 uppercase" };
414
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
415
- __name: "TransactionDialog",
416
- props: {
417
- message: {},
418
- title: {},
419
- cancelTxn: { type: Function }
420
- },
421
- emits: [
422
- // REQUIRED; need to specify some events that your
423
- // component will emit through useDialogPluginComponent()
424
- ...useDialogPluginComponent.emits
425
- ],
426
- setup(__props) {
427
- const { dialogRef, onDialogHide } = useDialogPluginComponent();
428
- return (_ctx, _cache) => {
429
- const _directive_close_popup = resolveDirective("close-popup");
430
- return openBlock(), createBlock(unref(QDialog), {
431
- ref_key: "dialogRef",
432
- ref: dialogRef,
433
- onHide: unref(onDialogHide),
434
- persistent: ""
435
- }, {
436
- default: withCtx(() => [
437
- createVNode(unref(QCard), { class: "q-dialog-plugin" }, {
438
- default: withCtx(() => [
439
- _ctx.title === "INPROGRESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 0 }, {
440
- default: withCtx(() => [
441
- createElementVNode("div", _hoisted_1$2, toDisplayString(_ctx.message), 1),
442
- createVNode(unref(QBtn), {
443
- label: "Cancel",
444
- onClick: _ctx.cancelTxn,
445
- color: "primary",
446
- outline: "",
447
- class: "!mt-6 !w-full",
448
- unelevated: "",
449
- ripple: false
450
- }, null, 8, ["onClick"])
451
- ]),
452
- _: 1
453
- })) : _ctx.title === "SUCCESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 1 }, {
454
- default: withCtx(() => [
455
- createElementVNode("div", _hoisted_2$1, toDisplayString(_ctx.message), 1),
456
- withDirectives(createVNode(unref(QBtn), {
457
- label: "OK",
458
- color: "primary",
459
- outline: "",
460
- class: "!mt-6 !w-full",
461
- unelevated: "",
462
- ripple: false
463
- }, null, 512), [
464
- [_directive_close_popup]
465
- ])
466
- ]),
467
- _: 1
468
- })) : _ctx.title === "FAILED" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
469
- default: withCtx(() => [
470
- createElementVNode("div", _hoisted_3$1, toDisplayString(_ctx.message), 1),
471
- withDirectives(createVNode(unref(QBtn), {
472
- label: "OK",
473
- color: "primary",
474
- outline: "",
475
- class: "!mt-6 !w-full",
476
- unelevated: "",
477
- ripple: false
478
- }, null, 512), [
479
- [_directive_close_popup]
480
- ])
481
- ]),
482
- _: 1
483
- })) : createCommentVNode("", true)
484
- ]),
485
- _: 1
486
- })
487
- ]),
488
- _: 1
489
- }, 8, ["onHide"]);
490
- };
491
- }
492
- });
493
412
  const useTillPayment = () => {
494
413
  const tillPayment = new TillPaymentsApi({
495
414
  apiKey: state.tillPaymentApiKey,
@@ -0,0 +1,87 @@
1
+ import { defineComponent, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createCommentVNode, createElementVNode, toDisplayString, withDirectives } from "vue";
2
+ import { useDialogPluginComponent, QDialog, QCard, QCardSection, QBtn } from "quasar";
3
+ const _hoisted_1 = { class: "text-center font-semibold text-gray-500 uppercase" };
4
+ const _hoisted_2 = { class: "text-center font-semibold text-gray-500 uppercase" };
5
+ const _hoisted_3 = { class: "text-center font-semibold text-gray-500 uppercase" };
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ __name: "TransactionDialog",
8
+ props: {
9
+ message: {},
10
+ title: {},
11
+ cancelTxn: { type: Function }
12
+ },
13
+ emits: [
14
+ // REQUIRED; need to specify some events that your
15
+ // component will emit through useDialogPluginComponent()
16
+ ...useDialogPluginComponent.emits
17
+ ],
18
+ setup(__props) {
19
+ const { dialogRef, onDialogHide } = useDialogPluginComponent();
20
+ return (_ctx, _cache) => {
21
+ const _directive_close_popup = resolveDirective("close-popup");
22
+ return openBlock(), createBlock(unref(QDialog), {
23
+ ref_key: "dialogRef",
24
+ ref: dialogRef,
25
+ onHide: unref(onDialogHide),
26
+ persistent: ""
27
+ }, {
28
+ default: withCtx(() => [
29
+ createVNode(unref(QCard), { class: "q-dialog-plugin" }, {
30
+ default: withCtx(() => [
31
+ _ctx.title === "INPROGRESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 0 }, {
32
+ default: withCtx(() => [
33
+ createElementVNode("div", _hoisted_1, toDisplayString(_ctx.message), 1),
34
+ createVNode(unref(QBtn), {
35
+ label: "Cancel",
36
+ onClick: _ctx.cancelTxn,
37
+ color: "primary",
38
+ outline: "",
39
+ class: "!mt-6 !w-full",
40
+ unelevated: "",
41
+ ripple: false
42
+ }, null, 8, ["onClick"])
43
+ ]),
44
+ _: 1
45
+ })) : _ctx.title === "SUCCESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 1 }, {
46
+ default: withCtx(() => [
47
+ createElementVNode("div", _hoisted_2, toDisplayString(_ctx.message), 1),
48
+ withDirectives(createVNode(unref(QBtn), {
49
+ label: "OK",
50
+ color: "primary",
51
+ outline: "",
52
+ class: "!mt-6 !w-full",
53
+ unelevated: "",
54
+ ripple: false
55
+ }, null, 512), [
56
+ [_directive_close_popup]
57
+ ])
58
+ ]),
59
+ _: 1
60
+ })) : _ctx.title === "FAILED" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
61
+ default: withCtx(() => [
62
+ createElementVNode("div", _hoisted_3, toDisplayString(_ctx.message), 1),
63
+ withDirectives(createVNode(unref(QBtn), {
64
+ label: "OK",
65
+ color: "primary",
66
+ outline: "",
67
+ class: "!mt-6 !w-full",
68
+ unelevated: "",
69
+ ripple: false
70
+ }, null, 512), [
71
+ [_directive_close_popup]
72
+ ])
73
+ ]),
74
+ _: 1
75
+ })) : createCommentVNode("", true)
76
+ ]),
77
+ _: 1
78
+ })
79
+ ]),
80
+ _: 1
81
+ }, 8, ["onHide"]);
82
+ };
83
+ }
84
+ });
85
+ export {
86
+ _sfc_main as _
87
+ };
@@ -0,0 +1,5 @@
1
+ import { EventBus } from "quasar";
2
+ const emitter = new EventBus();
3
+ export {
4
+ emitter as e
5
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,13 @@
1
+ import { ComponentOptionsMixin } from 'vue';
2
+ import { ComponentProvideOptions } from 'vue';
3
+ import { DefineComponent } from 'vue';
1
4
  import { FunctionPlugin } from 'vue';
5
+ import { PublicProps } from 'vue';
6
+
7
+ declare type __VLS_Props = {
8
+ gateway: PaymentGateways;
9
+ merchantId: string | number;
10
+ };
2
11
 
3
12
  declare const _default: {
4
13
  install: FunctionPlugin<InstallOptions>;
@@ -29,6 +38,23 @@ declare interface InstallOptions extends POSConfig {
29
38
  onReceiptPrint?: (receipt: string, type: ReceiptTypes) => void;
30
39
  }
31
40
 
41
+ export declare const PairingInterface: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
42
+ "pairing-success": (data: any, gateway: PaymentGateways) => any;
43
+ "pairing-failure": (data: any) => any;
44
+ }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
45
+ "onPairing-success"?: ((data: any, gateway: PaymentGateways) => any) | undefined;
46
+ "onPairing-failure"?: ((data: any) => any) | undefined;
47
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
48
+
49
+ declare enum PaymentGateways {
50
+ Tyro = "tyro",
51
+ TillPayment = "till-instore",
52
+ MX51 = "mx51-spi",
53
+ Linkly = "linkly",
54
+ SmartPay = "smartpay",
55
+ ANZ = "anz-instore"
56
+ }
57
+
32
58
  declare interface POSConfig {
33
59
  productName: string;
34
60
  productVersion: string;
@@ -50,10 +76,3 @@ declare enum ReceiptTypes {
50
76
  }
51
77
 
52
78
  export { }
53
-
54
-
55
- declare module "vue" {
56
- interface GlobalComponents {
57
- PairingInterface: typeof PairingInterface;
58
- }
59
- }
package/dist/index.js CHANGED
@@ -1,17 +1,19 @@
1
- import { P as PaymentGateways, i as isPluginInitialized, s as setState, a as setEnvironment } from "./PairInstructions.vue_vue_type_script_setup_true_lang-BkPzOduD.js";
1
+ import { i as isPluginInitialized, s as setState, a as setEnvironment, P as PaymentGateways } from "./PairInstructions.vue_vue_type_script_setup_true_lang-BkPzOduD.js";
2
2
  import "quasar";
3
- import { _ as _sfc_main$1, T as TYRO_CONSTANTS } from "./PairTyro.vue_vue_type_script_setup_true_lang-JrzRlXk_.js";
3
+ import { T as TYRO_CONSTANTS, _ as _sfc_main$1 } from "./PairTyro.vue_vue_type_script_setup_true_lang-JrzRlXk_.js";
4
4
  import { defineComponent, createElementBlock, openBlock, createBlock, createCommentVNode, unref } from "vue";
5
5
  import { useEventListener, useScriptTag } from "@vueuse/core";
6
- import { _ as _sfc_main$2, s as spi } from "./PairMX51.vue_vue_type_script_setup_true_lang-4wjsUvaJ.js";
6
+ import { s as spi, _ as _sfc_main$2 } from "./PairMX51.vue_vue_type_script_setup_true_lang-BUf-HQ15.js";
7
7
  import "@mx51/spi-client-js";
8
8
  import "uuid";
9
- import { PairTimapi as _sfc_main$4, TimApiEvents, timApi } from "./worldline.js";
9
+ import "./emitter-B70DsNvX.js";
10
+ import { TimApiEvents, timApi, PairTimapi as _sfc_main$4 } from "./worldline.js";
10
11
  import "axios";
11
- import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-DM33Q34t.js";
12
- import { _ as _sfc_main$6 } from "./PairSmartPay.vue_vue_type_script_setup_true_lang-CLQRpw0i.js";
12
+ import "./TransactionDialog.vue_vue_type_script_setup_true_lang-DTIELKw0.js";
13
+ import { _ as _sfc_main$3 } from "./PairLinkly.vue_vue_type_script_setup_true_lang-Dcg0IDxC.js";
14
+ import { _ as _sfc_main$6 } from "./PairSmartPay.vue_vue_type_script_setup_true_lang-BH-rrj07.js";
13
15
  import "dayjs";
14
- import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-D5zLdkh3.js";
16
+ import { _ as _sfc_main$5 } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-rGuP7j0T.js";
15
17
  import { g } from "./index-e4lpzJsL.js";
16
18
  var ReceiptTypes = /* @__PURE__ */ ((ReceiptTypes2) => {
17
19
  ReceiptTypes2["MERCHANT_COPY"] = "MERCHANT_COPY";
@@ -19,42 +21,10 @@ var ReceiptTypes = /* @__PURE__ */ ((ReceiptTypes2) => {
19
21
  ReceiptTypes2["SIGNATURE_RECEIPT"] = "SIGNATURE_RECEIPT";
20
22
  return ReceiptTypes2;
21
23
  })(ReceiptTypes || {});
22
- const _hoisted_1 = { class: "" };
23
- const _sfc_main = /* @__PURE__ */ defineComponent({
24
- __name: "PairingInterface",
25
- props: {
26
- gateway: {},
27
- merchantId: {}
28
- },
29
- emits: ["pairing-success", "pairing-failure"],
30
- setup(__props, { emit: __emit }) {
31
- const emit = __emit;
32
- const onPairingSuccess = (data, gateway) => {
33
- emit("pairing-success", data, gateway);
34
- };
35
- return (_ctx, _cache) => {
36
- return openBlock(), createElementBlock("div", _hoisted_1, [
37
- _ctx.gateway === unref(PaymentGateways).Tyro ? (openBlock(), createBlock(unref(_sfc_main$1), {
38
- key: 0,
39
- "merchant-id": _ctx.merchantId
40
- }, null, 8, ["merchant-id"])) : createCommentVNode("", true),
41
- _ctx.gateway === unref(PaymentGateways).MX51 ? (openBlock(), createBlock(unref(_sfc_main$2), { key: 1 })) : createCommentVNode("", true),
42
- _ctx.gateway === unref(PaymentGateways).Linkly ? (openBlock(), createBlock(unref(_sfc_main$3), {
43
- key: 2,
44
- onPairingSuccess: _cache[0] || (_cache[0] = ($event) => onPairingSuccess($event, unref(PaymentGateways).Linkly))
45
- })) : createCommentVNode("", true),
46
- _ctx.gateway === unref(PaymentGateways).ANZ ? (openBlock(), createBlock(_sfc_main$4, { key: 3 })) : createCommentVNode("", true),
47
- _ctx.gateway === unref(PaymentGateways).TillPayment ? (openBlock(), createBlock(unref(_sfc_main$5), { key: 4 })) : createCommentVNode("", true),
48
- _ctx.gateway === unref(PaymentGateways).SmartPay ? (openBlock(), createBlock(unref(_sfc_main$6), { key: 5 })) : createCommentVNode("", true)
49
- ]);
50
- };
51
- }
52
- });
53
- const install = (app, options) => {
24
+ const install = (_app, options) => {
54
25
  if (!options) {
55
26
  throw new Error("Payment terminal plugin requires options");
56
27
  }
57
- app.component("PairingInterface", _sfc_main);
58
28
  setupEventHandlers(options);
59
29
  initializeConfigurations(options);
60
30
  isPluginInitialized.value = true;
@@ -141,7 +111,39 @@ function initializeTimApi(options) {
141
111
  }
142
112
  }
143
113
  const VuePaymentGateway = { install };
114
+ const _hoisted_1 = { class: "" };
115
+ const _sfc_main = /* @__PURE__ */ defineComponent({
116
+ __name: "PairingInterface",
117
+ props: {
118
+ gateway: {},
119
+ merchantId: {}
120
+ },
121
+ emits: ["pairing-success", "pairing-failure"],
122
+ setup(__props, { emit: __emit }) {
123
+ const emit = __emit;
124
+ const onPairingSuccess = (data, gateway) => {
125
+ emit("pairing-success", data, gateway);
126
+ };
127
+ return (_ctx, _cache) => {
128
+ return openBlock(), createElementBlock("div", _hoisted_1, [
129
+ _ctx.gateway === unref(PaymentGateways).Tyro ? (openBlock(), createBlock(unref(_sfc_main$1), {
130
+ key: 0,
131
+ "merchant-id": _ctx.merchantId
132
+ }, null, 8, ["merchant-id"])) : createCommentVNode("", true),
133
+ _ctx.gateway === unref(PaymentGateways).MX51 ? (openBlock(), createBlock(unref(_sfc_main$2), { key: 1 })) : createCommentVNode("", true),
134
+ _ctx.gateway === unref(PaymentGateways).Linkly ? (openBlock(), createBlock(unref(_sfc_main$3), {
135
+ key: 2,
136
+ onPairingSuccess: _cache[0] || (_cache[0] = ($event) => onPairingSuccess($event, unref(PaymentGateways).Linkly))
137
+ })) : createCommentVNode("", true),
138
+ _ctx.gateway === unref(PaymentGateways).ANZ ? (openBlock(), createBlock(_sfc_main$4, { key: 3 })) : createCommentVNode("", true),
139
+ _ctx.gateway === unref(PaymentGateways).TillPayment ? (openBlock(), createBlock(unref(_sfc_main$5), { key: 4 })) : createCommentVNode("", true),
140
+ _ctx.gateway === unref(PaymentGateways).SmartPay ? (openBlock(), createBlock(unref(_sfc_main$6), { key: 5 })) : createCommentVNode("", true)
141
+ ]);
142
+ };
143
+ }
144
+ });
144
145
  export {
146
+ _sfc_main as PairingInterface,
145
147
  VuePaymentGateway as default,
146
148
  g as generateTransactionId
147
149
  };