@feedmepos/mf-payment 1.5.35-dev → 1.5.37-dev

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.
Files changed (25) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-otzczqU5.js → Actions.vue_vue_type_script_setup_true_lang-CSmRCpz2.js} +1 -1
  2. package/dist/{Chargeback-CQkYS7zA.js → Chargeback-F4uNGOcy.js} +1 -1
  3. package/dist/{OnboardForm-By03Chhh.js → OnboardForm-BRD1s1Y3.js} +1 -1
  4. package/dist/{OnboardForm-CqZYRciP.js → OnboardForm-DuJ4ZrJV.js} +1 -1
  5. package/dist/{PayoutAccount-DbJB5Y6K.js → PayoutAccount-5IcgD7Bd.js} +1 -1
  6. package/dist/{PayoutAccount-D8ZiVHXg.js → PayoutAccount-Cs0IYGri.js} +1 -1
  7. package/dist/Settlement-kRuh2LGa.js +616 -0
  8. package/dist/{SettlementTransactions-C0vRk4kI.js → SettlementTransactions-DEoxfkFL.js} +2 -2
  9. package/dist/{SettlementTransactions-C4F8UT8k.js → SettlementTransactions-DN9uCpiR.js} +2 -2
  10. package/dist/Transaction-CvUypCQq.js +490 -0
  11. package/dist/{Transaction-pfFFXNUZ.js → Transaction-HTemq8TC.js} +117 -109
  12. package/dist/{TransactionOld-CaLBhbhp.js → TransactionOld-BEfflWka.js} +3 -3
  13. package/dist/{app-CjT9c5hY.js → app-BmekPZck.js} +11 -11
  14. package/dist/app.js +1 -1
  15. package/dist/{assets-gWQvONT9.js → assets-t2kJFjI9.js} +72 -71
  16. package/dist/composable/transaction/index.d.ts +4 -0
  17. package/dist/index-CPf8YYLa.js +9 -0
  18. package/dist/{index-CiCmB-Rg.js → index-jfRfVr4R.js} +1 -1
  19. package/dist/model/transaction.d.ts +1 -0
  20. package/dist/package.json +1 -1
  21. package/dist/{payout-account-BvYk9wz-.js → payout-account-Bmz3nyNW.js} +1 -1
  22. package/dist/tsconfig.app.tsbuildinfo +1 -1
  23. package/package.json +1 -1
  24. package/dist/Settlement-BAeQCoUt.js +0 -610
  25. package/dist/Transaction-CkmY_1p2.js +0 -482
