@achyutlabsau/vue-payment-gateway 0.3.0 → 0.3.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.
@@ -435,7 +435,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
435
435
  default: withCtx(() => [
436
436
  createElementVNode("div", _hoisted_2$1, toDisplayString(_ctx.message), 1),
437
437
  withDirectives(createVNode(unref(QBtn), {
438
- label: "Ok",
438
+ label: "OK",
439
439
  color: "primary",
440
440
  outline: "",
441
441
  class: "!mt-6 !w-full",
@@ -450,7 +450,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
450
450
  default: withCtx(() => [
451
451
  createElementVNode("div", _hoisted_3$1, toDisplayString(_ctx.message), 1),
452
452
  withDirectives(createVNode(unref(QBtn), {
453
- label: "Ok",
453
+ label: "OK",
454
454
  color: "primary",
455
455
  outline: "",
456
456
  class: "!mt-6 !w-full",
package/dist/timApi.d.ts CHANGED
@@ -190,12 +190,27 @@ declare namespace timapi {
190
190
 
191
191
  type EcrInfoKeys = "ecrApplication" | "eftApi" | "eftModule" | "os";
192
192
 
193
+ type GuidesKeys =
194
+ | "retail"
195
+ | "unattended"
196
+ | "advancedRetail"
197
+ | "banking"
198
+ | "petrol"
199
+ | "dialog"
200
+ | "remote"
201
+ | "gastro"
202
+ | "hospitality"
203
+ | "valueAddedServices"
204
+ | "austrianUseCases"
205
+ | "certification";
206
+
193
207
  interface Constants {
194
208
  TransactionType: Record<TransactionTypeKeys, EnumValue>;
195
209
  Currency: Record<CurrencyKeys, Currency>;
196
210
  RequestType: Record<RequestTypeKeys, EnumValue>;
197
211
  SettingType: Record<SettingTypeKeys, EnumValue>;
198
212
  EcrInfoType: Record<EcrInfoKeys, EnumValue>;
213
+ Guides: Record<GuidesKeys, EnumValue>;
199
214
 
200
215
  ManagementStatus: "";
201
216
  ReceiptRequestType: "";
@@ -260,7 +275,6 @@ declare namespace timapi {
260
275
  CurrencyType: "";
261
276
  PosEntryMode: "";
262
277
  ResourceId: "";
263
- Guides: "";
264
278
  }
265
279
  /* ========================= Terminal Status =============================== */
266
280
 
@@ -357,6 +371,10 @@ declare namespace timapi {
357
371
  constructor();
358
372
  }
359
373
 
374
+ class Guides {
375
+ constructor();
376
+ add(key: EnumValue): void;
377
+ }
360
378
  class Terminal {
361
379
  _listenersLocked: boolean;
362
380
  _listeners: DefaultTerminalListener[];
@@ -406,11 +424,15 @@ declare namespace timapi {
406
424
  fetchBrands: boolean;
407
425
  autoCommit: boolean | undefined;
408
426
  partialCommit: boolean | undefined;
427
+ dcc: boolean;
428
+ tipAllowed: boolean;
429
+ partialApproval: boolean;
430
+ integratorId: string;
409
431
  /**
410
432
  * Enable persistent state if supported. Default is false.
411
433
  */
412
434
  persistentState: boolean;
413
-
435
+ guides: Guides;
414
436
  constructor();
415
437
  }
416
438
 
@@ -66,6 +66,7 @@ declare interface TimApiConfig {
66
66
  posName: string;
67
67
  posVendorName: string;
68
68
  posId: string;
69
+ integratorId: string;
69
70
  }
70
71
 
71
72
  export declare const TimApiDialog: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
package/dist/worldline.js CHANGED
@@ -3,7 +3,7 @@ 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 { c as commonjsGlobal, g as getDefaultExportFromCjs, d as dayjs } from "./dayjs.min-DGv2T_Zf.js";
5
5
  import { EventBus, QForm, QInput, QBtn, QDialog, QCard, QCardSection, Dialog, QToolbar, QToolbarTitle, QIcon } from "quasar";
6
- import { defineComponent, ref, resolveDirective, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, createBlock, toDisplayString, withDirectives, createCommentVNode, Fragment, getCurrentScope, onScopeDispose, useModel, createTextVNode, renderList } from "vue";
6
+ import { defineComponent, ref, resolveDirective, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, createBlock, toDisplayString, withDirectives, createCommentVNode, nextTick, getCurrentScope, onScopeDispose, useModel, createTextVNode, Fragment, renderList } from "vue";
7
7
  import { useLocalStorage, useEventListener, whenever } from "@vueuse/core";
8
8
  var dexie_min$1 = { exports: {} };
9
9
  var dexie_min = dexie_min$1.exports;
@@ -3254,17 +3254,22 @@ class AdvanceEcr {
3254
3254
  const settings = new timapi.TerminalSettings();
3255
3255
  settings.connectionIPString = ipAddress;
3256
3256
  settings.connectionIPPort = port;
3257
- settings.autoCommit = true;
3258
3257
  settings.persistentState = true;
3258
+ settings.autoCommit = true;
3259
+ settings.dcc = false;
3260
+ settings.tipAllowed = false;
3261
+ settings.partialApproval = false;
3262
+ settings.integratorId = this._config.integratorId;
3263
+ settings.guides.add(timapi.constants.Guides.retail);
3259
3264
  this.terminal = new timapi.Terminal(settings);
3260
3265
  this.terminal.setUserId("1");
3261
3266
  this.terminal.setPosId(this._config.posId);
3262
- let ei = new timapi.EcrInfo();
3263
- ei.type = timapi.constants.EcrInfoType.ecrApplication;
3264
- ei.name = this._config.posName;
3265
- ei.manufacturerName = this._config.posVendorName;
3266
- ei.version = this._config.posVersion;
3267
- this.terminal.addEcrData(ei);
3267
+ const ecrInfo = new timapi.EcrInfo();
3268
+ ecrInfo.type = timapi.constants.EcrInfoType.ecrApplication;
3269
+ ecrInfo.name = this._config.posName;
3270
+ ecrInfo.manufacturerName = this._config.posVendorName;
3271
+ ecrInfo.version = this._config.posVersion;
3272
+ this.terminal.addEcrData(ecrInfo);
3268
3273
  return this.terminal;
3269
3274
  }
3270
3275
  // Ensure terminal is created if absent. Returns the terminal instance.
@@ -3458,12 +3463,13 @@ const timApi = new AdvanceEcr({
3458
3463
  posId: "T1",
3459
3464
  posName: "Pratham POS",
3460
3465
  posVendorName: "Achyutlabs",
3461
- posVersion: "3.4.0"
3466
+ posVersion: "3.4.0",
3467
+ integratorId: "3F507ED1-98C5-4CBF-A595-BFA5C34BC76C"
3462
3468
  });
3463
3469
  const _hoisted_1$2 = { class: "my-6 rounded-md bg-white p-6 shadow-md" };
3464
3470
  const _hoisted_2$2 = { class: "text-center font-semibold text-gray-500 uppercase" };
3465
3471
  const _hoisted_3$2 = { class: "text-center font-semibold text-gray-500 uppercase" };
3466
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3472
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3467
3473
  __name: "PairTimapi",
3468
3474
  setup(__props) {
3469
3475
  function isValidIP(str) {
@@ -3474,9 +3480,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3474
3480
  const model = ref(false);
3475
3481
  const isPaired = useLocalStorage("timapi.isTerminalPaired", false);
3476
3482
  const pairForm = useLocalStorage("timapi.pairingData", {
3477
- connectionIPPort: "",
3478
- connectionIPString: "",
3479
- userId: ""
3483
+ connectionIPPort: "80",
3484
+ connectionIPString: ""
3480
3485
  });
3481
3486
  const pairInfo = ref({
3482
3487
  state: "INPROGRESS",
@@ -3494,9 +3499,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3494
3499
  const onUnpairTerminal = () => {
3495
3500
  timApi.actionDisconnect();
3496
3501
  pairForm.value = {
3497
- connectionIPPort: "",
3498
- connectionIPString: "",
3499
- userId: ""
3502
+ connectionIPPort: "80",
3503
+ connectionIPString: ""
3500
3504
  };
3501
3505
  Dialog.create({
3502
3506
  title: "Successfully Unpaired!",
@@ -3520,40 +3524,33 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3520
3524
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
3521
3525
  createVNode(unref(QForm), {
3522
3526
  onSubmit: onPairTerminal,
3523
- class: "space-y-4"
3527
+ class: "!space-y-4"
3524
3528
  }, {
3525
3529
  default: withCtx(() => [
3526
- _cache[4] || (_cache[4] = createElementVNode("div", { class: "font-sans text-lg font-semibold text-gray-600" }, "Tim API Terminal Pairing", -1)),
3530
+ _cache[3] || (_cache[3] = createElementVNode("div", { class: "font-sans text-lg font-semibold text-gray-600" }, "Tim API Terminal Pairing", -1)),
3527
3531
  createVNode(unref(QInput), {
3528
3532
  disable: unref(isPaired),
3529
3533
  dense: "",
3530
3534
  outlined: "",
3531
- modelValue: unref(pairForm).userId,
3532
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(pairForm).userId = $event),
3533
- label: "User Id",
3534
- rules: [(v) => !!v || "User ID is required"]
3535
+ modelValue: unref(pairForm).connectionIPString,
3536
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(pairForm).connectionIPString = $event),
3537
+ label: "Connection IP",
3538
+ hint: "IP address of the EFT terminal.",
3539
+ rules: [
3540
+ (v) => !!v || "Connection IP is required",
3541
+ (v) => isValidIP(v) || "The Connection IP is not in the right format"
3542
+ ]
3535
3543
  }, null, 8, ["disable", "modelValue", "rules"]),
3536
3544
  createVNode(unref(QInput), {
3537
3545
  disable: unref(isPaired),
3538
3546
  dense: "",
3547
+ hint: "Listening Port of the EFT terminal. Default is 80.",
3539
3548
  outlined: "",
3540
3549
  modelValue: unref(pairForm).connectionIPPort,
3541
3550
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(pairForm).connectionIPPort = $event),
3542
3551
  label: "Connection Port",
3543
3552
  rules: [(v) => !!v || "Connection Port is required"]
3544
3553
  }, null, 8, ["disable", "modelValue", "rules"]),
3545
- createVNode(unref(QInput), {
3546
- disable: unref(isPaired),
3547
- dense: "",
3548
- outlined: "",
3549
- modelValue: unref(pairForm).connectionIPString,
3550
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(pairForm).connectionIPString = $event),
3551
- label: "Connection IP",
3552
- rules: [
3553
- (v) => !!v || "Connection IP is required",
3554
- (v) => isValidIP(v) || "The Connection IP is not in the right format"
3555
- ]
3556
- }, null, 8, ["disable", "modelValue", "rules"]),
3557
3554
  !unref(isPaired) ? (openBlock(), createBlock(unref(QBtn), {
3558
3555
  key: 0,
3559
3556
  label: "Pair Terminal",
@@ -3580,7 +3577,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3580
3577
  }),
3581
3578
  createVNode(unref(QDialog), {
3582
3579
  modelValue: model.value,
3583
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => model.value = $event),
3580
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value = $event),
3584
3581
  persistent: ""
3585
3582
  }, {
3586
3583
  default: withCtx(() => [
@@ -3628,6 +3625,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3628
3625
  };
3629
3626
  }
3630
3627
  });
3628
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3629
+ __name: "PBtn",
3630
+ setup(__props) {
3631
+ return (_ctx, _cache) => {
3632
+ return openBlock(), createBlock(unref(QBtn), {
3633
+ label: "Cancel",
3634
+ color: "primary",
3635
+ class: "!py-2.5",
3636
+ unelevated: "",
3637
+ ripple: false
3638
+ });
3639
+ };
3640
+ }
3641
+ });
3631
3642
  const _hoisted_1$1 = { key: 0 };
3632
3643
  const _hoisted_2$1 = { class: "text-center font-semibold text-gray-500" };
3633
3644
  const _hoisted_3$1 = { key: 1 };
@@ -3636,7 +3647,7 @@ const _hoisted_4$1 = {
3636
3647
  class: "text-center font-semibold text-gray-500 uppercase"
3637
3648
  };
3638
3649
  const _hoisted_5 = {
3639
- key: 0,
3650
+ key: 1,
3640
3651
  class: "text-center font-semibold text-gray-500 uppercase"
3641
3652
  };
3642
3653
  const _hoisted_6 = { class: "text-center font-semibold text-gray-500" };
@@ -3666,16 +3677,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3666
3677
  runningTxData.value.txnAmount = (amount / 100).toFixed(2);
3667
3678
  runningTxData.value.txType = type ?? "purchase";
3668
3679
  });
3669
- useEventListener(document, TimApiEvents.TxnCompleted, (ev) => {
3680
+ useEventListener(document, TimApiEvents.TxnCompleted, async (ev) => {
3670
3681
  const { event } = ev.detail;
3671
3682
  model.value = true;
3672
3683
  if (event.exception) {
3684
+ await nextTick();
3673
3685
  pairInfo.value.state = "FAILED";
3674
3686
  pairInfo.value.message = event.exception.localizedMessage;
3675
3687
  return;
3676
3688
  }
3677
3689
  pairInfo.value.state = "SUCCESS";
3678
3690
  pairInfo.value.message = "Transaction Accepted";
3691
+ setTimeout(() => {
3692
+ model.value = false;
3693
+ }, 1e3);
3679
3694
  });
3680
3695
  useEventListener(document, TimApiEvents.BalanceCompleted, (ev) => {
3681
3696
  const { event } = ev.detail;
@@ -3686,6 +3701,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3686
3701
  }
3687
3702
  pairInfo.value.state = "SUCCESS";
3688
3703
  pairInfo.value.message = "Daily closing successful.";
3704
+ setTimeout(() => {
3705
+ model.value = false;
3706
+ }, 1e3);
3689
3707
  });
3690
3708
  return (_ctx, _cache) => {
3691
3709
  const _directive_close_popup = resolveDirective("close-popup");
@@ -3703,19 +3721,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3703
3721
  _cache[1] || (_cache[1] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Daily closing in progress...", -1)),
3704
3722
  createElementVNode("div", _hoisted_2$1, toDisplayString(pairInfo.value.message), 1)
3705
3723
  ])) : (openBlock(), createElementBlock("div", _hoisted_3$1, [
3706
- unref(runningTxData).txType === "reversal" ? (openBlock(), createElementBlock("div", _hoisted_4$1, " Transaction reversal is in progress... ")) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3707
- unref(runningTxData).txType === "reversal" ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(unref(runningTxData).txType) + " of $" + toDisplayString(unref(runningTxData).txnAmount) + " in progress... ", 1)) : createCommentVNode("", true)
3708
- ], 64)),
3724
+ unref(runningTxData).txType === "reversal" ? (openBlock(), createElementBlock("div", _hoisted_4$1, " Transaction reversal is in progress... ")) : (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(unref(runningTxData).txType) + " of $" + toDisplayString(unref(runningTxData).txnAmount) + " in progress... ", 1)),
3709
3725
  createElementVNode("div", _hoisted_6, toDisplayString(pairInfo.value.message), 1),
3710
- createVNode(unref(QBtn), {
3726
+ createVNode(_sfc_main$2, {
3711
3727
  label: "Cancel",
3712
3728
  onClick: cancelTransaction,
3713
- color: "primary",
3714
3729
  outline: "",
3715
- class: "!mt-6 !w-full",
3716
- unelevated: "",
3717
- "no-caps": "",
3718
- ripple: false
3730
+ class: "!mt-6 !w-full"
3719
3731
  })
3720
3732
  ]))
3721
3733
  ]),
@@ -3729,14 +3741,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3729
3741
  })) : pairInfo.value.state === "SUCCESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 2 }, {
3730
3742
  default: withCtx(() => [
3731
3743
  createElementVNode("div", _hoisted_8, toDisplayString(pairInfo.value.message), 1),
3732
- withDirectives(createVNode(unref(QBtn), {
3744
+ withDirectives(createVNode(_sfc_main$2, {
3733
3745
  label: "OK",
3734
- color: "primary",
3735
3746
  outline: "",
3736
- class: "!mt-6 !w-full",
3737
- unelevated: "",
3738
- "no-caps": "",
3739
- ripple: false
3747
+ class: "!mt-6 !w-full"
3740
3748
  }, null, 512), [
3741
3749
  [_directive_close_popup]
3742
3750
  ])
@@ -3746,14 +3754,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3746
3754
  default: withCtx(() => [
3747
3755
  _cache[3] || (_cache[3] = createElementVNode("div", { class: "text-center font-semibold text-gray-500 uppercase" }, "Transaction Failed", -1)),
3748
3756
  createElementVNode("div", _hoisted_9, toDisplayString(pairInfo.value.message), 1),
3749
- withDirectives(createVNode(unref(QBtn), {
3757
+ withDirectives(createVNode(_sfc_main$2, {
3750
3758
  label: "OK",
3751
- color: "primary",
3752
3759
  outline: "",
3753
- class: "!mt-6 !w-full",
3754
- unelevated: "",
3755
- "no-caps": "",
3756
- ripple: false
3760
+ class: "!mt-6 !w-full"
3757
3761
  }, null, 512), [
3758
3762
  [_directive_close_popup]
3759
3763
  ])
@@ -3884,7 +3888,7 @@ onTimApiLog = (message) => {
3884
3888
  timApiLogger.addItem(message);
3885
3889
  };
3886
3890
  export {
3887
- _sfc_main$2 as PairTimapi,
3891
+ _sfc_main$3 as PairTimapi,
3888
3892
  _sfc_main$1 as TimApiDialog,
3889
3893
  TimApiEvents,
3890
3894
  _sfc_main as TimApiLogs,
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.0",
4
+ "version": "0.3.2",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",