@achyutlabsau/vue-payment-gateway 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
3
  import { f as s, m as c } from "./mx51-Df356gl0.js";
4
- import { a as l, i as u, r as d } from "./worldline-CEiMow5_.js";
5
- import { n as f } from "./utils-o5X3364V.js";
6
- import { t as p } from "./linkly-D3mav3HW.js";
7
- import { t as m } from "./smartpay-Be3u1f3L.js";
8
- import { t as h } from "./till-payment-C1iLnYV7.js";
9
- import { t as g } from "./valpay-DVV1AH4F.js";
4
+ import { a as l, i as u, r as d } from "./worldline-B-YkSPMs.js";
5
+ import { n as f } from "./utils-CAwJtwP_.js";
6
+ import { t as p } from "./linkly-BICvJBrk.js";
7
+ import { t as m } from "./smartpay-BHnbLa5i.js";
8
+ import { t as h } from "./till-payment-BlnycpPt.js";
9
+ import { t as g } from "./valpay-Co5GhIks.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
@@ -1,12 +1,12 @@
1
1
  import { a as e, h as t, i as n, o as r, r as i, t as a, u as o } from "./PairInstructions-BxzivULm.js";
2
- import { a as s, i as c, n as l, r as u, t as d } from "./utils-o5X3364V.js";
3
- import { t as f } from "./utils-BPFf60Ai.js";
4
- import { t as p } from "./core-BMUVlh-t.js";
5
- import { createBlock as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, onMounted as ee, openBlock as b, ref as x, renderSlot as S, resolveDirective as C, toDisplayString as w, unref as T, useModel as E, withCtx as D, withDirectives as O } from "vue";
6
- import { Dialog as te, Loading as k, Notify as A, QBtn as j, QCard as M, QCardActions as ne, QCardSection as re, QDialog as ie, QForm as N, QIcon as P, QInput as F, QToolbar as ae, QToolbarTitle as oe } from "quasar";
7
- import { useLocalStorage as se } from "@vueuse/core";
2
+ import { a as s, i as c, n as l, o as u, r as d, t as f } from "./utils-CAwJtwP_.js";
3
+ import { t as p } from "./utils-BPFf60Ai.js";
4
+ import { t as m } from "./core-BMUVlh-t.js";
5
+ import { createBlock as h, createElementBlock as g, createElementVNode as _, createTextVNode as v, createVNode as y, defineComponent as b, onMounted as ee, openBlock as x, ref as S, renderSlot as C, resolveDirective as te, toDisplayString as ne, unref as w, useModel as re, withCtx as T, withDirectives as E } from "vue";
6
+ import { Dialog as ie, Loading as D, Notify as O, QBtn as k, QCard as A, QCardActions as ae, QCardSection as j, QDialog as M, QForm as N, QIcon as P, QInput as F, QToolbar as oe, QToolbarTitle as se } from "quasar";
7
+ import { useLocalStorage as ce } from "@vueuse/core";
8
8
  import { v7 as I } from "uuid";
9
- import L, { HttpStatusCode as R, isAxiosError as ce } from "axios";
9
+ import L, { HttpStatusCode as R, isAxiosError as le } from "axios";
10
10
  //#region src/library/linkly/linkly.config.ts
