@feedmepos/mf-payment 1.7.0 → 1.7.3

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 (47) hide show
  1. package/dist/{Actions.vue_vue_type_script_setup_true_lang-eppVogL4.js → Actions.vue_vue_type_script_setup_true_lang-C0vtW1mG.js} +1 -1
  2. package/dist/AdminBusinessSelector.vue_vue_type_script_setup_true_lang-Dlc5qhqj.js +140 -0
  3. package/dist/{AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-Ee0Kcdli.js → AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-DUcR8dnK.js} +2 -2
  4. package/dist/{Chargeback-jT9X2WFA.js → Chargeback-DJwWFEMC.js} +5 -5
  5. package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-CdfIF2L-.js → DocumentViewer.vue_vue_type_script_setup_true_lang-DgUYOcVH.js} +1 -1
  6. package/dist/{OnboardForm-ijX8FIZm.js → OnboardForm-BjxwdZBj.js} +5 -5
  7. package/dist/{OnboardForm-BGBrKIbM.js → OnboardForm-C4x52ic-.js} +5 -5
  8. package/dist/{OnboardSubmission-B3lcdEGp.js → OnboardSubmission-BPvY5F_v.js} +2 -2
  9. package/dist/{OnboardSubmission-B3MuOwB7.js → OnboardSubmission-BYqtbwF1.js} +5 -5
  10. package/dist/PayoutAccount-eo1124GB.js +399 -0
  11. package/dist/{PayoutAccount-CRJgMDkh.js → PayoutAccount-mBiukFuW.js} +5 -5
  12. package/dist/{PayoutAccountSetting-Cz4Q8Nw3.js → PayoutAccountSetting-B5qa7Tay.js} +6 -6
  13. package/dist/{Restaurant-BqSRu2oB.js → Restaurant-qvBGTKUM.js} +4 -4
  14. package/dist/{RestaurantSetting-DQG-5w2m.js → RestaurantSetting-C1RnTMny.js} +3 -3
  15. package/dist/{Settlement-BNEDs442.js → Settlement-Cm3ahfMO.js} +87 -86
  16. package/dist/{Settlement-BdbmT2V9.js → Settlement-DcppFJan.js} +3 -3
  17. package/dist/{SettlementTransactions-DkUCtlRh.js → SettlementTransactions-AxnuTXRM.js} +4 -4
  18. package/dist/{SettlementTransactions-DUkhc-Q6.js → SettlementTransactions-DykuJ5sH.js} +4 -4
  19. package/dist/{Status.vue_vue_type_script_setup_true_lang-Bo7M8cD8.js → Status.vue_vue_type_script_setup_true_lang-BXojdBbs.js} +1 -1
  20. package/dist/{Terminal-DjSvvdd5.js → Terminal-BLq4uoFd.js} +5 -5
  21. package/dist/{TerminalSetting-CjSfDoXo.js → TerminalSetting-vQcQLV_v.js} +4 -4
  22. package/dist/Transaction-C2RBulBV.js +1005 -0
  23. package/dist/{Transaction-BI9Y1L8-.js → Transaction-CGZIey5t.js} +10 -10
  24. package/dist/{TransactionOld-D2uBVn6-.js → TransactionOld-Cyat_9Jm.js} +7 -7
  25. package/dist/api/payout/index.d.ts +4 -0
  26. package/dist/api/settlement/index.d.ts +6 -0
  27. package/dist/{app-Bv9EfJm8.js → app-xQjL6kAa.js} +24 -23
  28. package/dist/app.js +1 -1
  29. package/dist/{assets-Bt1SQIBr.js → assets-C-BcsR-y.js} +1 -1
  30. package/dist/{grafana-C1LGsF7g.js → grafana-CmQSpnyb.js} +1 -1
  31. package/dist/{index-BCpKOPCB.js → index-BbYvssG-.js} +27 -19
  32. package/dist/{index-D9LWgOgk.js → index-BmH37WyN.js} +1 -1
  33. package/dist/{index-DRTaSAHc.js → index-C5O-s4jh.js} +1 -1
  34. package/dist/{index-CdgUOxke.js → index-CBiZ4kcs.js} +34 -29
  35. package/dist/{index-gTLQWhrT.js → index-CyqhTgxa.js} +1 -1
  36. package/dist/{index-BQ7YWpB_.js → index-D5EqmdP2.js} +1 -1
  37. package/dist/{index-r34z-yqf.js → index-Dg5Q81XT.js} +2 -2
  38. package/dist/{index-9-IsOLYo.js → index-DgVvuZtu.js} +1 -1
  39. package/dist/{index-C-3b4IKH.js → index-hjYQcl9v.js} +1 -1
  40. package/dist/{index.vue_vue_type_script_setup_true_lang-D1UlVu4n.js → index.vue_vue_type_script_setup_true_lang-DiBVvISs.js} +1 -1
  41. package/dist/package.json +1 -1
  42. package/dist/{payout-account-CNsrpNV-.js → payout-account-GcdK3vkD.js} +3 -3
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/views/admin/payout-account/CreateDummyPayoutDialog.vue.d.ts +2 -0
  45. package/package.json +1 -1
  46. package/dist/PayoutAccount-QPYj4pDq.js +0 -273
  47. package/dist/Transaction-BAmiWdbA.js +0 -1135
