@temboplus/afloat 0.1.72 → 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.
Files changed (58) hide show
  1. package/dist/features/admin/admin.contract.d.ts +53 -53
  2. package/dist/features/admin/admin.repository.d.ts +5 -5
  3. package/dist/features/admin/index.d.ts +2 -2
  4. package/dist/features/auth/access/access.repository.d.ts +2 -2
  5. package/dist/features/auth/auth.manager.d.ts +2 -2
  6. package/dist/features/auth/auth.repository.d.ts +3 -3
  7. package/dist/features/auth/auth.store.d.ts +1 -1
  8. package/dist/features/auth/identity/identity.repository.d.ts +2 -2
  9. package/dist/features/auth/index.d.ts +5 -5
  10. package/dist/features/auth/profile/profile.repository.d.ts +3 -3
  11. package/dist/features/auth/storage/client-store.d.ts +2 -2
  12. package/dist/features/auth/storage/client-token-handler.d.ts +1 -1
  13. package/dist/features/contact/contact-input-handler.d.ts +2 -2
  14. package/dist/features/contact/contact.api-contract.d.ts +38 -43
  15. package/dist/features/contact/contact.dtos.d.ts +6 -6
  16. package/dist/features/contact/contact.repository.d.ts +4 -4
  17. package/dist/features/contact/index.d.ts +2 -2
  18. package/dist/features/payout/index.d.ts +3 -3
  19. package/dist/features/payout/payout-channel-handler.d.ts +3 -3
  20. package/dist/features/payout/payout.api-contract.d.ts +91 -112
  21. package/dist/features/payout/payout.dtos.d.ts +247 -13
  22. package/dist/features/payout/payout.query.d.ts +126 -0
  23. package/dist/features/payout/payout.repository.d.ts +45 -53
  24. package/dist/features/wallet/index.d.ts +4 -4
  25. package/dist/features/wallet/wallet-manager.session.d.ts +2 -2
  26. package/dist/features/wallet/wallet.contract.d.ts +9 -9
  27. package/dist/features/wallet/wallet.dtos.d.ts +14 -14
  28. package/dist/features/wallet/wallet.repository.d.ts +5 -5
  29. package/dist/features/wallet/wallet.utils.d.ts +1 -1
  30. package/dist/index.cjs.js +2 -0
  31. package/dist/index.cjs.js.map +1 -0
  32. package/dist/index.d.ts +7 -7
  33. package/dist/index.esm.js +2 -0
  34. package/dist/index.esm.js.map +1 -0
  35. package/dist/lib/api/common-schemas.d.ts +49 -0
  36. package/dist/lib/api/index.d.ts +2 -2
  37. package/dist/lib/error/error.permission.d.ts +1 -1
  38. package/dist/lib/error/index.d.ts +3 -3
  39. package/dist/lib/query/index.d.ts +2 -0
  40. package/dist/lib/query/query.builder.d.ts +71 -0
  41. package/dist/lib/query/query.types.d.ts +36 -0
  42. package/dist/models/contact-info.model.d.ts +2 -2
  43. package/dist/models/contact.model.d.ts +2 -2
  44. package/dist/models/index.d.ts +11 -11
  45. package/dist/models/managed-user.model.d.ts +2 -2
  46. package/dist/models/narration.model.d.ts +1 -1
  47. package/dist/models/payout.model.d.ts +2 -2
  48. package/dist/models/profile.model.d.ts +1 -1
  49. package/dist/models/role.model.d.ts +1 -1
  50. package/dist/models/statement-entry.model.d.ts +2 -2
  51. package/dist/models/user.model.d.ts +1 -1
  52. package/dist/models/wallet.model.d.ts +1 -1
  53. package/package.json +12 -8
  54. package/dist/index.cjs +0 -2
  55. package/dist/index.cjs.map +0 -1
  56. package/dist/index.js +0 -2
  57. package/dist/index.js.map +0 -1
  58. package/dist/lib/api/common-responses.d.ts +0 -12
