@feedmepos/mf-payment 1.0.2 → 1.0.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.
@@ -3,7 +3,7 @@ import { p as z } from "./index-CWGSYCJG.js";
3
3
  import { _ as y, u as S, e as K } from "./index-Dj_LwPBy.js";
4
4
  import { defineStore as _ } from "pinia";
5
5
  import { useCoreStore as $ } from "@feedmepos/mf-common";
6
- import { c as AA, P as v } from "./payout-account-D5aZKGxy.js";
6
+ import { c as AA, P as v } from "./payout-account-BhSP2Imp.js";
7
7
  import { useDialogChild as sA, useDialog as eA } from "@feedmepos/ui-library";
8
8
  import { z as X, a as x } from "./validator-D5jtpt9A.js";
9
9
  import { P as J } from "./PDFViewer-xrBtzrlR.js";
@@ -2,7 +2,7 @@ import { defineComponent as g, resolveComponent as i, openBlock as h, createBloc
2
2
  import { u as S } from "./index-BerQZMQW.js";
3
3
  import { _ as O } from "./index-Dj_LwPBy.js";
4
4
  import { _ as K } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
5
- import { P as V } from "./payout-account-D5aZKGxy.js";
5
+ import { P as V } from "./payout-account-BhSP2Imp.js";
6
6
  import { p as $ } from "./index-CWGSYCJG.js";
7
7
  import "@feedmepos/ui-library";
8
8
  import { _ as D } from "./index.vue_vue_type_script_setup_true_lang-BgTr7KWF.js";
@@ -3,7 +3,7 @@ import { e as E, u as q } from "./index-Dj_LwPBy.js";
3
3
  import { useDialog as J, useSnackbar as Q } from "@feedmepos/ui-library";
4
4
  import { d as B } from "./dinero-CIVmXLL-.js";
5
5
  import { g as W, a as X } from "./assets-DjRoCcqv.js";
6
- import { t as P, a as Z } from "./transaction-CIYqsLqc.js";
6
+ import { t as P, a as Z } from "./transaction-Bxl86wzh.js";
7
7
  import { _ as ee } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
8
8
  import { useRouter as te } from "vue-router";
9
9
  import { s as ae } from "./index-Bp_58SiC.js";
@@ -3,7 +3,7 @@ import { e as E, u as G } from "./index-Dj_LwPBy.js";
3
3
  import "@feedmepos/ui-library";
4
4
  import { d as h } from "./dinero-CIVmXLL-.js";
5
5
  import { g as Y, a as H } from "./assets-DjRoCcqv.js";
6
- import { t as q, a as J } from "./transaction-CIYqsLqc.js";
6
+ import { t as q, a as J } from "./transaction-Bxl86wzh.js";
7
7
  import { _ as Q } from "./Layout.vue_vue_type_script_setup_true_lang-DJm5br5a.js";
8
8
  import { useRouter as W } from "vue-router";
9
9
  import { s as X } from "./index-Bp_58SiC.js";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as f, resolveComponent as N, openBlock as g, createBlock as S, normalizeClass as O, withCtx as D, createElementVNode as _, toDisplayString as V, createElementBlock as I, unref as o, ref as A, h as v, onMounted as C, watch as w, createVNode as p, isRef as E } from "vue";
2
- import { t as b, a as M } from "./transaction-CIYqsLqc.js";
2
+ import { t as b, a as M } from "./transaction-Bxl86wzh.js";
3
3
  import { e as x, u as Y } from "./index-Dj_LwPBy.js";
4
4
  import "@feedmepos/ui-library";
5
5
  import "./dinero-CIVmXLL-.js";