@@ -2,8 +2,8 @@ import { defineComponent as h, resolveComponent as p, openBlock as A, createBloc
2
2
  import { u as H } from "./index-T2CVm7-_.js";
3
3
  import { useDialog as U, useSnackbar as q } from "@feedmepos/ui-library";
4
4
  import { d as B } from "./dinero-CIVmXLL-.js";
5
- import { g as J, a as Q, _ as W, t as X } from "./assets-gWQvONT9.js";
6
- import { t as L } from "./index-CiCmB-Rg.js";
5
+ import { g as J, a as Q, _ as W, t as X } from "./assets-t2kJFjI9.js";
6
+ import { t as L } from "./index-jfRfVr4R.js";
7
7
  import { _ as Z } from "./Layout.vue_vue_type_script_setup_true_lang-BKIvkgA_.js";
8
8
  import { useRouter as ee } from "vue-router";
9
9
  import { s as te } from "./index-_EfmUlsc.js";
@@ -0,0 +1,490 @@
1
+ import { defineComponent as w, ref as I, watch as D, onMounted as j, resolveComponent as T, unref as s, openBlock as R, createBlock as Y, createElementBlock as q, createVNode as y, withCtx as M, createElementVNode as S, Fragment as J, renderList as Q, createTextVNode as H, toDisplayString as W, isRef as E, h as F } from "vue";
2
+ import { t as C } from "./index-jfRfVr4R.js";
3
+ import { h as B } from "./moment-h96o7c8I.js";
4
+ import { useI18n as G, useCoreStore as z } from "@feedmepos/mf-common";
5
+ import { _ as X } from "./Layout.vue_vue_type_script_setup_true_lang-BKIvkgA_.js";
6
+ import { t as Z, b as ee, _ as te } from "./assets-t2kJFjI9.js";
7
+ import { u as ae } from "./index-Q0ELb0wB.js";
8
+ import { _ as ne } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
9
+ import { _ as re } from "./SelectAll.vue_vue_type_script_setup_true_lang-BNZTqdoF.js";
10
+ import { _ as se } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-kymnzYpd.js";
11
+ import { p as oe } from "./index-Dq4IAN2N.js";
12
+ import { t as le } from "./index-DGqWjywh.js";
13
+ import { u as ie, p as x } from "./index-T2CVm7-_.js";
14
+ import { useSnackbar as ce, useDialog as ue } from "@feedmepos/ui-library";
15
+ import { _ as me, a as de, b as pe } from "./Actions.vue_vue_type_script_setup_true_lang-CSmRCpz2.js";
16
+ import { g as ye } from "./grafana-VY3mqepx.js";
17
+ import { w as O } from "./Modal-DB8M9o1T.js";
18
+ import { u as L } from "./error-K1CakhA9.js";
19
+ import { _ as fe } from "./index.vue_vue_type_script_setup_true_lang-CkzD8rQP.js";
20
+ import { u as _e } from "./index-CPf8YYLa.js";
21
+ const be = {
22
+ key: 1,
23
+ class: "inline-flex"
24
+ }, ve = { class: "relative" }, ge = { class: "sticky top-0 py-8 bg-white translate-y-[-12px]" }, Te = /* @__PURE__ */ w({
25
+ __name: "SourceSelector",
26
+ props: {
27
+ id: {},
28
+ by: {},
29
+ excludePayoutAccount: { type: Boolean },
30
+ excludeOrderingPayoutAccount: { type: Boolean },
31
+ excludeMarketingPayoutAccount: { type: Boolean },
32
+ excludeRestaurant: { type: Boolean },
33
+ excludeDevice: { type: Boolean }
34
+ },
35
+ emits: ["update:id", "update:by"],
36
+ setup(P, { emit: f }) {
37
+ const b = P, m = f, { t: o } = G(), { currentBusiness: U, readRestaurants: v } = z(), { isLoading: p, startAsyncCall: g } = ie(!0), d = I([]), u = I(), _ = I(""), A = I([]);
38
+ let N;
39
+ D(_, async () => {
40
+ N && clearTimeout(N), N = setTimeout(() => {
41
+ var i = new RegExp(_.value, "i");
42
+ A.value = d.value.filter((r) => {
43
+ const a = JSON.stringify(r);
44
+ return i.test(a);
45
+ });
46
+ }, 700);
47
+ }), D(u, () => {
48
+ var i, r;
49
+ m("update:id", (i = u.value) == null ? void 0 : i.value), m("update:by", (r = u.value) == null ? void 0 : r.by);
50
+ });
51
+ async function $() {
52
+ return g(async () => {
53
+ let i = await oe.readBusinessPayoutAccounts();
54
+ if (i.length !== 0)
55
+ return i;
56
+ });
57
+ }
58
+ async function K() {
59
+ return g(async () => {
60
+ let i = await le.getBusinessTerminals();
61
+ if (i.length !== 0)
62
+ return i;
63
+ });
64
+ }
65
+ async function k() {
66
+ p.value = !0;
67
+ const i = [];
68
+ if (!b.excludePayoutAccount) {
69
+ let r = await $();
70
+ b.excludeMarketingPayoutAccount && (r = r == null ? void 0 : r.filter((a) => a.store.event !== "MARKETING")), b.excludeOrderingPayoutAccount && (r = r == null ? void 0 : r.filter((a) => a.store.event !== "ORDERING")), i.push(
71
+ ...(r || []).map((a) => {
72
+ var h, t, e, n;
73
+ return {
74
+ by: "PAYOUT_ACCOUNT",
75
+ value: a._id,
76
+ prefix: o("payment.components.payout_account"),
77
+ type: "Payout Account - " + a.store.event,
78
+ label: ((t = (h = a.ref) == null ? void 0 : h.profile) == null ? void 0 : t.name) ?? a.ref.name,
79
+ chipLabel: "Payout Account: " + (((n = (e = a.ref) == null ? void 0 : e.profile) == null ? void 0 : n.name) ?? a.ref.name)
80
+ };
81
+ })
82
+ );
83
+ }
84
+ if (!b.excludeRestaurant) {
85
+ const r = await v();
86
+ i.push(
87
+ ...(r || []).map((a) => ({
88
+ by: "RESTAURANT",
89
+ value: a._id,
90
+ prefix: o("payment.components.restaurant"),
91
+ type: "Restaurant",
92
+ label: a.profile.name + " (" + (a.profile.code ?? "--") + ")",
93
+ chipLabel: "Restaurant: " + a.profile.name + " (" + (a.profile.code ?? "--") + ")"
94
+ }))
95
+ );
96
+ }
97
+ if (!b.excludeDevice) {
98
+ const r = await K();
99
+ i.push(
100
+ ...(r || []).map((a) => ({
101
+ by: "DEVICE",
102
+ value: a._id,
103
+ prefix: o("payment.components.device"),
104
+ type: "Device - " + a.deviceType,
105
+ label: a.deviceType === "TERMINAL" ? a.name : a.restaurant.profile.name,
106
+ chipLabel: a.deviceType + ": " + (a.deviceType === "TERMINAL" ? a.name : a.restaurant.profile.name)
107
+ }))
108
+ );
109
+ }
110
+ d.value = i, A.value = d.value, p.value = !1;
111
+ }
112
+ return j(k), D(U, k), (i, r) => {
113
+ const a = T("FmCircularProgress"), h = T("FmChip"), t = T("FmSearch"), e = T("FmMenuItem"), n = T("FmMenu");
114
+ return s(p) ? (R(), Y(a, {
115
+ key: 0,
116
+ size: "md"
117
+ })) : (R(), q("div", be, [
118
+ y(n, { "close-on-click": !0 }, {
119
+ "menu-button": M(() => {
120
+ var l;
121
+ return [
122
+ y(h, {
123
+ icon: "account_box",
124
+ label: ((l = u.value) == null ? void 0 : l.chipLabel) ?? s(o)("payment.components.select"),
125
+ removable: !!u.value,
126
+ onChipClosed: r[0] || (r[0] = (c) => u.value = void 0)
127
+ }, null, 8, ["label", "removable"])
128
+ ];
129
+ }),
130
+ default: M(() => [
131
+ S("div", ve, [
132
+ S("div", ge, [
133
+ y(t, {
134
+ "model-value": _.value,
135
+ "onUpdate:modelValue": r[1] || (r[1] = (l) => _.value = l),
136
+ placeholder: s(o)("payment.components.select")
137
+ }, null, 8, ["model-value", "placeholder"])
138
+ ]),
139
+ S("div", null, [
140
+ (R(!0), q(J, null, Q(A.value, (l) => (R(), Y(e, {
141
+ key: l.value,
142
+ label: l.label,
143
+ sublabel: l.type,
144
+ onClick: () => u.value = l
145
+ }, null, 8, ["label", "sublabel", "onClick"]))), 128))
146
+ ])
147
+ ])
148
+ ]),
149
+ _: 1
150
+ })
151
+ ]));
152
+ };
153
+ }
154
+ }), Ae = { class: "flex items-center gap-1" }, he = /* @__PURE__ */ w({
155
+ __name: "BillSeqNumber",
156
+ props: {
157
+ row: {},
158
+ data: {}
159
+ },
160
+ setup(P) {
161
+ return (f, b) => {
162
+ const m = T("FmIcon");
163
+ return R(), q("span", Ae, [
164
+ H(W(P.row.original.seqNumber) + " ", 1),
165
+ y(m, {
166
+ size: "md",
167
+ name: "check",
168
+ color: "#16a34a"
169
+ })
170
+ ]);
171
+ };
172
+ }
173
+ }), Se = { class: "flex justify-between mb-6 items-center" }, Ne = { class: "flex space-x-8 items-start" }, Ee = { class: "flex space-x-4 self-center" }, Fe = { class: "flex space-x-12 mb-6" }, je = /* @__PURE__ */ w({
174
+ __name: "Transaction",
175
+ setup(P) {
176
+ var a, h;
177
+ const f = ce(), b = ue(), { sessionUser: m } = z(), { t: o } = G(), { getBillLink: U } = _e(), v = I(), { dateRange: p, searchKey: g, status: d, id: u, by: _ } = ae({
178
+ by: "",
179
+ id: "",
180
+ searchKey: "",
181
+ status: [x.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS],
182
+ dateRange: {
183
+ startDate: B().startOf("day").format("YYYY-MM-DD"),
184
+ endDate: B().endOf("day").format("YYYY-MM-DD")
185
+ }
186
+ });
187
+ let A;
188
+ D(g, async () => {
189
+ A && clearTimeout(A), A = setTimeout(
190
+ () => {
191
+ var t;
192
+ return (t = v.value) == null ? void 0 : t.reset();
193
+ },
194
+ 700
195
+ );
196
+ }), D([p, d, u, _], () => {
197
+ var t;
198
+ (t = v.value) == null || t.reset();
199
+ });
200
+ const N = [
201
+ {
202
+ label: "Success",
203
+ value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS
204
+ },
205
+ {
206
+ label: "Refunded",
207
+ value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED
208
+ },
209
+ {
210
+ label: "Process",
211
+ value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING
212
+ },
213
+ {
214
+ label: "Pending Settlement",
215
+ value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING_SETTLEMENT
216
+ },
217
+ {
218
+ label: "Failed",
219
+ value: x.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED
220
+ }
221
+ ];
222
+ async function $(t, e) {
223
+ var n;
224
+ try {
225
+ const l = await C.refetchTransaction({ transactionId: t.id });
226
+ (n = v.value) == null || n.replaceData(e, l), f.open({
227
+ type: "success",
228
+ title: "Transaction queried and updated successfully."
229
+ });
230
+ } catch (l) {
231
+ f.open({
232
+ type: "error",
233
+ title: "Fail to query transaction.",
234
+ message: L(l)
235
+ });
236
+ }
237
+ }
238
+ async function K(t, e) {
239
+ O(
240
+ b,
241
+ "Refund Transaction",
242
+ "Are you sure to refund transaction? This action cannot be revert!",
243
+ async () => {
244
+ var n;
245
+ try {
246
+ const l = await C.refundTransaction({
247
+ transactionId: t.id,
248
+ reason: "portal transaction refund",
249
+ amount: t.fdoAmount
250
+ });
251
+ (n = v.value) == null || n.replaceData(e, l), f.open({
252
+ type: "success",
253
+ title: "Transaction refund request initiated."
254
+ });
255
+ } catch (l) {
256
+ f.open({
257
+ type: "error",
258
+ title: "Fail to request refund transaction.",
259
+ message: L(l)
260
+ });
261
+ }
262
+ }
263
+ );
264
+ }
265
+ async function k(t, e) {
266
+ O(
267
+ b,
268
+ "Notify Transaction",
269
+ "Are you sure to perform notify transaction?",
270
+ async () => {
271
+ try {
272
+ await C.renotifyTransaction(t.id), f.open({
273
+ type: "success",
274
+ title: "Transaction notify successfully."
275
+ });
276
+ } catch (n) {
277
+ f.open({
278
+ type: "error",
279
+ title: "Fail to notify transaction.",
280
+ message: L(n)
281
+ });
282
+ }
283
+ }
284
+ );
285
+ }
286
+ async function i(t, e) {
287
+ const n = ye([
288
+ {
289
+ type: "span",
290
+ queryKey: "transaction.id",
291
+ queryValue: t.id
292
+ }
293
+ ], t.transactionAt);
294
+ window.open(n, "_blank");
295
+ }
296
+ I("");
297
+ const r = [
298
+ {
299
+ header: () => o("payment.transactions.table.id"),
300
+ accessorKey: "id",
301
+ cell: ({ cell: t, row: e }) => {
302
+ var n, l;
303
+ return ((n = m.value) != null && n.role.isStaff || (l = m.value) != null && l.role.isAdmin) && e.original.transactionId ? e.original.id + `
304
+ ID: ` + e.original.transactionId : e.original.id;
305
+ }
306
+ },
307
+ {
308
+ header: () => o("payment.transactions.table.pay_id"),
309
+ accessorKey: "payId",
310
+ cell: ({ cell: t, row: e }) => {
311
+ const n = U(e.original);
312
+ return n ? F("a", {
313
+ href: n,
314
+ class: "text-blue-600 underline"
315
+ }, t.getValue()) : t.getValue();
316
+ }
317
+ },
318
+ {
319
+ header: () => o("payment.transactions.table.gateway_id"),
320
+ accessorKey: "gatewayTransactionId"
321
+ },
322
+ {
323
+ header: () => o("payment.transactions.table.bill_seq"),
324
+ accessorKey: "seqNumber",
325
+ cell: ({ cell: t, row: e }) => e.original.seqNumberBinded ? F(he, { row: e, data: t.getValue() }) : e.original.seqNumber
326
+ },
327
+ {
328
+ header: () => o("payment.transactions.table.gateway"),
329
+ accessorKey: "gateway",
330
+ meta: {
331
+ textAlign: "center"
332
+ },
333
+ cell: ({ cell: t, row: e }) => e.original.gateway ? F(me, { row: e, data: t.getValue() }) : ""
334
+ },
335
+ {
336
+ header: () => o("payment.transactions.table.method"),
337
+ accessorKey: "method",
338
+ meta: {
339
+ textAlign: "center"
340
+ },
341
+ cell: ({ cell: t, row: e }) => e.original.method ? F(de, { row: e, data: t.getValue() }) : ""
342
+ },
343
+ {
344
+ header: () => o("payment.transactions.table.type"),
345
+ accessorKey: "payFor",
346
+ meta: {
347
+ textAlign: "center"
348
+ }
349
+ },
350
+ {
351
+ header: () => o("payment.transactions.table.status"),
352
+ accessorKey: "status",
353
+ cell: ({ cell: t }) => F(te, { data: t.getValue() })
354
+ },
355
+ {
356
+ header: () => o("payment.transactions.table.restaurant"),
357
+ accessorKey: "restaurantId"
358
+ },
359
+ {
360
+ header: () => o("payment.transactions.table.source"),
361
+ accessorKey: "source",
362
+ cell: ({ cell: t, row: e }) => `(${e.original.sourceType}) ${e.original.source}`
363
+ },
364
+ {
365
+ header: () => o("payment.transactions.table.transaction_at"),
366
+ accessorKey: "transactionAt",
367
+ meta: {
368
+ width: "180px"
369
+ },
370
+ cell: ({ cell: t, row: e }) => e.original.status === "REFUNDED" ? e.original.refundedAt : e.original.transactionAt
371
+ },
372
+ {
373
+ header: () => o("payment.transactions.table.sales_amount"),
374
+ accessorKey: "amount",
375
+ cell: ({ cell: t, row: e }) => {
376
+ var n, l;
377
+ return ((n = m.value) != null && n.role.isStaff || (l = m.value) != null && l.role.isAdmin) && e.original.flags.isDelivery ? e.original.amount + "( " + e.original.gatewayAmount + ")" : e.original.amount;
378
+ }
379
+ }
380
+ ];
381
+ return ((a = m.value) != null && a.role.isStaff || (h = m.value) != null && h.role.isAdmin) && r.push({
382
+ header: () => o("payment.transactions.table.actions"),
383
+ accessorKey: "actions",
384
+ cell: ({ row: t }) => F(pe, {
385
+ transaction: t.original,
386
+ onAction: (e) => {
387
+ var n;
388
+ switch (e) {
389
+ case "notify":
390
+ return k(t.original, t.index);
391
+ case "query":
392
+ return $(t.original, t.index);
393
+ case "refund":
394
+ return (n = m.value) != null && n.role.isStaff ? f.open({
395
+ type: "error",
396
+ title: "You are not allowed to refund transaction."
397
+ }) : K(t.original, t.index);
398
+ case "history":
399
+ return i(t.original, t.index);
400
+ }
401
+ }
402
+ })
403
+ }), (t, e) => {
404
+ const n = T("FmSearch"), l = T("FmSelect");
405
+ return R(), Y(X, {
406
+ title: s(o)("payment.transactions.title"),
407
+ description: s(o)("payment.transactions.description"),
408
+ loading: !1
409
+ }, {
410
+ default: M(() => [
411
+ S("div", Se, [
412
+ S("div", Ne, [
413
+ y(n, {
414
+ "model-value": s(g),
415
+ "onUpdate:modelValue": e[0] || (e[0] = (c) => E(g) ? g.value = c : null),
416
+ class: "mr-8",
417
+ label: s(o)("payment.transactions.search.title"),
418
+ placeholder: s(o)("payment.transactions.search.placeholder")
419
+ }, null, 8, ["model-value", "label", "placeholder"]),
420
+ y(l, {
421
+ modelValue: s(d),
422
+ "onUpdate:modelValue": e[2] || (e[2] = (c) => E(d) ? d.value = c : null),
423
+ class: "mr-6 w-[300px]",
424
+ label: s(o)("payment.transactions.status"),
425
+ "label-mark": "required",
426
+ multiselect: "",
427
+ items: N
428
+ }, {
429
+ "prepend-menu": M(() => [
430
+ y(re, {
431
+ modelValue: s(d),
432
+ "onUpdate:modelValue": e[1] || (e[1] = (c) => E(d) ? d.value = c : null),
433
+ items: N
434
+ }, null, 8, ["modelValue"])
435
+ ]),
436
+ _: 1
437
+ }, 8, ["modelValue", "label"])
438
+ ]),
439
+ S("div", Ee, [
440
+ y(ne, {
441
+ button: {
442
+ appendIcon: "file_download",
443
+ variant: "primary",
444
+ label: s(o)("payment.transactions.button.export")
445
+ },
446
+ handler: async () => {
447
+ var V;
448
+ const c = await ((V = v.value) == null ? void 0 : V.allData());
449
+ c != null && await s(C).downloadPortalTransactionReport(s(p), s(Z)(c));
450
+ }
451
+ }, null, 8, ["button", "handler"])
452
+ ])
453
+ ]),
454
+ S("div", Fe, [
455
+ y(Te, {
456
+ id: s(u),
457
+ "onUpdate:id": e[3] || (e[3] = (c) => E(u) ? u.value = c : null),
458
+ by: s(_),
459
+ "onUpdate:by": e[4] || (e[4] = (c) => E(_) ? _.value = c : null)
460
+ }, null, 8, ["id", "by"]),
461
+ y(se, {
462
+ modelValue: s(p),
463
+ "onUpdate:modelValue": e[5] || (e[5] = (c) => E(p) ? p.value = c : null)
464
+ }, null, 8, ["modelValue"])
465
+ ]),
466
+ y(fe, {
467
+ ref_key: "controller",
468
+ ref: v,
469
+ "column-defs": r,
470
+ "rows-defs": s(ee),
471
+ paginate: (c, V) => s(C).readTransactionsV2({
472
+ limit: c,
473
+ cursor: V,
474
+ status: s(d),
475
+ by: s(_),
476
+ id: s(u),
477
+ search: s(g),
478
+ start: s(p).startDate,
479
+ end: s(p).endDate
480
+ })
481
+ }, null, 8, ["rows-defs", "paginate"])
482
+ ]),
483
+ _: 1
484
+ }, 8, ["title", "description"]);
485
+ };
486
+ }
487
+ });
488
+ export {
489
+ je as default
490
+ };