@achyutlabsau/vue-payment-gateway 0.15.0 → 0.15.2

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.
@@ -11,6 +11,8 @@ function v(e) {
11
11
  amount: null,
12
12
  tipAmount: null,
13
13
  surchargeAmount: null,
14
+ maskedCard: null,
15
+ cardScheme: null,
14
16
  receipts: {},
15
17
  raw: null,
16
18
  ...e,
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import { d as e, f as t, m as n, p as r, s as i } from "./PairInstructions-Bxziv
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
4
  import { a as l, i as u, r as d } from "./worldline-CEiMow5_.js";
5
- import { n as f } from "./utils-LqvcWjKL.js";
6
- import { t as p } from "./linkly-yernhu9V.js";
7
- import { t as m } from "./smartpay-BSvt0cIh.js";
8
- import { t as h } from "./till-payment-DSScmuag.js";
9
- import { t as g } from "./valpay--SOqhe0M.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";
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 { i as s, n as c, r as l, t as u } from "./utils-LqvcWjKL.js";
3
- import { t as d } from "./utils-BPFf60Ai.js";
4
- import { t as f } from "./core-nvcK0Nr9.js";
5
- import { createBlock as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, onMounted as ee, openBlock as y, ref as b, renderSlot as x, resolveDirective as S, toDisplayString as te, unref as C, useModel as w, withCtx as T, withDirectives as E } from "vue";
6
- import { Dialog as D, Loading as O, Notify as k, QBtn as A, QCard as j, QCardActions as ne, QCardSection as re, QDialog as ie, QForm as ae, QIcon as M, QInput as N, QToolbar as P, QToolbarTitle as F } from "quasar";
7
- import { useLocalStorage as oe } from "@vueuse/core";
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";
8
8
  import { v7 as I } from "uuid";
9
- import L, { HttpStatusCode as R, isAxiosError as se } from "axios";
9
+ import L, { HttpStatusCode as R, isAxiosError as ce } 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, ce = class {
39
+ }, B = { async: !1 }, V = 18e4, H = 2e3, U = 1e3, { PATHS: W, STORAGE_KEYS: G } = z, le = 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 (se(e)) {
66
+ if (ce(e)) {
67
67
  let t = e.response?.status;
68
68
  switch (t) {
69
69
  case R.Unauthorized:
@@ -75,9 +75,9 @@ var z = {
75
75
  case R.RequestTimeout:
76
76
  n = "Request Timeout. This should be rare: a transient error has occurred, possibly due to server overloading.";
77
77
  break;
78
- default: s(t) && (n = "A server error has occurred. Wait a few seconds and attempt the request again. If the problem persists, contact Linkly Support.");
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
- l(e) && (n = "You are not connected to the internet");
80
+ u(e) && (n = "You are not connected to the internet");
81
81
  }
82
82
  return n;
83
83
  }
@@ -140,7 +140,7 @@ var z = {
140
140
  } catch {
141
141
  throw Error("Failed to authenticate. Please check your Linkly account credentials.", { cause: n });
142
142
  }
143
- if (r === R.RequestTimeout || s(n)) return this.getTransactionStatus(t);
143
+ if (r === R.RequestTimeout || c(n)) return this.getTransactionStatus(t);
144
144
  }
145
145
  throw n;
146
146
  }
@@ -153,8 +153,8 @@ var z = {
153
153
  } catch (e) {
154
154
  if (L.isAxiosError(e)) {
155
155
  let r = e.response?.status ?? 0;
156
- if (r === R.RequestTimeout || s(e)) {
157
- if (t < V) return await u(H), t = Math.min(t + U, V), n();
156
+ if (r === R.RequestTimeout || c(e)) {
157
+ if (t < V) return await d(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 || s(t)) return await u(), this.reprintReceipt(e);
193
+ if (n === R.RequestTimeout || c(t)) return await d(), 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 || s(t)) return await u(), this.sendKey(e);
222
+ if (n === R.RequestTimeout || c(t)) return await d(), 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 ce({
243
+ let e = new le({
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 = D.create({
251
- ...d,
250
+ let n = te.create({
251
+ ...f,
252
252
  message: "Pairing with the terminal..."
253
253
  }), r = await e.pairPinpad(t);
254
254
  return n.update({
@@ -261,13 +261,13 @@ var z = {
261
261
  let r = { Request: {
262
262
  Merchant: "00",
263
263
  Application: "00",
264
- TxnRef: c(),
264
+ TxnRef: l(),
265
265
  TxnType: n,
266
266
  CurrencyCode: q.AustralianDollar,
267
267
  CutReceipt: t.CutReceipt,
268
268
  AmtPurchase: t.AmtPurchase,
269
269
  ReceiptAutoPrint: t.ReceiptAutoPrint
270
- } }, i = f({
270
+ } }, i = p({
271
271
  message: `${n === K.Purchase ? "Purchase" : "Refund"} of $${t.AmtPurchase / 100} in progress...`,
272
272
  onCancel: () => {
273
273
  i.progress("Trying to cancel transaction..."), e.sendKey(X.Cancel);
@@ -278,19 +278,27 @@ var z = {
278
278
  return t?.response?.responseCode === Y.APPROVED || t?.response?.responseCode === Y.Approved ? (i.success("Transaction Approved!"), {
279
279
  result: Z.APPROVED,
280
280
  data: t.response,
281
- tipAmount: t.response?.amtTip ?? null
281
+ tipAmount: t.response?.amtTip ?? null,
282
+ maskedCard: s(t.response?.pan),
283
+ cardScheme: t.response?.cardType?.trim() || null
282
284
  }) : t?.response?.responseCode === Y.GENERAL_DECLINE ? (i.failed("Transaction Declined!"), {
283
285
  result: Z.DECLINED,
284
286
  data: t.response,
285
- tipAmount: t.response?.amtTip ?? null
287
+ tipAmount: t.response?.amtTip ?? null,
288
+ maskedCard: s(t.response?.pan),
289
+ cardScheme: t.response?.cardType?.trim() || null
286
290
  }) : t?.response?.responseCode === Y.CANCELLED ? (i.failed("Transaction Cancelled!"), {
287
291
  result: Z.CANCELLED,
288
292
  data: t.response,
289
- tipAmount: t.response?.amtTip ?? null
293
+ tipAmount: t.response?.amtTip ?? null,
294
+ maskedCard: s(t.response?.pan),
295
+ cardScheme: t.response?.cardType?.trim() || null
290
296
  }) : (i.failed("Transaction Failed!"), {
291
297
  result: Z.UNKNOWN,
292
298
  data: t.response,
293
- tipAmount: t.response?.amtTip ?? null
299
+ tipAmount: t.response?.amtTip ?? null,
300
+ maskedCard: s(t.response?.pan),
301
+ cardScheme: t.response?.cardType?.trim() || null
294
302
  });
295
303
  } catch (e) {
296
304
  throw i.failed("Transaction Failed!"), e;
@@ -315,7 +323,7 @@ var z = {
315
323
  getTransactionBySessionId: e.getTransactionStatus,
316
324
  getLastTransaction: e.getLastTransactionStatus
317
325
  };
318
- }, le = { class: "" }, ue = /* @__PURE__ */ v({
326
+ }, ue = { class: "" }, de = /* @__PURE__ */ y({
319
327
  __name: "ReprintReceiptDialog",
320
328
  props: {
321
329
  modelValue: { type: Boolean },
@@ -323,37 +331,37 @@ var z = {
323
331
  },
324
332
  emits: ["update:modelValue"],
325
333
  setup(e) {
326
- let t = Q(), n = w(e, "modelValue"), r = b(""), i = async () => {
334
+ let t = Q(), n = E(e, "modelValue"), r = x(""), i = async () => {
327
335
  try {
328
- O.show({ group: "reprintReceipt" });
336
+ k.show({ group: "reprintReceipt" });
329
337
  let e = await t.reprintReceipt(r.value || void 0);
330
- e.success ? (n.value = !1, k.create("Receipt printed successfully")) : k.create({
338
+ e.success ? (n.value = !1, A.create("Receipt printed successfully")) : A.create({
331
339
  type: "negative",
332
340
  message: e.message
333
341
  });
334
342
  } catch (e) {
335
343
  let t = e instanceof Error ? e.message : "Failed to print receipts";
336
- k.create({
344
+ A.create({
337
345
  type: "negative",
338
346
  message: t
339
347
  });
340
348
  } finally {
341
- O.hide("reprintReceipt");
349
+ k.hide("reprintReceipt");
342
350
  }
343
351
  };
344
352
  return (e, t) => {
345
- let a = S("close-popup");
346
- return y(), p(C(ie), {
353
+ let a = C("close-popup");
354
+ return b(), m(T(ie), {
347
355
  modelValue: n.value,
348
356
  "onUpdate:modelValue": t[1] ||= (e) => n.value = e
349
357
  }, {
350
- default: T(() => [_(C(j), { class: "w-full" }, {
351
- default: T(() => [
352
- _(C(P), { class: "bg-primary text-white" }, {
353
- default: T(() => [_(C(F), null, {
354
- default: T(() => [x(e.$slots, "title", {}, () => [t[2] ||= g("Reprint Receipt", -1)])]),
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)])]),
355
363
  _: 3
356
- }), E(_(C(M), {
364
+ }), O(v(T(P), {
357
365
  class: "float-right cursor-pointer rounded p-2 transition-colors",
358
366
  color: "gray",
359
367
  name: "close",
@@ -361,8 +369,8 @@ var z = {
361
369
  }, null, 512), [[a]])]),
362
370
  _: 3
363
371
  }),
364
- _(C(re), null, {
365
- default: T(() => [h("div", le, [t[3] ||= g(" Txn Number: ", -1), _(C(N), {
372
+ v(T(re), null, {
373
+ default: D(() => [g("div", ue, [t[3] ||= _(" Txn Number: ", -1), v(T(F), {
366
374
  modelValue: r.value,
367
375
  "onUpdate:modelValue": t[0] ||= (e) => r.value = e,
368
376
  class: "q-mb-sm",
@@ -373,16 +381,16 @@ var z = {
373
381
  }, null, 8, ["modelValue"])])]),
374
382
  _: 1
375
383
  }),
376
- _(C(ne), {
384
+ v(T(ne), {
377
385
  class: "!p-4",
378
386
  align: "right"
379
387
  }, {
380
- default: T(() => [E(_(C(A), {
388
+ default: D(() => [O(v(T(j), {
381
389
  label: "Cancel",
382
390
  "no-caps": "",
383
391
  unelevated: "",
384
392
  flat: ""
385
- }, null, 512), [[a]]), _(C(A), {
393
+ }, null, 512), [[a]]), v(T(j), {
386
394
  label: "Re-print Receipt",
387
395
  "no-caps": "",
388
396
  unelevated: "",
@@ -398,7 +406,7 @@ var z = {
398
406
  }, 8, ["modelValue"]);
399
407
  };
400
408
  }
401
- }), de = { class: "" }, fe = { class: "text-center" }, pe = { class: "mb-6" }, $ = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, me = { class: "!space-x-3" }, he = { key: 1 }, ge = { class: "flex items-center justify-end gap-3" }, _e = /* @__PURE__ */ v({
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({
402
410
  __name: "PairLinkly",
403
411
  emits: ["pairing-success"],
404
412
  setup(t, { emit: o }) {
@@ -407,71 +415,71 @@ var z = {
407
415
  "Set the PIN pad up to connect to the Linkly cloud. Each bank may have different configuration settings.",
408
416
  "Once connected, the PIN pad will display a temporary 'pair code'",
409
417
  "Enter the username, password, and PIN pad 'pair code' from the PIN pad in the form on next screen."
410
- ], c = (e) => [(t) => !!t || `${e} is required`, (t) => t.length <= 16 || `${e} must be less than 16 characters.`], l = o, u = Q(), d = oe("linkly.pairConfig", {
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", {
411
419
  isPaired: !1,
412
420
  lastPairedDate: null
413
- }), f = b(!1), g = b({
421
+ }), f = x(!1), p = x({
414
422
  username: "",
415
423
  password: "",
416
424
  pairCode: ""
417
- }), v = b(!d.value.isPaired), x = () => {
418
- v.value = !1;
425
+ }), _ = x(!d.value.isPaired), y = () => {
426
+ _.value = !1;
419
427
  }, S = async () => {
420
- let e = await u.pairPinpad(g.value);
428
+ let e = await u.pairPinpad(p.value);
421
429
  e.success && (d.value.isPaired = !0, d.value.lastPairedDate = /* @__PURE__ */ new Date(), l("pairing-success", e));
422
- }, w = () => {
430
+ }, C = () => {
423
431
  u.unpairPinpad(), d.value.isPaired = !1, d.value.lastPairedDate = null;
424
432
  };
425
- return ee(() => {}), (t, o) => (y(), m("div", de, [C(d).isPaired ? (y(), p(C(j), {
433
+ return ee(() => {}), (t, o) => (b(), h("div", fe, [T(d).isPaired ? (b(), m(T(M), {
426
434
  key: "paired",
427
435
  class: "flex items-center justify-center rounded-lg p-8",
428
436
  flat: "",
429
437
  bordered: ""
430
438
  }, {
431
- default: T(() => [h("div", fe, [
432
- h("div", pe, [_(C(M), {
433
- name: C(i),
439
+ default: D(() => [g("div", pe, [
440
+ g("div", $, [v(T(P), {
441
+ name: T(i),
434
442
  size: "4rem",
435
443
  class: "text-green-500"
436
444
  }, null, 8, ["name"])]),
437
- o[6] ||= h("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
438
- h("p", $, " Last paired: " + te(new Date(C(d).lastPairedDate).toLocaleString()), 1),
439
- h("div", me, [_(C(A), {
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), {
440
448
  color: "green",
441
449
  "no-caps": "",
442
450
  outline: "",
443
451
  unelevated: "",
444
452
  label: "Reprint Receipt",
445
- "icon-left": C(n),
453
+ "icon-left": T(n),
446
454
  onClick: o[0] ||= (e) => f.value = !0
447
- }, null, 8, ["icon-left"]), _(C(A), {
455
+ }, null, 8, ["icon-left"]), v(T(j), {
448
456
  color: "primary",
449
457
  unelevated: "",
450
458
  "no-caps": "",
451
- "icon-left": C(r),
459
+ "icon-left": T(r),
452
460
  label: "Re-pair Terminal",
453
- onClick: w
461
+ onClick: C
454
462
  }, null, 8, ["icon-left"])])
455
463
  ])]),
456
464
  _: 1
457
- })) : (y(), m("section", he, [v.value ? (y(), p(a, {
465
+ })) : (b(), h("section", ge, [_.value ? (b(), m(a, {
458
466
  key: 0,
459
- onNext: x,
467
+ onNext: y,
460
468
  steps: s
461
- })) : (y(), p(C(j), {
469
+ })) : (b(), m(T(M), {
462
470
  key: 1,
463
471
  flat: "",
464
472
  bordered: "",
465
473
  class: "w-full rounded-md p-6"
466
474
  }, {
467
- default: T(() => [o[7] ||= h("div", { class: "text-lg font-semibold" }, "Pairing configuration", -1), _(C(ae), {
475
+ default: D(() => [o[7] ||= g("div", { class: "text-lg font-semibold" }, "Pairing configuration", -1), v(T(N), {
468
476
  onSubmit: S,
469
477
  class: "mt-6 space-y-4"
470
478
  }, {
471
- default: T(() => [
472
- _(C(N), {
473
- modelValue: g.value.username,
474
- "onUpdate:modelValue": o[1] ||= (e) => g.value.username = e,
479
+ default: D(() => [
480
+ v(T(F), {
481
+ modelValue: p.value.username,
482
+ "onUpdate:modelValue": o[1] ||= (e) => p.value.username = e,
475
483
  rules: c("Username"),
476
484
  label: "Username",
477
485
  hint: "Cloud EFT Client Username",
@@ -480,9 +488,9 @@ var z = {
480
488
  "no-error-icon": "",
481
489
  dense: ""
482
490
  }, null, 8, ["modelValue", "rules"]),
483
- _(C(N), {
484
- modelValue: g.value.password,
485
- "onUpdate:modelValue": o[2] ||= (e) => g.value.password = e,
491
+ v(T(F), {
492
+ modelValue: p.value.password,
493
+ "onUpdate:modelValue": o[2] ||= (e) => p.value.password = e,
486
494
  rules: c("Password"),
487
495
  label: "Password",
488
496
  "no-error-icon": "",
@@ -491,9 +499,9 @@ var z = {
491
499
  hint: "Enter Cloud EFT Client Password",
492
500
  dense: ""
493
501
  }, null, 8, ["modelValue", "rules"]),
494
- _(C(N), {
495
- modelValue: g.value.pairCode,
496
- "onUpdate:modelValue": o[3] ||= (e) => g.value.pairCode = e,
502
+ v(T(F), {
503
+ modelValue: p.value.pairCode,
504
+ "onUpdate:modelValue": o[3] ||= (e) => p.value.pairCode = e,
497
505
  rules: c("Pairing Code"),
498
506
  label: "Pairing Code",
499
507
  type: "text",
@@ -502,29 +510,29 @@ var z = {
502
510
  hint: "Enter Pair code from terminal screen",
503
511
  dense: ""
504
512
  }, null, 8, ["modelValue", "rules"]),
505
- h("div", ge, [_(C(A), {
513
+ g("div", _e, [v(T(j), {
506
514
  flat: "",
507
515
  "no-caps": "",
508
516
  label: "Back",
509
- "icon-left": C(n),
510
- onClick: o[4] ||= (e) => v.value = !0
511
- }, null, 8, ["icon-left"]), _(C(A), {
517
+ "icon-left": T(n),
518
+ onClick: o[4] ||= (e) => _.value = !0
519
+ }, null, 8, ["icon-left"]), v(T(j), {
512
520
  type: "submit",
513
521
  color: "primary",
514
522
  unelevated: "",
515
523
  "no-caps": "",
516
- "icon-right": C(e),
524
+ "icon-right": T(e),
517
525
  label: "Pair Device"
518
526
  }, null, 8, ["icon-right"])])
519
527
  ]),
520
528
  _: 1
521
529
  })]),
522
530
  _: 1
523
- }))])), _(ue, {
531
+ }))])), v(de, {
524
532
  modelValue: f.value,
525
533
  "onUpdate:modelValue": o[5] ||= (e) => f.value = e
526
534
  }, null, 8, ["modelValue"])]));
527
535
  }
528
536
  });
529
537
  //#endregion
530
- export { J as a, K as c, X as i, Q as n, Y as o, q as r, Z as s, _e as t };
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 };
package/dist/linkly.d.ts CHANGED
@@ -424,6 +424,8 @@ export declare const useLinkly: () => {
424
424
  };
425
425
  };
426
426
  tipAmount: number;
427
+ maskedCard: string | null;
428
+ cardScheme: string | null;
427
429
  }>;
428
430
  initiateRefund: (data: TransactionPayload) => Promise<{
429
431
  result: TransactionOutcome;
@@ -471,6 +473,8 @@ export declare const useLinkly: () => {
471
473
  };
472
474
  };
473
475
  tipAmount: number;
476
+ maskedCard: string | null;
477
+ cardScheme: string | null;
474
478
  }>;
475
479
  reprintReceipt: (txnRef?: string) => Promise< ReceiptReprintReturn>;
476
480
  getTransactionBySessionId: (transactionId: string) => Promise< LinklyTransactionResponse>;
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-yernhu9V.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-D3mav3HW.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 };
@@ -1,5 +1,5 @@
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 { t as s } from "./utils-LqvcWjKL.js";
2
+ import { t as s } from "./utils-o5X3364V.js";
3
3
  import { t as c } from "./utils-BPFf60Ai.js";
4
4
  import { createBlock as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, openBlock as h, ref as g, toDisplayString as _, unref as v, withCtx as y, withModifiers as b } from "vue";
5
5
  import { Dialog as x, QBtn as S, QCard as C, QIcon as w, QInput as T } from "quasar";
@@ -156,7 +156,9 @@ var A = /* @__PURE__ */ function(e) {
156
156
  R(a, e.transactionOutcome), r({
157
157
  ...e,
158
158
  smartPayCustomerReceipt: e.responseData?.data?.Receipt,
159
- tipAmount: z(e.responseData?.data?.AmountTip)
159
+ tipAmount: z(e.responseData?.data?.AmountTip),
160
+ maskedCard: e.responseData?.data?.CardPan || null,
161
+ cardScheme: e.responseData?.data?.CardType || null
160
162
  }), setTimeout(a.hide, 3e3);
161
163
  }).catch((e) => {
162
164
  a.update({
@@ -57,6 +57,16 @@ declare interface SmartConnectPayRef extends PollingResult {
57
57
  * The tip amount in cents, flattened to the top level for easy access.
58
58
  */
59
59
  tipAmount: number | null;
60
+ /**
61
+ * Masked card number (PAN), flattened to the top level for easy access, or
62
+ * `null` when SmartPay didn't report one.
63
+ */
64
+ maskedCard: string | null;
65
+ /**
66
+ * Card scheme / company (e.g. "Visa", "Mastercard"), flattened to the top
67
+ * level for easy access, or `null` when SmartPay didn't report one.
68
+ */
69
+ cardScheme: string | null;
60
70
  }
61
71
 
62
72
  export declare class SmartPay {
package/dist/smartpay.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./smartpay-BSvt0cIh.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./smartpay-Be3u1f3L.js";
2
2
  export { n as DEV_SMARTPAY_API_URL, e as PROD_SMARTPAY_API_URL, c as PairSmartPay, a as ResultType, o as SmartPay, s as TransactionOutcome, t as TransactionResult, r as TransactionStatus, l as TransactionTypes, i as useSmartPay };
@@ -1,21 +1,21 @@
1
1
  import { a as e, h as t, i as n, o as r, r as i, t as a } from "./PairInstructions-BxzivULm.js";
2
- import { t as o } from "./utils-LqvcWjKL.js";
3
- import { n as s, r as c, t as l } from "./core-nvcK0Nr9.js";
4
- import { createBlock as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, onMounted as g, openBlock as _, ref as v, renderSlot as y, resolveDirective as b, toDisplayString as x, unref as S, useModel as C, withCtx as w, withDirectives as T } from "vue";
5
- import { Dialog as E, Loading as D, Notify as O, QBtn as k, QCard as A, QCardActions as j, QCardSection as M, QDialog as N, QForm as P, QIcon as F, QInput as I, QSelect as L, QToolbar as R, QToolbarTitle as z } from "quasar";
2
+ import { a as o, t as s } from "./utils-o5X3364V.js";
3
+ import { n as c, r as l, t as u } from "./core-BMUVlh-t.js";
4
+ import { createBlock as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, onMounted as _, openBlock as v, ref as y, renderSlot as b, resolveDirective as x, toDisplayString as S, unref as C, useModel as w, withCtx as T, withDirectives as E } from "vue";
5
+ import { Dialog as D, Loading as O, Notify as k, QBtn as A, QCard as j, QCardActions as M, QCardSection as N, QDialog as P, QForm as F, QIcon as I, QInput as L, QSelect as R, QToolbar as ee, QToolbarTitle as z } from "quasar";
6
6
  import { useLocalStorage as B } from "@vueuse/core";
7
7
  import { validate as V } from "uuid";
8
8
  import H from "dayjs";
9
- import U, { HttpStatusCode as W, isAxiosError as ee } from "axios";
9
+ import U, { HttpStatusCode as W, isAxiosError as G } from "axios";
10
10
  //#region src/library/till-payment/tillPayment.enums.ts
11
- var te = /* @__PURE__ */ function(e) {
11
+ var K = /* @__PURE__ */ function(e) {
12
12
  return e.SETTLEMENT = "SETTLEMENT", e.PRE_SETTLEMENT = "PRE_SETTLEMENT", e.LAST_SETTLEMENT = "LAST_SETTLEMENT", e;
13
- }({}), G = /* @__PURE__ */ function(e) {
13
+ }({}), q = /* @__PURE__ */ function(e) {
14
14
  return e.REPRINT_RECEIPT = "REPRINT_RECEIPT", e.PAYMENT = "PAYMENT", e.REFUND = "REFUND", e.REVERSAL = "REVERSAL", e.PREAUTH = "PREAUTH", e.PREAUTH_CANCEL = "PREAUTH_CANCEL", e.PREAUTH_CAPTURE = "PREAUTH_CAPTURE", e;
15
- }({}), K = /* @__PURE__ */ function(e) {
15
+ }({}), J = /* @__PURE__ */ function(e) {
16
16
  return e.Accepted = "accepted", e.Declined = "declined", e.Cancelled = "cancelled", e.Timeout = "timeout", e.Failed = "failed", e;
17
- }({}), q = (e) => {
18
- if (console.error(e), ee(e)) {
17
+ }({}), Y = (e) => {
18
+ if (console.error(e), G(e)) {
19
19
  let t = e.response?.data, n = t?.statusCode, r = e.code === "ERR_NETWORK";
20
20
  return {
21
21
  error: !0,
@@ -29,7 +29,7 @@ var te = /* @__PURE__ */ function(e) {
29
29
  message: e instanceof Error ? e.message : "something went wrong!",
30
30
  statusCode: W.BadRequest
31
31
  };
32
- }, J = (e) => (e / 100).toFixed(2), Y = (e, t) => {
32
+ }, X = (e) => (e / 100).toFixed(2), Z = (e, t) => {
33
33
  try {
34
34
  if (!t) return null;
35
35
  let n = JSON.parse(t), r = n.maskedMerchantId || `...${n.merchantId.slice(-4)}`, i = n.maskedTerminalId || n.terminalId, a = n.authMessage?.split("\\n") || [], o = a[0] || "", s = a[1] || "", c = (e, t) => `${e.padEnd(14)}${" AUD".padEnd(8)}${`$${t}`.padStart(10)}`;
@@ -44,14 +44,14 @@ var te = /* @__PURE__ */ function(e) {
44
44
  Card: ${n.maskedPan}
45
45
  Method: ${n.cardEntryMethod}${n.applicationIdentifier ? `\n AID: ${n.applicationIdentifier}` : ""}\n`,
46
46
  "",
47
- c(n.transactionType, J(n.amount.subtotal || n.paymentAmount - (n.amount.surcharge || 0) - (n.amount.tip || 0))),
47
+ c(n.transactionType, X(n.amount.subtotal || n.paymentAmount - (n.amount.surcharge || 0) - (n.amount.tip || 0))),
48
48
  [
49
- n.amount.surcharge > 0 ? c("Surcharge", J(n.amount.surcharge)) : null,
50
- n.amount.tip > 0 ? c("Tip", J(n.amount.tip)) : null,
51
- n.amount.tax > 0 ? c("Tax", J(n.amount.tax)) : null
49
+ n.amount.surcharge > 0 ? c("Surcharge", X(n.amount.surcharge)) : null,
50
+ n.amount.tip > 0 ? c("Tip", X(n.amount.tip)) : null,
51
+ n.amount.tax > 0 ? c("Tax", X(n.amount.tax)) : null
52
52
  ].filter(Boolean).join("\n"),
53
53
  "-".repeat(32),
54
- c("Total", J(n.paymentAmount)),
54
+ c("Total", X(n.paymentAmount)),
55
55
  `
56
56
  Auth Code: ${n.authCode}
57
57
  Response: ${o} ${s}
@@ -65,7 +65,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
65
65
  } catch (e) {
66
66
  return console.error("Receipt generation error:", e), null;
67
67
  }
68
- }, X = class e {
68
+ }, Q = class e {
69
69
  api;
70
70
  config;
71
71
  static URLS = {
@@ -113,14 +113,14 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
113
113
  try {
114
114
  return (await this.api.get("/terminals")).data.terminals;
115
115
  } catch (e) {
116
- return q(e);
116
+ return Y(e);
117
117
  }
118
118
  }
119
119
  async getSpecificTerminal(e) {
120
120
  try {
121
121
  return (await this.api.get(`/terminals/${e}`)).data.terminal;
122
122
  } catch (e) {
123
- return q(e);
123
+ return Y(e);
124
124
  }
125
125
  }
126
126
  async pairTerminal(e) {
@@ -132,7 +132,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
132
132
  statusCode: 0
133
133
  };
134
134
  } catch (e) {
135
- return q(e);
135
+ return Y(e);
136
136
  }
137
137
  }
138
138
  unpair() {
@@ -143,11 +143,11 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
143
143
  let t = await this.api.get(`/intent/${e}`);
144
144
  return {
145
145
  ...t.data,
146
- customerReceipt: Y("CUSTOMER COPY", t.data.transactionDetails?.rawReceipt),
147
- merchantReceipt: Y("MERCHANT COPY", t.data.transactionDetails?.rawReceipt)
146
+ customerReceipt: Z("CUSTOMER COPY", t.data.transactionDetails?.rawReceipt),
147
+ merchantReceipt: Z("MERCHANT COPY", t.data.transactionDetails?.rawReceipt)
148
148
  };
149
149
  } catch (e) {
150
- return q(e);
150
+ return Y(e);
151
151
  }
152
152
  }
153
153
  async createPaymentIntent(e) {
@@ -165,7 +165,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
165
165
  if (!e) return;
166
166
  if ((await this.api.post(`/intent/${e}/cancel`, { tid: this._getTid() })).status === 204) return !0;
167
167
  } catch (e) {
168
- return q(e);
168
+ return Y(e);
169
169
  }
170
170
  }
171
171
  async requestTerminalToProcessIntent(e, t) {
@@ -178,14 +178,14 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
178
178
  async processTransaction(e, t) {
179
179
  try {
180
180
  if (this._setRunningTxnId(t), !await this.requestTerminalToProcessIntent(e, t)) return this._deleteRunningTxnId(), {
181
- transactionOutcome: K.Failed,
181
+ transactionOutcome: J.Failed,
182
182
  message: "Failed to send payment request to terminal.",
183
183
  data: null
184
184
  };
185
185
  this._setLastTransactionId(t);
186
186
  let n, r = Date.now(), i = /* @__PURE__ */ new Set(["PENDING", "PROCESSING"]), a;
187
187
  for (; Date.now() - r < 18e4 && (!n || i.has(n.status));) {
188
- await o(2e3);
188
+ await s(2e3);
189
189
  let e = await this.getIntentById(t);
190
190
  if ("error" in e) {
191
191
  if (e.code === "ERR_NETWORK") continue;
@@ -193,12 +193,12 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
193
193
  }
194
194
  n = e;
195
195
  }
196
- return a = !n || i.has(n.status) ? K.Timeout : n.status === "COMPLETED" ? n.transactionDetails?.status === "SUCCESS" ? K.Accepted : n.transactionDetails?.status === "CANCELLED" ? K.Cancelled : n.transactionDetails?.status === "DECLINED" ? K.Declined : K.Failed : K.Failed, this._deleteRunningTxnId(), {
196
+ return a = !n || i.has(n.status) ? J.Timeout : n.status === "COMPLETED" ? n.transactionDetails?.status === "SUCCESS" ? J.Accepted : n.transactionDetails?.status === "CANCELLED" ? J.Cancelled : n.transactionDetails?.status === "DECLINED" ? J.Declined : J.Failed : J.Failed, this._deleteRunningTxnId(), {
197
197
  transactionOutcome: a,
198
198
  data: n
199
199
  };
200
200
  } catch (e) {
201
- return this._deleteRunningTxnId(), q(e);
201
+ return this._deleteRunningTxnId(), Y(e);
202
202
  }
203
203
  }
204
204
  async initiatePurchase(e) {
@@ -206,7 +206,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
206
206
  let t = await this.createPaymentIntent(e);
207
207
  return this.processTransaction(this._getTid(), t.intentId);
208
208
  } catch (e) {
209
- return q(e);
209
+ return Y(e);
210
210
  }
211
211
  }
212
212
  async initiateRefund(e) {
@@ -214,14 +214,14 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
214
214
  let t = await this.createRefundIntent(e);
215
215
  return this.processTransaction(this._getTid(), t.intentId);
216
216
  } catch (e) {
217
- return q(e);
217
+ return Y(e);
218
218
  }
219
219
  }
220
220
  async reprintReceipt(e) {
221
221
  try {
222
222
  let t = await this.createNftIntent({
223
223
  parentIntentId: e,
224
- type: G.REPRINT_RECEIPT
224
+ type: q.REPRINT_RECEIPT
225
225
  });
226
226
  return await this.requestTerminalToProcessIntent(this._getTid(), t.intentId) ? {
227
227
  error: !1,
@@ -233,7 +233,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
233
233
  statusCode: 0
234
234
  };
235
235
  } catch (e) {
236
- return q(e);
236
+ return Y(e);
237
237
  }
238
238
  }
239
239
  async getLastTransaction() {
@@ -247,37 +247,39 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
247
247
  };
248
248
  //#endregion
249
249
  //#region src/library/till-payment/tillPayment.mapper.ts
250
- function Z(e) {
250
+ function te(e) {
251
251
  switch (e) {
252
- case K.Accepted: return s.Approved;
253
- case K.Declined: return s.Declined;
254
- case K.Cancelled: return s.Cancelled;
255
- case K.Timeout: return s.Timeout;
256
- default: return s.Failed;
252
+ case J.Accepted: return c.Approved;
253
+ case J.Declined: return c.Declined;
254
+ case J.Cancelled: return c.Cancelled;
255
+ case J.Timeout: return c.Timeout;
256
+ default: return c.Failed;
257
257
  }
258
258
  }
259
259
  function ne(e) {
260
- if ("error" in e) return c({
261
- status: s.Failed,
260
+ if ("error" in e) return l({
261
+ status: c.Failed,
262
262
  message: e.message,
263
263
  raw: e
264
264
  });
265
- let t = Z(e.transactionOutcome), n = e.data?.transactionDetails, r = {};
266
- return e.data?.merchantReceipt && (r.merchant = e.data.merchantReceipt), e.data?.customerReceipt && (r.customer = e.data.customerReceipt), c({
265
+ let t = te(e.transactionOutcome), n = e.data?.transactionDetails, r = n?.paymentMethod?.card, i = o(r?.last4Digit), a = {};
266
+ return e.data?.merchantReceipt && (a.merchant = e.data.merchantReceipt), e.data?.customerReceipt && (a.customer = e.data.customerReceipt), l({
267
267
  status: t,
268
268
  transactionId: e.data?.intentId ?? null,
269
269
  amount: n?.paymentAmount ?? null,
270
270
  tipAmount: n?.amount.tip || null,
271
271
  surchargeAmount: n ? n.amount.surcharge : null,
272
- receipts: r,
273
- message: e.message ?? (t === s.Approved ? "Transaction Accepted!" : `Transaction ${e.transactionOutcome}!`),
272
+ maskedCard: i,
273
+ cardScheme: r?.scheme ?? null,
274
+ receipts: a,
275
+ message: e.message ?? (t === c.Approved ? "Transaction Accepted!" : `Transaction ${e.transactionOutcome}!`),
274
276
  raw: e.data ?? null
275
277
  });
276
278
  }
277
279
  //#endregion
278
280
  //#region src/library/till-payment/useTillPayment.ts
279
- var re = () => !!localStorage.getItem("till.tid"), Q = () => {
280
- let e = new X({
281
+ var re = () => !!localStorage.getItem("till.tid"), $ = () => {
282
+ let e = new Q({
281
283
  apiKey: t.tillPaymentApiKey,
282
284
  merchantId: t.tillPaymentMerchantId,
283
285
  environment: "SANDBOX"
@@ -295,7 +297,7 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
295
297
  }, r = () => {
296
298
  e.unpair();
297
299
  }, i = async (t, n, r) => {
298
- let i = r?.tipAmount, a = l({
300
+ let i = r?.tipAmount, a = u({
299
301
  message: `${t} of $${n / 100}${i === void 0 ? "" : ` (+ $${i / 100} tip)`} in progress...`,
300
302
  onCancel: () => {
301
303
  a.progress("Trying to cancel transaction..."), e.cancelIntent();
@@ -314,7 +316,7 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
314
316
  refund: (e) => i("Refund", e),
315
317
  reprintReceipt: async (t) => {
316
318
  try {
317
- return D.show(), await e.reprintReceipt(t);
319
+ return O.show(), await e.reprintReceipt(t);
318
320
  } catch (e) {
319
321
  return console.error(e), {
320
322
  error: !0,
@@ -322,12 +324,12 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
322
324
  statusCode: 400
323
325
  };
324
326
  } finally {
325
- D.hide();
327
+ O.hide();
326
328
  }
327
329
  },
328
330
  raw: e
329
331
  };
330
- }, ie = { class: "" }, ae = /* @__PURE__ */ h({
332
+ }, ie = { class: "" }, ae = /* @__PURE__ */ g({
331
333
  __name: "ReprintReceiptDialog",
332
334
  props: {
333
335
  modelValue: { type: Boolean },
@@ -335,38 +337,38 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
335
337
  },
336
338
  emits: ["update:modelValue"],
337
339
  setup(e) {
338
- let t = Q(), n = C(e, "modelValue"), r = v(""), i = async () => {
340
+ let t = $(), n = w(e, "modelValue"), r = y(""), i = async () => {
339
341
  try {
340
- D.show({ group: "reprintReceipt" });
342
+ O.show({ group: "reprintReceipt" });
341
343
  let e = await t.reprintReceipt(r.value);
342
- e.error ? O.create({
344
+ e.error ? k.create({
343
345
  type: "negative",
344
346
  message: e.message
345
- }) : (n.value = !1, O.create("Receipt printed successfully"));
347
+ }) : (n.value = !1, k.create("Receipt printed successfully"));
346
348
  } catch (e) {
347
349
  let t = e instanceof Error ? e.message : "Failed to print receipts";
348
- O.create({
350
+ k.create({
349
351
  type: "negative",
350
352
  message: t
351
353
  });
352
354
  } finally {
353
- D.hide("reprintReceipt");
355
+ O.hide("reprintReceipt");
354
356
  }
355
357
  };
356
358
  return (e, t) => {
357
- let a = b("close-popup");
358
- return _(), u(S(N), {
359
+ let a = x("close-popup");
360
+ return v(), d(C(P), {
359
361
  modelValue: n.value,
360
362
  "onUpdate:modelValue": t[1] ||= (e) => n.value = e
361
363
  }, {
362
- default: w(() => [m(S(A), { class: "w-full" }, {
363
- default: w(() => [m(S(P), { onSubmit: i }, {
364
- default: w(() => [
365
- m(S(R), { class: "bg-primary text-white" }, {
366
- default: w(() => [m(S(z), null, {
367
- default: w(() => [y(e.$slots, "title", {}, () => [t[2] ||= p("Reprint Receipt", -1)])]),
364
+ default: T(() => [h(C(j), { class: "w-full" }, {
365
+ default: T(() => [h(C(F), { onSubmit: i }, {
366
+ default: T(() => [
367
+ h(C(ee), { class: "bg-primary text-white" }, {
368
+ default: T(() => [h(C(z), null, {
369
+ default: T(() => [b(e.$slots, "title", {}, () => [t[2] ||= m("Reprint Receipt", -1)])]),
368
370
  _: 3
369
- }), T(m(S(F), {
371
+ }), E(h(C(I), {
370
372
  class: "float-right cursor-pointer rounded p-2 transition-colors",
371
373
  color: "gray",
372
374
  name: "close",
@@ -374,11 +376,11 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
374
376
  }, null, 512), [[a]])]),
375
377
  _: 3
376
378
  }),
377
- m(S(M), null, {
378
- default: w(() => [f("div", ie, [t[3] ||= p(" Txn Number: ", -1), m(S(I), {
379
+ h(C(N), null, {
380
+ default: T(() => [p("div", ie, [t[3] ||= m(" Txn Number: ", -1), h(C(L), {
379
381
  modelValue: r.value,
380
382
  "onUpdate:modelValue": t[0] ||= (e) => r.value = e,
381
- rules: [(e) => !!e || "Transaction Id is required", (e) => S(V)(e) || "Invalid Transaction Id"],
383
+ rules: [(e) => !!e || "Transaction Id is required", (e) => C(V)(e) || "Invalid Transaction Id"],
382
384
  class: "q-mb-sm",
383
385
  type: "text",
384
386
  outlined: "",
@@ -388,16 +390,16 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
388
390
  }, null, 8, ["modelValue", "rules"])])]),
389
391
  _: 1
390
392
  }),
391
- m(S(j), {
393
+ h(C(M), {
392
394
  class: "!p-4",
393
395
  align: "right"
394
396
  }, {
395
- default: w(() => [T(m(S(k), {
397
+ default: T(() => [E(h(C(A), {
396
398
  label: "Cancel",
397
399
  "no-caps": "",
398
400
  unelevated: "",
399
401
  flat: ""
400
- }, null, 512), [[a]]), m(S(k), {
402
+ }, null, 512), [[a]]), h(C(A), {
401
403
  label: "Re-print Receipt",
402
404
  "no-caps": "",
403
405
  unelevated: "",
@@ -415,102 +417,102 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
415
417
  }, 8, ["modelValue"]);
416
418
  };
417
419
  }
418
- }), oe = { class: "text-center" }, $ = { class: "mb-6" }, se = { class: "!mb-2 text-sm text-gray-500 dark:text-gray-300" }, ce = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, le = { class: "!space-x-3" }, ue = { key: 1 }, de = { class: "flex items-center justify-end gap-3" }, fe = /* @__PURE__ */ h({
420
+ }), oe = { class: "text-center" }, se = { class: "mb-6" }, ce = { class: "!mb-2 text-sm text-gray-500 dark:text-gray-300" }, le = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, ue = { class: "!space-x-3" }, de = { key: 1 }, fe = { class: "flex items-center justify-end gap-3" }, pe = /* @__PURE__ */ g({
419
421
  __name: "PairTillPayment",
420
422
  setup(t) {
421
423
  let o = [
422
424
  "Plug in the PIN pad and connect it to the internet via cable or Wi-Fi, depending on the EFTPOS hardware.",
423
425
  "Once connected, the PIN pad will display as online.",
424
426
  "Select the terminal on the next screen and click 'Pair Device'."
425
- ], { raw: s, pair: c, unpair: l } = Q(), h = B("till.pairConfig", {
427
+ ], { raw: s, pair: c, unpair: l } = $(), u = B("till.pairConfig", {
426
428
  isPaired: !1,
427
429
  lastPairedDate: "",
428
430
  terminalId: ""
429
- }), y = v([]), b = v(null), C = v(!h.value.isPaired), T = v(!1), j = () => {
430
- C.value = !1;
431
- }, N = () => {
432
- h.value.isPaired = !1, l();
433
- }, I = async () => {
431
+ }), g = y([]), b = y(null), x = y(!u.value.isPaired), w = y(!1), E = () => {
432
+ x.value = !1;
433
+ }, M = () => {
434
+ u.value.isPaired = !1, l();
435
+ }, P = async () => {
434
436
  try {
435
- D.show();
437
+ O.show();
436
438
  let e = await c({ tid: b.value });
437
439
  if (!e.success) {
438
- E.create({
440
+ D.create({
439
441
  title: "Pairing Failed!",
440
442
  message: e.message ?? "Failed To pair terminal."
441
443
  });
442
444
  return;
443
445
  }
444
- h.value.isPaired = !0, h.value.lastPairedDate = /* @__PURE__ */ new Date(), h.value.terminalId = b.value;
446
+ u.value.isPaired = !0, u.value.lastPairedDate = /* @__PURE__ */ new Date(), u.value.terminalId = b.value;
445
447
  } catch (e) {
446
- E.create({
448
+ D.create({
447
449
  title: "Pairing Failed!",
448
450
  message: e instanceof Error ? e.message : "Failed To pair terminal."
449
451
  });
450
452
  } finally {
451
- D.hide();
453
+ O.hide();
452
454
  }
453
- }, R = async () => {
455
+ }, L = async () => {
454
456
  let e = await s.getTerminals();
455
457
  if ("error" in e) {
456
- O.create({
458
+ k.create({
457
459
  type: "negative",
458
460
  message: "failed to fetch terminals"
459
461
  });
460
462
  return;
461
463
  }
462
- y.value = e;
464
+ g.value = e;
463
465
  };
464
- return g(async () => {
465
- await R();
466
- }), (t, s) => (_(), d("div", null, [S(h).isPaired ? (_(), u(S(A), {
466
+ return _(async () => {
467
+ await L();
468
+ }), (t, s) => (v(), f("div", null, [C(u).isPaired ? (v(), d(C(j), {
467
469
  key: "paired",
468
470
  class: "flex items-center justify-center rounded-lg p-8",
469
471
  flat: "",
470
472
  bordered: ""
471
473
  }, {
472
- default: w(() => [f("div", oe, [
473
- f("div", $, [m(S(F), {
474
- name: S(i),
474
+ default: T(() => [p("div", oe, [
475
+ p("div", se, [h(C(I), {
476
+ name: C(i),
475
477
  size: "4rem",
476
478
  class: "text-green-500"
477
479
  }, null, 8, ["name"])]),
478
- s[6] ||= f("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
479
- f("p", se, [s[4] ||= p(" Terminal ID: ", -1), f("b", null, x(S(h).terminalId), 1)]),
480
- f("p", ce, [s[5] ||= p(" Last paired: ", -1), f("b", null, x(new Date(S(h).lastPairedDate).toLocaleString()), 1)]),
481
- f("div", le, [m(S(k), {
480
+ s[6] ||= p("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
481
+ p("p", ce, [s[4] ||= m(" Terminal ID: ", -1), p("b", null, S(C(u).terminalId), 1)]),
482
+ p("p", le, [s[5] ||= m(" Last paired: ", -1), p("b", null, S(new Date(C(u).lastPairedDate).toLocaleString()), 1)]),
483
+ p("div", ue, [h(C(A), {
482
484
  color: "green",
483
485
  "no-caps": "",
484
486
  outline: "",
485
487
  unelevated: "",
486
488
  label: "Reprint Receipt",
487
- "icon-left": S(n),
488
- onClick: s[0] ||= (e) => T.value = !0
489
- }, null, 8, ["icon-left"]), m(S(k), {
489
+ "icon-left": C(n),
490
+ onClick: s[0] ||= (e) => w.value = !0
491
+ }, null, 8, ["icon-left"]), h(C(A), {
490
492
  color: "primary",
491
493
  unelevated: "",
492
494
  "no-caps": "",
493
- "icon-left": S(r),
495
+ "icon-left": C(r),
494
496
  label: "Re-pair Terminal",
495
- onClick: N
497
+ onClick: M
496
498
  }, null, 8, ["icon-left"])])
497
- ]), m(ae, {
498
- modelValue: T.value,
499
- "onUpdate:modelValue": s[1] ||= (e) => T.value = e
499
+ ]), h(ae, {
500
+ modelValue: w.value,
501
+ "onUpdate:modelValue": s[1] ||= (e) => w.value = e
500
502
  }, null, 8, ["modelValue"])]),
501
503
  _: 1
502
- })) : (_(), d("div", ue, [C.value ? (_(), u(a, {
504
+ })) : (v(), f("div", de, [x.value ? (v(), d(a, {
503
505
  key: 0,
504
- onNext: j,
506
+ onNext: E,
505
507
  steps: o
506
- })) : (_(), u(S(A), {
508
+ })) : (v(), d(C(j), {
507
509
  key: 1,
508
510
  flat: "",
509
511
  bordered: ""
510
512
  }, {
511
- default: w(() => [m(S(M), null, {
512
- default: w(() => [s[7] ||= f("h3", { class: "mb-3 !text-xl font-semibold" }, "Pairing configuration", -1), m(S(P), { onSubmit: I }, {
513
- default: w(() => [m(S(L), {
513
+ default: T(() => [h(C(N), null, {
514
+ default: T(() => [s[7] ||= p("h3", { class: "mb-3 !text-xl font-semibold" }, "Pairing configuration", -1), h(C(F), { onSubmit: P }, {
515
+ default: T(() => [h(C(R), {
514
516
  label: "Select Terminal",
515
517
  dense: "",
516
518
  outlined: "",
@@ -518,7 +520,7 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
518
520
  "onUpdate:modelValue": s[2] ||= (e) => b.value = e,
519
521
  "option-disable": (e) => e.status.connectivity !== "AVAILABLE",
520
522
  "option-label": ({ name: e, terminalId: t }) => e ? `${e} (${t})` : "",
521
- options: y.value,
523
+ options: g.value,
522
524
  rules: [(e) => !!e || "Please select terminal."],
523
525
  "option-value": "terminalId",
524
526
  "outer-label": "Select Terminal",
@@ -531,18 +533,18 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
531
533
  "option-label",
532
534
  "options",
533
535
  "rules"
534
- ]), f("div", de, [m(S(k), {
536
+ ]), p("div", fe, [h(C(A), {
535
537
  flat: "",
536
538
  "no-caps": "",
537
539
  label: "Back",
538
- "icon-left": S(n),
539
- onClick: s[3] ||= (e) => C.value = !0
540
- }, null, 8, ["icon-left"]), m(S(k), {
540
+ "icon-left": C(n),
541
+ onClick: s[3] ||= (e) => x.value = !0
542
+ }, null, 8, ["icon-left"]), h(C(A), {
541
543
  type: "submit",
542
544
  color: "primary",
543
545
  unelevated: "",
544
546
  "no-caps": "",
545
- "icon-right": S(e),
547
+ "icon-right": C(e),
546
548
  label: "Pair Device"
547
549
  }, null, 8, ["icon-right"])])]),
548
550
  _: 1
@@ -554,4 +556,4 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
554
556
  }
555
557
  });
556
558
  //#endregion
557
- export { K as a, te as i, Q as n, G as o, X as r, fe as t };
559
+ export { J as a, K as i, $ as n, q as o, Q as r, pe as t };
@@ -203,6 +203,18 @@ declare interface PaymentResult {
203
203
  tipAmount: number | null;
204
204
  /** Surcharge amount in cents, or `null` when the provider doesn't report one. */
205
205
  surchargeAmount: number | null;
206
+ /**
207
+ * Masked card number (PAN) as reported by the provider, or `null` when the
208
+ * provider doesn't report one. Format varies by provider (e.g.
209
+ * `"**** **** **** 0857"`, `"xxxxxxxxxxxx0857"`).
210
+ */
211
+ maskedCard: string | null;
212
+ /**
213
+ * Card scheme / company (e.g. `"Visa"`, `"Mastercard"`, `"Amex"`) as reported
214
+ * by the provider, or `null` when the provider doesn't report one. Casing is
215
+ * provider-native and not normalized.
216
+ */
217
+ cardScheme: string | null;
206
218
  /** Normalized receipts. */
207
219
  receipts: NormalizedReceipts;
208
220
  /** Human-readable message for display. */
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./till-payment-DSScmuag.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./till-payment-C1iLnYV7.js";
2
2
  export { a as PairTillPayment, t as SettlementTypes, i as TillPaymentsApi, e as TransactionOutcome, r as TransactionType, n as useTillPayment };
@@ -1,5 +1,8 @@
1
1
  import e from "axios";
2
2
  //#region src/utils/index.ts
3
- var t = () => `${Date.now().toString()}${Math.floor(1e3 + Math.random() * 9e3).toString()}`.slice(0, 16), n = (e = 1e3) => new Promise((t) => setTimeout(t, e)), r = (e) => e && Number(e) >= 500 && Number(e) <= 599, i = (t) => e.isAxiosError(t) && t.code === "ERR_NETWORK";
3
+ var t = () => `${Date.now().toString()}${Math.floor(1e3 + Math.random() * 9e3).toString()}`.slice(0, 16), n = (e = 1e3) => new Promise((t) => setTimeout(t, e)), r = (e) => e && Number(e) >= 500 && Number(e) <= 599, i = (e) => {
4
+ let t = e?.replace(/\s/g, "");
5
+ return t ? `**** **** **** ${t.slice(-4)}` : null;
6
+ }, a = (t) => e.isAxiosError(t) && t.code === "ERR_NETWORK";
4
7
  //#endregion
5
- export { r as i, t as n, i as r, n as t };
8
+ export { i as a, r as i, t as n, a as r, n as t };
@@ -1,5 +1,5 @@
1
1
  import { a as e, c as t, h as n, i as r, l as i, o as a, r as o, t as s, u as c } from "./PairInstructions-BxzivULm.js";
2
- import { n as l, r as u, t as d } from "./core-nvcK0Nr9.js";
2
+ import { n as l, r as u, t as d } from "./core-BMUVlh-t.js";
3
3
  import { createBlock as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, onMounted as v, openBlock as y, ref as b, toDisplayString as x, unref as S, withCtx as C } from "vue";
4
4
  import { Dialog as w, Loading as T, Notify as E, QBtn as D, QCard as O, QCardSection as k, QForm as A, QIcon as j, QInput as M, QSelect as N } from "quasar";
5
5
  import { useLocalStorage as P } from "@vueuse/core";
@@ -294,12 +294,14 @@ function H(e) {
294
294
  }
295
295
  var U = (e) => Math.round(e * 100);
296
296
  function W(e) {
297
- let t = e.data && "SaleToPOIResponse" in e.data ? e.data.SaleToPOIResponse.PaymentResponse : void 0, n = t?.PaymentResult?.AmountsResp;
297
+ let t = e.data && "SaleToPOIResponse" in e.data ? e.data.SaleToPOIResponse.PaymentResponse : void 0, n = t?.PaymentResult?.AmountsResp, r = t?.PaymentResult?.PaymentInstrumentData?.CardData;
298
298
  return u({
299
299
  status: H(e),
300
300
  transactionId: t?.POIData?.POITransactionID.TransactionID ?? null,
301
301
  amount: n ? U(n.AuthorizedAmount) : null,
302
302
  tipAmount: n?.TipAmount === void 0 ? null : U(n.TipAmount),
303
+ maskedCard: r?.MaskedPan ?? null,
304
+ cardScheme: r?.PaymentBrand ?? null,
303
305
  receipts: e.data ? V(e.data) : {},
304
306
  message: e.message,
305
307
  raw: e.data ?? null
package/dist/valpay.d.ts CHANGED
@@ -475,6 +475,18 @@ declare interface PaymentResult_2 {
475
475
  tipAmount: number | null;
476
476
  /** Surcharge amount in cents, or `null` when the provider doesn't report one. */
477
477
  surchargeAmount: number | null;
478
+ /**
479
+ * Masked card number (PAN) as reported by the provider, or `null` when the
480
+ * provider doesn't report one. Format varies by provider (e.g.
481
+ * `"**** **** **** 0857"`, `"xxxxxxxxxxxx0857"`).
482
+ */
483
+ maskedCard: string | null;
484
+ /**
485
+ * Card scheme / company (e.g. `"Visa"`, `"Mastercard"`, `"Amex"`) as reported
486
+ * by the provider, or `null` when the provider doesn't report one. Casing is
487
+ * provider-native and not normalized.
488
+ */
489
+ cardScheme: string | null;
478
490
  /** Normalized receipts. */
479
491
  receipts: NormalizedReceipts;
480
492
  /** Human-readable message for display. */
package/dist/valpay.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, r as t, t as n } from "./valpay--SOqhe0M.js";
1
+ import { n as e, r as t, t as n } from "./valpay-DVV1AH4F.js";
2
2
  export { n as PairValpay, t as ValpayAPI, e as useValpay };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@achyutlabsau/vue-payment-gateway",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Achyut-Labs/al-pay-npm-pkg#readme",
6
6
  "bugs": {