@feedmepos/mf-payment 0.0.0-beta.9 → 1.0.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. package/README.md +11 -1
  2. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js +39 -0
  3. package/dist/AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js +42 -0
  4. package/dist/AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js +40 -0
  5. package/dist/Modal-DB8M9o1T.js +13 -0
  6. package/dist/PayoutAccount-Ce_7sGf-.js +613 -0
  7. package/dist/{PayoutAccount-DLhMMlw_.js → PayoutAccount-ip4hKBE0.js} +96 -83
  8. package/dist/PayoutAccountSetting-kUQLeAcb.js +780 -0
  9. package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js +33 -0
  10. package/dist/SelectAll.vue_vue_type_script_setup_true_lang-DA4rs3tk.js +42 -0
  11. package/dist/Settlement-Crdfq22j.js +149 -0
  12. package/dist/Settlement-JHOJNkhd.js +194 -0
  13. package/dist/{SettlementTransactions-CoEzdtYT.js → SettlementTransactions-BxuLXUR-.js} +99 -105
  14. package/dist/{SettlementTransactions-Dl1H4jvh.js → SettlementTransactions-daWMAmtz.js} +117 -130
  15. package/dist/Terminal-gxGnjFGc.js +372 -0
  16. package/dist/TerminalSetting--ZAJJ_Hf.js +379 -0
  17. package/dist/TerminalTransaction-B2RjE2Y0.js +435 -0
  18. package/dist/TerminalTransaction-CCfrLWpi.js +259 -0
  19. package/dist/Transaction-8LlOLPeZ.js +404 -0
  20. package/dist/Transaction-DRQ_uZ30.js +241 -0
  21. package/dist/api/index.d.ts +14 -0
  22. package/dist/api/pagination.d.ts +20 -0
  23. package/dist/api/payment-gateway/index.d.ts +9 -0
  24. package/dist/api/settlement/index.d.ts +12 -13
  25. package/dist/api/terminal/index.d.ts +13 -1
  26. package/dist/api/terminal-transaction/index.d.ts +12 -1
  27. package/dist/api/transaction/index.d.ts +7 -2
  28. package/dist/app-DQNKrzQz.js +6356 -0
  29. package/dist/app.js +3 -198
  30. package/dist/assets-NrCec-W0.js +45 -0
  31. package/dist/clipboard-4jh1WteU.js +10 -0
  32. package/dist/components/AsyncButton.vue.d.ts +21 -0
  33. package/dist/components/AutoCopyCell.vue.d.ts +6 -0
  34. package/dist/components/CursorTable/index.vue.d.ts +24 -5
  35. package/dist/components/RestaurantSelector.vue.d.ts +2 -0
  36. package/dist/components/RouteCell.vue.d.ts +8 -0
  37. package/dist/components/SelectAll.vue.d.ts +57 -0
  38. package/dist/helpers/assets.d.ts +2 -0
  39. package/dist/{index-Bmka-1lQ.js → index-7KNaibcq.js} +1 -1
  40. package/dist/index-BWUtjGg7.js +47 -0
  41. package/dist/{index-CF56zGyu.js → index-BwcJZFsi.js} +1 -1
  42. package/dist/index-CWaKb7bG.js +56107 -0
  43. package/dist/index-CojhNtuG.js +127 -0
  44. package/dist/index-DbJpbpSs.js +52 -0
  45. package/dist/index.vue_vue_type_script_setup_true_lang-JdAFa8vy.js +167 -0
  46. package/dist/model/transaction.d.ts +2 -1
  47. package/dist/package.json +5 -5
  48. package/dist/payout-account-DVoSXsW7.js +1805 -0
  49. package/dist/router/index.d.ts +1 -0
  50. package/dist/stores/payoutAccount.d.ts +4 -4
  51. package/dist/transaction-CQiT7Y_s.js +87 -0
  52. package/dist/tsconfig.app.tsbuildinfo +1 -1
  53. package/dist/validator-D5jtpt9A.js +2877 -0
  54. package/dist/views/admin/payout-account/tabs/Information.vue.d.ts +4 -4
  55. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +81 -0
  56. package/dist/views/admin/payout-account/tabs/PaymentStatus.vue.d.ts +4 -4
  57. package/dist/views/admin/payout-account/tabs/Settlement.vue.d.ts +4 -4
  58. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  59. package/dist/views/admin/payout-account/tabs/gateway/GhlGateway.vue.d.ts +50 -0
  60. package/dist/views/admin/payout-account/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  61. package/dist/views/admin/settlement/SettlementTable.vue.d.ts +12 -12
  62. package/dist/views/admin/terminal/TerminalDialog.vue.d.ts +83 -0
  63. package/dist/views/admin/terminal/TerminalSetting.vue.d.ts +12 -0
  64. package/dist/views/admin/terminal/cell/Actions.vue.d.ts +80 -9
  65. package/dist/views/admin/terminal/tabs/FiuuGateway.vue.d.ts +94 -0
  66. package/dist/views/admin/terminal/tabs/GhlGateway.vue.d.ts +94 -0
  67. package/dist/views/admin/terminal/tabs/Information.vue.d.ts +85 -0
  68. package/dist/views/admin/terminal/tabs/TerminalGateway.vue.d.ts +94 -0
  69. package/dist/views/admin/terminal-transaction/cell/Actions.vue.d.ts +7 -0
  70. package/dist/views/admin/transaction/TransactionTable.vue.d.ts +6 -2
  71. package/dist/views/admin/transaction/cell/Actions.vue.d.ts +7 -0
  72. package/dist/views/payout-account/PayoutAccountTable.vue.d.ts +8 -8
  73. package/dist/views/settlement/SettlementTable.vue.d.ts +12 -12
  74. package/dist/views/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
  75. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
  76. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +9 -0
  77. package/package.json +5 -5
  78. package/dist/AdminLayout.vue_vue_type_script_setup_true_lang-oPYFBeEo.js +0 -42
  79. package/dist/PayoutAccount-xxSxqBTL.js +0 -3485
  80. package/dist/PayoutAccountSetting-CIeos0md.js +0 -425
  81. package/dist/Settlement-BVGACeme.js +0 -136
  82. package/dist/Settlement-Ce48KHrc.js +0 -132
  83. package/dist/Terminal-ByKV2Rof.js +0 -204
  84. package/dist/TerminalTransaction-RuSxBAxf.js +0 -240
  85. package/dist/Transaction-CYo-uLQi.js +0 -241
  86. package/dist/Transaction-Cjw9WwX8.js +0 -242
  87. package/dist/api/auth/index.d.ts +0 -7
  88. package/dist/assets-BuLGUMIx.js +0 -472
  89. package/dist/index-Coz5aeIO.js +0 -61
  90. package/dist/index-DCPNrUDq.js +0 -40075
  91. package/dist/index.vue_vue_type_script_setup_true_lang-CAR-bNaR.js +0 -150
  92. package/dist/mascot-side-3VXskf9y.js +0 -4
  93. package/dist/payout-account-iAM7HPtG.js +0 -3317
  94. package/dist/transaction-vRrBf3FN.js +0 -64
