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