@feedmepos/mf-payment 1.5.34-dev → 1.5.34

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