@achyutlabsau/vue-payment-gateway 0.2.4 → 0.2.6
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/mx51.d.ts +10 -2
- package/dist/mx51.js +24 -14
- package/package.json +1 -1
package/dist/mx51.d.ts
CHANGED
|
@@ -104,9 +104,17 @@ export declare const spi: Spi;
|
|
|
104
104
|
export declare const TransactionDialog: DefineComponent< {}, {
|
|
105
105
|
showDialog: (amount: number, type?: string) => void;
|
|
106
106
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
107
|
-
"transaction-success": (ev:
|
|
107
|
+
"transaction-success": (ev: {
|
|
108
|
+
purchaseAmount: number;
|
|
109
|
+
surchargeAmount?: number;
|
|
110
|
+
tipAmount?: number;
|
|
111
|
+
}) => any;
|
|
108
112
|
}, string, PublicProps, Readonly<{}> & Readonly<{
|
|
109
|
-
"onTransaction-success"?: ((ev:
|
|
113
|
+
"onTransaction-success"?: ((ev: {
|
|
114
|
+
purchaseAmount: number;
|
|
115
|
+
surchargeAmount?: number;
|
|
116
|
+
tipAmount?: number;
|
|
117
|
+
}) => any) | undefined;
|
|
110
118
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
111
119
|
|
|
112
120
|
export { }
|
package/dist/mx51.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { l as log, s as spi, g as getPairingData, a as getTenants, r as receiptOptions } from "./event-Zm-ArxiV.js";
|
|
2
2
|
import { defineComponent, ref, computed, onMounted, resolveDirective, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, createCommentVNode, createBlock, toDisplayString, withDirectives } from "vue";
|
|
3
3
|
import { QForm, QSelect, QInput, QCheckbox, QIcon, QBtn, QDialog, QCard, QCardSection, Dialog } from "quasar";
|
|
4
|
-
import { useEventListener } from "@vueuse/core";
|
|
5
|
-
import { SpiStatus,
|
|
4
|
+
import { useEventListener, useLocalStorage } from "@vueuse/core";
|
|
5
|
+
import { SpiStatus, SuccessState, TransactionType } from "@mx51/spi-client-js";
|
|
6
6
|
import { b as state } from "./state-D014QcxX.js";
|
|
7
7
|
import { v4 } from "uuid";
|
|
8
8
|
function pair(pairingInput) {
|
|
@@ -354,28 +354,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
354
354
|
const emit = __emit;
|
|
355
355
|
const pairInfo = ref({
|
|
356
356
|
state: "INPROGRESS",
|
|
357
|
-
message: "Processing"
|
|
358
|
-
transactionType: TransactionType.Purchase
|
|
357
|
+
message: "Processing"
|
|
359
358
|
});
|
|
360
359
|
const model = ref(false);
|
|
361
|
-
const
|
|
360
|
+
const runningTxData = useLocalStorage("mx51.runningTxnData", {
|
|
361
|
+
posRefId: "",
|
|
362
|
+
txType: "",
|
|
363
|
+
txnAmount: 0
|
|
364
|
+
});
|
|
362
365
|
function overrideTransaction(isSuccess) {
|
|
363
366
|
if (isSuccess) {
|
|
364
367
|
spi.AckFlowEndedAndBackToIdle();
|
|
365
368
|
pairInfo.value.state = "SUCCESS";
|
|
366
|
-
emit("transaction-success",
|
|
369
|
+
emit("transaction-success", {
|
|
370
|
+
purchaseAmount: runningTxData.value.txnAmount
|
|
371
|
+
});
|
|
367
372
|
} else {
|
|
368
373
|
spi.AckFlowEndedAndBackToIdle();
|
|
369
374
|
pairInfo.value.state = "FAILED";
|
|
370
375
|
pairInfo.value.message = "Manual Recovery";
|
|
371
376
|
}
|
|
377
|
+
runningTxData.value = { posRefId: "", txnAmount: 0, txType: "" };
|
|
372
378
|
}
|
|
373
379
|
document.addEventListener("TxFlowStateChanged", (e) => {
|
|
374
380
|
var _a, _b, _c;
|
|
375
381
|
model.value = true;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
localStorage.setItem("mx51.txType", e.detail.Type);
|
|
382
|
+
runningTxData.value.posRefId = e.detail.PosRefId;
|
|
383
|
+
runningTxData.value.txType = e.detail.Type;
|
|
379
384
|
if (e.detail.AttemptingToCancel) {
|
|
380
385
|
pairInfo.value.state = "AWAITING_CANCELLATION";
|
|
381
386
|
pairInfo.value.message = "Please wait";
|
|
@@ -384,8 +389,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
384
389
|
pairInfo.value.state = "AWAITING_SIGNATURE_CHECK";
|
|
385
390
|
} else if (e.detail.AwaitingPhoneForAuth) ;
|
|
386
391
|
else if (e.detail.Finished) {
|
|
387
|
-
|
|
388
|
-
localStorage.removeItem("mx51.txType");
|
|
392
|
+
runningTxData.value = { posRefId: "", txnAmount: 0, txType: "" };
|
|
389
393
|
switch (e.detail.Success) {
|
|
390
394
|
case SuccessState.Success:
|
|
391
395
|
pairInfo.value.state = "SUCCESS";
|
|
@@ -410,13 +414,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
410
414
|
pairInfo.value.message = e.Data.display_message_text;
|
|
411
415
|
};
|
|
412
416
|
const showDialog = (amount, type) => {
|
|
413
|
-
transactionAmount.value = amount;
|
|
414
417
|
pairInfo.value.state = "INPROGRESS";
|
|
415
418
|
pairInfo.value.message = "Processing";
|
|
416
419
|
model.value = true;
|
|
417
|
-
|
|
420
|
+
runningTxData.value.txnAmount = amount;
|
|
421
|
+
runningTxData.value.txType = type ?? TransactionType.Purchase;
|
|
422
|
+
};
|
|
423
|
+
const recoverTransaction = () => {
|
|
424
|
+
if (runningTxData.value.posRefId && runningTxData.value.txType) {
|
|
425
|
+
spi.InitiateRecovery(runningTxData.value.posRefId, runningTxData.value.txType);
|
|
426
|
+
}
|
|
418
427
|
};
|
|
419
428
|
__expose({ showDialog });
|
|
429
|
+
onMounted(recoverTransaction);
|
|
420
430
|
return (_ctx, _cache) => {
|
|
421
431
|
const _directive_close_popup = resolveDirective("close-popup");
|
|
422
432
|
return openBlock(), createBlock(unref(QDialog), {
|
|
@@ -429,7 +439,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
429
439
|
default: withCtx(() => [
|
|
430
440
|
pairInfo.value.state === "INPROGRESS" ? (openBlock(), createBlock(unref(QCardSection), { key: 0 }, {
|
|
431
441
|
default: withCtx(() => [
|
|
432
|
-
createElementVNode("div", _hoisted_1, toDisplayString(
|
|
442
|
+
createElementVNode("div", _hoisted_1, toDisplayString(unref(runningTxData).txType) + " of $" + toDisplayString(unref(runningTxData).txnAmount) + " in progress... ", 1),
|
|
433
443
|
createElementVNode("div", _hoisted_2, toDisplayString(pairInfo.value.message), 1),
|
|
434
444
|
createVNode(unref(QBtn), {
|
|
435
445
|
label: "Cancel",
|