@feedmepos/mf-payment 0.0.0-beta.44 → 0.0.0-beta.46

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,780 @@
1
+ import { defineComponent as I, resolveComponent as m, openBlock as g, createElementBlock as R, Fragment as D, createElementVNode as s, createVNode as u, withCtx as x, createTextVNode as C, toDisplayString as P, createCommentVNode as U, createBlock as V, ref as k, watch as O, computed as K, unref as r, isRef as j, h as q, onMounted as Y, resolveDynamicComponent as z, normalizeProps as H, mergeProps as L } from "vue";
2
+ import { p as N } from "./index-BlGpdOEP.js";
3
+ import { g as B, b as E, u as Q, e as $ } from "./index-9ujJCGqe.js";
4
+ import { _ as Z } from "./Layout.vue_vue_type_script_setup_true_lang-C38PTqO5.js";
5
+ import { useRouter as J } from "vue-router";
6
+ import { u as W } from "./index-C5AZUa6M.js";
7
+ import { P as M } from "./PDFViewer-CjH_C1uT.js";
8
+ import { useSnackbar as X } from "@feedmepos/ui-library";
9
+ import { u as h } from "./error-K1CakhA9.js";
10
+ import { z as A, a as S } from "./validator-D5jtpt9A.js";
11
+ import { useCoreStore as ee } from "@feedmepos/mf-common";
12
+ const te = { class: "flex gap-16 mb-6" }, ae = ["src"], ne = /* @__PURE__ */ I({
13
+ __name: "Information",
14
+ props: {
15
+ payoutAccount: {
16
+ type: Object,
17
+ required: !0
18
+ }
19
+ },
20
+ setup(a) {
21
+ return (i, e) => {
22
+ const d = m("FmCardHeader"), c = m("FmCardSection"), t = m("FmCard");
23
+ return g(), R(D, null, [
24
+ s("div", te, [
25
+ u(t, {
26
+ horizontal: "",
27
+ class: "flex-1 p-6",
28
+ variant: "elevated"
29
+ }, {
30
+ default: x(() => [
31
+ u(c, { class: "flex flex-col gap-16 justify-between" }, {
32
+ default: x(() => [
33
+ u(d, {
34
+ class: "p-0",
35
+ title: "Account Info",
36
+ subtitle: ""
37
+ }),
38
+ u(c, { class: "p-0" }, {
39
+ default: x(() => {
40
+ var l, v, y, o, n;
41
+ return [
42
+ e[0] || (e[0] = s("b", null, "For", -1)),
43
+ C(": " + P((v = (l = a.payoutAccount) == null ? void 0 : l.store) == null ? void 0 : v.event) + " ", 1),
44
+ e[1] || (e[1] = s("br", null, null, -1)),
45
+ e[2] || (e[2] = s("b", null, "Reference", -1)),
46
+ C(": " + P((o = (y = a.payoutAccount) == null ? void 0 : y.store) == null ? void 0 : o.id), 1),
47
+ e[3] || (e[3] = s("br", null, null, -1)),
48
+ e[4] || (e[4] = s("b", null, "Business", -1)),
49
+ C(": " + P((n = a.payoutAccount) == null ? void 0 : n.businessId), 1),
50
+ e[5] || (e[5] = s("br", null, null, -1))
51
+ ];
52
+ }),
53
+ _: 1
54
+ })
55
+ ]),
56
+ _: 1
57
+ })
58
+ ]),
59
+ _: 1
60
+ }),
61
+ u(t, {
62
+ horizontal: "",
63
+ class: "flex-1 p-6",
64
+ variant: "elevated"
65
+ }, {
66
+ default: x(() => [
67
+ u(c, { class: "flex flex-col gap-16 justify-between" }, {
68
+ default: x(() => [
69
+ u(d, {
70
+ class: "p-0",
71
+ title: "Key Person",
72
+ subtitle: ""
73
+ }),
74
+ u(c, { class: "p-0" }, {
75
+ default: x(() => {
76
+ var l, v, y, o, n, f, p, b;
77
+ return [
78
+ e[6] || (e[6] = s("b", null, "Email", -1)),
79
+ C(": " + P((y = (v = (l = a.payoutAccount) == null ? void 0 : l.store) == null ? void 0 : v.keyPerson) == null ? void 0 : y.email) + " ", 1),
80
+ e[7] || (e[7] = s("br", null, null, -1)),
81
+ e[8] || (e[8] = s("b", null, "Name", -1)),
82
+ C(": " + P((f = (n = (o = a.payoutAccount) == null ? void 0 : o.store) == null ? void 0 : n.keyPerson) == null ? void 0 : f.name), 1),
83
+ e[9] || (e[9] = s("br", null, null, -1)),
84
+ e[10] || (e[10] = s("b", null, "Phone", -1)),
85
+ C(": " + P((b = (p = a.payoutAccount) == null ? void 0 : p.store.keyPerson) == null ? void 0 : b.phone), 1),
86
+ e[11] || (e[11] = s("br", null, null, -1))
87
+ ];
88
+ }),
89
+ _: 1
90
+ })
91
+ ]),
92
+ _: 1
93
+ })
94
+ ]),
95
+ _: 1
96
+ })
97
+ ]),
98
+ e[12] || (e[12] = s("p", { class: "fm-typo-en-body-lg-600 mb-6" }, "Exterior Photo", -1)),
99
+ a.payoutAccount.store.exteriorPhoto ? (g(), R("img", {
100
+ key: 0,
101
+ src: a.payoutAccount.store.exteriorPhoto
102
+ }, null, 8, ae)) : U("", !0)
103
+ ], 64);
104
+ };
105
+ }
106
+ }), le = { class: "flex gap-16" }, oe = { class: "flex-1" }, ue = { class: "flex-1" }, re = /* @__PURE__ */ I({
107
+ __name: "Settlement",
108
+ props: {
109
+ payoutAccount: {
110
+ type: Object,
111
+ required: !0
112
+ }
113
+ },
114
+ setup(a) {
115
+ return (i, e) => {
116
+ const d = m("FmCardHeader"), c = m("FmCardSection"), t = m("FmCard");
117
+ return g(), R(D, null, [
118
+ u(t, {
119
+ horizontal: "",
120
+ class: "flex-1 p-6 mx-6 mb-6",
121
+ variant: "elevated"
122
+ }, {
123
+ default: x(() => [
124
+ u(c, { class: "flex flex-col gap-16 justify-between" }, {
125
+ default: x(() => [
126
+ u(d, {
127
+ class: "p-0",
128
+ title: "Bank Info",
129
+ subtitle: ""
130
+ }),
131
+ u(c, { class: "p-0" }, {
132
+ default: x(() => {
133
+ var l, v, y, o, n, f;
134
+ return [
135
+ e[0] || (e[0] = s("b", null, "Bank", -1)),
136
+ C(": " + P((v = (l = a.payoutAccount) == null ? void 0 : l.store.bank) == null ? void 0 : v.name), 1),
137
+ e[1] || (e[1] = s("br", null, null, -1)),
138
+ e[2] || (e[2] = s("b", null, "Name", -1)),
139
+ C(": " + P((o = (y = a.payoutAccount) == null ? void 0 : y.store.bank) == null ? void 0 : o.holderName), 1),
140
+ e[3] || (e[3] = s("br", null, null, -1)),
141
+ e[4] || (e[4] = s("b", null, "Number", -1)),
142
+ C(": " + P((f = (n = a.payoutAccount) == null ? void 0 : n.store.bank) == null ? void 0 : f.accountNumber), 1)
143
+ ];
144
+ }),
145
+ _: 1
146
+ })
147
+ ]),
148
+ _: 1
149
+ })
150
+ ]),
151
+ _: 1
152
+ }),
153
+ s("div", le, [
154
+ s("div", oe, [
155
+ e[5] || (e[5] = s("p", { class: "fm-typo-en-body-lg-600 mb-6" }, "SSM", -1)),
156
+ a.payoutAccount.store.ssm ? (g(), V(M, {
157
+ key: 0,
158
+ pdf: a.payoutAccount.store.ssm,
159
+ "disable-text-layer": !0,
160
+ "disable-annotation-layer": !0
161
+ }, null, 8, ["pdf"])) : U("", !0)
162
+ ]),
163
+ s("div", ue, [
164
+ e[6] || (e[6] = s("p", { class: "fm-typo-en-body-lg-600 mb-6" }, "Bank Statement", -1)),
165
+ a.payoutAccount.store.bankStatement ? (g(), V(M, {
166
+ key: 0,
167
+ pdf: a.payoutAccount.store.bankStatement,
168
+ "disable-text-layer": !0,
169
+ "disable-annotation-layer": !0
170
+ }, null, 8, ["pdf"])) : U("", !0)
171
+ ])
172
+ ])
173
+ ], 64);
174
+ };
175
+ }
176
+ }), se = /* @__PURE__ */ I({
177
+ __name: "RateInput",
178
+ props: {
179
+ data: {},
180
+ onChange: { type: Function }
181
+ },
182
+ setup(a) {
183
+ const i = a, e = k(i.data.toString());
184
+ return O(e, (d) => {
185
+ i.onChange(parseFloat(d));
186
+ }), (d, c) => {
187
+ const t = m("FmTextField");
188
+ return g(), V(t, {
189
+ inputmode: "decimal",
190
+ modelValue: e.value,
191
+ "onUpdate:modelValue": c[0] || (c[0] = (l) => e.value = l)
192
+ }, {
193
+ append: x(() => c[1] || (c[1] = [
194
+ C("%")
195
+ ])),
196
+ _: 1
197
+ }, 8, ["modelValue"]);
198
+ };
199
+ }
200
+ }), ie = /* @__PURE__ */ I({
201
+ __name: "TPlusInput",
202
+ props: {
203
+ data: {},
204
+ onChange: { type: Function }
205
+ },
206
+ setup(a) {
207
+ const i = a, e = k(i.data.toString());
208
+ return O(e, (d) => {
209
+ i.onChange(parseInt(d));
210
+ }), (d, c) => {
211
+ const t = m("FmTextField");
212
+ return g(), V(t, {
213
+ inputmode: "numeric",
214
+ modelValue: e.value,
215
+ "onUpdate:modelValue": c[0] || (c[0] = (l) => e.value = l)
216
+ }, null, 8, ["modelValue"]);
217
+ };
218
+ }
219
+ }), me = { class: "flex gap-16 mt-6" }, de = { class: "flex-1" }, ce = { class: "flex-1" }, pe = { class: "my-6 w-full flex justify-end" }, ye = { class: "w-[320px]" }, fe = /* @__PURE__ */ I({
220
+ __name: "PaymentStatus",
221
+ props: {
222
+ onUpdate: {
223
+ type: Function,
224
+ required: !0
225
+ },
226
+ payoutAccount: {
227
+ type: Object,
228
+ required: !0
229
+ }
230
+ },
231
+ setup(a) {
232
+ const i = a, e = k(!1), d = X(), c = async (o) => {
233
+ try {
234
+ e.value = !0, await i.onUpdate(o), d.open({
235
+ type: "success",
236
+ title: "Payout account update succesfully"
237
+ });
238
+ } catch (n) {
239
+ d.open({
240
+ type: "error",
241
+ title: "Error occurs when updating payout account",
242
+ message: h(n)
243
+ });
244
+ } finally {
245
+ e.value = !1;
246
+ }
247
+ }, { search: t } = W({
248
+ search: ""
249
+ }), l = K(() => {
250
+ const { ssm: o, bank: n, bankStatement: f } = i.payoutAccount.store;
251
+ return o && n && n.name && n.accountNumber && n.holderName && f;
252
+ }), v = k(""), y = [
253
+ {
254
+ header: () => "Payment Method",
255
+ accessorKey: "issuer",
256
+ cell: (o) => `${o.row.original.issuer} (${o.row.original.variant})`
257
+ },
258
+ {
259
+ header: () => "Rate",
260
+ accessorKey: "rate",
261
+ cell: ({ row: o }) => {
262
+ let n = 0;
263
+ return o.original.rate && (n = o.original.rate.amount / Math.pow(10, o.original.rate.precision)), q(se, {
264
+ data: n,
265
+ onChange: (f) => {
266
+ const p = i.payoutAccount.methods.at(o.index);
267
+ p.rate || (p.rate = {
268
+ amount: 0,
269
+ precision: 4
270
+ }), p.rate.amount = f * Math.pow(10, p.rate.precision);
271
+ }
272
+ });
273
+ }
274
+ },
275
+ {
276
+ header: () => "T plus",
277
+ accessorKey: "tPlus",
278
+ cell: ({ row: o }) => q(ie, {
279
+ data: o.original.tPlus ?? 0,
280
+ onChange: (n) => {
281
+ const f = i.payoutAccount.methods.at(o.index);
282
+ f.tPlus = n;
283
+ }
284
+ })
285
+ }
286
+ ];
287
+ return (o, n) => {
288
+ const f = m("FmRadio"), p = m("FmRadioGroup"), b = m("FmSwitch"), w = m("FmSearch"), T = m("FmTable"), F = m("FmButton");
289
+ return g(), R(D, null, [
290
+ s("div", me, [
291
+ s("div", de, [
292
+ u(p, {
293
+ modelValue: a.payoutAccount.status,
294
+ "onUpdate:modelValue": n[0] || (n[0] = (G) => a.payoutAccount.status = G),
295
+ label: "Account Status"
296
+ }, {
297
+ default: x(() => [
298
+ u(f, {
299
+ value: "NEW",
300
+ label: "New"
301
+ }),
302
+ u(f, {
303
+ value: "PENDING",
304
+ label: "Pending"
305
+ }),
306
+ u(f, {
307
+ value: "APPROVED",
308
+ label: "Approved"
309
+ })
310
+ ]),
311
+ _: 1
312
+ }, 8, ["modelValue"])
313
+ ]),
314
+ s("div", ce, [
315
+ u(b, {
316
+ modelValue: a.payoutAccount.enable,
317
+ "onUpdate:modelValue": n[1] || (n[1] = (G) => a.payoutAccount.enable = G),
318
+ disabled: !l.value,
319
+ label: "Enabled",
320
+ sublabel: "Merchant can use online features such as e-payment, settlement"
321
+ }, null, 8, ["modelValue", "disabled"])
322
+ ])
323
+ ]),
324
+ a.payoutAccount.enable ? (g(), R(D, { key: 0 }, [
325
+ s("div", pe, [
326
+ s("div", ye, [
327
+ u(w, {
328
+ modelValue: r(t),
329
+ "onUpdate:modelValue": n[2] || (n[2] = (G) => j(t) ? t.value = G : null),
330
+ placeholder: "Search Method ..."
331
+ }, null, 8, ["modelValue"])
332
+ ])
333
+ ]),
334
+ u(T, {
335
+ class: "mt-6",
336
+ modelValue: v.value,
337
+ "onUpdate:modelValue": n[3] || (n[3] = (G) => v.value = G),
338
+ "search-value": r(t),
339
+ "row-data": a.payoutAccount.methods,
340
+ "column-defs": y
341
+ }, null, 8, ["modelValue", "search-value", "row-data"])
342
+ ], 64)) : U("", !0),
343
+ u(F, {
344
+ class: "w-full mt-6",
345
+ variant: "primary",
346
+ label: "Save",
347
+ loading: e.value,
348
+ onclick: () => c(a.payoutAccount)
349
+ }, null, 8, ["loading", "onclick"])
350
+ ], 64);
351
+ };
352
+ }
353
+ }), _ = {
354
+ async get(a) {
355
+ return B(
356
+ await E().get(
357
+ `restaurants/${a}/payment-gateway`
358
+ )
359
+ );
360
+ },
361
+ async upsert(a, i) {
362
+ return B(
363
+ await E().post(
364
+ `restaurants/${a}/payment-gateway`,
365
+ { data: i }
366
+ )
367
+ );
368
+ },
369
+ async delete(a, i) {
370
+ return B(
371
+ await E().delete(
372
+ `restaurants/${a}/payment-gateway/${i}`
373
+ )
374
+ );
375
+ }
376
+ }, ve = { class: "flex mt-6 space-x-6" }, be = /* @__PURE__ */ I({
377
+ __name: "FiuuGateway",
378
+ props: {
379
+ onUpdate: {
380
+ type: Function,
381
+ required: !0
382
+ },
383
+ onDelete: {
384
+ type: Function,
385
+ required: !0
386
+ },
387
+ gateway: {
388
+ type: Object,
389
+ required: !0
390
+ }
391
+ },
392
+ setup(a) {
393
+ var d;
394
+ const e = k(((d = a.gateway) == null ? void 0 : d.config) || {
395
+ merchantId: "",
396
+ uniqueId: "",
397
+ verifyKey: "",
398
+ secretKey: "",
399
+ applicationCode: "",
400
+ offlineSecret: ""
401
+ });
402
+ return (c, t) => {
403
+ const l = m("FmTextField"), v = m("FmButton"), y = m("FmForm");
404
+ return g(), V(y, {
405
+ ref: "form",
406
+ class: "flex flex-col gap-16",
407
+ onValidationSuccess: t[6] || (t[6] = () => a.onUpdate(e.value))
408
+ }, {
409
+ default: x(() => [
410
+ u(l, {
411
+ modelValue: e.value.merchantId,
412
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => e.value.merchantId = o),
413
+ label: "Merchant ID",
414
+ rules: r(A)(r(S).string())
415
+ }, null, 8, ["modelValue", "rules"]),
416
+ u(l, {
417
+ modelValue: e.value.uniqueId,
418
+ "onUpdate:modelValue": t[1] || (t[1] = (o) => e.value.uniqueId = o),
419
+ label: "Unique ID",
420
+ rules: r(A)(r(S).string())
421
+ }, null, 8, ["modelValue", "rules"]),
422
+ u(l, {
423
+ modelValue: e.value.verifyKey,
424
+ "onUpdate:modelValue": t[2] || (t[2] = (o) => e.value.verifyKey = o),
425
+ label: "Verify Key",
426
+ rules: r(A)(r(S).string())
427
+ }, null, 8, ["modelValue", "rules"]),
428
+ u(l, {
429
+ modelValue: e.value.secretKey,
430
+ "onUpdate:modelValue": t[3] || (t[3] = (o) => e.value.secretKey = o),
431
+ label: "Secret Key",
432
+ rules: r(A)(r(S).string())
433
+ }, null, 8, ["modelValue", "rules"]),
434
+ u(l, {
435
+ modelValue: e.value.applicationCode,
436
+ "onUpdate:modelValue": t[4] || (t[4] = (o) => e.value.applicationCode = o),
437
+ label: "Application Code ( Offline )",
438
+ rules: r(A)(r(S).string())
439
+ }, null, 8, ["modelValue", "rules"]),
440
+ u(l, {
441
+ modelValue: e.value.offlineSecret,
442
+ "onUpdate:modelValue": t[5] || (t[5] = (o) => e.value.offlineSecret = o),
443
+ label: "Offline Secret ( Offline )",
444
+ rules: r(A)(r(S).string())
445
+ }, null, 8, ["modelValue", "rules"]),
446
+ s("div", ve, [
447
+ a.gateway ? (g(), V(v, {
448
+ key: 0,
449
+ class: "flex-1",
450
+ variant: "secondary",
451
+ label: "Delete",
452
+ onclick: () => a.onDelete(a.gateway)
453
+ }, null, 8, ["onclick"])) : U("", !0),
454
+ u(v, {
455
+ type: "submit",
456
+ class: "flex-1",
457
+ variant: "primary",
458
+ label: "Save"
459
+ })
460
+ ])
461
+ ]),
462
+ _: 1
463
+ }, 512);
464
+ };
465
+ }
466
+ }), ge = { class: "flex mt-6 space-x-6" }, Fe = /* @__PURE__ */ I({
467
+ __name: "RevenueMonsterGateway",
468
+ props: {
469
+ onUpdate: {
470
+ type: Function,
471
+ required: !0
472
+ },
473
+ onDelete: {
474
+ type: Function,
475
+ required: !0
476
+ },
477
+ gateway: {
478
+ type: Object,
479
+ required: !0
480
+ }
481
+ },
482
+ setup(a) {
483
+ var d;
484
+ const e = k(((d = a.gateway) == null ? void 0 : d.config) || {
485
+ storeId: "",
486
+ clientId: "",
487
+ clientSecret: "",
488
+ clientPrivateKey: ""
489
+ });
490
+ return (c, t) => {
491
+ const l = m("FmTextField"), v = m("FmTextarea"), y = m("FmButton"), o = m("FmForm");
492
+ return g(), V(o, {
493
+ ref: "form",
494
+ class: "flex flex-col gap-16",
495
+ onValidationSuccess: t[4] || (t[4] = () => a.onUpdate(e.value))
496
+ }, {
497
+ default: x(() => [
498
+ u(l, {
499
+ modelValue: e.value.storeId,
500
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.storeId = n),
501
+ label: "Store ID",
502
+ rules: r(A)(r(S).string())
503
+ }, null, 8, ["modelValue", "rules"]),
504
+ u(l, {
505
+ modelValue: e.value.clientId,
506
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.clientId = n),
507
+ label: "Client ID",
508
+ rules: r(A)(r(S).string())
509
+ }, null, 8, ["modelValue", "rules"]),
510
+ u(l, {
511
+ modelValue: e.value.clientSecret,
512
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => e.value.clientSecret = n),
513
+ label: "Client Secret",
514
+ rules: r(A)(r(S).string())
515
+ }, null, 8, ["modelValue", "rules"]),
516
+ u(v, {
517
+ modelValue: e.value.clientPrivateKey,
518
+ "onUpdate:modelValue": t[3] || (t[3] = (n) => e.value.clientPrivateKey = n),
519
+ label: "Client Private Key"
520
+ }, null, 8, ["modelValue"]),
521
+ s("div", ge, [
522
+ a.gateway ? (g(), V(y, {
523
+ key: 0,
524
+ class: "flex-1",
525
+ variant: "secondary",
526
+ label: "Delete",
527
+ onclick: () => a.onDelete(a.gateway)
528
+ }, null, 8, ["onclick"])) : U("", !0),
529
+ u(y, {
530
+ type: "submit",
531
+ class: "flex-1",
532
+ variant: "primary",
533
+ label: "Save"
534
+ })
535
+ ])
536
+ ]),
537
+ _: 1
538
+ }, 512);
539
+ };
540
+ }
541
+ }), xe = { class: "flex mt-6 space-x-6" }, Ve = /* @__PURE__ */ I({
542
+ __name: "GhlGateway",
543
+ props: {
544
+ onUpdate: {
545
+ type: Function,
546
+ required: !0
547
+ },
548
+ onDelete: {
549
+ type: Function,
550
+ required: !0
551
+ },
552
+ gateway: {
553
+ type: Object,
554
+ required: !0
555
+ }
556
+ },
557
+ setup(a) {
558
+ var d;
559
+ const e = k(((d = a.gateway) == null ? void 0 : d.config) || {
560
+ merchantId: "",
561
+ terminalId: "",
562
+ privateKey: ""
563
+ });
564
+ return (c, t) => {
565
+ const l = m("FmTextField"), v = m("FmTextarea"), y = m("FmButton"), o = m("FmForm");
566
+ return g(), V(o, {
567
+ ref: "form",
568
+ class: "flex flex-col gap-16",
569
+ onValidationSuccess: t[3] || (t[3] = () => a.onUpdate(e.value))
570
+ }, {
571
+ default: x(() => [
572
+ u(l, {
573
+ modelValue: e.value.merchantId,
574
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => e.value.merchantId = n),
575
+ label: "Merchant ID",
576
+ rules: r(A)(r(S).string())
577
+ }, null, 8, ["modelValue", "rules"]),
578
+ u(l, {
579
+ modelValue: e.value.terminalId,
580
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.value.terminalId = n),
581
+ label: "Terminal ID",
582
+ rules: r(A)(r(S).string())
583
+ }, null, 8, ["modelValue", "rules"]),
584
+ u(v, {
585
+ modelValue: e.value.privateKey,
586
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => e.value.privateKey = n),
587
+ label: "Private Key",
588
+ rules: r(A)(r(S).string())
589
+ }, null, 8, ["modelValue", "rules"]),
590
+ s("div", xe, [
591
+ a.gateway ? (g(), V(y, {
592
+ key: 0,
593
+ class: "flex-1",
594
+ variant: "secondary",
595
+ label: "Delete",
596
+ onclick: () => a.onDelete(a.gateway)
597
+ }, null, 8, ["onclick"])) : U("", !0),
598
+ u(y, {
599
+ type: "submit",
600
+ class: "flex-1",
601
+ variant: "primary",
602
+ label: "Save"
603
+ })
604
+ ])
605
+ ]),
606
+ _: 1
607
+ }, 512);
608
+ };
609
+ }
610
+ }), we = {
611
+ key: 0,
612
+ class: "flex items-center justify-center min-h-[80vh]"
613
+ }, Ae = /* @__PURE__ */ I({
614
+ __name: "PaymentGateway",
615
+ props: {
616
+ payoutAccount: {
617
+ type: Object,
618
+ required: !0
619
+ }
620
+ },
621
+ setup(a) {
622
+ const i = a, e = ee(), { isLoading: d, startAsyncCall: c } = Q(), t = k(), l = k([]);
623
+ function v() {
624
+ c(async () => {
625
+ var p;
626
+ l.value = await _.get(i.payoutAccount.store.id), t.value = (p = l.value.find((b) => b.active)) == null ? void 0 : p.paymentGateway;
627
+ });
628
+ }
629
+ async function y(p) {
630
+ c(async () => {
631
+ var T;
632
+ const b = {
633
+ _id: "",
634
+ _rev: "",
635
+ paymentGateway: t.value,
636
+ config: p,
637
+ active: !0
638
+ }, w = l.value.find((F) => F.paymentGateway === t.value);
639
+ w && (b._id = w._id, b._rev = w._rev), await Promise.all(
640
+ l.value.map(async (F) => {
641
+ F.active && F.paymentGateway !== b.paymentGateway && await _.upsert(i.payoutAccount.store.id, {
642
+ ...F,
643
+ active: !1
644
+ });
645
+ })
646
+ ), await _.upsert(i.payoutAccount.store.id, b), l.value = await _.get(i.payoutAccount.store.id), t.value = (T = l.value.find((F) => F.active)) == null ? void 0 : T.paymentGateway;
647
+ });
648
+ }
649
+ async function o(p) {
650
+ c(async () => {
651
+ var b;
652
+ await _.delete(i.payoutAccount.store.id, p._id), l.value = await _.get(i.payoutAccount.store.id), t.value = (b = l.value.find((w) => w.active)) == null ? void 0 : b.paymentGateway;
653
+ });
654
+ }
655
+ Y(v);
656
+ const n = [
657
+ {
658
+ label: "Fiuu",
659
+ value: "RAZER_MERCHANT_SERVICE",
660
+ form: be,
661
+ region: [$.F_COUNTRY.enum.MY, $.F_COUNTRY.enum.SG]
662
+ },
663
+ {
664
+ label: "Revenue Monster",
665
+ value: "REVENUE_MONSTER",
666
+ form: Fe,
667
+ region: [$.F_COUNTRY.enum.MY]
668
+ },
669
+ {
670
+ label: "GHL",
671
+ value: "E_GHL",
672
+ form: Ve,
673
+ region: [$.F_COUNTRY.enum.MY]
674
+ }
675
+ ], f = K(() => {
676
+ var p;
677
+ return (p = n.find((b) => b.value === t.value)) == null ? void 0 : p.form;
678
+ });
679
+ return (p, b) => {
680
+ const w = m("FmCircularProgress"), T = m("FmSelect");
681
+ return g(), R(D, null, [
682
+ r(d) ? (g(), R("div", we, [
683
+ u(w, { size: "xxl" })
684
+ ])) : (g(), V(T, {
685
+ key: 1,
686
+ modelValue: t.value,
687
+ "onUpdate:modelValue": b[0] || (b[0] = (F) => t.value = F),
688
+ class: "mb-6",
689
+ label: "Payment Service Provider",
690
+ items: n.filter((F) => F.region.includes(r(e).currentCountry.value ?? r($.F_COUNTRY).enum.MY))
691
+ }, null, 8, ["modelValue", "items"])),
692
+ t.value ? (g(), V(z(f.value), H(L({ key: 2 }, {
693
+ gateway: l.value.find((F) => F.paymentGateway === t.value),
694
+ onDelete: o,
695
+ onUpdate: y
696
+ })), null, 16)) : U("", !0)
697
+ ], 64);
698
+ };
699
+ }
700
+ }), De = /* @__PURE__ */ I({
701
+ __name: "PayoutAccountSetting",
702
+ props: {
703
+ accountId: {
704
+ type: String,
705
+ required: !0
706
+ }
707
+ },
708
+ setup(a) {
709
+ const i = a, { tab: e } = W({
710
+ tab: "information"
711
+ }), { isLoading: d, startAsyncCall: c } = Q(!0), t = J(), l = k();
712
+ async function v(f) {
713
+ await N.updateById(
714
+ i.accountId,
715
+ f
716
+ ), l.value = await N.readById(i.accountId);
717
+ }
718
+ const y = [
719
+ {
720
+ label: "Information",
721
+ value: "information",
722
+ icon: "overview",
723
+ render: ne
724
+ },
725
+ {
726
+ label: "Settlement",
727
+ value: "settlement",
728
+ icon: "payments",
729
+ render: re
730
+ },
731
+ {
732
+ label: "MDR Status",
733
+ value: "payment",
734
+ icon: "account_box",
735
+ render: fe
736
+ }
737
+ ];
738
+ function o() {
739
+ c(async () => {
740
+ l.value = await N.readById(i.accountId), l.value.store.event === "ORDERING" && y.push({
741
+ label: "Payment Gateway",
742
+ value: "payment-gateway",
743
+ icon: "assured_workload",
744
+ render: Ae
745
+ });
746
+ });
747
+ }
748
+ Y(o);
749
+ const n = K(() => {
750
+ var f;
751
+ return (f = y.find((p) => p.value === e.value)) == null ? void 0 : f.render;
752
+ });
753
+ return (f, p) => {
754
+ var w;
755
+ const b = m("FmTabs");
756
+ return g(), V(Z, {
757
+ title: `Payout Account (${(w = l.value) == null ? void 0 : w._id})`,
758
+ loading: r(d),
759
+ onBack: r(t).back
760
+ }, {
761
+ default: x(() => [
762
+ u(b, {
763
+ "model-value": r(e),
764
+ "onUpdate:modelValue": p[0] || (p[0] = (T) => j(e) ? e.value = T : null),
765
+ class: "mb-6",
766
+ items: y
767
+ }, null, 8, ["model-value"]),
768
+ r(e) ? (g(), V(z(n.value), H(L({ key: 0 }, {
769
+ payoutAccount: l.value,
770
+ onUpdate: v
771
+ })), null, 16)) : U("", !0)
772
+ ]),
773
+ _: 1
774
+ }, 8, ["title", "loading", "onBack"]);
775
+ };
776
+ }
777
+ });
778
+ export {
779
+ De as default
780
+ };