@feedmepos/mf-payment 1.4.3 → 1.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,413 +0,0 @@
1
- import { defineComponent as B, ref as N, watch as M, onMounted as J, resolveComponent as g, openBlock as b, createElementBlock as $, Fragment as q, unref as r, createBlock as D, createCommentVNode as Y, withCtx as V, createVNode as f, renderList as Q, createElementVNode as U, isRef as S, h as I } from "vue";
2
- import { t as C, c as w } from "./assets-B67WKlO6.js";
3
- import { h as O } from "./moment-h96o7c8I.js";
4
- import { useI18n as G, useCoreStore as j } from "@feedmepos/mf-common";
5
- import { _ as H } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
6
- import { u as W } from "./index-ILoz50zh.js";
7
- import { _ as X } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
8
- import { _ as Z } from "./SelectAll.vue_vue_type_script_setup_true_lang-DA4rs3tk.js";
9
- import { _ as ee } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-dP_5WjEJ.js";
10
- import { p as ae } from "./index-BWjmOoX3.js";
11
- import { t as te } from "./index-C8G7ruiF.js";
12
- import { u as ne, p as x } from "./index-C4FfKmPS.js";
13
- import { useSnackbar as re, useDialog as se } from "@feedmepos/ui-library";
14
- import { _ as oe, a as le, b as ie, c as ce } from "./Actions.vue_vue_type_script_setup_true_lang-CqIt6ELp.js";
15
- import { g as ue } from "./grafana-BrdrOUM4.js";
16
- import { w as L } from "./Modal-DB8M9o1T.js";
17
- import { u as P } from "./error-K1CakhA9.js";
18
- import { _ as me } from "./index.vue_vue_type_script_setup_true_lang-v7o6C5Pg.js";
19
- const de = /* @__PURE__ */ B({
20
- __name: "SourceSelector",
21
- props: {
22
- id: {},
23
- by: {}
24
- },
25
- emits: ["update:id", "update:by"],
26
- setup(z, { emit: p }) {
27
- const E = p, { t: c } = G(), { currentBusiness: s, readRestaurants: T } = j(), { isLoading: u, startAsyncCall: A } = ne(!0), m = N([]), l = N(), y = N(""), v = N([]);
28
- let F;
29
- M(y, async () => {
30
- F && clearTimeout(F), F = setTimeout(() => {
31
- var i = new RegExp(y.value, "i");
32
- v.value = m.value.filter((d) => {
33
- const _ = JSON.stringify(d);
34
- return i.test(_);
35
- });
36
- }, 700);
37
- }), M(l, () => {
38
- l.value && (E("update:id", l.value.value), E("update:by", l.value.by));
39
- });
40
- async function k() {
41
- return A(async () => {
42
- let i = await ae.readBusinessPayoutAccounts();
43
- if (i.length !== 0)
44
- return i;
45
- });
46
- }
47
- async function K() {
48
- return A(async () => {
49
- let i = await te.getBusinessTerminals();
50
- if (i.length !== 0)
51
- return i;
52
- });
53
- }
54
- async function R() {
55
- u.value = !0;
56
- const i = await k(), d = await T(), _ = await K();
57
- m.value = [
58
- ...(d || []).map((a) => ({
59
- by: "RESTAURANT",
60
- prefix: c("payment.components.restaurant"),
61
- label: "(RESTAURANT) " + a.profile.name,
62
- value: a._id
63
- })),
64
- ...(_ || []).map((a) => ({
65
- by: "DEVICE",
66
- prefix: c("payment.components.device"),
67
- label: "(" + a.deviceType + ") " + (a.deviceType === "TERMINAL" ? a.name : a.restaurant.profile.name),
68
- value: a._id
69
- })),
70
- ...(i || []).map((a) => {
71
- var e, t;
72
- return {
73
- by: "PAYOUT_ACCOUNT",
74
- prefix: c("payment.components.payout_account"),
75
- label: "(" + a.store.event + ") " + (((t = (e = a.ref) == null ? void 0 : e.profile) == null ? void 0 : t.name) ?? a.ref.name),
76
- value: a._id
77
- };
78
- })
79
- ], v.value = m.value, u.value = !1;
80
- }
81
- return J(R), M(s, R), (i, d) => {
82
- const _ = g("FmCircularProgress"), a = g("FmChip"), e = g("FmSearch"), t = g("FmMenuItem"), o = g("FmMenu");
83
- return b(), $(q, null, [
84
- r(u) ? (b(), D(_, {
85
- key: 0,
86
- size: "md"
87
- })) : Y("", !0),
88
- r(u) ? Y("", !0) : (b(), D(o, { key: 1 }, {
89
- "menu-button": V(() => {
90
- var n;
91
- return [
92
- f(a, {
93
- icon: "account_box",
94
- label: l.value ? l.value.prefix + " > " + ((n = l.value) == null ? void 0 : n.label) : r(c)("payment.components.select"),
95
- removable: !!l.value,
96
- onChipClosed: d[0] || (d[0] = (h) => l.value = void 0)
97
- }, null, 8, ["label", "removable"])
98
- ];
99
- }),
100
- default: V(() => [
101
- f(e, {
102
- "model-value": y.value,
103
- "onUpdate:modelValue": d[1] || (d[1] = (n) => y.value = n),
104
- placeholder: "Search Restaurants/Devices/Payout Accounts"
105
- }, null, 8, ["model-value"]),
106
- v.value.length === 0 ? (b(), D(t, {
107
- key: 0,
108
- disabled: !0,
109
- label: "No result"
110
- })) : Y("", !0),
111
- (b(!0), $(q, null, Q(v.value, (n) => (b(), D(t, {
112
- onClick: (h) => l.value = n,
113
- key: n.value,
114
- label: n.label,
115
- selectable: ""
116
- }, null, 8, ["onClick", "label"]))), 128))
117
- ]),
118
- _: 1
119
- }))
120
- ], 64);
121
- };
122
- }
123
- }), pe = { class: "flex justify-between mb-6 items-center" }, ye = { class: "flex space-x-8 items-start" }, fe = { class: "flex space-x-4 self-center" }, _e = { class: "flex space-x-12 mb-6" }, Ke = /* @__PURE__ */ B({
124
- __name: "Transaction",
125
- setup(z) {
126
- var d, _;
127
- const p = re(), E = se(), { sessionUser: c } = j(), { t: s } = G(), T = N(), { dateRange: u, searchKey: A, status: m, id: l, by: y } = W({
128
- by: "",
129
- id: "",
130
- searchKey: "",
131
- status: [x.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS],
132
- dateRange: {
133
- startDate: O().startOf("day").format("YYYY-MM-DD"),
134
- endDate: O().endOf("day").format("YYYY-MM-DD")
135
- }
136
- }), v = [
137
- {
138
- label: "Success",
139
- value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS
140
- },
141
- {
142
- label: "Refunded",
143
- value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED
144
- },
145
- {
146
- label: "Process",
147
- value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING
148
- },
149
- {
150
- label: "Failed",
151
- value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED
152
- }
153
- ];
154
- async function F(a, e) {
155
- var t;
156
- try {
157
- const o = await C.refetchTransaction({ transactionId: a.id });
158
- (t = T.value) == null || t.replaceData(e, w(o)), p.open({
159
- type: "success",
160
- title: "Transaction queried and updated successfully."
161
- });
162
- } catch (o) {
163
- p.open({
164
- type: "error",
165
- title: "Fail to query transaction.",
166
- message: P(o)
167
- });
168
- }
169
- }
170
- async function k(a, e) {
171
- L(
172
- E,
173
- "Refund Transaction",
174
- "Are you sure to refund transaction? This action cannot be revert!",
175
- async () => {
176
- var t;
177
- try {
178
- const o = await C.refundTransaction({
179
- transactionId: a.id,
180
- reason: "portal transaction refund",
181
- amount: a.fdoAmount
182
- });
183
- (t = T.value) == null || t.replaceData(e, w(o)), p.open({
184
- type: "success",
185
- title: "Transaction refund request initiated."
186
- });
187
- } catch (o) {
188
- p.open({
189
- type: "error",
190
- title: "Fail to request refund transaction.",
191
- message: P(o)
192
- });
193
- }
194
- }
195
- );
196
- }
197
- async function K(a, e) {
198
- L(
199
- E,
200
- "Notify Transaction",
201
- "Are you sure to perform notify transaction?",
202
- async () => {
203
- try {
204
- await C.renotifyTransaction(a.id), p.open({
205
- type: "success",
206
- title: "Transaction notify successfully."
207
- });
208
- } catch (t) {
209
- p.open({
210
- type: "error",
211
- title: "Fail to notify transaction.",
212
- message: P(t)
213
- });
214
- }
215
- }
216
- );
217
- }
218
- async function R(a, e) {
219
- const t = ue([
220
- {
221
- type: "span",
222
- queryKey: "transaction.id",
223
- queryValue: a.id
224
- }
225
- ], a.transactionAt);
226
- window.open(t, "_blank");
227
- }
228
- N("");
229
- const i = [
230
- {
231
- header: () => s("payment.transactions.table.id"),
232
- accessorKey: "id",
233
- cell: ({ cell: a, row: e }) => {
234
- var t, o;
235
- return ((t = c.value) != null && t.role.isStaff || (o = c.value) != null && o.role.isAdmin) && e.original.transactionId ? e.original.id + `
236
- ID: ` + e.original.transactionId : e.original.id;
237
- }
238
- },
239
- {
240
- header: () => s("payment.transactions.table.pay_id"),
241
- accessorKey: "payId"
242
- },
243
- {
244
- header: () => s("payment.transactions.table.gateway_id"),
245
- accessorKey: "gatewayTransactionId"
246
- },
247
- {
248
- header: () => s("payment.transactions.table.bill_seq"),
249
- accessorKey: "seqNumber"
250
- },
251
- {
252
- header: () => s("payment.transactions.table.gateway"),
253
- accessorKey: "gateway",
254
- meta: {
255
- textAlign: "center"
256
- },
257
- cell: ({ cell: a, row: e }) => e.original.gateway ? I(oe, { row: e, data: a.getValue() }) : ""
258
- },
259
- {
260
- header: () => s("payment.transactions.table.method"),
261
- accessorKey: "method",
262
- meta: {
263
- textAlign: "center"
264
- },
265
- cell: ({ cell: a, row: e }) => e.original.method ? I(le, { row: e, data: a.getValue() }) : ""
266
- },
267
- {
268
- header: () => s("payment.transactions.table.type"),
269
- accessorKey: "payFor",
270
- meta: {
271
- textAlign: "center"
272
- }
273
- },
274
- {
275
- header: () => s("payment.transactions.table.status"),
276
- accessorKey: "status",
277
- cell: ({ cell: a, row: e }) => I(ie, { row: e, data: a.getValue() })
278
- },
279
- {
280
- header: () => s("payment.transactions.table.restaurant"),
281
- accessorKey: "restaurantId"
282
- },
283
- {
284
- header: () => s("payment.transactions.table.source"),
285
- accessorKey: "source",
286
- cell: ({ cell: a, row: e }) => `(${e.original.sourceType}) ${e.original.source}`
287
- },
288
- {
289
- header: () => s("payment.transactions.table.transaction_at"),
290
- accessorKey: "transactionAt",
291
- meta: {
292
- width: "180px"
293
- },
294
- cell: ({ cell: a, row: e }) => e.original.status === "REFUNDED" ? e.original.refundedAt : e.original.transactionAt
295
- },
296
- {
297
- header: () => s("payment.transactions.table.sales_amount"),
298
- accessorKey: "amount",
299
- cell: ({ cell: a, row: e }) => {
300
- var t, o;
301
- return ((t = c.value) != null && t.role.isStaff || (o = c.value) != null && o.role.isAdmin) && e.original.flags.isDelivery ? e.original.amount + "( " + e.original.gatewayAmount + ")" : e.original.amount;
302
- }
303
- }
304
- ];
305
- return ((d = c.value) != null && d.role.isStaff || (_ = c.value) != null && _.role.isAdmin) && i.push({
306
- header: () => s("payment.transactions.table.actions"),
307
- accessorKey: "actions",
308
- cell: ({ row: a }) => I(ce, {
309
- transaction: a.original,
310
- onAction: (e) => {
311
- var t;
312
- switch (e) {
313
- case "notify":
314
- return K(a.original, a.index);
315
- case "query":
316
- return F(a.original, a.index);
317
- case "refund":
318
- return (t = c.value) != null && t.role.isStaff ? p.open({
319
- type: "error",
320
- title: "You are not allowed to refund transaction."
321
- }) : k(a.original, a.index);
322
- case "history":
323
- return R(a.original, a.index);
324
- }
325
- }
326
- })
327
- }), (a, e) => {
328
- const t = g("FmSearch"), o = g("FmSelect");
329
- return b(), D(H, {
330
- title: r(s)("payment.transactions.title"),
331
- description: r(s)("payment.transactions.description"),
332
- loading: !1
333
- }, {
334
- default: V(() => [
335
- U("div", pe, [
336
- U("div", ye, [
337
- f(t, {
338
- "model-value": r(A),
339
- "onUpdate:modelValue": e[0] || (e[0] = (n) => S(A) ? A.value = n : null),
340
- class: "mr-8",
341
- label: r(s)("payment.transactions.search.title"),
342
- placeholder: r(s)("payment.transactions.search.placeholder")
343
- }, null, 8, ["model-value", "label", "placeholder"]),
344
- f(o, {
345
- modelValue: r(m),
346
- "onUpdate:modelValue": e[2] || (e[2] = (n) => S(m) ? m.value = n : null),
347
- class: "mr-6 w-[300px]",
348
- label: r(s)("payment.transactions.status"),
349
- "label-mark": "required",
350
- multiselect: "",
351
- items: v
352
- }, {
353
- "prepend-menu": V(() => [
354
- f(Z, {
355
- modelValue: r(m),
356
- "onUpdate:modelValue": e[1] || (e[1] = (n) => S(m) ? m.value = n : null),
357
- items: v
358
- }, null, 8, ["modelValue"])
359
- ]),
360
- _: 1
361
- }, 8, ["modelValue", "label"])
362
- ]),
363
- U("div", fe, [
364
- f(X, {
365
- button: {
366
- appendIcon: "file_download",
367
- variant: "primary",
368
- label: r(s)("payment.transactions.button.export")
369
- },
370
- handler: async () => {
371
- var h;
372
- const n = await ((h = T.value) == null ? void 0 : h.allData());
373
- n != null && await r(C).downloadPortalTransactionReport(r(u), n);
374
- }
375
- }, null, 8, ["button", "handler"])
376
- ])
377
- ]),
378
- U("div", _e, [
379
- f(de, {
380
- id: r(l),
381
- "onUpdate:id": e[3] || (e[3] = (n) => S(l) ? l.value = n : null),
382
- by: r(y),
383
- "onUpdate:by": e[4] || (e[4] = (n) => S(y) ? y.value = n : null)
384
- }, null, 8, ["id", "by"]),
385
- f(ee, {
386
- modelValue: r(u),
387
- "onUpdate:modelValue": e[5] || (e[5] = (n) => S(u) ? u.value = n : null)
388
- }, null, 8, ["modelValue"])
389
- ]),
390
- f(me, {
391
- ref_key: "controller",
392
- ref: T,
393
- "column-defs": i,
394
- "rows-defs": r(w),
395
- paginate: (n, h) => r(C).readTransactionsV2({
396
- limit: n,
397
- cursor: h,
398
- status: r(m),
399
- by: r(y),
400
- id: r(l),
401
- start: r(u).startDate,
402
- end: r(u).endDate
403
- })
404
- }, null, 8, ["rows-defs", "paginate"])
405
- ]),
406
- _: 1
407
- }, 8, ["title", "description"]);
408
- };
409
- }
410
- });
411
- export {
412
- Ke as default
413
- };