11
11
  var z = {
12
12
  PATHS: {
@@ -36,7 +36,7 @@ var z = {
36
36
  BASE: "https://rest.pos.cloud.pceftpos.com/v1/sessions/"
37
37
  }
38
38
  }
39
- }, B = { async: !1 }, V = 18e4, H = 2e3, U = 1e3, { PATHS: W, STORAGE_KEYS: G } = z, le = class {
39
+ }, B = { async: !1 }, V = 18e4, H = 2e3, U = 1e3, { PATHS: W, STORAGE_KEYS: G } = z, ue = class {
40
40
  _api;
41
41
  _authApi;
42
42
  token = null;
@@ -63,7 +63,7 @@ var z = {
63
63
  }
64
64
  _getErrorMessage(e, t) {
65
65
  let n = t ?? "An unexpected error occurred.";
66
- if (ce(e)) {
66
+ if (le(e)) {
67
67
  let t = e.response?.status;
68
68
  switch (t) {
69
69
  case R.Unauthorized:
@@ -77,7 +77,7 @@ var z = {
77
77
  break;
78
78
  default: c(t) && (n = "A server error has occurred. Wait a few seconds and attempt the request again. If the problem persists, contact Linkly Support.");
79
79
  }
80
- u(e) && (n = "You are not connected to the internet");
80
+ d(e) && (n = "You are not connected to the internet");
81
81
  }
82
82
  return n;
83
83
  }
@@ -154,7 +154,7 @@ var z = {
154
154
  if (L.isAxiosError(e)) {
155
155
  let r = e.response?.status ?? 0;
156
156
  if (r === R.RequestTimeout || c(e)) {
157
- if (t < V) return await d(H), t = Math.min(t + U, V), n();
157
+ if (t < V) return await f(H), t = Math.min(t + U, V), n();
158
158
  throw Error("Unable to get the transaction details. Please contact service provider!", { cause: e });
159
159
  } else if (r === R.Unauthorized) return await this.getLinklyAuthToken(), n();
160
160
  }
@@ -190,7 +190,7 @@ var z = {
190
190
  data: null
191
191
  };
192
192
  }
193
- if (n === R.RequestTimeout || c(t)) return await d(), this.reprintReceipt(e);
193
+ if (n === R.RequestTimeout || c(t)) return await f(), this.reprintReceipt(e);
194
194
  }
195
195
  return {
196
196
  success: !1,
@@ -219,7 +219,7 @@ var z = {
219
219
  message: "Failed to authenticate. Please check your Linkly account credentials."
220
220
  };
221
221
  }
222
- if (n === R.RequestTimeout || c(t)) return await d(), this.sendKey(e);
222
+ if (n === R.RequestTimeout || c(t)) return await f(), this.sendKey(e);
223
223
  }
224
224
  return {
225
225
  success: !1,
@@ -240,15 +240,15 @@ var z = {
240
240
  }({}), Z = /* @__PURE__ */ function(e) {
241
241
  return e.APPROVED = "APPROVED", e.CANCELLED = "CANCELLED", e.DECLINED = "DECLINED", e.UNKNOWN = "UNKNOWN", e;
242
242
  }({}), Q = () => {
243
- let e = new le({
243
+ let e = new ue({
244
244
  posId: t.posId,
245
245
  posName: t.productName,
246
246
  posVendorId: t.productVendorName,
247
247
  posVersion: t.productVersion,
248
248
  environment: o.value
249
249
  }), n = async (t) => {
250
- let n = te.create({
251
- ...f,
250
+ let n = ie.create({
251
+ ...p,
252
252
  message: "Pairing with the terminal..."
253
253
  }), r = await e.pairPinpad(t);
254
254
  return n.update({
@@ -266,8 +266,9 @@ var z = {
266
266
  CurrencyCode: q.AustralianDollar,
267
267
  CutReceipt: t.CutReceipt,
268
268
  AmtPurchase: t.AmtPurchase,
269
- ReceiptAutoPrint: t.ReceiptAutoPrint
270
- } }, i = p({
269
+ ReceiptAutoPrint: t.ReceiptAutoPrint,
270
+ ...t.referenceNumber ? { PurchaseAnalysisData: { RFN: t.referenceNumber } } : {}
271
+ } }, i = m({
271
272
  message: `${n === K.Purchase ? "Purchase" : "Refund"} of $${t.AmtPurchase / 100} in progress...`,
272
273
  onCancel: () => {
273
274
  i.progress("Trying to cancel transaction..."), e.sendKey(X.Cancel);
@@ -280,25 +281,25 @@ var z = {
280
281
  data: t.response,
281
282
  tipAmount: t.response?.amtTip ?? null,
282
283
  maskedCard: s(t.response?.pan),
283
- cardScheme: t.response?.cardType?.trim() || null
284
+ cardScheme: u(t.response?.cardType)
284
285
  }) : t?.response?.responseCode === Y.GENERAL_DECLINE ? (i.failed("Transaction Declined!"), {
285
286
  result: Z.DECLINED,
286
287
  data: t.response,
287
288
  tipAmount: t.response?.amtTip ?? null,
288
289
  maskedCard: s(t.response?.pan),
289
- cardScheme: t.response?.cardType?.trim() || null
290
+ cardScheme: u(t.response?.cardType)
290
291
  }) : t?.response?.responseCode === Y.CANCELLED ? (i.failed("Transaction Cancelled!"), {
291
292
  result: Z.CANCELLED,
292
293
  data: t.response,
293
294
  tipAmount: t.response?.amtTip ?? null,
294
295
  maskedCard: s(t.response?.pan),
295
- cardScheme: t.response?.cardType?.trim() || null
296
+ cardScheme: u(t.response?.cardType)
296
297
  }) : (i.failed("Transaction Failed!"), {
297
298
  result: Z.UNKNOWN,
298
299
  data: t.response,
299
300
  tipAmount: t.response?.amtTip ?? null,
300
301
  maskedCard: s(t.response?.pan),
301
- cardScheme: t.response?.cardType?.trim() || null
302
+ cardScheme: u(t.response?.cardType)
302
303
  });
303
304
  } catch (e) {
304
305
  throw i.failed("Transaction Failed!"), e;
@@ -323,7 +324,7 @@ var z = {
323
324
  getTransactionBySessionId: e.getTransactionStatus,
324
325
  getLastTransaction: e.getLastTransactionStatus
325
326
  };
326
- }, ue = { class: "" }, de = /* @__PURE__ */ y({
327
+ }, de = { class: "" }, fe = /* @__PURE__ */ b({
327
328
  __name: "ReprintReceiptDialog",
328
329
  props: {
329
330
  modelValue: { type: Boolean },
@@ -331,37 +332,37 @@ var z = {
331
332
  },
332
333
  emits: ["update:modelValue"],
333
334
  setup(e) {
334
- let t = Q(), n = E(e, "modelValue"), r = x(""), i = async () => {
335
+ let t = Q(), n = re(e, "modelValue"), r = S(""), i = async () => {
335
336
  try {
336
- k.show({ group: "reprintReceipt" });
337
+ D.show({ group: "reprintReceipt" });
337
338
  let e = await t.reprintReceipt(r.value || void 0);
338
- e.success ? (n.value = !1, A.create("Receipt printed successfully")) : A.create({
339
+ e.success ? (n.value = !1, O.create("Receipt printed successfully")) : O.create({
339
340
  type: "negative",
340
341
  message: e.message
341
342
  });
342
343
  } catch (e) {
343
344
  let t = e instanceof Error ? e.message : "Failed to print receipts";
344
- A.create({
345
+ O.create({
345
346
  type: "negative",
346
347
  message: t
347
348
  });
348
349
  } finally {
349
- k.hide("reprintReceipt");
350
+ D.hide("reprintReceipt");
350
351
  }
351
352
  };
352
353
  return (e, t) => {
353
- let a = C("close-popup");
354
- return b(), m(T(ie), {
354
+ let a = te("close-popup");
355
+ return x(), h(w(M), {
355
356
  modelValue: n.value,
356
357
  "onUpdate:modelValue": t[1] ||= (e) => n.value = e
357
358
  }, {
358
- default: D(() => [v(T(M), { class: "w-full" }, {
359
- default: D(() => [
360
- v(T(ae), { class: "bg-primary text-white" }, {
361
- default: D(() => [v(T(oe), null, {
362
- default: D(() => [S(e.$slots, "title", {}, () => [t[2] ||= _("Reprint Receipt", -1)])]),
359
+ default: T(() => [y(w(A), { class: "w-full" }, {
360
+ default: T(() => [
361
+ y(w(oe), { class: "bg-primary text-white" }, {
362
+ default: T(() => [y(w(se), null, {
363
+ default: T(() => [C(e.$slots, "title", {}, () => [t[2] ||= v("Reprint Receipt", -1)])]),
363
364
  _: 3
364
- }), O(v(T(P), {
365
+ }), E(y(w(P), {
365
366
  class: "float-right cursor-pointer rounded p-2 transition-colors",
366
367
  color: "gray",
367
368
  name: "close",
@@ -369,8 +370,8 @@ var z = {
369
370
  }, null, 512), [[a]])]),
370
371
  _: 3
371
372
  }),
372
- v(T(re), null, {
373
- default: D(() => [g("div", ue, [t[3] ||= _(" Txn Number: ", -1), v(T(F), {
373
+ y(w(j), null, {
374
+ default: T(() => [_("div", de, [t[3] ||= v(" Txn Number: ", -1), y(w(F), {
374
375
  modelValue: r.value,
375
376
  "onUpdate:modelValue": t[0] ||= (e) => r.value = e,
376
377
  class: "q-mb-sm",
@@ -381,16 +382,16 @@ var z = {
381
382
  }, null, 8, ["modelValue"])])]),
382
383
  _: 1
383
384
  }),
384
- v(T(ne), {
385
+ y(w(ae), {
385
386
  class: "!p-4",
386
387
  align: "right"
387
388
  }, {
388
- default: D(() => [O(v(T(j), {
389
+ default: T(() => [E(y(w(k), {
389
390
  label: "Cancel",
390
391
  "no-caps": "",
391
392
  unelevated: "",
392
393
  flat: ""
393
- }, null, 512), [[a]]), v(T(j), {
394
+ }, null, 512), [[a]]), y(w(k), {
394
395
  label: "Re-print Receipt",
395
396
  "no-caps": "",
396
397
  unelevated: "",
@@ -406,7 +407,7 @@ var z = {
406
407
  }, 8, ["modelValue"]);
407
408
  };
408
409
  }
409
- }), fe = { class: "" }, pe = { class: "text-center" }, $ = { class: "mb-6" }, me = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, he = { class: "!space-x-3" }, ge = { key: 1 }, _e = { class: "flex items-center justify-end gap-3" }, ve = /* @__PURE__ */ y({
410
+ }), pe = { class: "" }, me = { class: "text-center" }, he = { class: "mb-6" }, ge = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, $ = { class: "!space-x-3" }, _e = { key: 1 }, ve = { class: "flex items-center justify-end gap-3" }, ye = /* @__PURE__ */ b({
410
411
  __name: "PairLinkly",
411
412
  emits: ["pairing-success"],
412
413
  setup(t, { emit: o }) {
@@ -415,69 +416,69 @@ var z = {
415
416
  "Set the PIN pad up to connect to the Linkly cloud. Each bank may have different configuration settings.",
416
417
  "Once connected, the PIN pad will display a temporary 'pair code'",
417
418
  "Enter the username, password, and PIN pad 'pair code' from the PIN pad in the form on next screen."
418
- ], c = (e) => [(t) => !!t || `${e} is required`, (t) => t.length <= 16 || `${e} must be less than 16 characters.`], l = o, u = Q(), d = se("linkly.pairConfig", {
419
+ ], c = (e) => [(t) => !!t || `${e} is required`, (t) => t.length <= 16 || `${e} must be less than 16 characters.`], l = o, u = Q(), d = ce("linkly.pairConfig", {
419
420
  isPaired: !1,
420
421
  lastPairedDate: null
421
- }), f = x(!1), p = x({
422
+ }), f = S(!1), p = S({
422
423
  username: "",
423
424
  password: "",
424
425
  pairCode: ""
425
- }), _ = x(!d.value.isPaired), y = () => {
426
- _.value = !1;
427
- }, S = async () => {
426
+ }), m = S(!d.value.isPaired), v = () => {
427
+ m.value = !1;
428
+ }, b = async () => {
428
429
  let e = await u.pairPinpad(p.value);
429
430
  e.success && (d.value.isPaired = !0, d.value.lastPairedDate = /* @__PURE__ */ new Date(), l("pairing-success", e));
430
431
  }, C = () => {
431
432
  u.unpairPinpad(), d.value.isPaired = !1, d.value.lastPairedDate = null;
432
433
  };
433
- return ee(() => {}), (t, o) => (b(), h("div", fe, [T(d).isPaired ? (b(), m(T(M), {
434
+ return ee(() => {}), (t, o) => (x(), g("div", pe, [w(d).isPaired ? (x(), h(w(A), {
434
435
  key: "paired",
435
436
  class: "flex items-center justify-center rounded-lg p-8",
436
437
  flat: "",
437
438
  bordered: ""
438
439
  }, {
439
- default: D(() => [g("div", pe, [
440
- g("div", $, [v(T(P), {
441
- name: T(i),
440
+ default: T(() => [_("div", me, [
441
+ _("div", he, [y(w(P), {
442
+ name: w(i),
442
443
  size: "4rem",
443
444
  class: "text-green-500"
444
445
  }, null, 8, ["name"])]),
445
- o[6] ||= g("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
446
- g("p", me, " Last paired: " + w(new Date(T(d).lastPairedDate).toLocaleString()), 1),
447
- g("div", he, [v(T(j), {
446
+ o[6] ||= _("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
447
+ _("p", ge, " Last paired: " + ne(new Date(w(d).lastPairedDate).toLocaleString()), 1),
448
+ _("div", $, [y(w(k), {
448
449
  color: "green",
449
450
  "no-caps": "",
450
451
  outline: "",
451
452
  unelevated: "",
452
453
  label: "Reprint Receipt",
453
- "icon-left": T(n),
454
+ "icon-left": w(n),
454
455
  onClick: o[0] ||= (e) => f.value = !0
455
- }, null, 8, ["icon-left"]), v(T(j), {
456
+ }, null, 8, ["icon-left"]), y(w(k), {
456
457
  color: "primary",
457
458
  unelevated: "",
458
459
  "no-caps": "",
459
- "icon-left": T(r),
460
+ "icon-left": w(r),
460
461
  label: "Re-pair Terminal",
461
462
  onClick: C
462
463
  }, null, 8, ["icon-left"])])
463
464
  ])]),
464
465
  _: 1
465
- })) : (b(), h("section", ge, [_.value ? (b(), m(a, {
466
+ })) : (x(), g("section", _e, [m.value ? (x(), h(a, {
466
467
  key: 0,
467
- onNext: y,
468
+ onNext: v,
468
469
  steps: s
469
- })) : (b(), m(T(M), {
470
+ })) : (x(), h(w(A), {
470
471
  key: 1,
471
472
  flat: "",
472
473
  bordered: "",
473
474
  class: "w-full rounded-md p-6"
474
475
  }, {
475
- default: D(() => [o[7] ||= g("div", { class: "text-lg font-semibold" }, "Pairing configuration", -1), v(T(N), {
476
- onSubmit: S,
476
+ default: T(() => [o[7] ||= _("div", { class: "text-lg font-semibold" }, "Pairing configuration", -1), y(w(N), {
477
+ onSubmit: b,
477
478
  class: "mt-6 space-y-4"
478
479
  }, {
479
- default: D(() => [
480
- v(T(F), {
480
+ default: T(() => [
481
+ y(w(F), {
481
482
  modelValue: p.value.username,
482
483
  "onUpdate:modelValue": o[1] ||= (e) => p.value.username = e,
483
484
  rules: c("Username"),
@@ -488,7 +489,7 @@ var z = {
488
489
  "no-error-icon": "",
489
490
  dense: ""
490
491
  }, null, 8, ["modelValue", "rules"]),
491
- v(T(F), {
492
+ y(w(F), {
492
493
  modelValue: p.value.password,
493
494
  "onUpdate:modelValue": o[2] ||= (e) => p.value.password = e,
494
495
  rules: c("Password"),
@@ -499,7 +500,7 @@ var z = {
499
500
  hint: "Enter Cloud EFT Client Password",
500
501
  dense: ""
501
502
  }, null, 8, ["modelValue", "rules"]),
502
- v(T(F), {
503
+ y(w(F), {
503
504
  modelValue: p.value.pairCode,
504
505
  "onUpdate:modelValue": o[3] ||= (e) => p.value.pairCode = e,
505
506
  rules: c("Pairing Code"),
@@ -510,29 +511,29 @@ var z = {
510
511
  hint: "Enter Pair code from terminal screen",
511
512
  dense: ""
512
513
  }, null, 8, ["modelValue", "rules"]),
513
- g("div", _e, [v(T(j), {
514
+ _("div", ve, [y(w(k), {
514
515
  flat: "",
515
516
  "no-caps": "",
516
517
  label: "Back",
517
- "icon-left": T(n),
518
- onClick: o[4] ||= (e) => _.value = !0
519
- }, null, 8, ["icon-left"]), v(T(j), {
518
+ "icon-left": w(n),
519
+ onClick: o[4] ||= (e) => m.value = !0
520
+ }, null, 8, ["icon-left"]), y(w(k), {
520
521
  type: "submit",
521
522
  color: "primary",
522
523
  unelevated: "",
523
524
  "no-caps": "",
524
- "icon-right": T(e),
525
+ "icon-right": w(e),
525
526
  label: "Pair Device"
526
527
  }, null, 8, ["icon-right"])])
527
528
  ]),
528
529
  _: 1
529
530
  })]),
530
531
  _: 1
531
- }))])), v(de, {
532
+ }))])), y(fe, {
532
533
  modelValue: f.value,
533
534
  "onUpdate:modelValue": o[5] ||= (e) => f.value = e
534
535
  }, null, 8, ["modelValue"])]));
535
536
  }
536
537
  });
537
538
  //#endregion
538
- export { J as a, K as c, X as i, Q as n, Y as o, q as r, Z as s, ve as t };
539
+ export { J as a, K as c, X as i, Q as n, Y as o, q as r, Z as s, ye as t };
package/dist/linkly.d.ts CHANGED
@@ -259,9 +259,14 @@ export declare interface PinpadPairResponse {
259
259
  }
260
260
 
261
261
  declare interface PurchaseAnalysisData {
262
- OPR: string;
263
- AMT: string;
264
- PCM: string;
262
+ OPR?: string;
263
+ AMT?: string;
264
+ PCM?: string;
265
+ /**
266
+ * Reference Number from the purchase request this refund is for. Populate to
267
+ * perform a referenced (linked) refund tied to the original purchase.
268
+ */
269
+ RFN?: string;
265
270
  }
266
271
 
267
272
  export declare enum ReceiptAutoPrint {
@@ -325,7 +330,14 @@ export declare enum TransactionOutcome {
325
330
  UNKNOWN = "UNKNOWN"
326
331
  }
327
332
 
328
- export declare type TransactionPayload = Pick<TransactionPostRequest, "AmtPurchase" | "ReceiptAutoPrint" | "CutReceipt">;
333
+ export declare type TransactionPayload = Pick<TransactionPostRequest, "AmtPurchase" | "ReceiptAutoPrint" | "CutReceipt"> & {
334
+ /**
335
+ * Reference Number (RFN) from the original purchase this refund relates to.
336
+ * When provided on a refund, Linkly performs a referenced (linked) refund by
337
+ * sending it as `PurchaseAnalysisData.RFN`. Ignored for purchases.
338
+ */
339
+ referenceNumber?: string;
340
+ };
329
341
 
330
342
  /**
331
343
  * View Documentation - https://www.linkly.com.au/apidoc/REST/#purchase
package/dist/linkly.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./linkly-D3mav3HW.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./linkly-BICvJBrk.js";
2
2
  export { a as CurrencyCodes, n as LinklyKeyType, s as PairLinkly, e as ReceiptAutoPrint, i as ResponseCodes, o as TransactionOutcome, t as TransactionTypes, r as useLinkly };