@achyutlabsau/vue-payment-gateway 0.3.8 → 0.4.1

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
  };
@@ -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.js CHANGED
@@ -6,12 +6,14 @@ import { useEventListener, useScriptTag } from "@vueuse/core";
6
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 "./emitter-B70DsNvX.js";
9
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";
package/dist/linkly.d.ts CHANGED
@@ -89,6 +89,13 @@ declare interface LinklyConfig {
89
89
  environment?: "development" | "production";
90
90
  }
91
91
 
92
+ export declare enum LinklyKeyType {
93
+ Cancel = "0",
94
+ Yes = "1",
95
+ No = "2",
96
+ Auth = "3"
97
+ }
98
+
92
99
  declare class LinklyPaymentGateway {
93
100
  private _api;
94
101
  private _authApi;
@@ -110,6 +117,7 @@ declare class LinklyPaymentGateway {
110
117
  getTransactionStatus(transactionId: string): Promise<LinklyTransactionResponse>;
111
118
  getLastTransactionStatus(): Promise<LinklyTransactionResponse>;
112
119
  reprintReceipt(data: LinklyReprintReceiptRequest): Promise<ReceiptReprintReturn>;
120
+ sendKey(key: LinklyKeyType): Promise<SendKeyReturn>;
113
121
  }
114
122
 
115
123
  export declare interface LinklyReprintReceiptRequest {
@@ -160,45 +168,45 @@ export declare interface LinklyReprintReceiptResponse {
160
168
  }
161
169
 
162
170
  export declare interface LinklyTransactionResponse {
163
- SessionId: string;
164
- ResponseType: string;
165
- Response: {
166
- TxnType: TransactionTypes;
167
- Merchant: string;
168
- CardType: string;
169
- CardName: string;
170
- RRN: string;
171
- DateSettlement: string;
172
- AmtCash: number;
173
- AmtPurchase: number;
174
- AmtTip: number;
175
- AuthCode: string;
176
- TxnRef: string;
177
- Pan: string;
178
- DateExpiry: string;
179
- Track2: string;
180
- AccountType: string;
181
- TxnFlags: {
182
- Offline: BooleanishString;
183
- ReceiptPrinted: BooleanishString;
184
- CardEntry: string;
185
- CommsMethod: string;
186
- Currency: string;
187
- PayPass: string;
188
- UndefinedFlag6: string;
189
- UndefinedFlag7: string;
171
+ sessionId: string;
172
+ responseType: string;
173
+ response: {
174
+ txnType: TransactionTypes;
175
+ merchant: string;
176
+ cardType: string;
177
+ cardName: string;
178
+ rrn: string;
179
+ dateSettlement: string;
180
+ amtCash: number;
181
+ amtPurchase: number;
182
+ amtTip: number;
183
+ authCode: number;
184
+ txnRef: string;
185
+ pan: string;
186
+ dateExpiry: string;
187
+ track2: string;
188
+ accountType: string;
189
+ txnFlags: {
190
+ offline: BooleanishString;
191
+ receiptPrinted: BooleanishString;
192
+ cardEntry: string;
193
+ commsMethod: string;
194
+ currency: string;
195
+ payPass: string;
196
+ undefinedFlag6: string;
197
+ undefinedFlag7: string;
190
198
  };
191
- BalanceReceived: boolean;
192
- AvailableBalance: number;
193
- ClearedFundsBalance: number;
194
- Success: boolean;
195
- ResponseCode: ResponseCodes | string;
196
- ResponseText: string;
197
- Date: string;
198
- Catid: string;
199
- Caid: string;
200
- Stan: number;
201
- PurchaseAnalysisData: {
199
+ balanceReceived: boolean;
200
+ availableBalance: number;
201
+ clearedFundsBalance: number;
202
+ success: boolean;
203
+ responseCode: ResponseCodes | string;
204
+ responseText: string;
205
+ date: string;
206
+ catid: string;
207
+ caid: string;
208
+ stan: number;
209
+ purchaseAnalysisData: {
202
210
  RFN: string;
203
211
  REF: string;
204
212
  HRC: string;
@@ -296,12 +304,21 @@ export declare enum ResponseCodes {
296
304
  * Unexpected Error
297
305
  */
298
306
  GENERAL_DECLINE = "99",
307
+ /**
308
+ * Operator cancelled sale
309
+ */
310
+ CANCELLED = "TM",
299
311
  /**
300
312
  * Pinpad is offline
301
313
  */
302
314
  PINPAD_OFFLINE = "PF"
303
315
  }
304
316
 
317
+ declare interface SendKeyReturn {
318
+ success: boolean;
319
+ message: string;
320
+ }
321
+
305
322
  export declare enum TransactionOutcome {
306
323
  APPROVED = "APPROVED",
307
324
  CANCELLED = "CANCELLED",
@@ -365,42 +382,42 @@ export declare const useLinkly: () => {
365
382
  initiatePurchase: (data: TransactionPayload) => Promise<{
366
383
  result: TransactionOutcome;
367
384
  data: {
368
- TxnType: TransactionTypes;
369
- Merchant: string;
370
- CardType: string;
371
- CardName: string;
372
- RRN: string;
373
- DateSettlement: string;
374
- AmtCash: number;
375
- AmtPurchase: number;
376
- AmtTip: number;
377
- AuthCode: string;
378
- TxnRef: string;
379
- Pan: string;
380
- DateExpiry: string;
381
- Track2: string;
382
- AccountType: string;
383
- TxnFlags: {
384
- Offline: "0" | "1";
385
- ReceiptPrinted: "0" | "1";
386
- CardEntry: string;
387
- CommsMethod: string;
388
- Currency: string;
389
- PayPass: string;
390
- UndefinedFlag6: string;
391
- UndefinedFlag7: string;
385
+ txnType: TransactionTypes;
386
+ merchant: string;
387
+ cardType: string;
388
+ cardName: string;
389
+ rrn: string;
390
+ dateSettlement: string;
391
+ amtCash: number;
392
+ amtPurchase: number;
393
+ amtTip: number;
394
+ authCode: number;
395
+ txnRef: string;
396
+ pan: string;
397
+ dateExpiry: string;
398
+ track2: string;
399
+ accountType: string;
400
+ txnFlags: {
401
+ offline: "0" | "1";
402
+ receiptPrinted: "0" | "1";
403
+ cardEntry: string;
404
+ commsMethod: string;
405
+ currency: string;
406
+ payPass: string;
407
+ undefinedFlag6: string;
408
+ undefinedFlag7: string;
392
409
  };
393
- BalanceReceived: boolean;
394
- AvailableBalance: number;
395
- ClearedFundsBalance: number;
396
- Success: boolean;
397
- ResponseCode: ResponseCodes | string;
398
- ResponseText: string;
399
- Date: string;
400
- Catid: string;
401
- Caid: string;
402
- Stan: number;
403
- PurchaseAnalysisData: {
410
+ balanceReceived: boolean;
411
+ availableBalance: number;
412
+ clearedFundsBalance: number;
413
+ success: boolean;
414
+ responseCode: ResponseCodes | string;
415
+ responseText: string;
416
+ date: string;
417
+ catid: string;
418
+ caid: string;
419
+ stan: number;
420
+ purchaseAnalysisData: {
404
421
  RFN: string;
405
422
  REF: string;
406
423
  HRC: string;
@@ -411,42 +428,42 @@ export declare const useLinkly: () => {
411
428
  initiateRefund: (data: TransactionPayload) => Promise<{
412
429
  result: TransactionOutcome;
413
430
  data: {
414
- TxnType: TransactionTypes;
415
- Merchant: string;
416
- CardType: string;
417
- CardName: string;
418
- RRN: string;
419
- DateSettlement: string;
420
- AmtCash: number;
421
- AmtPurchase: number;
422
- AmtTip: number;
423
- AuthCode: string;
424
- TxnRef: string;
425
- Pan: string;
426
- DateExpiry: string;
427
- Track2: string;
428
- AccountType: string;
429
- TxnFlags: {
430
- Offline: "0" | "1";
431
- ReceiptPrinted: "0" | "1";
432
- CardEntry: string;
433
- CommsMethod: string;
434
- Currency: string;
435
- PayPass: string;
436
- UndefinedFlag6: string;
437
- UndefinedFlag7: string;
431
+ txnType: TransactionTypes;
432
+ merchant: string;
433
+ cardType: string;
434
+ cardName: string;
435
+ rrn: string;
436
+ dateSettlement: string;
437
+ amtCash: number;
438
+ amtPurchase: number;
439
+ amtTip: number;
440
+ authCode: number;
441
+ txnRef: string;
442
+ pan: string;
443
+ dateExpiry: string;
444
+ track2: string;
445
+ accountType: string;
446
+ txnFlags: {
447
+ offline: "0" | "1";
448
+ receiptPrinted: "0" | "1";
449
+ cardEntry: string;
450
+ commsMethod: string;
451
+ currency: string;
452
+ payPass: string;
453
+ undefinedFlag6: string;
454
+ undefinedFlag7: string;
438
455
  };
439
- BalanceReceived: boolean;
440
- AvailableBalance: number;
441
- ClearedFundsBalance: number;
442
- Success: boolean;
443
- ResponseCode: ResponseCodes | string;
444
- ResponseText: string;
445
- Date: string;
446
- Catid: string;
447
- Caid: string;
448
- Stan: number;
449
- PurchaseAnalysisData: {
456
+ balanceReceived: boolean;
457
+ availableBalance: number;
458
+ clearedFundsBalance: number;
459
+ success: boolean;
460
+ responseCode: ResponseCodes | string;
461
+ responseText: string;
462
+ date: string;
463
+ catid: string;
464
+ caid: string;
465
+ stan: number;
466
+ purchaseAnalysisData: {
450
467
  RFN: string;
451
468
  REF: string;
452
469
  HRC: string;
package/dist/linkly.js CHANGED
@@ -1,7 +1,7 @@
1
- import { _, u } from "./PairLinkly.vue_vue_type_script_setup_true_lang-DM33Q34t.js";
2
- import { C, R, a, b, T } from "./utils-Bp5B61Zb.js";
1
+ import { C, L, _, R, a, b, T, u } from "./PairLinkly.vue_vue_type_script_setup_true_lang-Dcg0IDxC.js";
3
2
  export {
4
3
  C as CurrencyCodes,
4
+ L as LinklyKeyType,
5
5
  _ as PairLinkly,
6
6
  R as ReceiptAutoPrint,
7
7
  a as ResponseCodes,
package/dist/mx51.d.ts CHANGED
@@ -39,7 +39,7 @@ export declare const PairMX51: DefineComponent< {}, {}, {}, {}, {}, Component
39
39
  **/
40
40
  export declare function purchase({ purchaseAmount, tipAmount, cashoutAmount, promptForCashout, surchargeAmount }: PurchaseOptions): void;
41
41
 
42
- declare interface PurchaseOptions {
42
+ export declare interface PurchaseOptions {
43
43
  /**
44
44
  * The Purchase amount in cents
45
45
  */
@@ -117,4 +117,9 @@ tipAmount?: number;
117
117
  }) => any) | undefined;
118
118
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
119
119
 
120
+ export declare const useMX51: () => {
121
+ initiatePurchase: (options: PurchaseOptions) => Promise<void>;
122
+ initiateRefund: (refundAmount: number) => Promise<void>;
123
+ };
124
+
120
125
  export { }
package/dist/mx51.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { s as spi, r as receiptOptions } from "./PairMX51.vue_vue_type_script_setup_true_lang-BUf-HQ15.js";
2
2
  import { _, l } from "./PairMX51.vue_vue_type_script_setup_true_lang-BUf-HQ15.js";
3
3
  import { defineComponent, ref, onMounted, resolveDirective, createBlock, openBlock, unref, withCtx, createVNode, createCommentVNode, createElementVNode, toDisplayString, withDirectives } from "vue";
4
- import { SuccessState, TransactionType } from "@mx51/spi-client-js";
4
+ import { SuccessState, TransactionType, SpiStatus } from "@mx51/spi-client-js";
5
5
  import { v4 } from "uuid";
6
- import { QDialog, QCard, QCardSection, QBtn } from "quasar";
6
+ import { QDialog, QCard, QCardSection, QBtn, Dialog } from "quasar";
7
7
  import { useLocalStorage } from "@vueuse/core";
8
+ import { e as emitter } from "./emitter-B70DsNvX.js";
8
9
  function posRefIdGenerator(type) {
9
10
  return (/* @__PURE__ */ new Date()).toISOString() + "-" + type + v4();
10
11
  }
@@ -55,7 +56,7 @@ function settlementEnquiry() {
55
56
  function acceptSignature(signatureConfirmed) {
56
57
  spi.AcceptSignature(signatureConfirmed);
57
58
  }
58
- const _hoisted_1 = { class: "text-center font-semibold text-gray-500 uppercase" };
59
+ const _hoisted_1 = { class: "text-center font-semibold uppercase text-gray-500" };
59
60
  const _hoisted_2 = { class: "text-center font-semibold text-gray-500" };
60
61
  const _hoisted_3 = { class: "text-center font-semibold text-gray-500" };
61
62
  const _hoisted_4 = { class: "grid grid-cols-2 gap-3" };
@@ -143,6 +144,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
143
144
  };
144
145
  __expose({ showDialog });
145
146
  onMounted(recoverTransaction);
147
+ emitter.on("SHOW_TXN_DIALOG", showDialog);
146
148
  return (_ctx, _cache) => {
147
149
  const _directive_close_popup = resolveDirective("close-popup");
148
150
  return openBlock(), createBlock(unref(QDialog), {
@@ -171,13 +173,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
171
173
  _: 1
172
174
  })) : pairInfo.value.state === "AWAITING_CANCELLATION" ? (openBlock(), createBlock(unref(QCardSection), { key: 1 }, {
173
175
  default: withCtx(() => [
174
- _cache[5] || (_cache[5] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Attempting to cancel transaction", -1)),
176
+ _cache[5] || (_cache[5] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Attempting to cancel transaction", -1)),
175
177
  createElementVNode("div", _hoisted_3, toDisplayString(pairInfo.value.message), 1)
176
178
  ]),
177
179
  _: 1
178
180
  })) : pairInfo.value.state === "MANUAL_RECOVERY" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
179
181
  default: withCtx(() => [
180
- _cache[6] || (_cache[6] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Was the transaction successful", -1)),
182
+ _cache[6] || (_cache[6] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Was the transaction successful", -1)),
181
183
  _cache[7] || (_cache[7] = createElementVNode("div", { class: "text-center font-semibold text-gray-500" }, "Check the EFTPOS terminal", -1)),
182
184
  createElementVNode("div", _hoisted_4, [
183
185
  createVNode(unref(QBtn), {
@@ -205,7 +207,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
205
207
  _: 1
206
208
  })) : pairInfo.value.state === "AWAITING_SIGNATURE_CHECK" ? (openBlock(), createBlock(unref(QCardSection), { key: 3 }, {
207
209
  default: withCtx(() => [
208
- _cache[8] || (_cache[8] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Confirm the customer's signature", -1)),
210
+ _cache[8] || (_cache[8] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Confirm the customer's signature", -1)),
209
211
  createElementVNode("div", _hoisted_5, toDisplayString(pairInfo.value.message), 1),
210
212
  createElementVNode("div", _hoisted_6, [
211
213
  createVNode(unref(QBtn), {
@@ -233,7 +235,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
233
235
  _: 1
234
236
  })) : pairInfo.value.state === "SUCCESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 4 }, {
235
237
  default: withCtx(() => [
236
- _cache[9] || (_cache[9] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Transaction Successful", -1)),
238
+ _cache[9] || (_cache[9] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Transaction Successful", -1)),
237
239
  withDirectives(createVNode(unref(QBtn), {
238
240
  label: "OK",
239
241
  color: "primary",
@@ -249,7 +251,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
249
251
  _: 1
250
252
  })) : pairInfo.value.state === "FAILED" ? (openBlock(), createBlock(unref(QCardSection), { key: 5 }, {
251
253
  default: withCtx(() => [
252
- _cache[10] || (_cache[10] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Transaction Failed", -1)),
254
+ _cache[10] || (_cache[10] = createElementVNode("div", { class: "text-center font-semibold uppercase text-gray-500" }, "Transaction Failed", -1)),
253
255
  createElementVNode("div", _hoisted_7, toDisplayString(pairInfo.value.message), 1),
254
256
  withDirectives(createVNode(unref(QBtn), {
255
257
  label: "OK",
@@ -274,6 +276,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
274
276
  };
275
277
  }
276
278
  });
279
+ const useMX51 = () => {
280
+ const initiatePurchase = async (options) => {
281
+ if (spi._currentStatus !== SpiStatus.PairedConnected) {
282
+ Dialog.create({
283
+ title: "Failed!",
284
+ message: "The EFTPOS terminal and the POS are not connected."
285
+ });
286
+ return;
287
+ }
288
+ purchase(options);
289
+ emitter.emit("SHOW_TXN_DIALOG", options.purchaseAmount / 100, TransactionType.Purchase);
290
+ };
291
+ const initiateRefund = async (refundAmount) => {
292
+ if (spi._currentStatus !== SpiStatus.PairedConnected) {
293
+ Dialog.create({
294
+ title: "Failed!",
295
+ message: "The EFTPOS terminal and the POS are not connected."
296
+ });
297
+ return;
298
+ }
299
+ refund({ refundAmount });
300
+ emitter.emit("SHOW_TXN_DIALOG", refundAmount / 100, TransactionType.Refund);
301
+ };
302
+ return {
303
+ initiatePurchase,
304
+ initiateRefund
305
+ };
306
+ };
277
307
  export {
278
308
  _ as PairMX51,
279
309
  _sfc_main as TransactionDialog,
@@ -285,5 +315,6 @@ export {
285
315
  refund,
286
316
  settlement,
287
317
  settlementEnquiry,
288
- spi
318
+ spi,
319
+ useMX51
289
320
  };
package/dist/smartpay.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, P, _, R, S, T, b, a, c, u } from "./PairSmartPay.vue_vue_type_script_setup_true_lang-CLQRpw0i.js";
1
+ import { D, P, _, R, S, T, b, a, c, u } from "./PairSmartPay.vue_vue_type_script_setup_true_lang-BH-rrj07.js";
2
2
  export {
3
3
  D as DEV_SMARTPAY_API_URL,
4
4
  P as PROD_SMARTPAY_API_URL,
@@ -1,4 +1,4 @@
1
- import { _, S, T, b, a, u } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-D5zLdkh3.js";
1
+ import { _, S, T, b, a, u } from "./PairTillPayment.vue_vue_type_script_setup_true_lang-rGuP7j0T.js";
2
2
  export {
3
3
  _ as PairTillPayment,
4
4
  S as SettlementTypes,
@@ -0,0 +1,22 @@
1
+ import { QSpinnerHourglass } from "quasar";
2
+ const dialogDefaultOpts = {
3
+ message: "Processing the payment...",
4
+ class: "text-lg",
5
+ progress: {
6
+ // spinner: QSpinnerClock,
7
+ spinner: QSpinnerHourglass,
8
+ color: "amber"
9
+ },
10
+ persistent: true,
11
+ html: true,
12
+ ok: false,
13
+ cancel: {
14
+ label: "Close",
15
+ noCaps: true,
16
+ color: "red",
17
+ outline: true
18
+ }
19
+ };
20
+ export {
21
+ dialogDefaultOpts as d
22
+ };
@@ -52,6 +52,7 @@ export declare const emitter: EventBus<{
52
52
  connectCompleted: (event: timapi.TimEvent) => void;
53
53
  txnCompleted: (event: timapi.TimEvent, data?: timapi.TransactionResponse) => void;
54
54
  txnStarted: (amount: number, type?: string) => void;
55
+ SHOW_TXN_DIALOG: (amount: number, type?: string) => void;
55
56
  }>;
56
57
 
57
58
  declare interface PairingInput {
package/dist/worldline.js CHANGED
@@ -3,8 +3,9 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import dayjs from "dayjs";
5
5
  import Dexie, { liveQuery } from "dexie";
6
- import { EventBus, QForm, QInput, QBtn, QDialog, QCard, QCardSection, Dialog, QToolbar, QToolbarTitle, QIcon } from "quasar";
6
+ import { e as emitter } from "./emitter-B70DsNvX.js";
7
7
  import { defineComponent, ref, resolveDirective, createElementBlock, openBlock, createVNode, unref, withCtx, createElementVNode, createBlock, createCommentVNode, toDisplayString, withDirectives, nextTick, useModel, createTextVNode, Fragment, renderList } from "vue";
8
+ import { QForm, QInput, QBtn, QDialog, QCard, QCardSection, Dialog, QToolbar, QToolbarTitle, QIcon } from "quasar";
8
9
  import { useLocalStorage, useEventListener, whenever } from "@vueuse/core";
9
10
  import { useObservable } from "@vueuse/rxjs";
10
11
  function downloadTxtFile(filename, dataArray) {
@@ -60,7 +61,6 @@ class RotatingDatabase extends Dexie {
60
61
  }
61
62
  }
62
63
  const timApiLogger = new RotatingDatabase("timapiLogs");
63
- const emitter = new EventBus();
64
64
  const TimApiEvents = Object.freeze({
65
65
  TxnCompleted: "timTxnCompleted",
66
66
  BalanceCompleted: "timBalanceCompleted"
@@ -392,8 +392,8 @@ const timApi = new AdvanceEcr({
392
392
  integratorId: "3F507ED1-98C5-4CBF-A595-BFA5C34BC76C"
393
393
  });
394
394
  const _hoisted_1$2 = { class: "my-6 rounded-md bg-white p-6 shadow-md" };
395
- const _hoisted_2$2 = { class: "text-center font-semibold text-gray-500 uppercase" };
396
- const _hoisted_3$2 = { class: "text-center font-semibold text-gray-500 uppercase" };
395
+ const _hoisted_2$2 = { class: "text-center font-semibold uppercase text-gray-500" };
396
+ const _hoisted_3$2 = { class: "text-center font-semibold uppercase text-gray-500" };
397
397
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
398
398
  __name: "PairTimapi",
399
399
  setup(__props) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@achyutlabsau/vue-payment-gateway",
3
3
  "private": false,
4
- "version": "0.3.8",
4
+ "version": "0.4.1",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -52,16 +52,15 @@
52
52
  "preview": "vite preview",
53
53
  "docs:dev": "vitepress dev docs",
54
54
  "docs:build": "vitepress build docs",
55
- "docs:preview": "vitepress preview docs",
56
- "prepublish": "npm run build"
55
+ "docs:preview": "vitepress preview docs"
57
56
  },
58
57
  "dependencies": {
59
58
  "uuid": "^11.1.0",
60
- "@vueuse/core": "^13.1.0",
61
- "axios": "^1.8.4",
59
+ "@vueuse/core": "^13.3.0",
60
+ "axios": "^1.9.0",
62
61
  "dayjs": "^1.11.13",
63
62
  "@mx51/spi-client-js": "^2.9.13",
64
- "@vueuse/rxjs": "^13.1.0",
63
+ "@vueuse/rxjs": "^13.3.0",
65
64
  "dexie": "^4.0.11"
66
65
  },
67
66
  "peerDependencies": {
@@ -73,19 +72,19 @@
73
72
  "vue": "^3.5.x"
74
73
  },
75
74
  "devDependencies": {
76
- "@quasar/extras": "^1.16.17",
77
- "@tailwindcss/vite": "^4.1.4",
78
- "@types/node": "^22.14.1",
79
- "@vitejs/plugin-vue": "^5.2.3",
75
+ "@quasar/extras": "^1.17.0",
76
+ "@tailwindcss/vite": "^4.1.8",
77
+ "@types/node": "^24.0.0",
78
+ "@vitejs/plugin-vue": "^5.2.4",
80
79
  "prettier": "^3.5.3",
81
- "prettier-plugin-tailwindcss": "^0.6.11",
80
+ "prettier-plugin-tailwindcss": "^0.6.12",
82
81
  "quasar": "^2.x.x",
83
- "tailwindcss": "^4.1.4",
82
+ "tailwindcss": "^4.1.8",
84
83
  "typescript": "5.8.3",
85
- "vite": "^6.3.2",
86
- "vite-plugin-dts": "^4.5.3",
84
+ "vite": "^6.3.5",
85
+ "vite-plugin-dts": "^4.5.4",
87
86
  "vitepress": "^2.0.0-alpha.4",
88
- "vue": "^3.5.13",
89
- "vue-tsc": "^2.2.8"
87
+ "vue": "^3.5.16",
88
+ "vue-tsc": "^2.2.10"
90
89
  }
91
90
  }
@@ -1,98 +0,0 @@
1
- import { QSpinnerHourglass } from "quasar";
2
- var TransactionTypes = /* @__PURE__ */ ((TransactionTypes2) => {
3
- TransactionTypes2["Purchase"] = "P";
4
- TransactionTypes2["Refund"] = "R";
5
- return TransactionTypes2;
6
- })(TransactionTypes || {});
7
- var CurrencyCodes = /* @__PURE__ */ ((CurrencyCodes2) => {
8
- CurrencyCodes2["AustralianDollar"] = "AUD";
9
- return CurrencyCodes2;
10
- })(CurrencyCodes || {});
11
- var ReceiptAutoPrint = /* @__PURE__ */ ((ReceiptAutoPrint2) => {
12
- ReceiptAutoPrint2["ReturnToPOS"] = "0";
13
- ReceiptAutoPrint2["MixedPrint"] = "7";
14
- ReceiptAutoPrint2["AllReceiptsFromPINPad"] = "9";
15
- return ReceiptAutoPrint2;
16
- })(ReceiptAutoPrint || {});
17
- var ResponseCodes = /* @__PURE__ */ ((ResponseCodes2) => {
18
- ResponseCodes2["APPROVED"] = "00";
19
- ResponseCodes2["Approved"] = "08";
20
- ResponseCodes2["TXN_CANCELLED"] = "HD";
21
- ResponseCodes2["INSUFFICIENT_FUND"] = "HB";
22
- ResponseCodes2["GENERAL_DECLINE"] = "99";
23
- ResponseCodes2["PINPAD_OFFLINE"] = "PF";
24
- return ResponseCodes2;
25
- })(ResponseCodes || {});
26
- var TransactionOutcome = /* @__PURE__ */ ((TransactionOutcome2) => {
27
- TransactionOutcome2["APPROVED"] = "APPROVED";
28
- TransactionOutcome2["CANCELLED"] = "CANCELLED";
29
- TransactionOutcome2["DECLINED"] = "DECLINED";
30
- TransactionOutcome2["UNKNOWN"] = "UNKNOWN";
31
- return TransactionOutcome2;
32
- })(TransactionOutcome || {});
33
- const dialogDefaultOpts = {
34
- message: "Processing the payment...",
35
- class: "text-lg",
36
- progress: {
37
- // spinner: QSpinnerClock,
38
- spinner: QSpinnerHourglass,
39
- color: "amber"
40
- },
41
- persistent: true,
42
- html: true,
43
- ok: false,
44
- cancel: {
45
- label: "Close",
46
- noCaps: true,
47
- color: "red",
48
- outline: true
49
- }
50
- };
51
- const updateDialog = (dialog, transactionOutcome) => {
52
- if (transactionOutcome === TransactionOutcome.APPROVED) {
53
- dialog.update({
54
- title: "Success!",
55
- class: "text-green-500",
56
- progress: false,
57
- message: '<div class="text-gray-800 text-base">Transaction Accepted!</div>'
58
- });
59
- setTimeout(() => dialog.hide(), 1e3);
60
- } else if (transactionOutcome === TransactionOutcome.DECLINED) {
61
- dialog.update({
62
- title: "Failed!",
63
- class: "text-red-500",
64
- progress: false,
65
- message: '<div class="text-gray-800 text-base">Transaction Declined!</div>'
66
- });
67
- } else if (transactionOutcome === TransactionOutcome.CANCELLED) {
68
- dialog.update({
69
- title: "Failed!",
70
- class: "text-red-500",
71
- progress: false,
72
- message: '<div class="text-gray-800 text-base">Transaction Cancelled!</div>'
73
- });
74
- } else if (transactionOutcome === TransactionOutcome.UNKNOWN) {
75
- dialog.update({
76
- title: "Failed!",
77
- class: "text-red-500",
78
- progress: false,
79
- message: '<div class="text-gray-800 text-base">Transaction Failed!</div>'
80
- });
81
- } else {
82
- dialog.update({
83
- title: "Failed!",
84
- class: "text-red-500",
85
- progress: false,
86
- message: '<div class="text-gray-800 text-base">Transaction Failed!</div>'
87
- });
88
- }
89
- };
90
- export {
91
- CurrencyCodes as C,
92
- ReceiptAutoPrint as R,
93
- TransactionTypes as T,
94
- ResponseCodes as a,
95
- TransactionOutcome as b,
96
- dialogDefaultOpts as d,
97
- updateDialog as u
98
- };