@@ -0,0 +1,1005 @@
1
+ import { reactive as ie, computed as A, watch as O, defineComponent as E, useModel as ue, toRef as pe, ref as ae, resolveComponent as b, openBlock as g, createBlock as N, withCtx as D, createVNode as f, createElementVNode as S, unref as T, createElementBlock as M, Fragment as ce, renderList as de, toDisplayString as W, createCommentVNode as me, withModifiers as ye, mergeModels as ne, createTextVNode as fe, onBeforeUnmount as ve, isRef as z, h as $ } from "vue";
2
+ import { t as U } from "./index-C5O-s4jh.js";
3
+ import { h as J } from "./moment-h96o7c8I.js";
4
+ import { p as V } from "./index-D5EqmdP2.js";
5
+ import { g as ge, a as be, t as _e, _ as he, b as Q } from "./assets-C-BcsR-y.js";
6
+ import { u as Fe } from "./index-DgVvuZtu.js";
7
+ import { useRoute as Te, useRouter as Ae } from "vue-router";
8
+ import { _ as Se } from "./AdminLayout.vue_vue_type_script_setup_true_lang-0Mf1MhAL.js";
9
+ import { _ as Ie } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
10
+ import { _ as we } from "./SelectAll.vue_vue_type_script_setup_true_lang-BNZTqdoF.js";
11
+ import { useSnackbar as De, useDialog as xe } from "@feedmepos/ui-library";
12
+ import { w as oe } from "./Modal-DB8M9o1T.js";
13
+ import { u as B } from "./error-K1CakhA9.js";
14
+ import { _ as Pe } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-CDjdQf-E.js";
15
+ import { u as ee, _ as Ne } from "./AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-DUcR8dnK.js";
16
+ import { _ as Ve } from "./AdminBusinessSelector.vue_vue_type_script_setup_true_lang-Dlc5qhqj.js";
17
+ import { p as te } from "./index-CBiZ4kcs.js";
18
+ import { useI18n as ke, useCoreStore as Ce } from "@feedmepos/mf-common";
19
+ import { k as Me, h as se } from "./app-xQjL6kAa.js";
20
+ import { g as Ee } from "./grafana-CmQSpnyb.js";
21
+ import { _ as $e } from "./index.vue_vue_type_script_setup_true_lang-DiBVvISs.js";
22
+ import { _ as Ue } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-DrBLdVka.js";
23
+ import { _ as re } from "./TextInputDialog.vue_vue_type_script_setup_true_lang-C3AeZqwO.js";
24
+ import { u as Oe, a as qe } from "./index-n58-Qewm.js";
25
+ import { s as le } from "./validator-CTlVogBQ.js";
26
+ const H = {
27
+ businessFilter: "",
28
+ restaurantFilter: "",
29
+ payoutAccountId: "",
30
+ amount: null
31
+ };
32
+ function Re() {
33
+ var c, w, _;
34
+ const o = Te(), a = Ae(), n = ie({
35
+ ...H,
36
+ businessFilter: ((c = o.query.businessFilter) == null ? void 0 : c.toString()) || "",
37
+ restaurantFilter: ((w = o.query.restaurantFilter) == null ? void 0 : w.toString()) || "",
38
+ payoutAccountId: ((_ = o.query.payoutAccountFilter) == null ? void 0 : _.toString()) || ""
39
+ }), y = A(() => {
40
+ let p = 0;
41
+ return n.businessFilter && p++, n.restaurantFilter && p++, n.payoutAccountId && p++, n.amount !== null && n.amount !== void 0 && p++, p;
42
+ }), v = A(() => y.value > 0);
43
+ function i() {
44
+ Object.assign(n, { ...H });
45
+ }
46
+ function I(p) {
47
+ Object.assign(n, { ...p });
48
+ }
49
+ return O(
50
+ () => [n.businessFilter, n.restaurantFilter, n.payoutAccountId],
51
+ ([p, d, m]) => {
52
+ a.replace({
53
+ name: o.name,
54
+ query: {
55
+ ...o.query,
56
+ businessFilter: p || void 0,
57
+ restaurantFilter: d || void 0,
58
+ payoutAccountFilter: m || void 0
59
+ }
60
+ });
61
+ }
62
+ ), {
63
+ filter: n,
64
+ activeCount: y,
65
+ hasActiveFilters: v,
66
+ reset: i,
67
+ apply: I,
68
+ defaultState: H
69
+ };
70
+ }
71
+ const Ge = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 bg-fm-color-neutral-gray-100 cursor-pointer" }, Be = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, Ke = { class: "relative min-w-[280px]" }, Le = { class: "sticky top-0 py-8 bg-white translate-y-[-12px]" }, Ye = {
72
+ key: 0,
73
+ class: "px-8 py-12 text-center fm-typo-en-body-md-400 text-fm-color-neutral-gray-500"
74
+ }, je = /* @__PURE__ */ E({
75
+ __name: "AdminPayoutAccountSelector",
76
+ props: /* @__PURE__ */ ne({
77
+ label: {},
78
+ labelMark: {},
79
+ placeholder: {},
80
+ searchPlaceholder: {},
81
+ rules: {},
82
+ businessId: {}
83
+ }, {
84
+ modelValue: { default: "" },
85
+ modelModifiers: {}
86
+ }),
87
+ emits: ["update:modelValue"],
88
+ setup(o) {
89
+ const a = o, n = ue(o, "modelValue"), { t: y } = ke(), v = pe(a, "businessId"), i = ae(""), I = ae("");
90
+ let c = null;
91
+ O(i, (s) => {
92
+ c && clearTimeout(c), c = setTimeout(() => I.value = s, 300);
93
+ }), O(v, () => {
94
+ n.value = "";
95
+ });
96
+ function w(s) {
97
+ return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
98
+ }
99
+ const _ = (s) => {
100
+ var C, q, R, t, e;
101
+ const P = (C = s.store) != null && C.event ? w(s.store.event) : void 0;
102
+ return {
103
+ label: ((R = (q = s.ref) == null ? void 0 : q.profile) == null ? void 0 : R.name) ?? ((t = s.ref) == null ? void 0 : t.name) ?? ((e = s.store) == null ? void 0 : e.id) ?? s._id,
104
+ sublabel: P ? `Payout Account (${P})` : "Payout Account",
105
+ value: s._id
106
+ };
107
+ }, p = A(
108
+ () => v.value ? ["admin-payout-accounts", "business", v.value] : ["admin-payout-accounts"]
109
+ ), { data: d, isLoading: m } = ee({
110
+ queryKey: p,
111
+ queryFn: () => te.read({
112
+ status: [
113
+ V.F_PAYOUT_ACCOUNT_STATUS.Enum.APPROVED,
114
+ V.F_PAYOUT_ACCOUNT_STATUS.Enum.PENDING
115
+ ],
116
+ searchKey: "",
117
+ cursor: "",
118
+ limit: 20,
119
+ businessId: v.value
120
+ }).then((s) => s.data),
121
+ select: (s) => s.map(_)
122
+ }), { data: x, isLoading: G } = ee({
123
+ queryKey: A(() => [...p.value, "search", I.value]),
124
+ queryFn: () => te.read({
125
+ status: [
126
+ V.F_PAYOUT_ACCOUNT_STATUS.Enum.APPROVED,
127
+ V.F_PAYOUT_ACCOUNT_STATUS.Enum.PENDING
128
+ ],
129
+ searchKey: I.value,
130
+ cursor: "",
131
+ limit: 20,
132
+ businessId: v.value
133
+ }).then((s) => s.data),
134
+ select: (s) => s.map(_),
135
+ enabled: A(() => I.value.length > 0),
136
+ placeholderData: Me
137
+ }), { data: k, isLoading: h } = ee({
138
+ queryKey: A(() => ["admin-payout-accounts", n.value]),
139
+ queryFn: () => te.readById(n.value).then((s) => s ? _(s) : null),
140
+ enabled: A(
141
+ () => !!n.value && !(d.value ?? []).some((s) => s.value === n.value)
142
+ )
143
+ }), K = A(() => d.value ?? []), L = A(
144
+ () => i.value ? x.value ?? [] : K.value
145
+ ), Y = A(
146
+ () => m.value || G.value || h.value
147
+ ), j = A(
148
+ () => K.value.find((s) => s.value === n.value) ?? k.value ?? void 0
149
+ ), X = A(
150
+ () => i.value && !Y.value && L.value.length === 0
151
+ ), Z = (s) => {
152
+ n.value = s, i.value = "";
153
+ };
154
+ return (s, P) => {
155
+ const C = b("FmIcon"), q = b("FmCircularProgress"), R = b("FmSearch"), t = b("FmMenuItem"), e = b("FmMenu"), r = b("FmFormGroup");
156
+ return g(), N(r, {
157
+ modelValue: n.value,
158
+ "onUpdate:modelValue": P[2] || (P[2] = (u) => n.value = u),
159
+ label: a.label ?? "Payout Account",
160
+ "label-mark": a.labelMark,
161
+ rules: a.rules
162
+ }, {
163
+ default: D(() => [
164
+ f(e, { "close-on-click": !0 }, {
165
+ "menu-button": D(() => {
166
+ var u;
167
+ return [
168
+ S("div", Ge, [
169
+ f(C, {
170
+ name: "account_balance_wallet",
171
+ size: "sm"
172
+ }),
173
+ S("div", Be, W(((u = j.value) == null ? void 0 : u.label) ?? a.placeholder ?? T(y)("payment.components.select")), 1),
174
+ Y.value ? (g(), N(q, {
175
+ key: 0,
176
+ size: "md"
177
+ })) : j.value ? (g(), N(C, {
178
+ key: 1,
179
+ name: "close",
180
+ size: "sm",
181
+ onClick: P[0] || (P[0] = ye((l) => n.value = "", ["stop"]))
182
+ })) : (g(), N(C, {
183
+ key: 2,
184
+ name: "expand_more",
185
+ size: "sm"
186
+ }))
187
+ ])
188
+ ];
189
+ }),
190
+ default: D(() => [
191
+ S("div", Ke, [
192
+ S("div", Le, [
193
+ f(R, {
194
+ "model-value": i.value,
195
+ "onUpdate:modelValue": P[1] || (P[1] = (u) => i.value = u),
196
+ placeholder: a.searchPlaceholder ?? a.placeholder ?? T(y)("payment.components.select")
197
+ }, null, 8, ["model-value", "placeholder"])
198
+ ]),
199
+ (g(!0), M(ce, null, de(L.value, (u) => (g(), N(t, {
200
+ key: u.value,
201
+ label: u.label,
202
+ sublabel: u.sublabel,
203
+ onClick: (l) => Z(u.value)
204
+ }, null, 8, ["label", "sublabel", "onClick"]))), 128)),
205
+ X.value ? (g(), M("div", Ye, W(T(y)("payment.components.no_results")), 1)) : me("", !0)
206
+ ])
207
+ ]),
208
+ _: 1
209
+ })
210
+ ]),
211
+ _: 1
212
+ }, 8, ["modelValue", "label", "label-mark", "rules"]);
213
+ };
214
+ }
215
+ }), ze = { class: "relative inline-flex" }, Je = { class: "flex flex-col gap-6 px-4 py-6" }, Qe = { class: "flex gap-2 items-center justify-start" }, He = /* @__PURE__ */ E({
216
+ __name: "AdvancedFilterPanel",
217
+ props: /* @__PURE__ */ ne({
218
+ filter: {},
219
+ activeCount: {},
220
+ hasActiveFilters: { type: Boolean },
221
+ disable: { type: Boolean }
222
+ }, {
223
+ modelValue: { type: Boolean, default: !1 },
224
+ modelModifiers: {}
225
+ }),
226
+ emits: /* @__PURE__ */ ne(["apply", "reset"], ["update:modelValue"]),
227
+ setup(o, { emit: a }) {
228
+ const n = o, y = a, v = ue(o, "modelValue"), i = ie({ ...n.filter }), I = A({
229
+ get: () => i.amount != null ? String(i.amount) : "",
230
+ set: (p) => {
231
+ const d = Number(p);
232
+ i.amount = p === "" ? null : Number.isFinite(d) ? d : null;
233
+ }
234
+ });
235
+ O(v, (p) => {
236
+ p && Object.assign(i, { ...n.filter });
237
+ }), O(
238
+ () => i.businessFilter,
239
+ (p, d) => {
240
+ p !== d && (i.restaurantFilter = "", i.payoutAccountId = "");
241
+ }
242
+ );
243
+ function c() {
244
+ y("apply", { ...i }), v.value = !1;
245
+ }
246
+ function w() {
247
+ Object.assign(i, { ...H }), y("reset"), v.value = !1;
248
+ }
249
+ function _() {
250
+ v.value = !1;
251
+ }
252
+ return (p, d) => {
253
+ const m = b("FmButton"), x = b("FmBadge"), G = b("FmTextField"), k = b("FmSideSheet");
254
+ return g(), N(k, {
255
+ modelValue: v.value,
256
+ "onUpdate:modelValue": d[6] || (d[6] = (h) => v.value = h),
257
+ header: "Advanced filters",
258
+ "dismiss-away": "",
259
+ "onOn:clickedAway": _
260
+ }, {
261
+ "side-sheet-button": D(() => [
262
+ S("div", ze, [
263
+ f(m, {
264
+ variant: "plain",
265
+ size: "md",
266
+ "prepend-icon": "tune",
267
+ label: "Advanced filters"
268
+ }),
269
+ o.hasActiveFilters ? (g(), N(x, {
270
+ key: 0,
271
+ value: o.activeCount,
272
+ variant: "neutral",
273
+ class: "bg-fm-color-primary text-fm-color-typo-white"
274
+ }, null, 8, ["value"])) : me("", !0)
275
+ ])
276
+ ]),
277
+ "side-sheet-footer": D(() => [
278
+ S("div", Qe, [
279
+ f(m, {
280
+ variant: "primary",
281
+ label: "Apply",
282
+ onClick: d[4] || (d[4] = (h) => c())
283
+ }),
284
+ f(m, {
285
+ variant: "secondary",
286
+ label: "Reset",
287
+ onClick: d[5] || (d[5] = (h) => w())
288
+ })
289
+ ])
290
+ ]),
291
+ default: D(() => [
292
+ S("div", Je, [
293
+ f(Ve, {
294
+ modelValue: i.businessFilter,
295
+ "onUpdate:modelValue": d[0] || (d[0] = (h) => i.businessFilter = h),
296
+ label: "Business",
297
+ placeholder: "All businesses",
298
+ "search-placeholder": "Search businesses"
299
+ }, null, 8, ["modelValue"]),
300
+ f(Ne, {
301
+ modelValue: i.restaurantFilter,
302
+ "onUpdate:modelValue": d[1] || (d[1] = (h) => i.restaurantFilter = h),
303
+ "business-id": i.businessFilter,
304
+ label: "Restaurant",
305
+ placeholder: "All restaurants",
306
+ "search-placeholder": "Search restaurants"
307
+ }, null, 8, ["modelValue", "business-id"]),
308
+ f(je, {
309
+ modelValue: i.payoutAccountId,
310
+ "onUpdate:modelValue": d[2] || (d[2] = (h) => i.payoutAccountId = h),
311
+ "business-id": i.businessFilter,
312
+ label: "Payout Account",
313
+ placeholder: "All payout accounts",
314
+ "search-placeholder": "Search payout accounts"
315
+ }, null, 8, ["modelValue", "business-id"]),
316
+ f(G, {
317
+ modelValue: I.value,
318
+ "onUpdate:modelValue": d[3] || (d[3] = (h) => I.value = h),
319
+ label: "Amount",
320
+ type: "number",
321
+ placeholder: "Exact amount",
322
+ disabled: o.disable
323
+ }, null, 8, ["modelValue", "disabled"])
324
+ ])
325
+ ]),
326
+ _: 1
327
+ }, 8, ["modelValue"]);
328
+ };
329
+ }
330
+ }), We = ["src"], Xe = /* @__PURE__ */ E({
331
+ __name: "Gateway",
332
+ props: {
333
+ row: {},
334
+ data: {}
335
+ },
336
+ setup(o) {
337
+ return (a, n) => {
338
+ const y = b("FmTooltip");
339
+ return g(), N(y, {
340
+ variant: "plain",
341
+ placement: "top",
342
+ content: o.row.original.gateway,
343
+ "hide-arrow": !0
344
+ }, {
345
+ default: D(() => [
346
+ S("img", {
347
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
348
+ src: T(ge)(o.row.original.gateway)
349
+ }, null, 8, We)
350
+ ]),
351
+ _: 1
352
+ }, 8, ["content"]);
353
+ };
354
+ }
355
+ }), Ze = ["src"], et = /* @__PURE__ */ E({
356
+ __name: "Method",
357
+ props: {
358
+ row: {},
359
+ data: {}
360
+ },
361
+ setup(o) {
362
+ return (a, n) => {
363
+ const y = b("FmTooltip");
364
+ return g(), N(y, {
365
+ variant: "plain",
366
+ placement: "top",
367
+ content: o.row.original.method.issuer,
368
+ "hide-arrow": !0
369
+ }, {
370
+ default: D(() => [
371
+ S("img", {
372
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
373
+ src: T(be)(o.row.original.method.issuer, o.row.original.method.variant)
374
+ }, null, 8, Ze)
375
+ ]),
376
+ _: 1
377
+ }, 8, ["content"]);
378
+ };
379
+ }
380
+ }), tt = /* @__PURE__ */ E({
381
+ __name: "Actions",
382
+ props: {
383
+ onAction: { type: Function },
384
+ transaction: {}
385
+ },
386
+ setup(o) {
387
+ const a = A(() => [
388
+ o.transaction.flags.query && {
389
+ label: "Query",
390
+ sublabel: "Perform transaction status inquriy",
391
+ icon: "question_answer",
392
+ action: "query"
393
+ },
394
+ o.transaction.flags.refund && {
395
+ label: "Refund",
396
+ sublabel: "Perform transaction refund request",
397
+ icon: "request_page",
398
+ action: "refund"
399
+ },
400
+ o.transaction.flags.notify && {
401
+ label: "Notify",
402
+ sublabel: "Perform webhook notification for transaction",
403
+ icon: "webhook",
404
+ action: "notify"
405
+ },
406
+ o.transaction.callbackResponse != null && {
407
+ label: "Show Transaction Metadata",
408
+ sublabel: "Display the transaction callback metadata in JSON.",
409
+ icon: "code",
410
+ action: "transactionMetadata"
411
+ },
412
+ {
413
+ label: "Log",
414
+ sublabel: "Inspect transaction historical actions, requests and responses.",
415
+ icon: "history",
416
+ action: "history"
417
+ },
418
+ {
419
+ label: "Set Pay ID",
420
+ sublabel: "Set a pay ID for this transaction",
421
+ icon: "receipt_long",
422
+ action: "setPayId"
423
+ },
424
+ {
425
+ label: "Set Gateway ID",
426
+ sublabel: "Set a gateway transaction ID",
427
+ icon: "link",
428
+ action: "setGatewayId"
429
+ }
430
+ ]);
431
+ return (n, y) => {
432
+ const v = b("FmIcon"), i = b("FmMenuItem"), I = b("FmMenu");
433
+ return g(), M("div", {
434
+ onClick: y[0] || (y[0] = (c) => {
435
+ c.stopPropagation();
436
+ })
437
+ }, [
438
+ f(I, null, {
439
+ "menu-button": D(() => [
440
+ f(v, { name: "settings" })
441
+ ]),
442
+ default: D(() => [
443
+ (g(!0), M(ce, null, de(a.value.filter((c) => !!c), (c) => (g(), N(i, {
444
+ selectable: !0,
445
+ key: c.label,
446
+ sublabel: c.sublabel,
447
+ label: c.label,
448
+ icon: c.icon,
449
+ onclick: () => o.onAction(c.action)
450
+ }, null, 8, ["sublabel", "label", "icon", "onclick"]))), 128))
451
+ ]),
452
+ _: 1
453
+ })
454
+ ]);
455
+ };
456
+ }
457
+ }), at = { class: "pb-24" }, nt = {
458
+ key: 0,
459
+ class: "bg-gray-50 border border-gray-200 rounded-md p-16 text-xs font-mono overflow-auto max-h-[60vh]"
460
+ }, ot = {
461
+ key: 1,
462
+ class: "text-gray-500 text-sm"
463
+ }, st = /* @__PURE__ */ E({
464
+ __name: "TransactionMetadataDialog",
465
+ props: {
466
+ transactionMetadata: {}
467
+ },
468
+ setup(o) {
469
+ const a = o, n = () => {
470
+ if (a.transactionMetadata == null)
471
+ return "No transaction metadata available.";
472
+ try {
473
+ return JSON.stringify(a.transactionMetadata, null, 2);
474
+ } catch {
475
+ return String(a.transactionMetadata);
476
+ }
477
+ };
478
+ return (y, v) => (g(), M("div", at, [
479
+ a.transactionMetadata != null ? (g(), M("pre", nt, W(n()), 1)) : (g(), M("div", ot, " No transaction metadata available for this transaction. "))
480
+ ]));
481
+ }
482
+ }), rt = { class: "flex items-center gap-1" }, lt = /* @__PURE__ */ E({
483
+ __name: "BillSeqNumber",
484
+ props: {
485
+ row: {},
486
+ data: {}
487
+ },
488
+ setup(o) {
489
+ return (a, n) => {
490
+ const y = b("FmIcon");
491
+ return g(), M("span", rt, [
492
+ fe(W(o.row.original.seqNumber) + " ", 1),
493
+ f(y, {
494
+ size: "md",
495
+ name: "check",
496
+ color: "#16a34a"
497
+ })
498
+ ]);
499
+ };
500
+ }
501
+ }), it = { class: "flex flex-row justify-between items-end mb-6" }, ut = { class: "flex flex-col" }, ct = { class: "flex items-start mb-2 gap-3" }, dt = { class: "flex gap-3" }, Ut = /* @__PURE__ */ E({
502
+ __name: "Transaction",
503
+ setup(o) {
504
+ const a = ae(), { filter: n, activeCount: y, hasActiveFilters: v, reset: i, apply: I } = Re(), { dateRange: c, searchKey: w, status: _ } = Fe({
505
+ searchKey: "",
506
+ status: [V.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS],
507
+ dateRange: {
508
+ startDate: J().startOf("day").format("YYYY-MM-DD"),
509
+ endDate: J().endOf("day").format("YYYY-MM-DD")
510
+ }
511
+ }), p = [
512
+ {
513
+ label: "Success",
514
+ value: V.F_PAYMENT_TRANSACTION_STATUS.Enum.SUCCESS
515
+ },
516
+ {
517
+ label: "Refunded",
518
+ value: V.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED
519
+ },
520
+ {
521
+ label: "Process",
522
+ value: V.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING
523
+ },
524
+ {
525
+ label: "Pending Settlement",
526
+ value: V.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING_SETTLEMENT
527
+ },
528
+ {
529
+ label: "Failed",
530
+ value: V.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED
531
+ }
532
+ ], { sessionUser: d } = Ce(), m = De(), x = xe(), { getBillLink: G } = Oe();
533
+ let k;
534
+ const h = () => {
535
+ k && (clearTimeout(k), k = void 0);
536
+ }, {
537
+ promptSuggestion: K,
538
+ closeSuggestion: L
539
+ } = qe({
540
+ searchKey: w,
541
+ dateRange: c,
542
+ onBeforeApply: h
543
+ }), Y = async (t, e) => {
544
+ const r = await U.readTransactions({
545
+ start: J(c.value.startDate).startOf("day").toISOString(),
546
+ end: J(c.value.endDate).endOf("day").toISOString(),
547
+ limit: t,
548
+ cursor: e,
549
+ status: _.value,
550
+ businessId: n.businessFilter || void 0,
551
+ restaurantId: n.restaurantFilter || void 0,
552
+ payoutAccountId: n.payoutAccountId || void 0,
553
+ amount: n.amount ?? void 0,
554
+ search: w.value
555
+ });
556
+ return {
557
+ data: _e(r.data),
558
+ meta: r.meta
559
+ };
560
+ };
561
+ O([c, _], () => {
562
+ var t;
563
+ (t = a.value) == null || t.reset();
564
+ }), O(w, () => {
565
+ h(), K(), k = setTimeout(() => {
566
+ var t;
567
+ (t = a.value) == null || t.reset();
568
+ }, 700);
569
+ }), ve(() => {
570
+ h(), L();
571
+ });
572
+ async function j(t) {
573
+ var r, u;
574
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t);
575
+ if (!e) {
576
+ m.open({
577
+ type: "error",
578
+ title: "Something went wrong",
579
+ message: "Fail to find transactions from the displayed transactions."
580
+ });
581
+ return;
582
+ }
583
+ try {
584
+ const l = await U.refetchTransaction({
585
+ transactionId: e.id
586
+ });
587
+ (u = a.value) == null || u.replaceData(t, Q(l)), m.open({
588
+ type: "success",
589
+ title: "Transaction queried and updated successfully."
590
+ });
591
+ } catch (l) {
592
+ m.open({
593
+ type: "error",
594
+ title: "Fail to query transaction.",
595
+ message: B(l)
596
+ });
597
+ }
598
+ }
599
+ async function X(t) {
600
+ var r;
601
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t);
602
+ if (!e) {
603
+ m.open({
604
+ type: "error",
605
+ title: "Something went wrong",
606
+ message: "Fail to find transactions from the displayed transactions."
607
+ });
608
+ return;
609
+ }
610
+ oe(
611
+ x,
612
+ "Refund Transaction",
613
+ "Are you sure to refund transaction? This action cannot be revert!",
614
+ async () => {
615
+ var u;
616
+ try {
617
+ const l = await U.refundTransaction({
618
+ transactionId: e.id,
619
+ reason: "portal transaction refund",
620
+ amount: e.fdoAmount
621
+ });
622
+ (u = a.value) == null || u.replaceData(t, Q(l)), m.open({
623
+ type: "success",
624
+ title: "Transaction refund request initiated."
625
+ });
626
+ } catch (l) {
627
+ m.open({
628
+ type: "error",
629
+ title: "Fail to request refund transaction.",
630
+ message: B(l)
631
+ });
632
+ }
633
+ }
634
+ );
635
+ }
636
+ async function Z(t) {
637
+ var r;
638
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t);
639
+ if (!e) {
640
+ m.open({
641
+ type: "error",
642
+ title: "Something went wrong",
643
+ message: "Fail to find transactions from the displayed transactions."
644
+ });
645
+ return;
646
+ }
647
+ oe(
648
+ x,
649
+ "Notify Transaction",
650
+ "Are you sure to perform notify transaction?",
651
+ async () => {
652
+ try {
653
+ await U.renotifyTransaction(e.id), m.open({
654
+ type: "success",
655
+ title: "Transaction notify successfully."
656
+ });
657
+ } catch (u) {
658
+ m.open({
659
+ type: "error",
660
+ title: "Fail to notify transaction.",
661
+ message: B(u)
662
+ });
663
+ }
664
+ }
665
+ );
666
+ }
667
+ async function s(t) {
668
+ var u;
669
+ const e = (u = a.value) == null ? void 0 : u.pageData().at(t);
670
+ if (!e) {
671
+ m.open({
672
+ type: "error",
673
+ title: "Something went wrong",
674
+ message: "Fail to find transactions from the displayed transactions."
675
+ });
676
+ return;
677
+ }
678
+ const r = Ee(
679
+ [
680
+ {
681
+ type: "span",
682
+ queryKey: "transaction.id",
683
+ queryValue: e.id
684
+ }
685
+ ],
686
+ e.transactionAt
687
+ );
688
+ window.open(r, "_blank");
689
+ }
690
+ async function P(t) {
691
+ var r;
692
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t);
693
+ if (!e) {
694
+ m.open({
695
+ type: "error",
696
+ title: "Something went wrong",
697
+ message: "Fail to find transactions from the displayed transactions."
698
+ });
699
+ return;
700
+ }
701
+ x.open({
702
+ title: "Set Pay ID",
703
+ closeButton: !0,
704
+ overlay: !0,
705
+ contentComponent: re,
706
+ contentComponentProps: {
707
+ label: "Pay ID",
708
+ placeholder: "Enter Pay ID",
709
+ schema: le().trim().min(1, "Pay ID is required")
710
+ }
711
+ }).onPrimary(async (u) => {
712
+ var l;
713
+ try {
714
+ const F = await U.bindPayId({
715
+ transactionId: e.id,
716
+ payId: u
717
+ });
718
+ (l = a.value) == null || l.replaceData(t, Q(F)), m.open({
719
+ type: "success",
720
+ title: "Pay ID set successfully."
721
+ }), x.close();
722
+ } catch (F) {
723
+ m.open({
724
+ type: "error",
725
+ title: "Failed to set Pay ID.",
726
+ message: B(F)
727
+ });
728
+ }
729
+ });
730
+ }
731
+ async function C(t) {
732
+ var r;
733
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t);
734
+ if (!e) {
735
+ m.open({
736
+ type: "error",
737
+ title: "Something went wrong",
738
+ message: "Fail to find transactions from the displayed transactions."
739
+ });
740
+ return;
741
+ }
742
+ x.open({
743
+ title: "Set Gateway ID",
744
+ closeButton: !0,
745
+ overlay: !0,
746
+ contentComponent: re,
747
+ contentComponentProps: {
748
+ label: "Gateway Transaction ID",
749
+ placeholder: "Enter Gateway Transaction ID",
750
+ schema: le().trim().min(1, "Gateway Transaction ID is required")
751
+ }
752
+ }).onPrimary(async (u) => {
753
+ var l;
754
+ try {
755
+ const F = await U.setGatewayId({
756
+ transactionId: e.id,
757
+ gatewayTransactionId: u
758
+ });
759
+ (l = a.value) == null || l.replaceData(t, Q(F)), m.open({
760
+ type: "success",
761
+ title: "Gateway ID set successfully."
762
+ }), x.close();
763
+ } catch (F) {
764
+ m.open({
765
+ type: "error",
766
+ title: "Failed to set Gateway ID.",
767
+ message: B(F)
768
+ });
769
+ }
770
+ });
771
+ }
772
+ async function q(t) {
773
+ var r;
774
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t);
775
+ if (!e) {
776
+ m.open({
777
+ type: "error",
778
+ title: "Something went wrong",
779
+ message: "Fail to find transactions from the displayed transactions."
780
+ });
781
+ return;
782
+ }
783
+ x.open({
784
+ title: "Transaction Metadata",
785
+ closeButton: !0,
786
+ overlay: !0,
787
+ contentComponent: st,
788
+ contentComponentProps: {
789
+ transactionMetadata: e.callbackResponse
790
+ }
791
+ });
792
+ }
793
+ const R = [
794
+ {
795
+ header: () => "Transaction ID",
796
+ accessorKey: "id",
797
+ cell: ({ cell: t }) => {
798
+ let e = "";
799
+ return se(d.value) && t.row.original.transactionId && (e = `
800
+ ID: ${t.row.original.transactionId}`), $(Ue, { data: t.getValue(), extra: e });
801
+ }
802
+ },
803
+ {
804
+ header: () => "Pay ID",
805
+ accessorKey: "payId",
806
+ cell: ({ cell: t, row: e }) => {
807
+ const r = G(e.original);
808
+ return r ? $(
809
+ "a",
810
+ {
811
+ href: r,
812
+ class: "text-blue-600 underline"
813
+ },
814
+ t.getValue()
815
+ ) : t.getValue();
816
+ }
817
+ },
818
+ {
819
+ header: () => "Bill",
820
+ accessorKey: "seqNumber",
821
+ cell: ({ cell: t, row: e }) => e.original.seqNumberBinded ? $(lt, { row: e, data: t.getValue() }) : e.original.seqNumber
822
+ },
823
+ {
824
+ header: () => "Gateway",
825
+ accessorKey: "gateway",
826
+ meta: {
827
+ textAlign: "center"
828
+ },
829
+ cell: ({ cell: t, row: e }) => e.original.method ? $(Xe, { row: e, data: t.getValue() }) : ""
830
+ },
831
+ {
832
+ header: () => "Method",
833
+ accessorKey: "method",
834
+ meta: {
835
+ textAlign: "center"
836
+ },
837
+ cell: ({ cell: t, row: e }) => e.original.method ? $(et, { row: e, data: t.getValue() }) : ""
838
+ },
839
+ {
840
+ header: () => "Gateway ID",
841
+ accessorKey: "gatewayTransactionId",
842
+ cell: ({ cell: t, row: e }) => e.original.status === "REFUNDED" ? e.original.gatewayRefundId : e.original.gatewayTransactionId
843
+ },
844
+ {
845
+ header: () => "Type",
846
+ accessorKey: "payFor",
847
+ meta: {
848
+ textAlign: "center"
849
+ }
850
+ },
851
+ {
852
+ header: () => "Status",
853
+ accessorKey: "status",
854
+ cell: ({ cell: t }) => $(he, { data: t.getValue() })
855
+ },
856
+ {
857
+ header: () => "Restaurant",
858
+ accessorKey: "restaurantId"
859
+ },
860
+ {
861
+ header: () => "Source",
862
+ accessorKey: "source",
863
+ cell: ({ cell: t, row: e }) => `(${e.original.sourceType}) ${e.original.source}`
864
+ },
865
+ {
866
+ header: () => "Transaction At",
867
+ accessorKey: "transactionAt",
868
+ meta: {
869
+ width: "180px"
870
+ }
871
+ },
872
+ {
873
+ header: () => "Sales Amount",
874
+ accessorKey: "amount",
875
+ cell: ({ cell: t, row: e }) => se(d.value) && e.original.flags.isDelivery ? e.original.amount + "( " + e.original.gatewayAmount + ")" : e.original.amount
876
+ },
877
+ {
878
+ header: () => "Actions",
879
+ accessorKey: "actions",
880
+ cell: ({ row: t }) => {
881
+ var r;
882
+ const e = (r = a.value) == null ? void 0 : r.pageData().at(t.index);
883
+ if (!e) {
884
+ m.open({
885
+ type: "error",
886
+ title: "Something went wrong",
887
+ message: "Fail to find transactions from the displayed transactions."
888
+ });
889
+ return;
890
+ }
891
+ return $(tt, {
892
+ transaction: e,
893
+ onAction: (u) => {
894
+ switch (u) {
895
+ case "notify":
896
+ return Z(t.index);
897
+ case "query":
898
+ return j(t.index);
899
+ case "refund":
900
+ return X(t.index);
901
+ case "transactionMetadata":
902
+ return q(t.index);
903
+ case "history":
904
+ return s(t.index);
905
+ case "setPayId":
906
+ return P(t.index);
907
+ case "setGatewayId":
908
+ return C(t.index);
909
+ }
910
+ }
911
+ });
912
+ }
913
+ }
914
+ ];
915
+ return (t, e) => {
916
+ const r = b("FmSearch"), u = b("FmSelect");
917
+ return g(), N(Se, {
918
+ title: "Transactions",
919
+ loading: !1
920
+ }, {
921
+ default: D(() => [
922
+ S("div", it, [
923
+ S("div", ut, [
924
+ S("div", ct, [
925
+ f(r, {
926
+ "model-value": T(w),
927
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => z(w) ? w.value = l : null),
928
+ class: "mr-8",
929
+ label: "Search",
930
+ "label-info": "Search by Transaction ID, Pay ID or Gateway Transaction ID.",
931
+ placeholder: "Search Transactions ..."
932
+ }, null, 8, ["model-value"]),
933
+ f(u, {
934
+ modelValue: T(_),
935
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => z(_) ? _.value = l : null),
936
+ class: "w-[300px]",
937
+ label: "Status",
938
+ "label-mark": "required",
939
+ multiselect: "",
940
+ items: p
941
+ }, {
942
+ "prepend-menu": D(() => [
943
+ f(we, {
944
+ modelValue: T(_),
945
+ "onUpdate:modelValue": e[1] || (e[1] = (l) => z(_) ? _.value = l : null),
946
+ items: p
947
+ }, null, 8, ["modelValue"])
948
+ ]),
949
+ _: 1
950
+ }, 8, ["modelValue"])
951
+ ]),
952
+ S("div", dt, [
953
+ f(Pe, {
954
+ modelValue: T(c),
955
+ "onUpdate:modelValue": e[3] || (e[3] = (l) => z(c) ? c.value = l : null)
956
+ }, null, 8, ["modelValue"]),
957
+ f(He, {
958
+ filter: T(n),
959
+ "active-count": T(y),
960
+ "has-active-filters": T(v),
961
+ onApply: e[4] || (e[4] = (l) => {
962
+ var F;
963
+ T(I)(l), (F = a.value) == null || F.reset();
964
+ }),
965
+ onReset: e[5] || (e[5] = (l) => {
966
+ var F;
967
+ T(i)(), (F = a.value) == null || F.reset();
968
+ })
969
+ }, null, 8, ["filter", "active-count", "has-active-filters"])
970
+ ])
971
+ ]),
972
+ S("div", null, [
973
+ f(Ie, {
974
+ button: {
975
+ appendIcon: "file_download",
976
+ variant: "primary",
977
+ label: "Export"
978
+ },
979
+ handler: async () => {
980
+ var F;
981
+ const l = await ((F = a.value) == null ? void 0 : F.allData());
982
+ l != null && await T(U).downloadPortalTransactionReport(
983
+ T(c),
984
+ l
985
+ );
986
+ }
987
+ }, null, 8, ["handler"])
988
+ ])
989
+ ]),
990
+ f($e, {
991
+ ref_key: "controller",
992
+ ref: a,
993
+ "column-defs": R,
994
+ "rows-defs": (l) => l,
995
+ paginate: Y
996
+ }, null, 8, ["rows-defs"])
997
+ ]),
998
+ _: 1
999
+ });
1000
+ };
1001
+ }
1002
+ });
1003
+ export {
1004
+ Ut as default
1005
+ };