@temboplus/afloat 0.1.76-beta.0 → 0.1.77-beta.10
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/error/error.permission.d.ts +1 -1
- package/dist/modules/auth/auth.contract.d.ts +6 -6
- package/dist/modules/auth/auth.manager.d.ts +1 -1
- package/dist/modules/auth/company-membership.model.d.ts +171 -0
- package/dist/modules/auth/index.d.ts +1 -1
- package/dist/modules/auth/user.model.d.ts +330 -33
- package/dist/modules/contact/contact-info.model.d.ts +183 -533
- package/dist/modules/contact/contact.api-contract.d.ts +16 -16
- package/dist/modules/contact/contact.dtos.d.ts +4 -4
- package/dist/modules/contact/contact.model.d.ts +309 -32
- package/dist/modules/login/index.d.ts +2 -0
- package/dist/modules/login/login.api-contract.d.ts +34 -5
- package/dist/modules/login/login.dtos.d.ts +85 -0
- package/dist/modules/login/login.model.d.ts +168 -1
- package/dist/modules/{auth → login}/permission.type.d.ts +8 -8
- package/dist/modules/payout/payout.api-contract.d.ts +46 -46
- package/dist/modules/payout/payout.dtos.d.ts +30 -24
- package/dist/modules/payout/payout.model.d.ts +242 -2
- package/dist/modules/payout/payout.query.d.ts +7 -0
- package/dist/modules/profile/profile.model.d.ts +65 -30
- package/dist/modules/team-member/index.d.ts +4 -0
- package/dist/modules/team-member/role.model.d.ts +61 -0
- package/dist/modules/{user/user.contract.d.ts → team-member/team-member.contract.d.ts} +238 -127
- package/dist/modules/team-member/team-member.dtos.d.ts +261 -0
- package/dist/modules/team-member/team-member.model.d.ts +237 -0
- package/dist/modules/team-member/team-member.repository.d.ts +179 -0
- package/dist/modules/wallet/narration.model.d.ts +34 -38
- package/dist/modules/wallet/statement-entry.model.d.ts +172 -73
- package/dist/modules/wallet/wallet.contract.d.ts +4 -4
- package/dist/modules/wallet/wallet.dtos.d.ts +8 -8
- package/dist/modules/wallet/wallet.model.d.ts +56 -19
- package/dist/modules/wallet/wallet.query.d.ts +95 -0
- package/dist/modules/wallet/wallet.repository.d.ts +45 -13
- package/package.json +2 -2
- package/dist/modules/user/index.d.ts +0 -4
- package/dist/modules/user/role.model.d.ts +0 -13
- package/dist/modules/user/user.dtos.d.ts +0 -145
- package/dist/modules/user/user.model.d.ts +0 -108
- package/dist/modules/user/user.repository.d.ts +0 -179
|
@@ -72,17 +72,17 @@ declare const PayoutInputDTOSchema: z.ZodObject<{
|
|
|
72
72
|
} & {
|
|
73
73
|
payeeName: z.ZodString;
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
description: string;
|
|
75
76
|
channel: string;
|
|
76
77
|
msisdn: string;
|
|
77
78
|
amount: number;
|
|
78
|
-
description: string;
|
|
79
79
|
payeeName: string;
|
|
80
80
|
notes?: string | null | undefined;
|
|
81
81
|
}, {
|
|
82
|
+
description: string;
|
|
82
83
|
channel: string;
|
|
83
84
|
msisdn: string;
|
|
84
85
|
amount: number;
|
|
85
|
-
description: string;
|
|
86
86
|
payeeName: string;
|
|
87
87
|
notes?: string | null | undefined;
|
|
88
88
|
}>;
|
|
@@ -143,15 +143,15 @@ declare const PayoutDTOSchema: z.ZodObject<{
|
|
|
143
143
|
}, "strip", z.ZodTypeAny, {
|
|
144
144
|
status: PayoutStatus;
|
|
145
145
|
id: string;
|
|
146
|
-
createdAt: Date;
|
|
147
146
|
profileId: string;
|
|
147
|
+
createdAt: Date;
|
|
148
|
+
updatedAt: Date;
|
|
149
|
+
description: string;
|
|
148
150
|
channel: string;
|
|
149
151
|
countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
|
|
150
152
|
currencyCode: import("@temboplus/frontend-core").CurrencyCode;
|
|
151
|
-
updatedAt: Date;
|
|
152
153
|
msisdn: string;
|
|
153
154
|
amount: number;
|
|
154
|
-
description: string;
|
|
155
155
|
payeeName: string;
|
|
156
156
|
statusMessage: string;
|
|
157
157
|
notes?: string | null | undefined;
|
|
@@ -171,13 +171,13 @@ declare const PayoutDTOSchema: z.ZodObject<{
|
|
|
171
171
|
}, {
|
|
172
172
|
status: PayoutStatus;
|
|
173
173
|
id: string;
|
|
174
|
-
createdAt: Date;
|
|
175
174
|
profileId: string;
|
|
176
|
-
|
|
175
|
+
createdAt: Date;
|
|
177
176
|
updatedAt: Date;
|
|
177
|
+
description: string;
|
|
178
|
+
channel: string;
|
|
178
179
|
msisdn: string;
|
|
179
180
|
amount: number;
|
|
180
|
-
description: string;
|
|
181
181
|
payeeName: string;
|
|
182
182
|
statusMessage: string;
|
|
183
183
|
countryCode?: string | undefined;
|
|
@@ -213,6 +213,7 @@ declare const PayoutFiltersSchema: z.ZodObject<{
|
|
|
213
213
|
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
214
|
partnerReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
215
|
channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
217
|
status: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutStatus>>>;
|
|
217
218
|
approvalStatus: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutApprovalStatus>>>;
|
|
218
219
|
minAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -225,11 +226,12 @@ declare const PayoutFiltersSchema: z.ZodObject<{
|
|
|
225
226
|
sortOrder: "asc" | "desc";
|
|
226
227
|
status?: PayoutStatus | null | undefined;
|
|
227
228
|
id?: string | null | undefined;
|
|
229
|
+
profileId?: string | null | undefined;
|
|
228
230
|
search?: string | null | undefined;
|
|
229
231
|
startDate?: string | null | undefined;
|
|
230
232
|
endDate?: string | null | undefined;
|
|
231
|
-
profileId?: string | null | undefined;
|
|
232
233
|
channel?: string | null | undefined;
|
|
234
|
+
currencyCode?: string | null | undefined;
|
|
233
235
|
msisdn?: string | null | undefined;
|
|
234
236
|
payeeName?: string | null | undefined;
|
|
235
237
|
partnerReference?: string | null | undefined;
|
|
@@ -239,13 +241,14 @@ declare const PayoutFiltersSchema: z.ZodObject<{
|
|
|
239
241
|
}, {
|
|
240
242
|
status?: PayoutStatus | null | undefined;
|
|
241
243
|
id?: string | null | undefined;
|
|
244
|
+
profileId?: string | null | undefined;
|
|
242
245
|
search?: string | null | undefined;
|
|
243
246
|
startDate?: string | null | undefined;
|
|
244
247
|
endDate?: string | null | undefined;
|
|
245
248
|
page?: number | undefined;
|
|
246
249
|
limit?: number | undefined;
|
|
247
|
-
profileId?: string | null | undefined;
|
|
248
250
|
channel?: string | null | undefined;
|
|
251
|
+
currencyCode?: string | null | undefined;
|
|
249
252
|
msisdn?: string | null | undefined;
|
|
250
253
|
payeeName?: string | null | undefined;
|
|
251
254
|
partnerReference?: string | null | undefined;
|
|
@@ -281,12 +284,12 @@ declare const PayoutURLQueryParamsSchema: z.ZodObject<{
|
|
|
281
284
|
sortOrder: "asc" | "desc";
|
|
282
285
|
status?: PayoutStatus | undefined;
|
|
283
286
|
id?: string | undefined;
|
|
287
|
+
profileId?: string | undefined;
|
|
284
288
|
search?: string | undefined;
|
|
285
289
|
startDate?: string | undefined;
|
|
286
290
|
endDate?: string | undefined;
|
|
287
291
|
page?: number | undefined;
|
|
288
292
|
limit?: number | undefined;
|
|
289
|
-
profileId?: string | undefined;
|
|
290
293
|
channel?: string | undefined;
|
|
291
294
|
msisdn?: string | undefined;
|
|
292
295
|
payeeName?: string | undefined;
|
|
@@ -297,12 +300,12 @@ declare const PayoutURLQueryParamsSchema: z.ZodObject<{
|
|
|
297
300
|
}, {
|
|
298
301
|
status?: string | undefined;
|
|
299
302
|
id?: string | undefined;
|
|
303
|
+
profileId?: string | undefined;
|
|
300
304
|
search?: string | undefined;
|
|
301
305
|
startDate?: string | undefined;
|
|
302
306
|
endDate?: string | undefined;
|
|
303
307
|
page?: string | undefined;
|
|
304
308
|
limit?: string | undefined;
|
|
305
|
-
profileId?: string | undefined;
|
|
306
309
|
channel?: string | undefined;
|
|
307
310
|
msisdn?: string | undefined;
|
|
308
311
|
payeeName?: string | undefined;
|
|
@@ -389,15 +392,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
389
392
|
}, "strip", z.ZodTypeAny, {
|
|
390
393
|
status: PayoutStatus;
|
|
391
394
|
id: string;
|
|
392
|
-
createdAt: Date;
|
|
393
395
|
profileId: string;
|
|
396
|
+
createdAt: Date;
|
|
397
|
+
updatedAt: Date;
|
|
398
|
+
description: string;
|
|
394
399
|
channel: string;
|
|
395
400
|
countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
|
|
396
401
|
currencyCode: import("@temboplus/frontend-core").CurrencyCode;
|
|
397
|
-
updatedAt: Date;
|
|
398
402
|
msisdn: string;
|
|
399
403
|
amount: number;
|
|
400
|
-
description: string;
|
|
401
404
|
payeeName: string;
|
|
402
405
|
statusMessage: string;
|
|
403
406
|
notes?: string | null | undefined;
|
|
@@ -417,13 +420,13 @@ export declare const PayoutDTOSchemas: {
|
|
|
417
420
|
}, {
|
|
418
421
|
status: PayoutStatus;
|
|
419
422
|
id: string;
|
|
420
|
-
createdAt: Date;
|
|
421
423
|
profileId: string;
|
|
422
|
-
|
|
424
|
+
createdAt: Date;
|
|
423
425
|
updatedAt: Date;
|
|
426
|
+
description: string;
|
|
427
|
+
channel: string;
|
|
424
428
|
msisdn: string;
|
|
425
429
|
amount: number;
|
|
426
|
-
description: string;
|
|
427
430
|
payeeName: string;
|
|
428
431
|
statusMessage: string;
|
|
429
432
|
countryCode?: string | undefined;
|
|
@@ -452,17 +455,17 @@ export declare const PayoutDTOSchemas: {
|
|
|
452
455
|
} & {
|
|
453
456
|
payeeName: z.ZodString;
|
|
454
457
|
}, "strip", z.ZodTypeAny, {
|
|
458
|
+
description: string;
|
|
455
459
|
channel: string;
|
|
456
460
|
msisdn: string;
|
|
457
461
|
amount: number;
|
|
458
|
-
description: string;
|
|
459
462
|
payeeName: string;
|
|
460
463
|
notes?: string | null | undefined;
|
|
461
464
|
}, {
|
|
465
|
+
description: string;
|
|
462
466
|
channel: string;
|
|
463
467
|
msisdn: string;
|
|
464
468
|
amount: number;
|
|
465
|
-
description: string;
|
|
466
469
|
payeeName: string;
|
|
467
470
|
notes?: string | null | undefined;
|
|
468
471
|
}>;
|
|
@@ -494,6 +497,7 @@ export declare const PayoutDTOSchemas: {
|
|
|
494
497
|
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
495
498
|
partnerReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
496
499
|
channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
500
|
+
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
497
501
|
status: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutStatus>>>;
|
|
498
502
|
approvalStatus: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutApprovalStatus>>>;
|
|
499
503
|
minAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -506,11 +510,12 @@ export declare const PayoutDTOSchemas: {
|
|
|
506
510
|
sortOrder: "asc" | "desc";
|
|
507
511
|
status?: PayoutStatus | null | undefined;
|
|
508
512
|
id?: string | null | undefined;
|
|
513
|
+
profileId?: string | null | undefined;
|
|
509
514
|
search?: string | null | undefined;
|
|
510
515
|
startDate?: string | null | undefined;
|
|
511
516
|
endDate?: string | null | undefined;
|
|
512
|
-
profileId?: string | null | undefined;
|
|
513
517
|
channel?: string | null | undefined;
|
|
518
|
+
currencyCode?: string | null | undefined;
|
|
514
519
|
msisdn?: string | null | undefined;
|
|
515
520
|
payeeName?: string | null | undefined;
|
|
516
521
|
partnerReference?: string | null | undefined;
|
|
@@ -520,13 +525,14 @@ export declare const PayoutDTOSchemas: {
|
|
|
520
525
|
}, {
|
|
521
526
|
status?: PayoutStatus | null | undefined;
|
|
522
527
|
id?: string | null | undefined;
|
|
528
|
+
profileId?: string | null | undefined;
|
|
523
529
|
search?: string | null | undefined;
|
|
524
530
|
startDate?: string | null | undefined;
|
|
525
531
|
endDate?: string | null | undefined;
|
|
526
532
|
page?: number | undefined;
|
|
527
533
|
limit?: number | undefined;
|
|
528
|
-
profileId?: string | null | undefined;
|
|
529
534
|
channel?: string | null | undefined;
|
|
535
|
+
currencyCode?: string | null | undefined;
|
|
530
536
|
msisdn?: string | null | undefined;
|
|
531
537
|
payeeName?: string | null | undefined;
|
|
532
538
|
partnerReference?: string | null | undefined;
|
|
@@ -559,12 +565,12 @@ export declare const PayoutDTOSchemas: {
|
|
|
559
565
|
sortOrder: "asc" | "desc";
|
|
560
566
|
status?: PayoutStatus | undefined;
|
|
561
567
|
id?: string | undefined;
|
|
568
|
+
profileId?: string | undefined;
|
|
562
569
|
search?: string | undefined;
|
|
563
570
|
startDate?: string | undefined;
|
|
564
571
|
endDate?: string | undefined;
|
|
565
572
|
page?: number | undefined;
|
|
566
573
|
limit?: number | undefined;
|
|
567
|
-
profileId?: string | undefined;
|
|
568
574
|
channel?: string | undefined;
|
|
569
575
|
msisdn?: string | undefined;
|
|
570
576
|
payeeName?: string | undefined;
|
|
@@ -575,12 +581,12 @@ export declare const PayoutDTOSchemas: {
|
|
|
575
581
|
}, {
|
|
576
582
|
status?: string | undefined;
|
|
577
583
|
id?: string | undefined;
|
|
584
|
+
profileId?: string | undefined;
|
|
578
585
|
search?: string | undefined;
|
|
579
586
|
startDate?: string | undefined;
|
|
580
587
|
endDate?: string | undefined;
|
|
581
588
|
page?: string | undefined;
|
|
582
589
|
limit?: string | undefined;
|
|
583
|
-
profileId?: string | undefined;
|
|
584
590
|
channel?: string | undefined;
|
|
585
591
|
msisdn?: string | undefined;
|
|
586
592
|
payeeName?: string | undefined;
|
|
@@ -1,6 +1,119 @@
|
|
|
1
1
|
import { PayoutDTO, PayoutStatus, PayoutApprovalStatus, PayoutAuthorizer } from "@/modules/payout/payout.dtos.js";
|
|
2
2
|
import { Amount } from "@temboplus/frontend-core";
|
|
3
3
|
import { ContactInfo } from "../contact/contact-info.model.js";
|
|
4
|
+
import z from "zod";
|
|
5
|
+
/**
|
|
6
|
+
* Zod schema for Payout JSON serialization
|
|
7
|
+
* This mirrors the PayoutDTO structure but is specifically for JSON serialization
|
|
8
|
+
*/
|
|
9
|
+
export declare const PayoutJSONSchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
profileId: z.ZodString;
|
|
12
|
+
payeeName: z.ZodString;
|
|
13
|
+
channel: z.ZodString;
|
|
14
|
+
msisdn: z.ZodString;
|
|
15
|
+
amount: z.ZodNumber;
|
|
16
|
+
currencyCode: z.ZodString;
|
|
17
|
+
countryCode: z.ZodString;
|
|
18
|
+
description: z.ZodString;
|
|
19
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
status: z.ZodNativeEnum<typeof PayoutStatus>;
|
|
21
|
+
statusMessage: z.ZodString;
|
|
22
|
+
partnerReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
createdAt: z.ZodString;
|
|
24
|
+
updatedAt: z.ZodString;
|
|
25
|
+
actionedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
approvalStatus: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutApprovalStatus>>>;
|
|
27
|
+
createdBy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
identity: z.ZodString;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
identity: string;
|
|
35
|
+
}, {
|
|
36
|
+
name: string;
|
|
37
|
+
id: string;
|
|
38
|
+
identity: string;
|
|
39
|
+
}>>>;
|
|
40
|
+
actionedBy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
identity: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
name: string;
|
|
46
|
+
id: string;
|
|
47
|
+
identity: string;
|
|
48
|
+
}, {
|
|
49
|
+
name: string;
|
|
50
|
+
id: string;
|
|
51
|
+
identity: string;
|
|
52
|
+
}>>>;
|
|
53
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
status: PayoutStatus;
|
|
56
|
+
id: string;
|
|
57
|
+
version: string;
|
|
58
|
+
profileId: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
updatedAt: string;
|
|
61
|
+
description: string;
|
|
62
|
+
channel: string;
|
|
63
|
+
countryCode: string;
|
|
64
|
+
currencyCode: string;
|
|
65
|
+
msisdn: string;
|
|
66
|
+
amount: number;
|
|
67
|
+
payeeName: string;
|
|
68
|
+
statusMessage: string;
|
|
69
|
+
notes?: string | null | undefined;
|
|
70
|
+
partnerReference?: string | null | undefined;
|
|
71
|
+
actionedAt?: string | null | undefined;
|
|
72
|
+
approvalStatus?: PayoutApprovalStatus | null | undefined;
|
|
73
|
+
createdBy?: {
|
|
74
|
+
name: string;
|
|
75
|
+
id: string;
|
|
76
|
+
identity: string;
|
|
77
|
+
} | null | undefined;
|
|
78
|
+
actionedBy?: {
|
|
79
|
+
name: string;
|
|
80
|
+
id: string;
|
|
81
|
+
identity: string;
|
|
82
|
+
} | null | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
status: PayoutStatus;
|
|
85
|
+
id: string;
|
|
86
|
+
profileId: string;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
updatedAt: string;
|
|
89
|
+
description: string;
|
|
90
|
+
channel: string;
|
|
91
|
+
countryCode: string;
|
|
92
|
+
currencyCode: string;
|
|
93
|
+
msisdn: string;
|
|
94
|
+
amount: number;
|
|
95
|
+
payeeName: string;
|
|
96
|
+
statusMessage: string;
|
|
97
|
+
version?: string | undefined;
|
|
98
|
+
notes?: string | null | undefined;
|
|
99
|
+
partnerReference?: string | null | undefined;
|
|
100
|
+
actionedAt?: string | null | undefined;
|
|
101
|
+
approvalStatus?: PayoutApprovalStatus | null | undefined;
|
|
102
|
+
createdBy?: {
|
|
103
|
+
name: string;
|
|
104
|
+
id: string;
|
|
105
|
+
identity: string;
|
|
106
|
+
} | null | undefined;
|
|
107
|
+
actionedBy?: {
|
|
108
|
+
name: string;
|
|
109
|
+
id: string;
|
|
110
|
+
identity: string;
|
|
111
|
+
} | null | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Infer the PayoutJSON type from the schema
|
|
115
|
+
*/
|
|
116
|
+
export type PayoutJSON = z.infer<typeof PayoutJSONSchema>;
|
|
4
117
|
/**
|
|
5
118
|
* Payout class that wraps the Zod schema and provides additional functionality
|
|
6
119
|
*/
|
|
@@ -133,7 +246,134 @@ export declare class Payout {
|
|
|
133
246
|
*/
|
|
134
247
|
static is(obj: unknown): obj is Payout;
|
|
135
248
|
/**
|
|
136
|
-
|
|
249
|
+
* Serializes the Payout instance to a JSON-compatible object
|
|
250
|
+
*
|
|
251
|
+
* Converts all Date objects to ISO strings for proper JSON serialization.
|
|
252
|
+
* The resulting object can be safely stringified and stored or transmitted.
|
|
253
|
+
*
|
|
254
|
+
* @returns {PayoutJSON} A plain object containing all payout data
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* const payout = Payout.create(payoutData);
|
|
259
|
+
* const json = payout.toJSON();
|
|
260
|
+
* // {
|
|
261
|
+
* // id: "payout-123",
|
|
262
|
+
* // amount: 50000,
|
|
263
|
+
* // currencyCode: "TZS",
|
|
264
|
+
* // createdAt: "2024-01-15T10:30:00.000Z",
|
|
265
|
+
* // ...
|
|
266
|
+
* // }
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
toJSON(): PayoutJSON;
|
|
270
|
+
/**
|
|
271
|
+
* Serializes the Payout instance to a JSON string
|
|
272
|
+
*
|
|
273
|
+
* @returns {string} JSON string representation of the payout
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* const payout = Payout.create(payoutData);
|
|
278
|
+
* const jsonString = payout.toJSONString();
|
|
279
|
+
*
|
|
280
|
+
* // Store in localStorage
|
|
281
|
+
* localStorage.setItem('pendingPayout', jsonString);
|
|
282
|
+
*
|
|
283
|
+
* // Or send to server
|
|
284
|
+
* await fetch('/api/cache-payout', {
|
|
285
|
+
* method: 'POST',
|
|
286
|
+
* body: jsonString
|
|
287
|
+
* });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
toJSONString(): string;
|
|
291
|
+
/**
|
|
292
|
+
* Creates a Payout instance from a JSON-compatible object or string
|
|
293
|
+
*
|
|
294
|
+
* This method reconstructs a Payout instance from data that was previously
|
|
295
|
+
* serialized using toJSON(). It validates the input data using Zod schema
|
|
296
|
+
* and converts ISO date strings back to Date objects.
|
|
297
|
+
*
|
|
298
|
+
* @param {PayoutJSON | string} json - Either a PayoutJSON object or a JSON string
|
|
299
|
+
* @returns {Payout | undefined} A Payout instance if valid, undefined otherwise
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* // From localStorage
|
|
304
|
+
* const stored = localStorage.getItem('pendingPayout');
|
|
305
|
+
* const payout = Payout.fromJSON(stored!);
|
|
306
|
+
*
|
|
307
|
+
* if (payout) {
|
|
308
|
+
* console.log(payout.amount.label); // "TSh 50,000.00"
|
|
309
|
+
* console.log(payout.status); // "PENDING"
|
|
310
|
+
* }
|
|
311
|
+
*
|
|
312
|
+
* // From object
|
|
313
|
+
* const payoutJson = {
|
|
314
|
+
* id: "payout-123",
|
|
315
|
+
* amount: 50000,
|
|
316
|
+
* currencyCode: "TZS",
|
|
317
|
+
* createdAt: "2024-01-15T10:30:00.000Z",
|
|
318
|
+
* ...
|
|
319
|
+
* };
|
|
320
|
+
* const payout = Payout.fromJSON(payoutJson);
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
static fromJSON(json: PayoutJSON | string): Payout | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* Type guard using Zod schema validation
|
|
326
|
+
*
|
|
327
|
+
* Checks if an unknown value conforms to the PayoutJSON structure
|
|
328
|
+
* without attempting to create a Payout instance.
|
|
329
|
+
*
|
|
330
|
+
* @param {unknown} obj - The object to validate
|
|
331
|
+
* @returns {boolean} True if the object is a valid PayoutJSON
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const data = JSON.parse(localStorage.getItem('payout'));
|
|
336
|
+
*
|
|
337
|
+
* if (Payout.isPayoutJSON(data)) {
|
|
338
|
+
* const payout = Payout.fromJSON(data);
|
|
339
|
+
* // TypeScript knows data is PayoutJSON here
|
|
340
|
+
* }
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
static isPayoutJSON(obj: unknown): obj is PayoutJSON;
|
|
344
|
+
/**
|
|
345
|
+
* Creates multiple Payout instances from a JSON array
|
|
346
|
+
*
|
|
347
|
+
* @param {PayoutJSON[] | string} jsonArray - Array of PayoutJSON objects or JSON string
|
|
348
|
+
* @returns {Payout[]} Array of Payout instances (invalid items are filtered out)
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* // From API response
|
|
353
|
+
* const response = await fetch('/api/payouts');
|
|
354
|
+
* const jsonArray = await response.json();
|
|
355
|
+
* const payouts = Payout.fromJSONArray(jsonArray);
|
|
356
|
+
*
|
|
357
|
+
* // From stored array
|
|
358
|
+
* const stored = localStorage.getItem('recentPayouts');
|
|
359
|
+
* const payouts = Payout.fromJSONArray(stored!);
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
static fromJSONArray(jsonArray: PayoutJSON[] | string): Payout[];
|
|
363
|
+
/**
|
|
364
|
+
* Serializes an array of Payout instances to JSON
|
|
365
|
+
*
|
|
366
|
+
* @param {Payout[]} payouts - Array of Payout instances to serialize
|
|
367
|
+
* @returns {PayoutJSON[]} Array of PayoutJSON objects
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* const payouts = [payout1, payout2, payout3];
|
|
372
|
+
* const jsonArray = Payout.toJSONArray(payouts);
|
|
373
|
+
*
|
|
374
|
+
* // Store or transmit
|
|
375
|
+
* localStorage.setItem('recentPayouts', JSON.stringify(jsonArray));
|
|
376
|
+
* ```
|
|
137
377
|
*/
|
|
138
|
-
|
|
378
|
+
static toJSONArray(payouts: Payout[]): PayoutJSON[];
|
|
139
379
|
}
|
|
@@ -47,6 +47,7 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
47
47
|
whereProfileId(profileId: string): this;
|
|
48
48
|
wherePartnerReference(partnerReference: string): this;
|
|
49
49
|
whereSearch(searchTerm: string): this;
|
|
50
|
+
whereCurrencyCode(currencyCode: string): this;
|
|
50
51
|
/**
|
|
51
52
|
* Apply all filters from PayoutFilters object
|
|
52
53
|
*/
|
|
@@ -91,6 +92,12 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
91
92
|
* Create new instance with channel filter
|
|
92
93
|
*/
|
|
93
94
|
withChannel(channel?: string): PayoutQuery;
|
|
95
|
+
/**
|
|
96
|
+
* Includes default relations for eager loading.
|
|
97
|
+
* This ensures that related data (createdBy, actionedBy) is fetched automatically.
|
|
98
|
+
* @returns The current query builder instance.
|
|
99
|
+
*/
|
|
100
|
+
includeDefaultRelations(): this;
|
|
94
101
|
/**
|
|
95
102
|
* Reset to first page
|
|
96
103
|
*/
|
|
@@ -1,4 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for Profile JSON serialization
|
|
4
|
+
*/
|
|
5
|
+
export declare const ProfileJSONSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
displayName: z.ZodString;
|
|
10
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
accountNo: z.ZodString;
|
|
12
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
14
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
id: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
accountNo: string;
|
|
19
|
+
version: string;
|
|
20
|
+
firstName?: string | null | undefined;
|
|
21
|
+
lastName?: string | null | undefined;
|
|
22
|
+
phone?: string | null | undefined;
|
|
23
|
+
email?: string | null | undefined;
|
|
24
|
+
autoApprove?: boolean | null | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
id: string;
|
|
27
|
+
displayName: string;
|
|
28
|
+
accountNo: string;
|
|
29
|
+
firstName?: string | null | undefined;
|
|
30
|
+
lastName?: string | null | undefined;
|
|
31
|
+
phone?: string | null | undefined;
|
|
32
|
+
email?: string | null | undefined;
|
|
33
|
+
autoApprove?: boolean | null | undefined;
|
|
34
|
+
version?: string | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Infer the ProfileJSON type from the schema
|
|
38
|
+
*/
|
|
39
|
+
export type ProfileJSON = z.infer<typeof ProfileJSONSchema>;
|
|
2
40
|
/**
|
|
3
41
|
* Represents a user profile in the system.
|
|
4
42
|
*
|
|
@@ -25,16 +63,16 @@ export declare class Profile {
|
|
|
25
63
|
/**
|
|
26
64
|
* Gets the profile schema used for validation.
|
|
27
65
|
*/
|
|
28
|
-
static get schema():
|
|
29
|
-
id:
|
|
30
|
-
firstName:
|
|
31
|
-
lastName:
|
|
32
|
-
displayName:
|
|
33
|
-
phone:
|
|
34
|
-
accountNo:
|
|
35
|
-
email:
|
|
36
|
-
autoApprove:
|
|
37
|
-
}, "strip",
|
|
66
|
+
static get schema(): z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
displayName: z.ZodString;
|
|
71
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
accountNo: z.ZodString;
|
|
73
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
76
|
id: string;
|
|
39
77
|
displayName: string;
|
|
40
78
|
accountNo: string;
|
|
@@ -113,31 +151,12 @@ export declare class Profile {
|
|
|
113
151
|
* Returns the display name if it exists, otherwise returns the first and last name combined.
|
|
114
152
|
*/
|
|
115
153
|
getName(): string;
|
|
116
|
-
/**
|
|
117
|
-
* Creates a plain object representation of the profile for validation or serialization.
|
|
118
|
-
*
|
|
119
|
-
* @returns A plain object matching the ProfileType interface
|
|
120
|
-
*/
|
|
121
|
-
toObject(): ProfileDTO;
|
|
122
|
-
/**
|
|
123
|
-
* Converts the profile to a JSON string.
|
|
124
|
-
*
|
|
125
|
-
* @returns A JSON string representation of the profile
|
|
126
|
-
*/
|
|
127
|
-
toJSON(): string;
|
|
128
154
|
/**
|
|
129
155
|
* Validates the profile data against the Zod schema.
|
|
130
156
|
*
|
|
131
157
|
* @returns True if the profile is valid, false otherwise
|
|
132
158
|
*/
|
|
133
159
|
validate(): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Creates a Profile instance from a JSON string.
|
|
136
|
-
*
|
|
137
|
-
* @param jsonString - JSON string containing profile data
|
|
138
|
-
* @returns A new Profile instance, or undefined if parsing failed
|
|
139
|
-
*/
|
|
140
|
-
static fromJSON(jsonString: string): Profile | undefined;
|
|
141
160
|
/**
|
|
142
161
|
* Creates a Profile instance from a plain object.
|
|
143
162
|
*
|
|
@@ -152,4 +171,20 @@ export declare class Profile {
|
|
|
152
171
|
* @returns Type predicate indicating if the object is a valid Profile
|
|
153
172
|
*/
|
|
154
173
|
static is(obj: unknown): obj is Profile;
|
|
174
|
+
/**
|
|
175
|
+
* Serializes the Profile instance to a JSON-compatible object
|
|
176
|
+
*/
|
|
177
|
+
toJSON(): ProfileJSON;
|
|
178
|
+
/**
|
|
179
|
+
* Serializes the Profile instance to a JSON string
|
|
180
|
+
*/
|
|
181
|
+
toJSONString(): string;
|
|
182
|
+
/**
|
|
183
|
+
* Creates a Profile instance from a JSON-compatible object or string
|
|
184
|
+
*/
|
|
185
|
+
static fromJSON(json: ProfileJSON | string): Profile | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Type guard using Zod schema validation
|
|
188
|
+
*/
|
|
189
|
+
static isProfileJSON(obj: unknown): obj is ProfileJSON;
|
|
155
190
|
}
|