@@ -143,17 +143,17 @@ declare const PayoutDTOSchema: z.ZodObject<{
143
143
  }, "strip", z.ZodTypeAny, {
144
144
  status: PayoutStatus;
145
145
  id: string;
146
+ profileId: string;
147
+ createdAt: Date;
148
+ updatedAt: Date;
146
149
  channel: string;
147
150
  msisdn: string;
148
151
  amount: number;
149
152
  description: string;
150
153
  payeeName: string;
151
- profileId: string;
152
154
  countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
153
155
  currencyCode: import("@temboplus/frontend-core").CurrencyCode;
154
156
  statusMessage: string;
155
- createdAt: Date;
156
- updatedAt: Date;
157
157
  notes?: string | null | undefined;
158
158
  partnerReference?: string | null | undefined;
159
159
  actionedAt?: Date | null | undefined;
@@ -171,15 +171,15 @@ declare const PayoutDTOSchema: z.ZodObject<{
171
171
  }, {
172
172
  status: PayoutStatus;
173
173
  id: string;
174
+ profileId: string;
175
+ createdAt: Date;
176
+ updatedAt: Date;
174
177
  channel: string;
175
178
  msisdn: string;
176
179
  amount: number;
177
180
  description: string;
178
181
  payeeName: string;
179
- profileId: string;
180
182
  statusMessage: string;
181
- createdAt: Date;
182
- updatedAt: Date;
183
183
  notes?: string | null | undefined;
184
184
  countryCode?: string | undefined;
185
185
  currencyCode?: string | undefined;
@@ -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
@@ -265,17 +389,17 @@ export declare const PayoutDTOSchemas: {
265
389
  }, "strip", z.ZodTypeAny, {
266
390
  status: PayoutStatus;
267
391
  id: string;
392
+ profileId: string;
393
+ createdAt: Date;
394
+ updatedAt: Date;
268
395
  channel: string;
269
396
  msisdn: string;
270
397
  amount: number;
271
398
  description: string;
272
399
  payeeName: string;
273
- profileId: string;
274
400
  countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
275
401
  currencyCode: import("@temboplus/frontend-core").CurrencyCode;
276
402
  statusMessage: string;
277
- createdAt: Date;
278
- updatedAt: Date;
279
403
  notes?: string | null | undefined;
280
404
  partnerReference?: string | null | undefined;
281
405
  actionedAt?: Date | null | undefined;
@@ -293,15 +417,15 @@ export declare const PayoutDTOSchemas: {
293
417
  }, {
294
418
  status: PayoutStatus;
295
419
  id: string;
420
+ profileId: string;
421
+ createdAt: Date;
422
+ updatedAt: Date;
296
423
  channel: string;
297
424
  msisdn: string;
298
425
  amount: number;
299
426
  description: string;
300
427
  payeeName: string;
301
- profileId: string;
302
428
  statusMessage: string;
303
- createdAt: Date;
304
- updatedAt: Date;
305
429
  notes?: string | null | undefined;
306
430
  countryCode?: string | undefined;
307
431
  currencyCode?: string | undefined;
@@ -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";
2
- import { type PayoutAPI } from "./payout.api-contract";
3
- import { Payout } from "../../models/payout.model";
1
+ import { BaseRepository, PaginationDTO } from "@/lib/api/index.js";
2
+ import { ContactInfo } from "@/models/contact-info.model.js";
3
+ import { Payout } from "@/models/payout.model.js";
4
4
  import { Amount } from "@temboplus/frontend-core";
5
- import { PayoutChannel } from "./payout.dtos";
6
- import { ContactInfo } from "../../models/contact-info.model";
5
+ import { PayoutAPI } from "./payout.api-contract.js";
6
+ import { PayoutChannel } from "./payout.dtos.js";
7
+ import { PayoutQuery } from "./payout.query.js";
8
+ import { PayoutFilters } from "./payout.dtos.js";
7
9
  /**
8
- * Arguments for retrieving payouts from the API.
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 interface GetPayoutsAPIArgs {
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.getAll();
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
- * Retrieves a paginated list of payouts with optional filtering for pending status.
48
+ * Get all payouts with filtering and pagination.
49
+ * Accepts flexible input types and normalizes them to PayoutQuery.
73
50
  *
74
- * @param args - Optional arguments for filtering and pagination
75
- * @param args.rangeStart - Starting index for pagination (default: 0)
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
- * // Get first 20 payouts
85
- * const result = await repo.getAll({
86
- * rangeStart: 0,
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
- * // Get only pending payouts
91
- * const pendingResult = await repo.getAll({ pending: true });
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
- getAll(args?: GetPayoutsAPIArgs): Promise<{
95
- results: Payout[];
96
- total: number;
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.MOBILE_MONEY,
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
  }
@@ -1,4 +1,4 @@
1
- export * from "./wallet.repository";
2
- export * from "./wallet-manager.session";
3
- export * from "./wallet.dtos";
4
- export * from "./wallet.utils";
1
+ export * from "./wallet.repository.js";
2
+ export * from "./wallet-manager.session.js";
3
+ export * from "./wallet.dtos.js";
4
+ export * from "./wallet.utils.js";
@@ -1,6 +1,6 @@
1
1
  import { Country, type CountryCode } from "@temboplus/frontend-core";
2
- import { Wallet } from "../../models/wallet.model";
3
- import { User } from "../../models/user.model";
2
+ import { Wallet } from "../../models/wallet.model.js";
3
+ import { User } from "../../models/user.model.js";
4
4
  /**
5
5
  * Defines the shape of the persisted wallet session state.
6
6
  * IMPORTANT: Properties like selectedWalletId/selectedCountryCode are guaranteed
@@ -11,17 +11,17 @@ export declare const contract: {
11
11
  currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
12
12
  }, "strip", z.ZodTypeAny, {
13
13
  id?: string | undefined;
14
+ profileId?: string | undefined;
14
15
  accountNo?: string | undefined;
15
16
  channel?: string | undefined;
16
- profileId?: string | undefined;
17
17
  countryCode?: string | undefined;
18
18
  currencyCode?: string | undefined;
19
19
  accountName?: string | undefined;
20
20
  }, {
21
21
  id?: string | undefined;
22
+ profileId?: string | undefined;
22
23
  accountNo?: string | undefined;
23
24
  channel?: string | undefined;
24
- profileId?: string | undefined;
25
25
  countryCode?: string | undefined;
26
26
  currencyCode?: string | undefined;
27
27
  accountName?: string | undefined;
@@ -41,21 +41,21 @@ export declare const contract: {
41
41
  updatedAt: z.ZodString;
42
42
  }, "strip", z.ZodTypeAny, {
43
43
  id: string;
44
+ profileId: string;
45
+ createdAt: string;
46
+ updatedAt: string;
44
47
  accountNo: string;
45
48
  channel: string;
46
- profileId: string;
47
49
  countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
48
50
  currencyCode: import("@temboplus/frontend-core").CurrencyCode;
49
- createdAt: string;
50
- updatedAt: string;
51
51
  accountName: string;
52
52
  }, {
53
53
  id: string;
54
- accountNo: string;
55
- channel: string;
56
54
  profileId: string;
57
55
  createdAt: string;
58
56
  updatedAt: string;
57
+ accountNo: string;
58
+ channel: string;
59
59
  accountName: string;
60
60
  countryCode?: string | undefined;
61
61
  currencyCode?: string | undefined;
@@ -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";