@feedmepos/mf-payment 0.0.0-beta.14 → 0.0.0-beta.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/dist/{PayoutAccount-DuqITwjB.js → PayoutAccount-CNVWd22h.js} +5 -5
  2. package/dist/{PayoutAccount-BHwKD9si.js → PayoutAccount-DqNPOjFg.js} +3 -3
  3. package/dist/PayoutAccountSetting-uiFglxyj.js +702 -0
  4. package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-CY4ttpKj.js +33 -0
  5. package/dist/{Settlement-Dr6Rmkid.js → Settlement-DLFEvFiY.js} +3 -3
  6. package/dist/{Settlement-JkH7-Wd_.js → Settlement-DuT2FxzJ.js} +28 -26
  7. package/dist/{SettlementTransactions-CSz0G9iE.js → SettlementTransactions--BvqHEHi.js} +110 -116
  8. package/dist/{SettlementTransactions-BGfDReId.js → SettlementTransactions-BQpqcrAK.js} +99 -105
  9. package/dist/{Terminal-DQqtUzV2.js → Terminal-C6ns-w6k.js} +4 -4
  10. package/dist/{TerminalSetting-T0Sxq_z0.js → TerminalSetting-Dditd6yX.js} +3 -3
  11. package/dist/{TerminalTransaction-C0g2mMBJ.js → TerminalTransaction-CxkG6chg.js} +61 -69
  12. package/dist/TerminalTransaction-DYlm_3zt.js +230 -0
  13. package/dist/Transaction-CHHwlo39.js +242 -0
  14. package/dist/Transaction-CkRaGtkz.js +243 -0
  15. package/dist/api/pagination.d.ts +20 -0
  16. package/dist/api/payment-gateway/index.d.ts +9 -0
  17. package/dist/api/terminal-transaction/index.d.ts +8 -0
  18. package/dist/app.js +56 -48
  19. package/dist/{assets-nIQ0r4oP.js → assets-DB7pg43Y.js} +1 -1
  20. package/dist/components/RestaurantSelector.vue.d.ts +2 -0
  21. package/dist/{index-CxYMbN69.js → index-7_iwp3ZF.js} +1 -1
  22. package/dist/{index-DflgpHga.js → index-BBTjdV3w.js} +2 -2
  23. package/dist/index-BVmZTFl8.js +20 -0
  24. package/dist/{index-CIIojtd5.js → index-Bboaan5m.js} +1 -1
  25. package/dist/{index-DhPhiNvt.js → index-BuCL5h0R.js} +1 -1
  26. package/dist/{index-DqQBDo_Y.js → index-DIT7Btp7.js} +1 -1
  27. package/dist/{index.vue_vue_type_script_setup_true_lang-CcY9Uu6G.js → index.vue_vue_type_script_setup_true_lang-CcT6hjAl.js} +1 -1
  28. package/dist/package.json +1 -1
  29. package/dist/{payout-account-FNZygqj-.js → payout-account-BFlecjFI.js} +306 -306
  30. package/dist/{transaction-B4rEbejx.js → transaction-CSqbF07L.js} +1 -1
  31. package/dist/tsconfig.app.tsbuildinfo +1 -1
  32. package/dist/views/admin/payout-account/tabs/PaymentGateway.vue.d.ts +81 -0
  33. package/dist/views/admin/payout-account/tabs/gateway/FiuuGateway.vue.d.ts +56 -0
  34. package/dist/views/admin/payout-account/tabs/gateway/RevenueMonsterGateway.vue.d.ts +52 -0
  35. package/dist/views/terminal-transaction/TerminalTransaction.vue.d.ts +2 -0
  36. package/dist/views/terminal-transaction/cell/Gateway.vue.d.ts +9 -0
  37. package/dist/views/terminal-transaction/cell/Status.vue.d.ts +9 -0
  38. package/package.json +1 -1
  39. package/dist/PayoutAccountSetting-cOThY31e.js +0 -425
  40. package/dist/Transaction-BKBh8jOT.js +0 -249
  41. package/dist/Transaction-DVS8SkBi.js +0 -247