@@ -0,0 +1,404 @@
1
+ import { defineComponent as h, resolveComponent as _, openBlock as g, createBlock as E, normalizeClass as $, withCtx as x, createElementVNode as b, toDisplayString as L, createElementBlock as F, unref as m, createVNode as y, Fragment as B, renderList as U, ref as N, h as T, onMounted as G, watch as k, isRef as D } from "vue";
2
+ import { t as w, a as J, b as R } from "./transaction-CQiT7Y_s.js";
3
+ import { e as S, u as Q } from "./index-CWaKb7bG.js";
4
+ import { useSnackbar as Y, useDialog as j } from "@feedmepos/ui-library";
5
+ import "./dinero-CIVmXLL-.js";
6
+ import { h as O } from "./moment-h96o7c8I.js";
7
+ import { g as z, a as H } from "./assets-NrCec-W0.js";
8
+ import { _ as W } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-GXPXBEf5.js";
9
+ import { u as X } from "./index-7KNaibcq.js";
10
+ import { _ as Z } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
11
+ import { _ as ee } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
+ import { w as P } from "./Modal-DB8M9o1T.js";
13
+ import { u as I } from "./error-K1CakhA9.js";
14
+ const te = /* @__PURE__ */ h({
15
+ __name: "Status",
16
+ props: {
17
+ row: {},
18
+ data: {}
19
+ },
20
+ setup(p) {
21
+ const n = p;
22
+ function o() {
23
+ return n.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING ? "!w-[16px] !h-[16px] bg-yellow-400" : n.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED ? "!w-[16px] !h-[16px] bg-red-400" : n.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED ? "!w-[16px] !h-[16px] bg-blue-400" : "!w-[16px] !h-[16px] bg-green-400";
24
+ }
25
+ return (l, f) => {
26
+ const s = _("FmBadge");
27
+ return g(), E(s, {
28
+ inline: "",
29
+ class: $(o())
30
+ }, {
31
+ default: x(() => [
32
+ b("div", null, L(l.data), 1)
33
+ ]),
34
+ _: 1
35
+ }, 8, ["class"]);
36
+ };
37
+ }
38
+ }), ae = ["src"], ne = /* @__PURE__ */ h({
39
+ __name: "Gateway",
40
+ props: {
41
+ row: {},
42
+ data: {}
43
+ },
44
+ setup(p) {
45
+ return (n, o) => (g(), F("img", {
46
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
47
+ src: m(z)(n.row.original.gateway)
48
+ }, null, 8, ae));
49
+ }
50
+ }), oe = ["src"], re = /* @__PURE__ */ h({
51
+ __name: "Method",
52
+ props: {
53
+ row: {},
54
+ data: {}
55
+ },
56
+ setup(p) {
57
+ return (n, o) => (g(), F("img", {
58
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
59
+ src: m(H)(n.row.original.method.issuer)
60
+ }, null, 8, oe));
61
+ }
62
+ }), se = /* @__PURE__ */ h({
63
+ __name: "Actions",
64
+ props: {
65
+ onAction: { type: Function }
66
+ },
67
+ setup(p) {
68
+ const n = [
69
+ {
70
+ label: "Query",
71
+ sublabel: "Perform transaction status inquriy",
72
+ icon: "question_answer",
73
+ action: "query"
74
+ },
75
+ {
76
+ label: "Refund",
77
+ sublabel: "Perform transaction refund request",
78
+ icon: "request_page",
79
+ action: "refund"
80
+ },
81
+ {
82
+ label: "Notify",
83
+ sublabel: "Perform webhook notification for transaction",
84
+ icon: "webhook",
85
+ action: "notify"
86
+ }
87
+ ];
88
+ return (o, l) => {
89
+ const f = _("FmIcon"), s = _("FmMenuItem"), r = _("FmMenu");
90
+ return g(), F("div", {
91
+ onClick: l[0] || (l[0] = (e) => {
92
+ e.stopPropagation();
93
+ })
94
+ }, [
95
+ y(r, null, {
96
+ "menu-button": x(() => [
97
+ y(f, { name: "settings" })
98
+ ]),
99
+ default: x(() => [
100
+ (g(), F(B, null, U(n, (e) => y(s, {
101
+ selectable: !0,
102
+ key: e.label,
103
+ sublabel: e.sublabel,
104
+ label: e.label,
105
+ icon: e.icon,
106
+ onclick: () => o.onAction(e.action)
107
+ }, null, 8, ["sublabel", "label", "icon", "onclick"])), 64))
108
+ ]),
109
+ _: 1
110
+ })
111
+ ]);
112
+ };
113
+ }
114
+ }), ie = /* @__PURE__ */ h({
115
+ __name: "TransactionTable",
116
+ props: {
117
+ data: {
118
+ type: Array,
119
+ required: !0
120
+ },
121
+ loading: {
122
+ type: Boolean,
123
+ required: !0
124
+ }
125
+ },
126
+ emits: ["query", "refund", "notify"],
127
+ setup(p, { emit: n }) {
128
+ const o = p, l = n, f = N(""), s = [
129
+ {
130
+ header: () => "Transaction ID",
131
+ accessorKey: "id",
132
+ cell: ({ cell: r }) => T(W, { data: r.getValue() })
133
+ },
134
+ {
135
+ header: () => "Pay ID",
136
+ accessorKey: "payId"
137
+ },
138
+ {
139
+ header: () => "Gateway",
140
+ accessorKey: "gateway",
141
+ meta: {
142
+ textAlign: "center"
143
+ },
144
+ cell: ({ cell: r, row: e }) => e.original.method ? T(ne, { row: e, data: r.getValue() }) : ""
145
+ },
146
+ {
147
+ header: () => "Method",
148
+ accessorKey: "method",
149
+ meta: {
150
+ textAlign: "center"
151
+ },
152
+ cell: ({ cell: r, row: e }) => e.original.method ? T(re, { row: e, data: r.getValue() }) : ""
153
+ },
154
+ {
155
+ header: () => "Type",
156
+ accessorKey: "type",
157
+ meta: {
158
+ textAlign: "center"
159
+ },
160
+ cell: ({ row: r }) => {
161
+ if (!r.original.method)
162
+ return "";
163
+ const e = r.original.method.variant;
164
+ return e.includes("_ONLINE") ? "ONLINE" : e.includes("_OFFLINE") ? "OFFLINE" : e;
165
+ }
166
+ },
167
+ {
168
+ header: () => "Status",
169
+ accessorKey: "status",
170
+ cell: ({ cell: r, row: e }) => T(te, { row: e, data: r.getValue() })
171
+ },
172
+ {
173
+ header: () => "Transaction At",
174
+ accessorKey: "transactionAt",
175
+ meta: {
176
+ width: "180px"
177
+ }
178
+ },
179
+ {
180
+ header: () => "Sales Amount",
181
+ accessorKey: "amount"
182
+ },
183
+ {
184
+ header: () => "Fee",
185
+ accessorKey: "fee"
186
+ },
187
+ {
188
+ header: () => "Settlement Amount",
189
+ accessorKey: "payout"
190
+ },
191
+ {
192
+ header: () => "Actions",
193
+ accessorKey: "actions",
194
+ cell: ({ row: r }) => T(se, {
195
+ onAction: (e) => l(e, r.index)
196
+ })
197
+ }
198
+ ];
199
+ return (r, e) => {
200
+ const c = _("FmTable");
201
+ return g(), E(c, {
202
+ modelValue: f.value,
203
+ "onUpdate:modelValue": e[0] || (e[0] = (v) => f.value = v),
204
+ "column-defs": s,
205
+ "row-data": o.data,
206
+ loading: o.loading
207
+ }, null, 8, ["modelValue", "row-data", "loading"]);
208
+ };
209
+ }
210
+ }), ce = { class: "flex justify-between mb-6 items-center" }, le = { class: "flex space-x-4" }, ue = { class: "flex space-x-4" }, Fe = /* @__PURE__ */ h({
211
+ __name: "Transaction",
212
+ setup(p) {
213
+ const { dateRange: n, searchKey: o } = X({
214
+ searchKey: "",
215
+ dateRange: {
216
+ startDate: O().startOf("day").toISOString(),
217
+ endDate: O().endOf("day").toISOString()
218
+ }
219
+ }), { isLoading: l, startAsyncCall: f } = Q(!0), s = Y(), r = j(), e = N([]), c = N([]);
220
+ async function v() {
221
+ await f(async () => {
222
+ const { startDate: i, endDate: t } = n.value, a = await w.readTransactions({
223
+ start: i,
224
+ end: t
225
+ });
226
+ if (e.value = J(a), c.value = e.value, o.value > "") {
227
+ var u = new RegExp(o.value, "i");
228
+ c.value = e.value.filter((d) => {
229
+ const C = JSON.stringify(d);
230
+ return u.test(C);
231
+ });
232
+ }
233
+ });
234
+ }
235
+ function q() {
236
+ v();
237
+ }
238
+ G(q);
239
+ let A;
240
+ k(o, async () => {
241
+ A && clearTimeout(A), A = setTimeout(() => {
242
+ var i = new RegExp(o.value, "i");
243
+ c.value = e.value.filter((t) => {
244
+ const a = JSON.stringify(t);
245
+ return i.test(a);
246
+ });
247
+ }, 700);
248
+ }), k(e, async () => {
249
+ let i = e.value;
250
+ if (o.value) {
251
+ var t = new RegExp(o.value, "i");
252
+ i = e.value.filter((a) => {
253
+ const u = JSON.stringify(a);
254
+ return t.test(u);
255
+ });
256
+ }
257
+ c.value = i;
258
+ }, { deep: !0 });
259
+ async function K(i) {
260
+ const t = c.value.at(i);
261
+ if (!t) {
262
+ s.open({
263
+ type: "error",
264
+ title: "Something went wrong",
265
+ message: "Fail to find transactions from the displayed transactions."
266
+ });
267
+ return;
268
+ }
269
+ try {
270
+ const a = await w.refetchTransaction({ transactionId: t.id }), u = e.value.findIndex((d) => d.id === a._id);
271
+ e.value[u] = R(a), s.open({
272
+ type: "success",
273
+ title: "Transaction queried and updated successfully."
274
+ });
275
+ } catch (a) {
276
+ s.open({
277
+ type: "error",
278
+ title: "Fail to query transaction.",
279
+ message: I(a)
280
+ });
281
+ }
282
+ }
283
+ async function V(i) {
284
+ const t = c.value.at(i);
285
+ if (!t) {
286
+ s.open({
287
+ type: "error",
288
+ title: "Something went wrong",
289
+ message: "Fail to find transactions from the displayed transactions."
290
+ });
291
+ return;
292
+ }
293
+ P(
294
+ r,
295
+ "Refund Transaction",
296
+ "Are you sure to refund transaction? This action cannot be revert!",
297
+ async () => {
298
+ try {
299
+ const a = await w.refundTransaction({
300
+ transactionId: t.id,
301
+ reason: "portal transaction refund",
302
+ amount: t.fdoAmount
303
+ }), u = e.value.findIndex((d) => d.id === a._id);
304
+ e.value[u] = R(a), s.open({
305
+ type: "success",
306
+ title: "Transaction refund request initiated."
307
+ });
308
+ } catch (a) {
309
+ s.open({
310
+ type: "error",
311
+ title: "Fail to request refund transaction.",
312
+ message: I(a)
313
+ });
314
+ }
315
+ }
316
+ );
317
+ }
318
+ async function M(i) {
319
+ const t = c.value.at(i);
320
+ if (!t) {
321
+ s.open({
322
+ type: "error",
323
+ title: "Something went wrong",
324
+ message: "Fail to find transactions from the displayed transactions."
325
+ });
326
+ return;
327
+ }
328
+ P(
329
+ r,
330
+ "Notify Transaction",
331
+ "Are you sure to perform notify transaction?",
332
+ async () => {
333
+ try {
334
+ await w.renotifyTransaction(t.id), s.open({
335
+ type: "success",
336
+ title: "Transaction notify successfully."
337
+ });
338
+ } catch (a) {
339
+ s.open({
340
+ type: "error",
341
+ title: "Fail to notify transaction.",
342
+ message: I(a)
343
+ });
344
+ }
345
+ }
346
+ );
347
+ }
348
+ return (i, t) => {
349
+ const a = _("FmSearch"), u = _("FmSimpleDateRangePicker");
350
+ return g(), E(Z, {
351
+ title: "Online Transactions",
352
+ loading: m(l)
353
+ }, {
354
+ default: x(() => [
355
+ b("div", ce, [
356
+ b("div", le, [
357
+ y(a, {
358
+ "model-value": m(o),
359
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => D(o) ? o.value = d : null),
360
+ class: "mr-8",
361
+ label: "Search",
362
+ placeholder: "Search Transactions ..."
363
+ }, null, 8, ["model-value"]),
364
+ y(u, {
365
+ modelValue: m(n),
366
+ "onUpdate:modelValue": [
367
+ t[1] || (t[1] = (d) => D(n) ? n.value = d : null),
368
+ v
369
+ ],
370
+ "show-predefined-range": ""
371
+ }, null, 8, ["modelValue"])
372
+ ]),
373
+ b("div", ue, [
374
+ y(ee, {
375
+ button: {
376
+ appendIcon: "file_download",
377
+ variant: "primary",
378
+ label: "Export"
379
+ },
380
+ handler: async () => {
381
+ await m(w).downloadTransactionReport({
382
+ start: m(n).startDate,
383
+ end: m(n).endDate
384
+ });
385
+ }
386
+ }, null, 8, ["handler"])
387
+ ])
388
+ ]),
389
+ y(ie, {
390
+ loading: m(l),
391
+ data: c.value,
392
+ onQuery: K,
393
+ onRefund: V,
394
+ onNotify: M
395
+ }, null, 8, ["loading", "data"])
396
+ ]),
397
+ _: 1
398
+ }, 8, ["loading"]);
399
+ };
400
+ }
401
+ });
402
+ export {
403
+ Fe as default
404
+ };
@@ -0,0 +1,241 @@
1
+ import { defineComponent as _, resolveComponent as T, openBlock as f, createBlock as N, normalizeClass as k, withCtx as R, createElementVNode as y, toDisplayString as K, createElementBlock as O, unref as o, ref as A, h as x, onMounted as V, watch as E, createVNode as p, isRef as F } from "vue";
2
+ import { t as I, a as C } from "./transaction-CQiT7Y_s.js";
3
+ import { e as S, u as P } from "./index-CWaKb7bG.js";
4
+ import { useSnackbar as $ } from "@feedmepos/ui-library";
5
+ import "./dinero-CIVmXLL-.js";
6
+ import { h as b } from "./moment-h96o7c8I.js";
7
+ import { g as L, a as B } from "./assets-NrCec-W0.js";
8
+ import { useCoreStore as M } from "@feedmepos/mf-common";
9
+ import { _ as U } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
10
+ import { u as G } from "./index-7KNaibcq.js";
11
+ import { _ as Y } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
12
+ import { _ as q } from "./RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js";
13
+ const J = /* @__PURE__ */ _({
14
+ __name: "Status",
15
+ props: {
16
+ row: {},
17
+ data: {}
18
+ },
19
+ setup(s) {
20
+ const n = s;
21
+ function a() {
22
+ return n.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING ? "!w-[16px] !h-[16px] bg-yellow-400" : n.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED ? "!w-[16px] !h-[16px] bg-red-400" : n.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED ? "!w-[16px] !h-[16px] bg-blue-400" : "!w-[16px] !h-[16px] bg-green-400";
23
+ }
24
+ return (l, c) => {
25
+ const d = T("FmBadge");
26
+ return f(), N(d, {
27
+ inline: "",
28
+ class: k(a())
29
+ }, {
30
+ default: R(() => [
31
+ y("div", null, K(l.data), 1)
32
+ ]),
33
+ _: 1
34
+ }, 8, ["class"]);
35
+ };
36
+ }
37
+ }), j = ["src"], z = /* @__PURE__ */ _({
38
+ __name: "Gateway",
39
+ props: {
40
+ row: {},
41
+ data: {}
42
+ },
43
+ setup(s) {
44
+ return (n, a) => (f(), O("img", {
45
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
46
+ src: o(L)(n.row.original.gateway)
47
+ }, null, 8, j));
48
+ }
49
+ }), Q = ["src"], H = /* @__PURE__ */ _({
50
+ __name: "Method",
51
+ props: {
52
+ row: {},
53
+ data: {}
54
+ },
55
+ setup(s) {
56
+ return (n, a) => (f(), O("img", {
57
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
58
+ src: o(B)(n.row.original.method.issuer)
59
+ }, null, 8, Q));
60
+ }
61
+ }), W = /* @__PURE__ */ _({
62
+ __name: "TransactionTable",
63
+ props: {
64
+ data: {
65
+ type: Array,
66
+ required: !0
67
+ },
68
+ loading: {
69
+ type: Boolean,
70
+ required: !0
71
+ }
72
+ },
73
+ emits: ["row-click"],
74
+ setup(s, { emit: n }) {
75
+ const a = s, l = n, c = A(""), d = [
76
+ {
77
+ header: () => "Transaction ID",
78
+ accessorKey: "id"
79
+ },
80
+ {
81
+ header: () => "Pay ID",
82
+ accessorKey: "payId"
83
+ },
84
+ {
85
+ header: () => "Gateway",
86
+ accessorKey: "gateway",
87
+ meta: {
88
+ textAlign: "center"
89
+ },
90
+ cell: ({ cell: t, row: e }) => e.original.method ? x(z, { row: e, data: t.getValue() }) : ""
91
+ },
92
+ {
93
+ header: () => "Method",
94
+ accessorKey: "method",
95
+ meta: {
96
+ textAlign: "center"
97
+ },
98
+ cell: ({ cell: t, row: e }) => e.original.method ? x(H, { row: e, data: t.getValue() }) : ""
99
+ },
100
+ {
101
+ header: () => "Type",
102
+ accessorKey: "type",
103
+ meta: {
104
+ textAlign: "center"
105
+ },
106
+ cell: ({ row: t }) => {
107
+ if (!t.original.method)
108
+ return "";
109
+ const e = t.original.method.variant;
110
+ return e.includes("_ONLINE") ? "ONLINE" : e.includes("_OFFLINE") ? "OFFLINE" : e;
111
+ }
112
+ },
113
+ {
114
+ header: () => "Status",
115
+ accessorKey: "status",
116
+ cell: ({ cell: t, row: e }) => x(J, { row: e, data: t.getValue() })
117
+ },
118
+ {
119
+ header: () => "Transaction At",
120
+ accessorKey: "transactionAt",
121
+ meta: {
122
+ width: "180px"
123
+ }
124
+ },
125
+ {
126
+ header: () => "Sales Amount",
127
+ accessorKey: "amount"
128
+ },
129
+ {
130
+ header: () => "Fee",
131
+ accessorKey: "fee"
132
+ },
133
+ {
134
+ header: () => "Settlement Amount",
135
+ accessorKey: "payout"
136
+ }
137
+ ];
138
+ return (t, e) => {
139
+ const g = T("FmTable");
140
+ return f(), N(g, {
141
+ modelValue: c.value,
142
+ "onUpdate:modelValue": e[0] || (e[0] = (i) => c.value = i),
143
+ "column-defs": d,
144
+ "row-data": a.data,
145
+ loading: a.loading,
146
+ onRowClick: e[1] || (e[1] = (i) => l("row-click", a.data.at(i.index)))
147
+ }, null, 8, ["modelValue", "row-data", "loading"]);
148
+ };
149
+ }
150
+ }), X = { class: "flex justify-between mb-6 items-center" }, Z = { class: "flex space-x-8" }, ee = { class: "flex space-x-4" }, pe = /* @__PURE__ */ _({
151
+ __name: "Transaction",
152
+ setup(s) {
153
+ const { dateRange: n, searchKey: a } = G({
154
+ searchKey: "",
155
+ dateRange: {
156
+ startDate: b().startOf("day").toISOString(),
157
+ endDate: b().endOf("day").toISOString()
158
+ }
159
+ }), { isLoading: l, startAsyncCall: c } = P(!0);
160
+ $();
161
+ const { currentRestaurant: d } = M(), t = A([]), e = A([]);
162
+ async function g() {
163
+ await c(async () => {
164
+ const { startDate: h, endDate: r } = n.value, u = await I.readRestaurantTransactions({
165
+ start: h,
166
+ end: r
167
+ });
168
+ if (t.value = C(u), e.value = t.value, a.value > "") {
169
+ var v = new RegExp(a.value, "i");
170
+ e.value = t.value.filter((m) => {
171
+ const D = JSON.stringify(m);
172
+ return v.test(D);
173
+ });
174
+ }
175
+ });
176
+ }
177
+ function i() {
178
+ g();
179
+ }
180
+ V(i), E(d, i);
181
+ let w;
182
+ return E(a, async () => {
183
+ w && clearTimeout(w), w = setTimeout(() => {
184
+ var h = new RegExp(a.value, "i");
185
+ e.value = t.value.filter((r) => {
186
+ const u = JSON.stringify(r);
187
+ return h.test(u);
188
+ });
189
+ }, 700);
190
+ }), (h, r) => {
191
+ const u = T("FmSearch"), v = T("FmSimpleDateRangePicker");
192
+ return f(), N(U, {
193
+ title: "Online Transactions",
194
+ description: "Transactions are purchases or payments made over the internet using electronic methods like cards or digital wallets.",
195
+ loading: o(l)
196
+ }, {
197
+ default: R(() => [
198
+ y("div", X, [
199
+ y("div", Z, [
200
+ p(q),
201
+ p(u, {
202
+ "model-value": o(a),
203
+ "onUpdate:modelValue": r[0] || (r[0] = (m) => F(a) ? a.value = m : null),
204
+ label: "Search",
205
+ placeholder: "Search Transactions ..."
206
+ }, null, 8, ["model-value"]),
207
+ p(v, {
208
+ modelValue: o(n),
209
+ "onUpdate:modelValue": [
210
+ r[1] || (r[1] = (m) => F(n) ? n.value = m : null),
211
+ g
212
+ ],
213
+ "show-predefined-range": ""
214
+ }, null, 8, ["modelValue"])
215
+ ]),
216
+ y("div", ee, [
217
+ p(Y, {
218
+ button: {
219
+ appendIcon: "file_download",
220
+ variant: "primary",
221
+ label: "Export"
222
+ },
223
+ handler: async () => {
224
+ await o(I).downloadRestaurantTransactionReport(t.value);
225
+ }
226
+ }, null, 8, ["handler"])
227
+ ])
228
+ ]),
229
+ p(W, {
230
+ loading: o(l),
231
+ data: e.value
232
+ }, null, 8, ["loading", "data"])
233
+ ]),
234
+ _: 1
235
+ }, 8, ["loading"]);
236
+ };
237
+ }
238
+ });
239
+ export {
240
+ pe as default
241
+ };
@@ -1,5 +1,6 @@
1
1
  import { type PaginatedResult } from "@feedmepos/payment-entity";
