@feedmepos/mf-payment 1.0.0-beta.2 → 1.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ createdAt: string;
3
+ transactionAt: string;
4
+ refundedAt: string;
5
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
6
+ createdAt: string;
7
+ transactionAt: string;
8
+ refundedAt: string;
9
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,435 +0,0 @@
1
- import { defineComponent as b, openBlock as y, createElementBlock as I, unref as l, createCommentVNode as q, createElementVNode as w, resolveComponent as g, createBlock as C, normalizeClass as K, withCtx as h, toDisplayString as k, createVNode as m, Fragment as $, renderList as P, ref as L, watch as v, isRef as x, h as A } from "vue";
2
- import { c as f } from "./index-CWaKb7bG.js";
3
- import { h as S } from "./moment-h96o7c8I.js";
4
- import { u as B } from "./index-7KNaibcq.js";
5
- import { _ as G } from "./index.vue_vue_type_script_setup_true_lang-JdAFa8vy.js";
6
- import { _ as U } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
7
- import { useSnackbar as Y, useDialog as Q } from "@feedmepos/ui-library";
8
- import { g as W } from "./assets-NrCec-W0.js";
9
- import { E as j, t as N } from "./index-DbJpbpSs.js";
10
- import { d as z } from "./dinero-CIVmXLL-.js";
11
- import { _ as H } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
- import { _ as J } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
13
- import { useRouter as X } from "vue-router";
14
- import { w as Z } from "./Modal-DB8M9o1T.js";
15
- import { u as F } from "./error-K1CakhA9.js";
16
- import { _ as ee } from "./SelectAll.vue_vue_type_script_setup_true_lang-DA4rs3tk.js";
17
- const te = { class: "flex" }, ae = ["src"], ne = ["src"], re = /* @__PURE__ */ b({
18
- __name: "Gateway",
19
- props: {
20
- row: {},
21
- data: {}
22
- },
23
- setup(T) {
24
- return (n, d) => (y(), I("div", te, [
25
- n.row.original.ecrGateway ? (y(), I("img", {
26
- key: 0,
27
- class: "bg-fm-color-overlay-background rounded-md m-auto border-transparent w-[32px] h-[32px]",
28
- src: l(j)
29
- }, null, 8, ae)) : q("", !0),
30
- w("img", {
31
- class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
32
- src: l(W)(n.row.original.gateway)
33
- }, null, 8, ne)
34
- ]));
35
- }
36
- }), oe = /* @__PURE__ */ b({
37
- __name: "Status",
38
- props: {
39
- row: {},
40
- data: {}
41
- },
42
- setup(T) {
43
- const n = T;
44
- function d() {
45
- return n.data === f.F_TERMINAL_TRANSACTION_ACTION.Enum.process ? "!w-[16px] !h-[16px] bg-yellow-400" : n.data === f.F_TERMINAL_TRANSACTION_ACTION.Enum.failed ? "!w-[16px] !h-[16px] bg-red-400" : n.data === f.F_TERMINAL_TRANSACTION_ACTION.Enum.refunded ? "!w-[16px] !h-[16px] bg-blue-400" : "!w-[16px] !h-[16px] bg-green-400";
46
- }
47
- return (o, i) => {
48
- const s = g("FmBadge");
49
- return y(), C(s, {
50
- inline: "",
51
- class: K(d())
52
- }, {
53
- default: h(() => [
54
- w("div", null, k(o.data.toUpperCase()), 1)
55
- ]),
56
- _: 1
57
- }, 8, ["class"]);
58
- };
59
- }
60
- }), se = /* @__PURE__ */ b({
61
- __name: "RouteCell",
62
- props: {
63
- data: {},
64
- route: {}
65
- },
66
- setup(T) {
67
- const n = T, d = X();
68
- function o() {
69
- d.push(n.route);
70
- }
71
- return (i, s) => (y(), I("div", {
72
- class: "fm-typo-en-link-md-600",
73
- onClick: s[0] || (s[0] = (u) => {
74
- u.stopPropagation(), o();
75
- })
76
- }, k(i.data), 1));
77
- }
78
- }), le = /* @__PURE__ */ b({
79
- __name: "Actions",
80
- props: {
81
- onAction: { type: Function }
82
- },
83
- setup(T) {
84
- const n = [
85
- {
86
- label: "Query",
87
- sublabel: "Perform transaction status inquriy",
88
- icon: "question_answer",
89
- action: "query"
90
- },
91
- {
92
- label: "Refund",
93
- sublabel: "Perform transaction refund request",
94
- icon: "request_page",
95
- action: "refund"
96
- }
97
- ];
98
- return (d, o) => {
99
- const i = g("FmIcon"), s = g("FmMenuItem"), u = g("FmMenu");
100
- return y(), I("div", {
101
- onClick: o[0] || (o[0] = (c) => {
102
- c.stopPropagation();
103
- })
104
- }, [
105
- m(u, null, {
106
- "menu-button": h(() => [
107
- m(i, { name: "settings" })
108
- ]),
109
- default: h(() => [
110
- (y(), I($, null, P(n, (c) => m(s, {
111
- selectable: !0,
112
- key: c.label,
113
- sublabel: c.sublabel,
114
- label: c.label,
115
- icon: c.icon,
116
- onclick: () => d.onAction(c.action)
117
- }, null, 8, ["sublabel", "label", "icon", "onclick"])), 64))
118
- ]),
119
- _: 1
120
- })
121
- ]);
122
- };
123
- }
124
- }), ie = { class: "flex justify-between mb-6 items-start" }, ce = { class: "flex space-x-4 items-start" }, ue = { class: "flex space-x-4" }, Re = /* @__PURE__ */ b({
125
- __name: "TerminalTransaction",
126
- setup(T) {
127
- const n = Y(), d = Q(), o = L(), { dateRange: i, status: s, searchKey: u } = B({
128
- searchKey: "",
129
- status: [f.F_TERMINAL_TRANSACTION_ACTION.Enum.success],
130
- dateRange: {
131
- startDate: S().startOf("day").toISOString(),
132
- endDate: S().endOf("day").toISOString()
133
- }
134
- });
135
- v([i, s], () => {
136
- var e;
137
- return (e = o.value) == null ? void 0 : e.reset();
138
- });
139
- let c;
140
- v(u, async () => {
141
- c && clearTimeout(c), c = setTimeout(
142
- () => {
143
- var e;
144
- return (e = o.value) == null ? void 0 : e.reset();
145
- },
146
- 700
147
- );
148
- });
149
- async function E(e) {
150
- var r, p, _;
151
- const t = (p = (r = o.value) == null ? void 0 : r.pageData()) == null ? void 0 : p.at(e);
152
- if (!t) {
153
- n.open({
154
- type: "error",
155
- title: "Something went wrong",
156
- message: "Fail to find transactions from the displayed transactions."
157
- });
158
- return;
159
- }
160
- if (!t.refId) {
161
- n.open({
162
- type: "error",
163
- title: "Something went wrong",
164
- message: "Transaction isn't a valid transaction to perform query"
165
- });
166
- return;
167
- }
168
- try {
169
- const a = await N.queryTransaction(t._id);
170
- (_ = o.value) == null || _.replaceData(e, a), n.open({
171
- type: "success",
172
- title: "Transaction queried and updated successfully."
173
- });
174
- } catch (a) {
175
- n.open({
176
- type: "error",
177
- title: "Fail to query transaction.",
178
- message: F(a)
179
- });
180
- }
181
- }
182
- async function O(e) {
183
- var r, p;
184
- const t = (p = (r = o.value) == null ? void 0 : r.pageData()) == null ? void 0 : p.at(e);
185
- if (!t) {
186
- n.open({
187
- type: "error",
188
- title: "Something went wrong",
189
- message: "Fail to find transactions from the displayed transactions."
190
- });
191
- return;
192
- }
193
- if (!t.refId) {
194
- n.open({
195
- type: "error",
196
- title: "Something went wrong",
197
- message: "Transaction isn't a valid transaction to perform refund"
198
- });
199
- return;
200
- }
201
- Z(
202
- d,
203
- "Refund Transaction",
204
- "Are you sure to refund transaction? This action cannot be revert!",
205
- async () => {
206
- var _;
207
- try {
208
- const a = await N.refundTransaction({
209
- transactionId: t._id,
210
- reason: "portal transaction refund",
211
- amount: t.details.amount
212
- });
213
- (_ = o.value) == null || _.replaceData(e, a), n.open({
214
- type: "success",
215
- title: "Transaction queried and updated successfully."
216
- });
217
- } catch (a) {
218
- n.open({
219
- type: "error",
220
- title: "Fail to query transaction.",
221
- message: F(a)
222
- });
223
- }
224
- }
225
- );
226
- }
227
- const R = [
228
- {
229
- label: "Success",
230
- value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.success
231
- },
232
- {
233
- label: "Refunded",
234
- value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.refunded
235
- },
236
- {
237
- label: "Process",
238
- value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.process
239
- },
240
- {
241
- label: "Failed",
242
- value: f.F_TERMINAL_TRANSACTION_ACTION.Enum.failed
243
- }
244
- ], D = function(e) {
245
- const t = e;
246
- let r = "-";
247
- return t.details && t.details.amount && (r = z(t.details.amount).toFormat("$0.00")), {
248
- id: e._id,
249
- orderId: e.orderId,
250
- refId: e.refId,
251
- owner: e.owner,
252
- terminalId: e.terminalId,
253
- transactionAt: S(e.transactionAt).format("YYYY-MM-DD hh:mm:ss"),
254
- action: e.action,
255
- gateway: e.gateway,
256
- ecrGateway: e.ecrGateway,
257
- amount: r
258
- };
259
- }, V = [
260
- {
261
- accessorKey: "id",
262
- header: () => "Transaction ID",
263
- meta: {
264
- textAlign: "left"
265
- },
266
- cell: ({ cell: e }) => A(J, { data: e.getValue() })
267
- },
268
- {
269
- accessorKey: "orderId",
270
- header: () => "Pay ID",
271
- meta: {
272
- textAlign: "left"
273
- }
274
- },
275
- {
276
- accessorKey: "refId",
277
- header: () => "Reference ID",
278
- meta: {
279
- textAlign: "left"
280
- }
281
- },
282
- {
283
- accessorKey: "gateway",
284
- header: () => "Gateway",
285
- meta: {
286
- textAlign: "center",
287
- maxWidth: "128px"
288
- },
289
- cell: ({ cell: e, row: t }) => A(re, { row: t, data: e.getValue() })
290
- },
291
- {
292
- accessorKey: "action",
293
- header: () => "Status",
294
- meta: {
295
- textAlign: "right",
296
- maxWidth: "132px"
297
- },
298
- cell: ({ cell: e, row: t }) => A(oe, { row: t, data: e.getValue() })
299
- },
300
- {
301
- accessorKey: "amount",
302
- header: () => "Sales Amount",
303
- meta: {
304
- textAlign: "center"
305
- }
306
- },
307
- {
308
- accessorKey: "terminalId",
309
- header: () => "Terminal ID",
310
- meta: {
311
- textAlign: "left"
312
- },
313
- cell: ({ cell: e, row: t }) => {
314
- const r = e.getValue();
315
- return A(se, {
316
- data: r,
317
- route: {
318
- name: "mf-payment-admin.terminal-setting",
319
- params: { terminalId: r }
320
- }
321
- });
322
- }
323
- },
324
- {
325
- accessorKey: "owner",
326
- header: () => "Reference",
327
- meta: {
328
- textAlign: "left"
329
- }
330
- },
331
- {
332
- accessorKey: "transactionAt",
333
- header: () => "Transaction At",
334
- meta: {
335
- textAlign: "left"
336
- }
337
- },
338
- {
339
- header: () => "Actions",
340
- accessorKey: "actions",
341
- cell: ({ row: e }) => {
342
- if (e.original.gateway === "ScanPay")
343
- return A(le, {
344
- onAction: (t) => {
345
- const r = e.index;
346
- switch (t) {
347
- case "query":
348
- return E(r);
349
- case "refund":
350
- return O(r);
351
- }
352
- }
353
- });
354
- }
355
- }
356
- ];
357
- return (e, t) => {
358
- const r = g("FmSearch"), p = g("FmSelect"), _ = g("FmSimpleDateRangePicker");
359
- return y(), C(U, {
360
- title: "Offline Transactions",
361
- loading: !1
362
- }, {
363
- default: h(() => [
364
- w("div", ie, [
365
- w("div", ce, [
366
- m(r, {
367
- "model-value": l(u),
368
- "onUpdate:modelValue": t[0] || (t[0] = (a) => x(u) ? u.value = a : null),
369
- class: "mr-8",
370
- label: "Search",
371
- placeholder: "Search Transactions ..."
372
- }, null, 8, ["model-value"]),
373
- m(p, {
374
- modelValue: l(s),
375
- "onUpdate:modelValue": t[2] || (t[2] = (a) => x(s) ? s.value = a : null),
376
- class: "mr-6 w-[300px]",
377
- label: "Status",
378
- "label-mark": "required",
379
- multiselect: "",
380
- items: R
381
- }, {
382
- "prepend-menu": h(() => [
383
- m(ee, {
384
- modelValue: l(s),
385
- "onUpdate:modelValue": t[1] || (t[1] = (a) => x(s) ? s.value = a : null),
386
- items: R
387
- }, null, 8, ["modelValue"])
388
- ]),
389
- _: 1
390
- }, 8, ["modelValue"]),
391
- m(_, {
392
- modelValue: l(i),
393
- "onUpdate:modelValue": t[3] || (t[3] = (a) => x(i) ? i.value = a : null),
394
- "show-predefined-range": ""
395
- }, null, 8, ["modelValue"])
396
- ]),
397
- w("div", ue, [
398
- m(H, {
399
- button: {
400
- appendIcon: "file_download",
401
- variant: "primary",
402
- label: "Export"
403
- },
404
- handler: async () => {
405
- var a;
406
- return l(N).downloadTransactions(await ((a = o.value) == null ? void 0 : a.allData()) ?? []);
407
- }
408
- }, null, 8, ["handler"])
409
- ])
410
- ]),
411
- m(G, {
412
- ref_key: "controller",
413
- ref: o,
414
- "column-defs": V,
415
- "rows-defs": D,
416
- onRowClick: t[4] || (t[4] = () => {
417
- }),
418
- paginate: (a, M) => l(N).readTransactions({
419
- status: l(s),
420
- searchKey: l(u),
421
- limit: a,
422
- cursor: M,
423
- start: l(i).startDate,
424
- end: l(i).endDate
425
- })
426
- }, null, 8, ["paginate"])
427
- ]),
428
- _: 1
429
- });
430
- };
431
- }
432
- });
433
- export {
434
- Re as default
435
- };