@@ -0,0 +1,702 @@
1
+ import { defineComponent as I, resolveComponent as y, openBlock as b, createElementBlock as G, Fragment as D, createElementVNode as i, createVNode as o, withCtx as w, createTextVNode as x, toDisplayString as S, createCommentVNode as U, createBlock as V, ref as C, watch as K, computed as E, unref as p, isRef as M, h as N, onMounted as O, resolveDynamicComponent as j, normalizeProps as z, mergeProps as H } from "vue";
2
+ import { p as T } from "./index-DIT7Btp7.js";
3
+ import { g as _, b as B, u as L } from "./index-BBTjdV3w.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-Bboaan5m.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 k, a as P } 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(t) {
20
+ return (d, e) => {
21
+ const m = y("FmCardHeader"), r = y("FmCardSection"), a = y("FmCard");
22
+ return b(), G(D, null, [
23
+ i("div", h, [
24
+ o(a, {
25
+ horizontal: "",
26
+ class: "flex-1 p-6",
27
+ variant: "elevated"
28
+ }, {
29
+ default: w(() => [
30
+ o(r, { class: "flex flex-col gap-16 justify-between" }, {
31
+ default: w(() => [
32
+ o(m, {
33
+ class: "p-0",
34
+ title: "Account Info",
35
+ subtitle: ""
36
+ }),
37
+ o(r, { class: "p-0" }, {
38
+ default: w(() => {
39
+ var u, v, f, n, l;
40
+ return [
41
+ e[0] || (e[0] = i("b", null, "For", -1)),
42
+ x(": " + S((v = (u = t.payoutAccount) == null ? void 0 : u.store) == null ? void 0 : v.event) + " ", 1),
43
+ e[1] || (e[1] = i("br", null, null, -1)),
44
+ e[2] || (e[2] = i("b", null, "Reference", -1)),
45
+ x(": " + S((n = (f = t.payoutAccount) == null ? void 0 : f.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
+ x(": " + S((l = t.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(a, {
61
+ horizontal: "",
62
+ class: "flex-1 p-6",
63
+ variant: "elevated"
64
+ }, {
65
+ default: w(() => [
66
+ o(r, { class: "flex flex-col gap-16 justify-between" }, {
67
+ default: w(() => [
68
+ o(m, {
69
+ class: "p-0",
70
+ title: "Key Person",
71
+ subtitle: ""
72
+ }),
73
+ o(r, { class: "p-0" }, {
74
+ default: w(() => {
75
+ var u, v, f, n, l, s, c, F;
76
+ return [
77
+ e[6] || (e[6] = i("b", null, "Email", -1)),
78
+ x(": " + S((f = (v = (u = t.payoutAccount) == null ? void 0 : u.store) == null ? void 0 : v.keyPerson) == null ? void 0 : f.email) + " ", 1),
79
+ e[7] || (e[7] = i("br", null, null, -1)),
80
+ e[8] || (e[8] = i("b", null, "Name", -1)),
81
+ x(": " + S((s = (l = (n = t.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
+ x(": " + S((F = (c = t.payoutAccount) == null ? void 0 : c.store.keyPerson) == null ? void 0 : F.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
+ t.payoutAccount.store.exteriorPhoto ? (b(), G("img", {
99
+ key: 0,
100
+ src: t.payoutAccount.store.exteriorPhoto
101
+ }, null, 8, ee)) : U("", !0)
102
+ ], 64);
103
+ };
104
+ }
105
+ }), ae = { class: "flex gap-16 mt-6" }, ne = { class: "flex-1" }, le = { class: "flex-1" }, oe = /* @__PURE__ */ I({
106
+ __name: "Settlement",
107
+ props: {
108
+ payoutAccount: {
109
+ type: Object,
110
+ required: !0
111
+ }
112
+ },
113
+ setup(t) {
114
+ return (d, e) => {
115
+ const m = y("FmCardHeader"), r = y("FmCardSection"), a = y("FmCard");
116
+ return b(), G(D, null, [
117
+ o(a, {
118
+ horizontal: "",
119
+ class: "flex-1 p-6 mx-6",
120
+ variant: "elevated"
121
+ }, {
122
+ default: w(() => [
123
+ o(r, { class: "flex flex-col gap-16 justify-between" }, {
124
+ default: w(() => [
125
+ o(m, {
126
+ class: "p-0",
127
+ title: "Bank Info",
128
+ subtitle: ""
129
+ }),
130
+ o(r, { class: "p-0" }, {
131
+ default: w(() => {
132
+ var u, v, f, n, l, s;
133
+ return [
134
+ e[0] || (e[0] = i("b", null, "Bank", -1)),
135
+ x(": " + S((v = (u = t.payoutAccount) == null ? void 0 : u.store.bank) == null ? void 0 : v.name), 1),
136
+ e[1] || (e[1] = i("br", null, null, -1)),
137
+ e[2] || (e[2] = i("b", null, "Name", -1)),
138
+ x(": " + S((n = (f = t.payoutAccount) == null ? void 0 : f.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
+ x(": " + S((s = (l = t.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", ne, [
154
+ e[5] || (e[5] = i("p", { class: "fm-typo-en-body-lg-600 mb-6" }, "SSM", -1)),
155
+ t.payoutAccount.store.ssm ? (b(), V(q, {
156
+ key: 0,
157
+ pdf: t.payoutAccount.store.ssm,
158
+ "disable-text-layer": !0,
159
+ "disable-annotation-layer": !0
160
+ }, null, 8, ["pdf"])) : U("", !0)
161
+ ]),
162
+ i("div", le, [
163
+ e[6] || (e[6] = i("p", { class: "fm-typo-en-body-lg-600 mb-6" }, "Bank Statement", -1)),
164
+ t.payoutAccount.store.bankStatement ? (b(), V(q, {
165
+ key: 0,
166
+ pdf: t.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(t) {
182
+ const d = t, e = C(d.data.toString());
183
+ return K(e, (m) => {
184
+ d.onChange(parseFloat(m));
185
+ }), (m, r) => {
186
+ const a = y("FmTextField");
187
+ return b(), V(a, {
188
+ inputmode: "decimal",
189
+ modelValue: e.value,
190
+ "onUpdate:modelValue": r[0] || (r[0] = (u) => e.value = u)
191
+ }, {
192
+ append: w(() => r[1] || (r[1] = [
193
+ x("%")
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(t) {
206
+ const d = t, e = C(d.data.toString());
207
+ return K(e, (m) => {
208
+ d.onChange(parseInt(m));
209
+ }), (m, r) => {
210
+ const a = y("FmTextField");
211
+ return b(), V(a, {
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" }, ce = { class: "my-6 w-full flex justify-end" }, me = { 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(t) {
231
+ const d = t, e = C(!1), m = X(), r = async (n) => {
232
+ try {
233
+ e.value = !0, await d.onUpdate(n), m.open({
234
+ type: "success",
235
+ title: "Payout account update succesfully"
236
+ });
237
+ } catch (l) {
238
+ m.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: a } = Q({
247
+ search: ""
248
+ }), u = E(() => {
249
+ const { ssm: n, bank: l, bankStatement: s } = d.payoutAccount.store;
250
+ return n && l && l.name && l.accountNumber && l.holderName && s;
251
+ }), v = C(""), f = [
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)), N(ue, {
263
+ data: l,
264
+ onChange: (s) => {
265
+ const c = d.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 }) => N(re, {
278
+ data: n.original.tPlus ?? 0,
279
+ onChange: (l) => {
280
+ const s = d.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"), F = y("FmSwitch"), A = y("FmSearch"), g = y("FmTable"), W = y("FmButton");
288
+ return b(), G(D, null, [
289
+ i("div", se, [
290
+ i("div", ie, [
291
+ o(c, {
292
+ modelValue: t.payoutAccount.status,
293
+ "onUpdate:modelValue": l[0] || (l[0] = ($) => t.payoutAccount.status = $),
294
+ label: "Account Status"
295
+ }, {
296
+ default: w(() => [
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(F, {
315
+ modelValue: t.payoutAccount.enable,
316
+ "onUpdate:modelValue": l[1] || (l[1] = ($) => t.payoutAccount.enable = $),
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
+ t.payoutAccount.enable ? (b(), G(D, { key: 0 }, [
324
+ i("div", ce, [
325
+ i("div", me, [
326
+ o(A, {
327
+ modelValue: p(a),
328
+ "onUpdate:modelValue": l[2] || (l[2] = ($) => M(a) ? a.value = $ : null),
329
+ placeholder: "Search Method ..."
330
+ }, null, 8, ["modelValue"])
331
+ ])
332
+ ]),
333
+ o(g, {
334
+ class: "mt-6",
335
+ modelValue: v.value,
336
+ "onUpdate:modelValue": l[3] || (l[3] = ($) => v.value = $),
337
+ "search-value": p(a),
338
+ "row-data": t.payoutAccount.methods,
339
+ "column-defs": f
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(t.payoutAccount)
348
+ }, null, 8, ["loading", "onclick"])
349
+ ], 64);
350
+ };
351
+ }
352
+ }), R = {
353
+ async get(t) {
354
+ return _(
355
+ await B().get(
356
+ `restaurants/${t}/payment-gateway`
357
+ )
358
+ );
359
+ },
360
+ async upsert(t, d) {
361
+ return _(
362
+ await B().post(
363
+ `restaurants/${t}/payment-gateway`,
364
+ { data: d }
365
+ )
366
+ );
367
+ },
368
+ async delete(t, d) {
369
+ return _(
370
+ await B().delete(
371
+ `restaurants/${t}/payment-gateway/${d}`
372
+ )
373
+ );
374
+ }
375
+ }, ye = { class: "flex mt-6 space-x-6" }, fe = /* @__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(t) {
392
+ var m;
393
+ const e = C(((m = t.gateway) == null ? void 0 : m.config) || {
394
+ merchantId: "",
395
+ uniqueId: "",
396
+ verifyKey: "",
397
+ secretKey: "",
398
+ applicationCode: "",
399
+ offlineSecret: ""
400
+ });
401
+ return (r, a) => {
402
+ const u = y("FmTextField"), v = y("FmButton"), f = y("FmForm");
403
+ return b(), V(f, {
404
+ ref: "form",
405
+ class: "flex flex-col gap-16",
406
+ onValidationSuccess: a[6] || (a[6] = () => t.onUpdate(e.value))
407
+ }, {
408
+ default: w(() => [
409
+ o(u, {
410
+ modelValue: e.value.merchantId,
411
+ "onUpdate:modelValue": a[0] || (a[0] = (n) => e.value.merchantId = n),
412
+ label: "Merchant ID",
413
+ rules: p(k)(p(P).string())
414
+ }, null, 8, ["modelValue", "rules"]),
415
+ o(u, {
416
+ modelValue: e.value.uniqueId,
417
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => e.value.uniqueId = n),
418
+ label: "Unique ID",
419
+ rules: p(k)(p(P).string())
420
+ }, null, 8, ["modelValue", "rules"]),
421
+ o(u, {
422
+ modelValue: e.value.verifyKey,
423
+ "onUpdate:modelValue": a[2] || (a[2] = (n) => e.value.verifyKey = n),
424
+ label: "Verify Key",
425
+ rules: p(k)(p(P).string())
426
+ }, null, 8, ["modelValue", "rules"]),
427
+ o(u, {
428
+ modelValue: e.value.secretKey,
429
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => e.value.secretKey = n),
430
+ label: "Secret Key",
431
+ rules: p(k)(p(P).string())
432
+ }, null, 8, ["modelValue", "rules"]),
433
+ o(u, {
434
+ modelValue: e.value.applicationCode,
435
+ "onUpdate:modelValue": a[4] || (a[4] = (n) => e.value.applicationCode = n),
436
+ label: "Application Code ( Offline )",
437
+ rules: p(k)(p(P).string())
438
+ }, null, 8, ["modelValue", "rules"]),
439
+ o(u, {
440
+ modelValue: e.value.offlineSecret,
441
+ "onUpdate:modelValue": a[5] || (a[5] = (n) => e.value.offlineSecret = n),
442
+ label: "Offline Secret ( Offline )",
443
+ rules: p(k)(p(P).string())
444
+ }, null, 8, ["modelValue", "rules"]),
445
+ i("div", ye, [
446
+ t.gateway ? (b(), V(v, {
447
+ key: 0,
448
+ class: "flex-1",
449
+ variant: "secondary",
450
+ label: "Delete",
451
+ onclick: () => t.onDelete(t.gateway)
452
+ }, null, 8, ["onclick"])) : U("", !0),
453
+ o(v, {
454
+ type: "submit",
455
+ class: "flex-1",
456
+ variant: "primary",
457
+ label: "Save"
458
+ })
459
+ ])
460
+ ]),
461
+ _: 1
462
+ }, 512);
463
+ };
464
+ }
465
+ }), ve = { 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(t) {
482
+ var m;
483
+ const e = C(((m = t.gateway) == null ? void 0 : m.config) || {
484
+ storeId: "",
485
+ clientId: "",
486
+ clientSecret: "",
487
+ clientPrivateKey: ""
488
+ });
489
+ return (r, a) => {
490
+ const u = y("FmTextField"), v = y("FmTextarea"), f = y("FmButton"), n = y("FmForm");
491
+ return b(), V(n, {
492
+ ref: "form",
493
+ class: "flex flex-col gap-16",
494
+ onValidationSuccess: a[4] || (a[4] = () => t.onUpdate(e.value))
495
+ }, {
496
+ default: w(() => [
497
+ o(u, {
498
+ modelValue: e.value.storeId,
499
+ "onUpdate:modelValue": a[0] || (a[0] = (l) => e.value.storeId = l),
500
+ label: "Store ID",
501
+ rules: p(k)(p(P).string())
502
+ }, null, 8, ["modelValue", "rules"]),
503
+ o(u, {
504
+ modelValue: e.value.clientId,
505
+ "onUpdate:modelValue": a[1] || (a[1] = (l) => e.value.clientId = l),
506
+ label: "Client ID",
507
+ rules: p(k)(p(P).string())
508
+ }, null, 8, ["modelValue", "rules"]),
509
+ o(u, {
510
+ modelValue: e.value.clientSecret,
511
+ "onUpdate:modelValue": a[2] || (a[2] = (l) => e.value.clientSecret = l),
512
+ label: "Client Secret",
513
+ rules: p(k)(p(P).string())
514
+ }, null, 8, ["modelValue", "rules"]),
515
+ o(v, {
516
+ modelValue: e.value.clientPrivateKey,
517
+ "onUpdate:modelValue": a[3] || (a[3] = (l) => e.value.clientPrivateKey = l),
518
+ label: "Client Private Key"
519
+ }, null, 8, ["modelValue"]),
520
+ i("div", ve, [
521
+ t.gateway ? (b(), V(f, {
522
+ key: 0,
523
+ class: "flex-1",
524
+ variant: "secondary",
525
+ label: "Delete",
526
+ onclick: () => t.onDelete(t.gateway)
527
+ }, null, 8, ["onclick"])) : U("", !0),
528
+ o(f, {
529
+ type: "submit",
530
+ class: "flex-1",
531
+ variant: "primary",
532
+ label: "Save"
533
+ })
534
+ ])
535
+ ]),
536
+ _: 1
537
+ }, 512);
538
+ };
539
+ }
540
+ }), ge = {
541
+ key: 0,
542
+ class: "flex items-center justify-center min-h-[80vh]"
543
+ }, Fe = /* @__PURE__ */ I({
544
+ __name: "PaymentGateway",
545
+ props: {
546
+ payoutAccount: {
547
+ type: Object,
548
+ required: !0
549
+ }
550
+ },
551
+ setup(t) {
552
+ const d = t, { isLoading: e, startAsyncCall: m } = L(), r = C(), a = C([]);
553
+ function u() {
554
+ m(async () => {
555
+ var s;
556
+ a.value = await R.get(d.payoutAccount.store.id), r.value = (s = a.value.find((c) => c.active)) == null ? void 0 : s.paymentGateway;
557
+ });
558
+ }
559
+ async function v(s) {
560
+ m(async () => {
561
+ var A;
562
+ const c = {
563
+ _id: "",
564
+ _rev: "",
565
+ paymentGateway: r.value,
566
+ config: s,
567
+ active: !0
568
+ }, F = a.value.find((g) => g.paymentGateway === r.value);
569
+ F && (c._id = F._id, c._rev = F._rev), await Promise.all(
570
+ a.value.map(async (g) => {
571
+ g.active && g.paymentGateway !== c.paymentGateway && await R.upsert(d.payoutAccount.store.id, {
572
+ ...g,
573
+ active: !1
574
+ });
575
+ })
576
+ ), await R.upsert(d.payoutAccount.store.id, c), a.value = await R.get(d.payoutAccount.store.id), r.value = (A = a.value.find((g) => g.active)) == null ? void 0 : A.paymentGateway;
577
+ });
578
+ }
579
+ async function f(s) {
580
+ m(async () => {
581
+ var c;
582
+ await R.delete(d.payoutAccount.store.id, s._id), a.value = await R.get(d.payoutAccount.store.id), r.value = (c = a.value.find((F) => F.active)) == null ? void 0 : c.paymentGateway;
583
+ });
584
+ }
585
+ O(u);
586
+ const n = [
587
+ {
588
+ label: "Fiuu",
589
+ value: "RAZER_MERCHANT_SERVICE",
590
+ form: fe
591
+ },
592
+ {
593
+ label: "Revenue Monster",
594
+ value: "REVENUE_MONSTER",
595
+ form: be
596
+ }
597
+ ], l = E(() => {
598
+ var s;
599
+ return (s = n.find((c) => c.value === r.value)) == null ? void 0 : s.form;
600
+ });
601
+ return (s, c) => {
602
+ const F = y("FmCircularProgress"), A = y("FmSelect");
603
+ return b(), G(D, null, [
604
+ p(e) ? (b(), G("div", ge, [
605
+ o(F, { size: "xxl" })
606
+ ])) : (b(), V(A, {
607
+ key: 1,
608
+ modelValue: r.value,
609
+ "onUpdate:modelValue": c[0] || (c[0] = (g) => r.value = g),
610
+ class: "mb-6",
611
+ label: "Payment Service Provider",
612
+ items: n
613
+ }, null, 8, ["modelValue"])),
614
+ r.value ? (b(), V(j(l.value), z(H({ key: 2 }, {
615
+ gateway: a.value.find((g) => g.paymentGateway === r.value),
616
+ onDelete: f,
617
+ onUpdate: v
618
+ })), null, 16)) : U("", !0)
619
+ ], 64);
620
+ };
621
+ }
622
+ }), $e = /* @__PURE__ */ I({
623
+ __name: "PayoutAccountSetting",
624
+ props: {
625
+ accountId: {
626
+ type: String,
627
+ required: !0
628
+ }
629
+ },
630
+ setup(t) {
631
+ const d = t, { tab: e } = Q({
632
+ tab: "information"
633
+ }), { isLoading: m, startAsyncCall: r } = L(!0), a = J(), u = C();
634
+ async function v(s) {
635
+ await T.updateById(
636
+ d.accountId,
637
+ s
638
+ ), u.value = await T.readById(d.accountId);
639
+ }
640
+ const f = [
641
+ {
642
+ label: "Information",
643
+ value: "information",
644
+ icon: "overview",
645
+ render: te
646
+ },
647
+ {
648
+ label: "Settlement",
649
+ value: "settlement",
650
+ icon: "payments",
651
+ render: oe
652
+ },
653
+ {
654
+ label: "MDR Status",
655
+ value: "payment",
656
+ icon: "account_box",
657
+ render: pe
658
+ }
659
+ ];
660
+ function n() {
661
+ r(async () => {
662
+ u.value = await T.readById(d.accountId), u.value.store.event === "ORDERING" && f.push({
663
+ label: "Payment Gateway",
664
+ value: "payment-gateway",
665
+ icon: "assured_workload",
666
+ render: Fe
667
+ });
668
+ });
669
+ }
670
+ O(n);
671
+ const l = E(() => {
672
+ var s;
673
+ return (s = f.find((c) => c.value === e.value)) == null ? void 0 : s.render;
674
+ });
675
+ return (s, c) => {
676
+ var A;
677
+ const F = y("FmTabs");
678
+ return b(), V(Z, {
679
+ title: `Payout Account (${(A = u.value) == null ? void 0 : A._id})`,
680
+ loading: p(m),
681
+ onBack: p(a).back
682
+ }, {
683
+ default: w(() => [
684
+ o(F, {
685
+ "model-value": p(e),
686
+ "onUpdate:modelValue": c[0] || (c[0] = (g) => M(e) ? e.value = g : null),
687
+ class: "mb-6",
688
+ items: f
689
+ }, null, 8, ["model-value"]),
690
+ p(e) ? (b(), V(j(l.value), z(H({ key: 0 }, {
691
+ payoutAccount: u.value,
692
+ onUpdate: v
693
+ })), null, 16)) : U("", !0)
694
+ ]),
695
+ _: 1
696
+ }, 8, ["title", "loading", "onBack"]);
697
+ };
698
+ }
699
+ });
700
+ export {
701
+ $e as default
702
+ };