2
2
  import { type AxiosInstance, type AxiosResponse } from "axios";
3
+ import type { WorkBook } from "xlsx";
3
4
  type ApiVariant = "portal" | "auth";
4
5
  interface ApiUrl {
5
6
  portalBackendUrl: string;
@@ -29,6 +30,19 @@ export declare const authInstance: (config?: {
29
30
  }) => AxiosInstance;
30
31
  export declare const businessClientInstance: () => AxiosInstance;
31
32
  export declare const restaurantClientInstance: (prefix?: string) => AxiosInstance;
33
+ type TransformFunction<T> = (value: T) => any;
34
+ type TransformFunctions<T> = {
35
+ [K in keyof T]?: TransformFunction<T[K]>;
36
+ };
37
+ export declare function flattenObject(obj: Record<string, any>, parentKey?: string): Record<string, any>;
38
+ export declare function localWorkbookAndDownload<T extends Object>(data: T[], options?: {
39
+ transformers?: TransformFunctions<T>;
40
+ exclude?: (keyof T)[];
41
+ rename?: Partial<Record<keyof T, string>>;
42
+ filename?: string;
43
+ }): void;
44
+ export declare function getWorkbookAndDownload(response: AxiosResponse<WorkBook>, filename: string): void;
45
+ export declare function downloadAs(blob: Blob, filename: string): void;
32
46
  export declare function getData<T>(response: AxiosResponse<T>): T;
33
47
  export declare function getPaginatedResult<T>(response: AxiosResponse<PaginatedResult<T>>): PaginatedResult<T>;
34
48
  export {};
@@ -0,0 +1,20 @@
1
+ export interface PaginationRequest {
2
+ skip: number;
3
+ limit: number;
4
+ sortBy: string;
5
+ descending?: boolean;
6
+ search?: string;
7
+ }
8
+ export interface PaginatedResponse<T> {
9
+ resources: T[];
10
+ meta: PaginatedMeta;
11
+ }
12
+ export interface PaginatedMeta {
13
+ skip: number;
14
+ limit: number;
15
+ sortBy: string;
16
+ descending?: boolean;
17
+ search?: string;
18
+ totalPages: number | null;
19
+ totalResources: number | null;
20
+ }
@@ -0,0 +1,9 @@
1
+ import type { FdoPaymentGateway } from "@feedmepos/payment-entity";
2
+ /**
3
+ * Relying on the payout account so need pass in the restaurant id from the payout account
4
+ */
5
+ export declare const paymentGatewayApi: {
6
+ get(restaurantId: string): Promise<FdoPaymentGateway[]>;
7
+ upsert(restaurantId: string, body: FdoPaymentGateway): Promise<FdoPaymentGateway[]>;
8
+ delete(restaurantId: string, gatewayId: string): Promise<FdoPaymentGateway[]>;
9
+ };