@@ -0,0 +1,379 @@
1
+ import { defineComponent as b, resolveComponent as g, openBlock as p, createBlock as E, normalizeClass as q, withCtx as w, createElementVNode as h, toDisplayString as Y, createElementBlock as A, unref as u, createVNode as d, Fragment as $, renderList as C, ref as P, watch as N, isRef as v, h as _ } from "vue";
2
+ import { t as y, a as R, b as I } from "./transaction-Bxl86wzh.js";
3
+ import { h as T } from "./moment-h96o7c8I.js";
4
+ import { u as V } from "./index-BerQZMQW.js";
5
+ import { _ as B } from "./AdminLayout.vue_vue_type_script_setup_true_lang-BTmMOzwx.js";
6
+ import { _ as L } from "./AsyncButton.vue_vue_type_script_setup_true_lang-DcjzvYwT.js";
7
+ import { useSnackbar as U, useDialog as G } from "@feedmepos/ui-library";
8
+ import { w as D } from "./Modal-DB8M9o1T.js";
9
+ import { u as x } from "./error-K1CakhA9.js";
10
+ import { _ as j } from "./DateRangePicker.vue_vue_type_script_setup_true_lang-dP_5WjEJ.js";
11
+ import { _ as Q } from "./index.vue_vue_type_script_setup_true_lang-BgTr7KWF.js";
12
+ import { e as S } from "./index-Dj_LwPBy.js";
13
+ import { g as z, a as H } from "./assets-DjRoCcqv.js";
14
+ import { _ as J } from "./AutoCopyCell.vue_vue_type_script_setup_true_lang-CdmfrBoW.js";
15
+ const W = /* @__PURE__ */ b({
16
+ __name: "Status",
17
+ props: {
18
+ row: {},
19
+ data: {}
20
+ },
21
+ setup(f) {
22
+ const a = f;
23
+ function o() {
24
+ return a.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.PENDING ? "!w-[16px] !h-[16px] bg-yellow-400" : a.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.FAILED ? "!w-[16px] !h-[16px] bg-red-400" : a.data === S.F_PAYMENT_TRANSACTION_STATUS.Enum.REFUNDED ? "!w-[16px] !h-[16px] bg-blue-400" : "!w-[16px] !h-[16px] bg-green-400";
25
+ }
26
+ return (i, s) => {
27
+ const m = g("FmBadge");
28
+ return p(), E(m, {
29
+ inline: "",
30
+ class: q(o())
31
+ }, {
32
+ default: w(() => [
33
+ h("div", null, Y(i.data), 1)
34
+ ]),
35
+ _: 1
36
+ }, 8, ["class"]);
37
+ };
38
+ }
39
+ }), X = ["src"], Z = /* @__PURE__ */ b({
40
+ __name: "Gateway",
41
+ props: {
42
+ row: {},
43
+ data: {}
44
+ },
45
+ setup(f) {
46
+ return (a, o) => (p(), A("img", {
47
+ class: "rounded-md m-auto border-transparent object-contain w-[32px] h-[32px]",
48
+ src: u(z)(a.row.original.gateway)
49
+ }, null, 8, X));
50
+ }
51
+ }), ee = ["src"], te = /* @__PURE__ */ b({
52
+ __name: "Method",
53
+ props: {
54
+ row: {},
55
+ data: {}
56
+ },
57
+ setup(f) {
58
+ return (a, o) => (p(), A("img", {
59
+ class: "rounded-md m-auto border-transparent w-[32px] h-[32px]",
60
+ src: u(H)(a.row.original.method.issuer)
61
+ }, null, 8, ee));
62
+ }
63
+ }), ae = /* @__PURE__ */ b({
64
+ __name: "Actions",
65
+ props: {
66
+ onAction: { type: Function }
67
+ },
68
+ setup(f) {
69
+ const a = [
70
+ {
71
+ label: "Query",
72
+ sublabel: "Perform transaction status inquriy",
73
+ icon: "question_answer",
74
+ action: "query"
75
+ },
76
+ {
77
+ label: "Refund",
78
+ sublabel: "Perform transaction refund request",
79
+ icon: "request_page",
80
+ action: "refund"
81
+ },
82
+ {
83
+ label: "Notify",
84
+ sublabel: "Perform webhook notification for transaction",
85
+ icon: "webhook",
86
+ action: "notify"
87
+ }
88
+ ];
89
+ return (o, i) => {
90
+ const s = g("FmIcon"), m = g("FmMenuItem"), F = g("FmMenu");
91
+ return p(), A("div", {
92
+ onClick: i[0] || (i[0] = (c) => {
93
+ c.stopPropagation();
94
+ })
95
+ }, [
96
+ d(F, null, {
97
+ "menu-button": w(() => [
98
+ d(s, { name: "settings" })
99
+ ]),
100
+ default: w(() => [
101
+ (p(), A($, null, C(a, (c) => d(m, {
102
+ selectable: !0,
103
+ key: c.label,
104
+ sublabel: c.sublabel,
105
+ label: c.label,
106
+ icon: c.icon,
107
+ onclick: () => o.onAction(c.action)
108
+ }, null, 8, ["sublabel", "label", "icon", "onclick"])), 64))
109
+ ]),
110
+ _: 1
111
+ })
112
+ ]);
113
+ };
114
+ }
115
+ }), ne = { class: "flex justify-between mb-6 items-center" }, re = { class: "flex space-x-4" }, oe = { class: "flex space-x-4 self-center" }, se = { class: "mb-6" }, we = /* @__PURE__ */ b({
116
+ __name: "Transaction",
117
+ setup(f) {
118
+ const a = P(), { dateRange: o, searchKey: i } = V({
119
+ searchKey: "",
120
+ dateRange: {
121
+ startDate: T().startOf("day").format("YYYY-MM-DD"),
122
+ endDate: T().endOf("day").format("YYYY-MM-DD")
123
+ }
124
+ }), s = U(), m = G(), F = async (e, t) => {
125
+ let r = parseInt(t);
126
+ Number.isNaN(r) && (r = 1);
127
+ const n = await y.readTransactions({
128
+ start: T(o.value.startDate).startOf("day").toISOString(),
129
+ end: T(o.value.endDate).endOf("day").toISOString(),
130
+ limit: e,
131
+ skip: (r - 1) * e,
132
+ search: i.value
133
+ }), l = n.length == e;
134
+ return {
135
+ data: R(n),
136
+ meta: {
137
+ cursor: l ? (r + 1).toString() : ""
138
+ }
139
+ };
140
+ };
141
+ N(o, async () => {
142
+ var e;
143
+ (e = a.value) == null || e.reset();
144
+ });
145
+ let c;
146
+ N(i, async () => {
147
+ c && clearTimeout(c), c = setTimeout(() => {
148
+ var e;
149
+ (e = a.value) == null || e.reset();
150
+ }, 700);
151
+ });
152
+ async function k(e) {
153
+ var r, n;
154
+ const t = (r = a.value) == null ? void 0 : r.pageData().at(e);
155
+ if (!t) {
156
+ s.open({
157
+ type: "error",
158
+ title: "Something went wrong",
159
+ message: "Fail to find transactions from the displayed transactions."
160
+ });
161
+ return;
162
+ }
163
+ try {
164
+ const l = await y.refetchTransaction({ transactionId: t.id });
165
+ (n = a.value) == null || n.replaceData(e, I(l)), s.open({
166
+ type: "success",
167
+ title: "Transaction queried and updated successfully."
168
+ });
169
+ } catch (l) {
170
+ s.open({
171
+ type: "error",
172
+ title: "Fail to query transaction.",
173
+ message: x(l)
174
+ });
175
+ }
176
+ }
177
+ async function M(e) {
178
+ var r;
179
+ const t = (r = a.value) == null ? void 0 : r.pageData().at(e);
180
+ if (!t) {
181
+ s.open({
182
+ type: "error",
183
+ title: "Something went wrong",
184
+ message: "Fail to find transactions from the displayed transactions."
185
+ });
186
+ return;
187
+ }
188
+ D(
189
+ m,
190
+ "Refund Transaction",
191
+ "Are you sure to refund transaction? This action cannot be revert!",
192
+ async () => {
193
+ var n;
194
+ try {
195
+ const l = await y.refundTransaction({
196
+ transactionId: t.id,
197
+ reason: "portal transaction refund",
198
+ amount: t.fdoAmount
199
+ });
200
+ (n = a.value) == null || n.replaceData(e, I(l)), s.open({
201
+ type: "success",
202
+ title: "Transaction refund request initiated."
203
+ });
204
+ } catch (l) {
205
+ s.open({
206
+ type: "error",
207
+ title: "Fail to request refund transaction.",
208
+ message: x(l)
209
+ });
210
+ }
211
+ }
212
+ );
213
+ }
214
+ async function O(e) {
215
+ var r;
216
+ const t = (r = a.value) == null ? void 0 : r.pageData().at(e);
217
+ if (!t) {
218
+ s.open({
219
+ type: "error",
220
+ title: "Something went wrong",
221
+ message: "Fail to find transactions from the displayed transactions."
222
+ });
223
+ return;
224
+ }
225
+ D(
226
+ m,
227
+ "Notify Transaction",
228
+ "Are you sure to perform notify transaction?",
229
+ async () => {
230
+ try {
231
+ await y.renotifyTransaction(t.id), s.open({
232
+ type: "success",
233
+ title: "Transaction notify successfully."
234
+ });
235
+ } catch (n) {
236
+ s.open({
237
+ type: "error",
238
+ title: "Fail to notify transaction.",
239
+ message: x(n)
240
+ });
241
+ }
242
+ }
243
+ );
244
+ }
245
+ const K = [
246
+ {
247
+ header: () => "Transaction ID",
248
+ accessorKey: "id",
249
+ cell: ({ cell: e }) => _(J, { data: e.getValue() })
250
+ },
251
+ {
252
+ header: () => "Pay ID",
253
+ accessorKey: "payId"
254
+ },
255
+ {
256
+ header: () => "Gateway",
257
+ accessorKey: "gateway",
258
+ meta: {
259
+ textAlign: "center"
260
+ },
261
+ cell: ({ cell: e, row: t }) => t.original.method ? _(Z, { row: t, data: e.getValue() }) : ""
262
+ },
263
+ {
264
+ header: () => "Method",
265
+ accessorKey: "method",
266
+ meta: {
267
+ textAlign: "center"
268
+ },
269
+ cell: ({ cell: e, row: t }) => t.original.method ? _(te, { row: t, data: e.getValue() }) : ""
270
+ },
271
+ {
272
+ header: () => "Type",
273
+ accessorKey: "type",
274
+ meta: {
275
+ textAlign: "center"
276
+ },
277
+ cell: ({ row: e }) => {
278
+ if (!e.original.method)
279
+ return "";
280
+ const t = e.original.method.variant;
281
+ return t.includes("_ONLINE") ? "ONLINE" : t.includes("_OFFLINE") ? "OFFLINE" : t;
282
+ }
283
+ },
284
+ {
285
+ header: () => "Status",
286
+ accessorKey: "status",
287
+ cell: ({ cell: e, row: t }) => _(W, { row: t, data: e.getValue() })
288
+ },
289
+ {
290
+ header: () => "Transaction At",
291
+ accessorKey: "transactionAt",
292
+ meta: {
293
+ width: "180px"
294
+ }
295
+ },
296
+ {
297
+ header: () => "Sales Amount",
298
+ accessorKey: "amount"
299
+ },
300
+ {
301
+ header: () => "Fee",
302
+ accessorKey: "fee"
303
+ },
304
+ {
305
+ header: () => "Settlement Amount",
306
+ accessorKey: "payout"
307
+ },
308
+ {
309
+ header: () => "Actions",
310
+ accessorKey: "actions",
311
+ cell: ({ row: e }) => _(ae, {
312
+ onAction: (t) => {
313
+ switch (t) {
314
+ case "notify":
315
+ return O(e.index);
316
+ case "query":
317
+ return k(e.index);
318
+ case "refund":
319
+ return M(e.index);
320
+ }
321
+ }
322
+ })
323
+ }
324
+ ];
325
+ return (e, t) => {
326
+ const r = g("FmSearch");
327
+ return p(), E(B, {
328
+ title: "Online Transactions",
329
+ loading: !1
330
+ }, {
331
+ default: w(() => [
332
+ h("div", ne, [
333
+ h("div", re, [
334
+ d(r, {
335
+ "model-value": u(i),
336
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => v(i) ? i.value = n : null),
337
+ class: "mr-8",
338
+ label: "Search",
339
+ placeholder: "Search Transactions ..."
340
+ }, null, 8, ["model-value"])
341
+ ]),
342
+ h("div", oe, [
343
+ d(L, {
344
+ button: {
345
+ appendIcon: "file_download",
346
+ variant: "primary",
347
+ label: "Export"
348
+ },
349
+ handler: async () => {
350
+ await u(y).downloadTransactionReport({
351
+ start: u(o).startDate,
352
+ end: u(o).endDate
353
+ });
354
+ }
355
+ }, null, 8, ["handler"])
356
+ ])
357
+ ]),
358
+ h("div", se, [
359
+ d(j, {
360
+ modelValue: u(o),
361
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => v(o) ? o.value = n : null)
362
+ }, null, 8, ["modelValue"])
363
+ ]),
364
+ d(Q, {
365
+ ref_key: "controller",
366
+ ref: a,
367
+ "column-defs": K,
368
+ "rows-defs": (n) => n,
369
+ paginate: F
370
+ }, null, 8, ["rows-defs"])
371
+ ]),
372
+ _: 1
373
+ });
374
+ };
375
+ }
376
+ });
377
+ export {
378
+ we as default
379
+ };
@@ -5,6 +5,9 @@ export declare const transactionApi: {
5
5
  readTransactions(params: {
6
6
  start: string;
7
7
  end: string;
8
+ limit: number;
9
+ skip: number;
10
+ search: string;
8
11
  }): Promise<PaymentTransactionDtoOutput[]>;
9
12
  removeTransactionFromSettlement(transactionId: string): Promise<any>;
10
13
  refetchTransaction({ transactionId, }: {