@temboplus/afloat 0.1.73 → 0.1.74-0
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/features/contact/contact.api-contract.d.ts +0 -5
- package/dist/features/payout/payout.api-contract.d.ts +5 -26
- package/dist/features/payout/payout.dtos.d.ts +235 -1
- package/dist/features/payout/payout.query.d.ts +126 -0
- package/dist/features/payout/payout.repository.d.ts +41 -49
- package/dist/features/wallet/wallet.contract.d.ts +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/api/common-schemas.d.ts +49 -0
- package/dist/lib/api/index.d.ts +1 -1
- package/dist/lib/query/index.d.ts +2 -0
- package/dist/lib/query/query.builder.d.ts +71 -0
- package/dist/lib/query/query.types.d.ts +36 -0
- package/package.json +1 -1
- package/dist/lib/api/common-responses.d.ts +0 -12
|
@@ -29,7 +29,6 @@ export declare const contract: {
|
|
|
29
29
|
}>;
|
|
30
30
|
path: "/";
|
|
31
31
|
responses: {
|
|
32
|
-
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
33
32
|
201: z.ZodObject<{
|
|
34
33
|
id: z.ZodString;
|
|
35
34
|
profileId: z.ZodString;
|
|
@@ -81,7 +80,6 @@ export declare const contract: {
|
|
|
81
80
|
}>;
|
|
82
81
|
path: "/:id";
|
|
83
82
|
responses: {
|
|
84
|
-
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
85
83
|
200: z.ZodObject<{
|
|
86
84
|
id: z.ZodString;
|
|
87
85
|
profileId: z.ZodString;
|
|
@@ -124,7 +122,6 @@ export declare const contract: {
|
|
|
124
122
|
method: "GET";
|
|
125
123
|
path: "/";
|
|
126
124
|
responses: {
|
|
127
|
-
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
128
125
|
200: z.ZodArray<z.ZodObject<{
|
|
129
126
|
id: z.ZodString;
|
|
130
127
|
profileId: z.ZodString;
|
|
@@ -160,7 +157,6 @@ export declare const contract: {
|
|
|
160
157
|
method: "GET";
|
|
161
158
|
path: "/:id";
|
|
162
159
|
responses: {
|
|
163
|
-
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
164
160
|
200: z.ZodObject<{
|
|
165
161
|
id: z.ZodString;
|
|
166
162
|
profileId: z.ZodString;
|
|
@@ -197,7 +193,6 @@ export declare const contract: {
|
|
|
197
193
|
body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
198
194
|
path: "/:id";
|
|
199
195
|
responses: {
|
|
200
|
-
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
201
196
|
200: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
202
197
|
};
|
|
203
198
|
};
|
|
@@ -14,28 +14,7 @@ export declare const DEFAULT_ORDER_BY_DESC = "createdAt";
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const contract: {
|
|
16
16
|
getPayouts: {
|
|
17
|
-
query: z.ZodObject<{
|
|
18
|
-
rangeStart: z.ZodNumber;
|
|
19
|
-
rangeEnd: z.ZodNumber;
|
|
20
|
-
eager: z.ZodString;
|
|
21
|
-
approvalStatus: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof import("./payout.dtos.js").PayoutApprovalStatus>>>;
|
|
22
|
-
orderByDesc: z.ZodString;
|
|
23
|
-
msisdn: z.ZodOptional<z.ZodString>;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
eager: string;
|
|
26
|
-
orderByDesc: string;
|
|
27
|
-
rangeStart: number;
|
|
28
|
-
rangeEnd: number;
|
|
29
|
-
msisdn?: string | undefined;
|
|
30
|
-
approvalStatus?: import("./payout.dtos.js").PayoutApprovalStatus | null | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
eager: string;
|
|
33
|
-
orderByDesc: string;
|
|
34
|
-
rangeStart: number;
|
|
35
|
-
rangeEnd: number;
|
|
36
|
-
msisdn?: string | undefined;
|
|
37
|
-
approvalStatus?: import("./payout.dtos.js").PayoutApprovalStatus | null | undefined;
|
|
38
|
-
}>;
|
|
17
|
+
query: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
39
18
|
method: "GET";
|
|
40
19
|
path: "";
|
|
41
20
|
responses: {
|
|
@@ -144,6 +123,7 @@ export declare const contract: {
|
|
|
144
123
|
}>, "many">;
|
|
145
124
|
total: z.ZodNumber;
|
|
146
125
|
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
total: number;
|
|
147
127
|
results: {
|
|
148
128
|
status: import("./payout.dtos.js").PayoutStatus;
|
|
149
129
|
id: string;
|
|
@@ -173,8 +153,8 @@ export declare const contract: {
|
|
|
173
153
|
identity: string;
|
|
174
154
|
} | null | undefined;
|
|
175
155
|
}[];
|
|
176
|
-
total: number;
|
|
177
156
|
}, {
|
|
157
|
+
total: number;
|
|
178
158
|
results: {
|
|
179
159
|
status: import("./payout.dtos.js").PayoutStatus;
|
|
180
160
|
id: string;
|
|
@@ -204,7 +184,6 @@ export declare const contract: {
|
|
|
204
184
|
identity: string;
|
|
205
185
|
} | null | undefined;
|
|
206
186
|
}[];
|
|
207
|
-
total: number;
|
|
208
187
|
}>;
|
|
209
188
|
};
|
|
210
189
|
};
|
|
@@ -336,6 +315,7 @@ export declare const contract: {
|
|
|
336
315
|
}>, "many">;
|
|
337
316
|
total: z.ZodNumber;
|
|
338
317
|
}, "strip", z.ZodTypeAny, {
|
|
318
|
+
total: number;
|
|
339
319
|
results: {
|
|
340
320
|
status: import("./payout.dtos.js").PayoutStatus;
|
|
341
321
|
id: string;
|
|
@@ -365,8 +345,8 @@ export declare const contract: {
|
|
|
365
345
|
identity: string;
|
|
366
346
|
} | null | undefined;
|
|
367
347
|
}[];
|
|
368
|
-
total: number;
|
|
369
348
|
}, {
|
|
349
|
+
total: number;
|
|
370
350
|
results: {
|
|
371
351
|
status: import("./payout.dtos.js").PayoutStatus;
|
|
372
352
|
id: string;
|
|
@@ -396,7 +376,6 @@ export declare const contract: {
|
|
|
396
376
|
identity: string;
|
|
397
377
|
} | null | undefined;
|
|
398
378
|
}[];
|
|
399
|
-
total: number;
|
|
400
379
|
}>;
|
|
401
380
|
};
|
|
402
381
|
};
|
|
@@ -197,6 +197,122 @@ declare const PayoutDTOSchema: z.ZodObject<{
|
|
|
197
197
|
identity: string;
|
|
198
198
|
} | null | undefined;
|
|
199
199
|
}>;
|
|
200
|
+
/**
|
|
201
|
+
* Lightweight filters interface for payout queries
|
|
202
|
+
*/
|
|
203
|
+
declare const PayoutFiltersSchema: z.ZodObject<{
|
|
204
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
205
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
206
|
+
sortBy: z.ZodDefault<z.ZodString>;
|
|
207
|
+
sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
208
|
+
startDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
209
|
+
endDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
210
|
+
payeeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
211
|
+
msisdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
partnerReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutStatus>>>;
|
|
217
|
+
approvalStatus: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutApprovalStatus>>>;
|
|
218
|
+
minAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
219
|
+
maxAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
220
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
page: number;
|
|
223
|
+
limit: number;
|
|
224
|
+
sortBy: string;
|
|
225
|
+
sortOrder: "asc" | "desc";
|
|
226
|
+
status?: PayoutStatus | null | undefined;
|
|
227
|
+
id?: string | null | undefined;
|
|
228
|
+
profileId?: string | null | undefined;
|
|
229
|
+
channel?: string | null | undefined;
|
|
230
|
+
msisdn?: string | null | undefined;
|
|
231
|
+
payeeName?: string | null | undefined;
|
|
232
|
+
partnerReference?: string | null | undefined;
|
|
233
|
+
approvalStatus?: PayoutApprovalStatus | null | undefined;
|
|
234
|
+
startDate?: string | null | undefined;
|
|
235
|
+
endDate?: string | null | undefined;
|
|
236
|
+
minAmount?: number | null | undefined;
|
|
237
|
+
maxAmount?: number | null | undefined;
|
|
238
|
+
search?: string | null | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
status?: PayoutStatus | null | undefined;
|
|
241
|
+
id?: string | null | undefined;
|
|
242
|
+
profileId?: string | null | undefined;
|
|
243
|
+
channel?: string | null | undefined;
|
|
244
|
+
msisdn?: string | null | undefined;
|
|
245
|
+
payeeName?: string | null | undefined;
|
|
246
|
+
partnerReference?: string | null | undefined;
|
|
247
|
+
approvalStatus?: PayoutApprovalStatus | null | undefined;
|
|
248
|
+
page?: number | undefined;
|
|
249
|
+
limit?: number | undefined;
|
|
250
|
+
sortBy?: string | undefined;
|
|
251
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
252
|
+
startDate?: string | null | undefined;
|
|
253
|
+
endDate?: string | null | undefined;
|
|
254
|
+
minAmount?: number | null | undefined;
|
|
255
|
+
maxAmount?: number | null | undefined;
|
|
256
|
+
search?: string | null | undefined;
|
|
257
|
+
}>;
|
|
258
|
+
/**
|
|
259
|
+
* URL-safe schema for query parameters (all strings)
|
|
260
|
+
*/
|
|
261
|
+
declare const PayoutURLQueryParamsSchema: z.ZodObject<{
|
|
262
|
+
page: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
263
|
+
limit: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
264
|
+
sortBy: z.ZodDefault<z.ZodString>;
|
|
265
|
+
sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
266
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
267
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
268
|
+
payeeName: z.ZodOptional<z.ZodString>;
|
|
269
|
+
msisdn: z.ZodOptional<z.ZodString>;
|
|
270
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
271
|
+
id: z.ZodOptional<z.ZodString>;
|
|
272
|
+
partnerReference: z.ZodOptional<z.ZodString>;
|
|
273
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
274
|
+
status: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, PayoutStatus, string>>;
|
|
275
|
+
approvalStatus: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, PayoutApprovalStatus, string>>;
|
|
276
|
+
minAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
277
|
+
maxAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
278
|
+
search: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
sortBy: string;
|
|
281
|
+
sortOrder: "asc" | "desc";
|
|
282
|
+
status?: PayoutStatus | undefined;
|
|
283
|
+
id?: string | undefined;
|
|
284
|
+
profileId?: string | undefined;
|
|
285
|
+
channel?: string | undefined;
|
|
286
|
+
msisdn?: string | undefined;
|
|
287
|
+
payeeName?: string | undefined;
|
|
288
|
+
partnerReference?: string | undefined;
|
|
289
|
+
approvalStatus?: PayoutApprovalStatus | undefined;
|
|
290
|
+
page?: number | undefined;
|
|
291
|
+
limit?: number | undefined;
|
|
292
|
+
startDate?: string | undefined;
|
|
293
|
+
endDate?: string | undefined;
|
|
294
|
+
minAmount?: number | undefined;
|
|
295
|
+
maxAmount?: number | undefined;
|
|
296
|
+
search?: string | undefined;
|
|
297
|
+
}, {
|
|
298
|
+
status?: string | undefined;
|
|
299
|
+
id?: string | undefined;
|
|
300
|
+
profileId?: string | undefined;
|
|
301
|
+
channel?: string | undefined;
|
|
302
|
+
msisdn?: string | undefined;
|
|
303
|
+
payeeName?: string | undefined;
|
|
304
|
+
partnerReference?: string | undefined;
|
|
305
|
+
approvalStatus?: string | undefined;
|
|
306
|
+
page?: string | undefined;
|
|
307
|
+
limit?: string | undefined;
|
|
308
|
+
sortBy?: string | undefined;
|
|
309
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
310
|
+
startDate?: string | undefined;
|
|
311
|
+
endDate?: string | undefined;
|
|
312
|
+
minAmount?: string | undefined;
|
|
313
|
+
maxAmount?: string | undefined;
|
|
314
|
+
search?: string | undefined;
|
|
315
|
+
}>;
|
|
200
316
|
/**
|
|
201
317
|
* Type definition inferred from AuthorizerSchema
|
|
202
318
|
* Represents the structure of a user who actions the payout
|
|
@@ -212,6 +328,14 @@ type PayoutInputDTO = z.infer<typeof PayoutInputDTOSchema>;
|
|
|
212
328
|
* Represents the complete payout record structure
|
|
213
329
|
*/
|
|
214
330
|
type PayoutDTO = z.infer<typeof PayoutDTOSchema>;
|
|
331
|
+
/**
|
|
332
|
+
* Type definition for payout filters
|
|
333
|
+
*/
|
|
334
|
+
type PayoutFilters = z.infer<typeof PayoutFiltersSchema>;
|
|
335
|
+
/**
|
|
336
|
+
* Type definition for URL query parameters
|
|
337
|
+
*/
|
|
338
|
+
type PayoutURLQueryParams = z.infer<typeof PayoutURLQueryParamsSchema>;
|
|
215
339
|
/**
|
|
216
340
|
* Export object containing all payout-related schemas
|
|
217
341
|
* Used for validation and type checking throughout the application
|
|
@@ -357,9 +481,119 @@ export declare const PayoutDTOSchemas: {
|
|
|
357
481
|
id: string;
|
|
358
482
|
identity: string;
|
|
359
483
|
}>;
|
|
484
|
+
readonly PayoutFilters: z.ZodObject<{
|
|
485
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
486
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
487
|
+
sortBy: z.ZodDefault<z.ZodString>;
|
|
488
|
+
sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
489
|
+
startDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
490
|
+
endDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
491
|
+
payeeName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
492
|
+
msisdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
493
|
+
profileId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
494
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
495
|
+
partnerReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
496
|
+
channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
497
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutStatus>>>;
|
|
498
|
+
approvalStatus: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof PayoutApprovalStatus>>>;
|
|
499
|
+
minAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
500
|
+
maxAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
501
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
502
|
+
}, "strip", z.ZodTypeAny, {
|
|
503
|
+
page: number;
|
|
504
|
+
limit: number;
|
|
505
|
+
sortBy: string;
|
|
506
|
+
sortOrder: "asc" | "desc";
|
|
507
|
+
status?: PayoutStatus | null | undefined;
|
|
508
|
+
id?: string | null | undefined;
|
|
509
|
+
profileId?: string | null | undefined;
|
|
510
|
+
channel?: string | null | undefined;
|
|
511
|
+
msisdn?: string | null | undefined;
|
|
512
|
+
payeeName?: string | null | undefined;
|
|
513
|
+
partnerReference?: string | null | undefined;
|
|
514
|
+
approvalStatus?: PayoutApprovalStatus | null | undefined;
|
|
515
|
+
startDate?: string | null | undefined;
|
|
516
|
+
endDate?: string | null | undefined;
|
|
517
|
+
minAmount?: number | null | undefined;
|
|
518
|
+
maxAmount?: number | null | undefined;
|
|
519
|
+
search?: string | null | undefined;
|
|
520
|
+
}, {
|
|
521
|
+
status?: PayoutStatus | null | undefined;
|
|
522
|
+
id?: string | null | undefined;
|
|
523
|
+
profileId?: string | null | undefined;
|
|
524
|
+
channel?: string | null | undefined;
|
|
525
|
+
msisdn?: string | null | undefined;
|
|
526
|
+
payeeName?: string | null | undefined;
|
|
527
|
+
partnerReference?: string | null | undefined;
|
|
528
|
+
approvalStatus?: PayoutApprovalStatus | null | undefined;
|
|
529
|
+
page?: number | undefined;
|
|
530
|
+
limit?: number | undefined;
|
|
531
|
+
sortBy?: string | undefined;
|
|
532
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
533
|
+
startDate?: string | null | undefined;
|
|
534
|
+
endDate?: string | null | undefined;
|
|
535
|
+
minAmount?: number | null | undefined;
|
|
536
|
+
maxAmount?: number | null | undefined;
|
|
537
|
+
search?: string | null | undefined;
|
|
538
|
+
}>;
|
|
539
|
+
readonly PayoutURLQueryParams: z.ZodObject<{
|
|
540
|
+
page: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
541
|
+
limit: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
542
|
+
sortBy: z.ZodDefault<z.ZodString>;
|
|
543
|
+
sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
544
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
545
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
546
|
+
payeeName: z.ZodOptional<z.ZodString>;
|
|
547
|
+
msisdn: z.ZodOptional<z.ZodString>;
|
|
548
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
549
|
+
id: z.ZodOptional<z.ZodString>;
|
|
550
|
+
partnerReference: z.ZodOptional<z.ZodString>;
|
|
551
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
552
|
+
status: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, PayoutStatus, string>>;
|
|
553
|
+
approvalStatus: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, PayoutApprovalStatus, string>>;
|
|
554
|
+
minAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
555
|
+
maxAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
556
|
+
search: z.ZodOptional<z.ZodString>;
|
|
557
|
+
}, "strip", z.ZodTypeAny, {
|
|
558
|
+
sortBy: string;
|
|
559
|
+
sortOrder: "asc" | "desc";
|
|
560
|
+
status?: PayoutStatus | undefined;
|
|
561
|
+
id?: string | undefined;
|
|
562
|
+
profileId?: string | undefined;
|
|
563
|
+
channel?: string | undefined;
|
|
564
|
+
msisdn?: string | undefined;
|
|
565
|
+
payeeName?: string | undefined;
|
|
566
|
+
partnerReference?: string | undefined;
|
|
567
|
+
approvalStatus?: PayoutApprovalStatus | undefined;
|
|
568
|
+
page?: number | undefined;
|
|
569
|
+
limit?: number | undefined;
|
|
570
|
+
startDate?: string | undefined;
|
|
571
|
+
endDate?: string | undefined;
|
|
572
|
+
minAmount?: number | undefined;
|
|
573
|
+
maxAmount?: number | undefined;
|
|
574
|
+
search?: string | undefined;
|
|
575
|
+
}, {
|
|
576
|
+
status?: string | undefined;
|
|
577
|
+
id?: string | undefined;
|
|
578
|
+
profileId?: string | undefined;
|
|
579
|
+
channel?: string | undefined;
|
|
580
|
+
msisdn?: string | undefined;
|
|
581
|
+
payeeName?: string | undefined;
|
|
582
|
+
partnerReference?: string | undefined;
|
|
583
|
+
approvalStatus?: string | undefined;
|
|
584
|
+
page?: string | undefined;
|
|
585
|
+
limit?: string | undefined;
|
|
586
|
+
sortBy?: string | undefined;
|
|
587
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
588
|
+
startDate?: string | undefined;
|
|
589
|
+
endDate?: string | undefined;
|
|
590
|
+
minAmount?: string | undefined;
|
|
591
|
+
maxAmount?: string | undefined;
|
|
592
|
+
search?: string | undefined;
|
|
593
|
+
}>;
|
|
360
594
|
};
|
|
361
595
|
/**
|
|
362
596
|
* Export types for use in other parts of the application
|
|
363
597
|
* These types can be used for type checking and documentation
|
|
364
598
|
*/
|
|
365
|
-
export type { PayoutAuthorizerDTO as PayoutAuthorizer, PayoutDTO, PayoutInputDTO };
|
|
599
|
+
export type { PayoutAuthorizerDTO as PayoutAuthorizer, PayoutDTO, PayoutInputDTO, PayoutFilters, PayoutURLQueryParams, };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { QueryBuilder } from "@/lib/query/index.js";
|
|
2
|
+
import { PayoutStatus, PayoutApprovalStatus, PayoutFilters } from "./payout.dtos.js";
|
|
3
|
+
/**
|
|
4
|
+
* Payout-specific query builder that extends the base QueryBuilder
|
|
5
|
+
* and handles all possible input conversions (DTOs, URL params, etc.)
|
|
6
|
+
*/
|
|
7
|
+
export declare class PayoutQuery extends QueryBuilder {
|
|
8
|
+
/**
|
|
9
|
+
* Create empty payout query with defaults
|
|
10
|
+
*/
|
|
11
|
+
static create(): PayoutQuery;
|
|
12
|
+
/**
|
|
13
|
+
* Create from typed DTO/filters object
|
|
14
|
+
*/
|
|
15
|
+
static fromFilters(filters: PayoutFilters): PayoutQuery;
|
|
16
|
+
/**
|
|
17
|
+
* Create from URL search parameters (strings)
|
|
18
|
+
*/
|
|
19
|
+
static fromUrlParams(params: Record<string, string>): PayoutQuery;
|
|
20
|
+
/**
|
|
21
|
+
* Create from URLSearchParams object
|
|
22
|
+
*/
|
|
23
|
+
static fromSearchParams(searchParams: URLSearchParams): PayoutQuery;
|
|
24
|
+
/**
|
|
25
|
+
* Create from Next.js Request object
|
|
26
|
+
*/
|
|
27
|
+
static fromRequest(request: Request): PayoutQuery;
|
|
28
|
+
/**
|
|
29
|
+
* Create from any supported input type
|
|
30
|
+
*/
|
|
31
|
+
static from(input: QueryBuilder | PayoutFilters | Record<string, string> | URLSearchParams | null | undefined): PayoutQuery;
|
|
32
|
+
/**
|
|
33
|
+
* Type guard for string records
|
|
34
|
+
*/
|
|
35
|
+
private static isStringRecord;
|
|
36
|
+
whereStatus(status: PayoutStatus): this;
|
|
37
|
+
whereApprovalStatus(approvalStatus: PayoutApprovalStatus): this;
|
|
38
|
+
whereChannel(channel: string): this;
|
|
39
|
+
wherePending(): this;
|
|
40
|
+
whereApproved(): this;
|
|
41
|
+
whereRejected(): this;
|
|
42
|
+
wherePaid(): this;
|
|
43
|
+
whereFailed(): this;
|
|
44
|
+
whereAmountBetween(min: number, max: number): this;
|
|
45
|
+
wherePayee(payeeName: string): this;
|
|
46
|
+
whereMsisdn(msisdn: string): this;
|
|
47
|
+
whereProfileId(profileId: string): this;
|
|
48
|
+
wherePartnerReference(partnerReference: string): this;
|
|
49
|
+
whereSearch(searchTerm: string): this;
|
|
50
|
+
/**
|
|
51
|
+
* Apply all filters from PayoutFilters object
|
|
52
|
+
*/
|
|
53
|
+
private applyFilters;
|
|
54
|
+
/**
|
|
55
|
+
* Convert to PayoutFilters DTO
|
|
56
|
+
*/
|
|
57
|
+
toFilters(): PayoutFilters;
|
|
58
|
+
/**
|
|
59
|
+
* Convert to URL-safe string parameters
|
|
60
|
+
*/
|
|
61
|
+
toUrlParams(): Record<string, string>;
|
|
62
|
+
/**
|
|
63
|
+
* Convert to URLSearchParams
|
|
64
|
+
*/
|
|
65
|
+
toSearchParams(): URLSearchParams;
|
|
66
|
+
/**
|
|
67
|
+
* Convert to query string
|
|
68
|
+
*/
|
|
69
|
+
toQueryString(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Create new instance with updated pagination
|
|
72
|
+
*/
|
|
73
|
+
withPagination(page: number, limit?: number): PayoutQuery;
|
|
74
|
+
/**
|
|
75
|
+
* Create new instance with updated sorting
|
|
76
|
+
*/
|
|
77
|
+
withSorting(sortBy: string, sortOrder?: "asc" | "desc"): PayoutQuery;
|
|
78
|
+
/**
|
|
79
|
+
* Create new instance with date range
|
|
80
|
+
*/
|
|
81
|
+
withDateRange(startDate?: string, endDate?: string): PayoutQuery;
|
|
82
|
+
/**
|
|
83
|
+
* Create new instance with status filter
|
|
84
|
+
*/
|
|
85
|
+
withStatus(status?: PayoutStatus): PayoutQuery;
|
|
86
|
+
/**
|
|
87
|
+
* Create new instance with approval status filter
|
|
88
|
+
*/
|
|
89
|
+
withApprovalStatus(approvalStatus?: PayoutApprovalStatus): PayoutQuery;
|
|
90
|
+
/**
|
|
91
|
+
* Create new instance with channel filter
|
|
92
|
+
*/
|
|
93
|
+
withChannel(channel?: string): PayoutQuery;
|
|
94
|
+
/**
|
|
95
|
+
* Reset to first page
|
|
96
|
+
*/
|
|
97
|
+
resetPage(): PayoutQuery;
|
|
98
|
+
/**
|
|
99
|
+
* Check if any filters are applied
|
|
100
|
+
*/
|
|
101
|
+
hasFilters(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Get human-readable filter descriptions
|
|
104
|
+
*/
|
|
105
|
+
getActiveFilters(): string[];
|
|
106
|
+
/**
|
|
107
|
+
* Extract filter values from QueryBuilder options
|
|
108
|
+
*/
|
|
109
|
+
private extractFilterValues;
|
|
110
|
+
/**
|
|
111
|
+
* Extract primary sort field
|
|
112
|
+
*/
|
|
113
|
+
private extractSortField;
|
|
114
|
+
/**
|
|
115
|
+
* Extract primary sort order
|
|
116
|
+
*/
|
|
117
|
+
private extractSortOrder;
|
|
118
|
+
/**
|
|
119
|
+
* Type guard for valid statuses
|
|
120
|
+
*/
|
|
121
|
+
private isValidStatus;
|
|
122
|
+
/**
|
|
123
|
+
* Type guard for valid approval statuses
|
|
124
|
+
*/
|
|
125
|
+
private isValidApprovalStatus;
|
|
126
|
+
}
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
import { BaseRepository } from "@/lib/api/
|
|
1
|
+
import { BaseRepository, PaginationDTO } from "@/lib/api/index.js";
|
|
2
2
|
import { ContactInfo } from "@/models/contact-info.model.js";
|
|
3
3
|
import { Payout } from "@/models/payout.model.js";
|
|
4
4
|
import { Amount } from "@temboplus/frontend-core";
|
|
5
5
|
import { PayoutAPI } from "./payout.api-contract.js";
|
|
6
6
|
import { PayoutChannel } from "./payout.dtos.js";
|
|
7
|
+
import { PayoutQuery } from "./payout.query.js";
|
|
8
|
+
import { PayoutFilters } from "./payout.dtos.js";
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @interface GetPayoutsAPIArgs
|
|
11
|
-
*
|
|
12
|
-
* @property {number} [rangeStart] - The starting index for pagination. Defaults to 0.
|
|
13
|
-
* @property {number} [rangeEnd] - The ending index for pagination. Defaults to 10.
|
|
14
|
-
* @property {boolean} [pending] - Filter for pending payouts only. If true, returns only pending payouts.
|
|
15
|
-
* @property {string} [msisdn] - Filter for msisdn. Should be properly formatted. {country_code}{compact_number} for phone numbers and {SWIFT_CODE}:{account_no}
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* // Get first 10 payouts
|
|
20
|
-
* const args: GetPayoutsAPIArgs = {
|
|
21
|
-
* rangeStart: 0,
|
|
22
|
-
* rangeEnd: 10
|
|
23
|
-
* };
|
|
24
|
-
*
|
|
25
|
-
* // Get only pending payouts
|
|
26
|
-
* const pendingArgs: GetPayoutsAPIArgs = {
|
|
27
|
-
* pending: true
|
|
28
|
-
* };
|
|
29
|
-
* ```
|
|
10
|
+
* Flexible query input type - supports the class, filters interface, URL params, etc.
|
|
30
11
|
*/
|
|
31
|
-
export
|
|
32
|
-
rangeStart?: number;
|
|
33
|
-
rangeEnd?: number;
|
|
34
|
-
pending?: boolean;
|
|
35
|
-
msisdn?: string;
|
|
36
|
-
}
|
|
12
|
+
export type PayoutQueryInput = PayoutQuery | PayoutFilters | Record<string, string> | URLSearchParams | null | undefined;
|
|
37
13
|
/**
|
|
38
14
|
* Repository class for managing payout operations including creation, approval,
|
|
39
15
|
* rejection, and retrieval of payouts.
|
|
@@ -46,7 +22,7 @@ export interface GetPayoutsAPIArgs {
|
|
|
46
22
|
* @example
|
|
47
23
|
* ```typescript
|
|
48
24
|
* const repo = new PayoutRepository({ token: userToken });
|
|
49
|
-
* const payouts = await repo.
|
|
25
|
+
* const payouts = await repo.getPayouts();
|
|
50
26
|
* ```
|
|
51
27
|
*/
|
|
52
28
|
export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
|
|
@@ -69,31 +45,38 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
|
|
|
69
45
|
root?: string;
|
|
70
46
|
});
|
|
71
47
|
/**
|
|
72
|
-
*
|
|
48
|
+
* Get all payouts with filtering and pagination.
|
|
49
|
+
* Accepts flexible input types and normalizes them to PayoutQuery.
|
|
73
50
|
*
|
|
74
|
-
* @param
|
|
75
|
-
* @
|
|
76
|
-
* @param args.rangeEnd - Ending index for pagination (default: 10)
|
|
77
|
-
* @param args.pending - Filter for pending payouts only
|
|
78
|
-
* @param args.msisdn - Filter by MSISDN
|
|
79
|
-
* @returns Promise that resolves to paginated payout results and total count
|
|
80
|
-
* @throws {APIError} If range is invalid or if the fetch operation fails
|
|
51
|
+
* @param query - Query parameters in any supported format
|
|
52
|
+
* @returns Promise resolving to payouts and pagination info
|
|
81
53
|
*
|
|
82
54
|
* @example
|
|
83
55
|
* ```typescript
|
|
84
|
-
* //
|
|
85
|
-
* const
|
|
86
|
-
*
|
|
87
|
-
* rangeEnd: 20
|
|
88
|
-
* });
|
|
56
|
+
* // From API route with URL search params
|
|
57
|
+
* const { searchParams } = new URL(req.url);
|
|
58
|
+
* const result = await repo.getPayouts(searchParams);
|
|
89
59
|
*
|
|
90
|
-
* //
|
|
91
|
-
* const
|
|
60
|
+
* // From client with typed params
|
|
61
|
+
* const filters: PayoutFilters = { page: 1, limit: 20, approvalStatus: 'Pending' };
|
|
62
|
+
* const result2 = await repo.getPayouts(filters);
|
|
63
|
+
*
|
|
64
|
+
* // With PayoutQuery instance
|
|
65
|
+
* const query = PayoutQuery.create().wherePending().withPagination(1, 50);
|
|
66
|
+
* const result3 = await repo.getPayouts(query);
|
|
92
67
|
* ```
|
|
93
68
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
getPayouts(query?: PayoutQueryInput): Promise<{
|
|
70
|
+
payouts: Payout[];
|
|
71
|
+
pagination: PaginationDTO;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Convenience method for Next.js API routes
|
|
75
|
+
* Extracts search params directly from Request object
|
|
76
|
+
*/
|
|
77
|
+
getPayoutsFromRequest(req: Request): Promise<{
|
|
78
|
+
payouts: Payout[];
|
|
79
|
+
pagination: PaginationDTO;
|
|
97
80
|
}>;
|
|
98
81
|
/**
|
|
99
82
|
* Creates a new payout with the provided input data.
|
|
@@ -109,7 +92,7 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
|
|
|
109
92
|
* @example
|
|
110
93
|
* ```typescript
|
|
111
94
|
* const payout = await repo.pay({
|
|
112
|
-
* channel: PayoutChannel.
|
|
95
|
+
* channel: PayoutChannel.MOBILE,
|
|
113
96
|
* receiver: { name: "John Doe", phone: "+255123456789" },
|
|
114
97
|
* amount: Amount.from(10000, "TZS"),
|
|
115
98
|
* notes: "Payment for services"
|
|
@@ -174,4 +157,13 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
|
|
|
174
157
|
* ```
|
|
175
158
|
*/
|
|
176
159
|
getByID(id: string): Promise<Payout>;
|
|
160
|
+
/**
|
|
161
|
+
* Get count of payouts matching a query
|
|
162
|
+
* Uses the same query syntax as getPayouts but only returns the count
|
|
163
|
+
*/
|
|
164
|
+
count(query?: PayoutQueryInput): Promise<number>;
|
|
165
|
+
/**
|
|
166
|
+
* Check if any payouts exist matching a query
|
|
167
|
+
*/
|
|
168
|
+
exists(query?: PayoutQueryInput): Promise<boolean>;
|
|
177
169
|
}
|
|
@@ -90,12 +90,12 @@ export declare const contract: {
|
|
|
90
90
|
startDate: z.ZodDate;
|
|
91
91
|
accountNo: z.ZodOptional<z.ZodString>;
|
|
92
92
|
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
endDate: Date;
|
|
94
93
|
startDate: Date;
|
|
94
|
+
endDate: Date;
|
|
95
95
|
accountNo?: string | undefined;
|
|
96
96
|
}, {
|
|
97
|
-
endDate: Date;
|
|
98
97
|
startDate: Date;
|
|
98
|
+
endDate: Date;
|
|
99
99
|
accountNo?: string | undefined;
|
|
100
100
|
}>;
|
|
101
101
|
path: "/statement";
|