@temboplus/tembo-dashboard 0.0.10 → 0.0.12

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.
@@ -0,0 +1,119 @@
1
+ import { QueryBuilder } from "@/lib/query";
2
+ import { COLLECTION_STATUS, COLLECTION_CHANNEL, CollectionFilters } from "./collection.types";
3
+ /**
4
+ * Collection-specific query builder that extends the base QueryBuilder
5
+ * and handles all possible input conversions (DTOs, URL params, etc.)
6
+ */
7
+ export declare class CollectionQuery extends QueryBuilder {
8
+ /**
9
+ * Create empty collection query with defaults
10
+ */
11
+ static create(): CollectionQuery;
12
+ /**
13
+ * Create from typed DTO/filters object
14
+ */
15
+ static fromFilters(filters: CollectionFilters): CollectionQuery;
16
+ /**
17
+ * Create from URL search parameters (strings)
18
+ */
19
+ static fromUrlParams(params: Record<string, string>): CollectionQuery;
20
+ /**
21
+ * Create from URLSearchParams object
22
+ */
23
+ static fromSearchParams(searchParams: URLSearchParams): CollectionQuery;
24
+ /**
25
+ * Create from Next.js Request object
26
+ */
27
+ static fromRequest(request: Request): CollectionQuery;
28
+ /**
29
+ * Create from any supported input type
30
+ */
31
+ static from(input: QueryBuilder | CollectionFilters | Record<string, string> | URLSearchParams | null | undefined): CollectionQuery;
32
+ /**
33
+ * Type guard for string records
34
+ */
35
+ private static isStringRecord;
36
+ whereStatus(status: COLLECTION_STATUS): this;
37
+ whereChannel(channel: COLLECTION_CHANNEL): this;
38
+ wherePending(): this;
39
+ whereSuccessful(): this;
40
+ whereFailed(): this;
41
+ whereAmountBetween(min: number, max: number): this;
42
+ whereSender(msisdn: string): this;
43
+ whereAccount(accountNo: string): this;
44
+ whereReference(reference: string): this;
45
+ wherePartnerReference(partnerReference: string): this;
46
+ whereSearch(searchTerm: string): this;
47
+ /**
48
+ * Apply all filters from CollectionFilters object
49
+ */
50
+ private applyFilters;
51
+ /**
52
+ * Convert to CollectionFilters DTO
53
+ */
54
+ toFilters(): CollectionFilters;
55
+ /**
56
+ * Convert to URL-safe string parameters
57
+ */
58
+ toUrlParams(): Record<string, string>;
59
+ /**
60
+ * Convert to URLSearchParams
61
+ */
62
+ toSearchParams(): URLSearchParams;
63
+ /**
64
+ * Convert to query string
65
+ */
66
+ toQueryString(): string;
67
+ /**
68
+ * Create new instance with updated pagination
69
+ */
70
+ withPagination(page: number, limit?: number): CollectionQuery;
71
+ /**
72
+ * Create new instance with updated sorting
73
+ */
74
+ withSorting(sortBy: string, sortOrder?: "asc" | "desc"): CollectionQuery;
75
+ /**
76
+ * Create new instance with date range
77
+ */
78
+ withDateRange(startDate?: string, endDate?: string): CollectionQuery;
79
+ /**
80
+ * Create new instance with status filter
81
+ */
82
+ withStatus(status?: COLLECTION_STATUS): CollectionQuery;
83
+ /**
84
+ * Create new instance with channel filter
85
+ */
86
+ withChannel(channel?: COLLECTION_CHANNEL): CollectionQuery;
87
+ /**
88
+ * Reset to first page
89
+ */
90
+ resetPage(): CollectionQuery;
91
+ /**
92
+ * Check if any filters are applied
93
+ */
94
+ hasFilters(): boolean;
95
+ /**
96
+ * Get human-readable filter descriptions
97
+ */
98
+ getActiveFilters(): string[];
99
+ /**
100
+ * Extract filter values from QueryBuilder options
101
+ */
102
+ private extractFilterValues;
103
+ /**
104
+ * Extract primary sort field
105
+ */
106
+ private extractSortField;
107
+ /**
108
+ * Extract primary sort order
109
+ */
110
+ private extractSortOrder;
111
+ /**
112
+ * Type guard for valid channels
113
+ */
114
+ private isValidChannel;
115
+ /**
116
+ * Type guard for valid statuses
117
+ */
118
+ private isValidStatus;
119
+ }
@@ -1,32 +1,26 @@
1
- import { BaseRepository, PaginationDTO, WalletSummaryDTO } from "@/lib/api";
1
+ import { BaseRepository, PaginationDTO } from "@/lib/api";
2
2
  import { collectionContract } from "./collection.api-contract";
3
3
  import { Collection } from "./collection.model";
4
- import { CollectionQueryBuilder } from "./collection.query-builder";
5
- import { CollectionQueryParams } from "./collection.query-params.model";
4
+ import { CollectionQuery } from "./collection.query";
5
+ import { CollectionFilters } from "./collection.types";
6
+ import { TransactionSummary, WalletInfo } from "@/lib/models";
6
7
  /**
7
- * Flexible query input type - supports the class, DTO, URL params, etc.
8
+ * Flexible query input type - supports the class, filters interface, URL params, etc.
8
9
  */
9
- export type CollectionQueryInput = CollectionQueryParams | Parameters<typeof CollectionQueryParams.from>[0];
10
+ export type CollectionQueryInput = CollectionQuery | CollectionFilters | Record<string, string> | URLSearchParams | null | undefined;
10
11
  /**
11
12
  * Repository class for managing collections through API interactions.
12
13
  * Handles collection operations, filtering, and summary data retrieval.
13
- * Supports flexible query input types including URL search parameters and typed DTOs.
14
+ * Simplified to use CollectionQuery as the primary query interface.
14
15
  */
15
16
  export declare class CollectionRepository extends BaseRepository<typeof collectionContract> {
16
17
  constructor(options?: {
17
18
  token?: string;
18
19
  root?: string;
19
20
  });
20
- /**
21
- * Normalize query input to CollectionQueryParams class instance
22
- * @param query - Any supported query input type
23
- * @returns CollectionQueryParams instance
24
- * @throws Error if validation fails
25
- */
26
- private normalizeQueryParams;
27
21
  /**
28
22
  * Get all collections with filtering and pagination.
29
- * Supports flexible input types: typed DTO, URL search params, or string records.
23
+ * Accepts flexible input types and normalizes them to CollectionQuery.
30
24
  *
31
25
  * @param query - Query parameters in any supported format
32
26
  * @returns Promise resolving to collections and pagination info
@@ -35,16 +29,15 @@ export declare class CollectionRepository extends BaseRepository<typeof collecti
35
29
  * ```typescript
36
30
  * // From API route with URL search params
37
31
  * const { searchParams } = new URL(req.url);
38
- * const stringParams = Object.fromEntries(searchParams.entries());
39
- * const result = await repo.getCollections(stringParams);
32
+ * const result = await repo.getCollections(searchParams);
40
33
  *
41
34
  * // From client with typed params
42
- * const typedParams: CollectionQueryParamsDTO = { page: 1, limit: 20, status: 'PAYMENT_ACCEPTED' };
43
- * const result2 = await repo.getCollections(typedParams);
35
+ * const filters: CollectionFilters = { page: 1, limit: 20, status: 'PAYMENT_ACCEPTED' };
36
+ * const result2 = await repo.getCollections(filters);
44
37
  *
45
- * // With URLSearchParams directly
46
- * const urlParams = new URLSearchParams(window.location.search);
47
- * const result3 = await repo.getCollections(urlParams);
38
+ * // With CollectionQuery instance
39
+ * const query = CollectionQuery.create().whereSuccessful().withPagination(1, 50);
40
+ * const result3 = await repo.getCollections(query);
48
41
  * ```
49
42
  */
50
43
  getCollections(query?: CollectionQueryInput): Promise<{
@@ -52,42 +45,8 @@ export declare class CollectionRepository extends BaseRepository<typeof collecti
52
45
  pagination: PaginationDTO;
53
46
  }>;
54
47
  /**
55
- * Convenience method to get collections from URL search params directly.
56
- * Useful in API routes where you have direct access to search params.
57
- *
58
- * @param searchParams - URLSearchParams from request
59
- * @returns Promise resolving to collections and pagination info
60
- *
61
- * @example
62
- * ```typescript
63
- * // In API route
64
- * export async function GET(req: Request) {
65
- * const { searchParams } = new URL(req.url);
66
- * const repo = new CollectionRepository({ token });
67
- * return repo.getCollectionsFromSearchParams(searchParams);
68
- * }
69
- * ```
70
- */
71
- getCollectionsFromSearchParams(searchParams: URLSearchParams): Promise<{
72
- collections: Collection[];
73
- pagination: PaginationDTO;
74
- }>;
75
- /**
76
- * Convenience method to get collections from Next.js Request object.
77
- * Extracts and processes search params automatically.
78
- *
79
- * @param req - Next.js Request object
80
- * @returns Promise resolving to collections and pagination info
81
- *
82
- * @example
83
- * ```typescript
84
- * // In API route
85
- * export async function GET(req: Request) {
86
- * const repo = new CollectionRepository({ token });
87
- * const result = await repo.getCollectionsFromRequest(req);
88
- * return NextResponse.json(result);
89
- * }
90
- * ```
48
+ * Convenience method for Next.js API routes
49
+ * Extracts search params directly from Request object
91
50
  */
92
51
  getCollectionsFromRequest(req: Request): Promise<{
93
52
  collections: Collection[];
@@ -100,50 +59,9 @@ export declare class CollectionRepository extends BaseRepository<typeof collecti
100
59
  /**
101
60
  * Get collections summary statistics
102
61
  */
103
- getSummary(): Promise<{
104
- yesterday: number;
105
- today: number;
106
- thisMonth: number;
107
- lastMonth: number;
108
- }>;
109
- /**
110
- * Get account balance and summary information
111
- */
112
- getBalance(): Promise<WalletSummaryDTO>;
113
- /**
114
- * Build a query using the fluent query builder interface
115
- * Returns a query builder instance for complex filtering scenarios.
116
- *
117
- * @returns CollectionQueryBuilder instance for method chaining
118
- *
119
- * @example
120
- * ```typescript
121
- * const collections = await repo.query()
122
- * .whereSuccessful()
123
- * .whereAmountBetween(100, 1000)
124
- * .whereDateBetween('2024-01-01', '2024-01-31')
125
- * .orderByDesc('amount')
126
- * .paginate(1, 50)
127
- * .execute(repo);
128
- * ```
129
- */
130
- query(): CollectionQueryBuilderWithExecute;
131
- }
132
- /**
133
- * Extended query builder that includes execute method for direct repository integration
134
- */
135
- declare class CollectionQueryBuilderWithExecute extends CollectionQueryBuilder {
136
- private builder;
137
- private repository;
138
- constructor(builder: CollectionQueryBuilder, repository: CollectionRepository);
62
+ getCollectionStats(): Promise<TransactionSummary>;
139
63
  /**
140
- * Execute the query and return results
141
- *
142
- * @returns Promise resolving to collections and pagination info
64
+ * Get wallet information
143
65
  */
144
- execute(): Promise<{
145
- collections: Collection[];
146
- pagination: PaginationDTO;
147
- }>;
66
+ getWalletInfo(): Promise<WalletInfo>;
148
67
  }
149
- export {};
@@ -81,7 +81,7 @@ export declare const CollectionDTOSchemas: {
81
81
  notes?: string | undefined;
82
82
  currencyCode?: string | undefined;
83
83
  }>;
84
- collectionQueryParams: z.ZodObject<{
84
+ collectionFilters: z.ZodObject<{
85
85
  page: z.ZodDefault<z.ZodNumber>;
86
86
  limit: z.ZodDefault<z.ZodNumber>;
87
87
  sortBy: z.ZodDefault<z.ZodString>;
@@ -185,47 +185,9 @@ export declare const CollectionDTOSchemas: {
185
185
  minAmount?: string | undefined;
186
186
  maxAmount?: string | undefined;
187
187
  }>;
188
- pagination: z.ZodObject<{
189
- page: z.ZodNumber;
190
- limit: z.ZodNumber;
191
- total: z.ZodNumber;
192
- totalPages: z.ZodNumber;
193
- hasNext: z.ZodBoolean;
194
- hasPrev: z.ZodBoolean;
195
- }, "strip", z.ZodTypeAny, {
196
- page: number;
197
- limit: number;
198
- total: number;
199
- totalPages: number;
200
- hasNext: boolean;
201
- hasPrev: boolean;
202
- }, {
203
- page: number;
204
- limit: number;
205
- total: number;
206
- totalPages: number;
207
- hasNext: boolean;
208
- hasPrev: boolean;
209
- }>;
210
188
  paymentStatus: z.ZodNativeEnum<typeof COLLECTION_STATUS>;
211
189
  paymentChannel: z.ZodNativeEnum<typeof COLLECTION_CHANNEL>;
212
- walletSummary: z.ZodObject<{
213
- balance: z.ZodNumber;
214
- availableBalance: z.ZodNumber;
215
- accountNumber: z.ZodString;
216
- accountName: z.ZodString;
217
- }, "strip", z.ZodTypeAny, {
218
- balance: number;
219
- availableBalance: number;
220
- accountNumber: string;
221
- accountName: string;
222
- }, {
223
- balance: number;
224
- availableBalance: number;
225
- accountNumber: string;
226
- accountName: string;
227
- }>;
228
190
  };
229
191
  export type CollectionDTO = z.infer<typeof CollectionDTOSchemas.collection>;
230
- export type CollectionQueryParamsDTO = z.infer<typeof CollectionDTOSchemas.collectionQueryParams>;
231
- export type CollectionURLQueryParamsDTO = z.infer<typeof CollectionDTOSchemas.collectionURLQueryParams>;
192
+ export type CollectionFilters = z.infer<typeof CollectionDTOSchemas.collectionFilters>;
193
+ export type CollectionURLQueryParams = z.infer<typeof CollectionDTOSchemas.collectionURLQueryParams>;
@@ -1,7 +1,5 @@
1
1
  export * from "./collection.api-contract";
2
- export * from "./collection.dtos";
3
- export * from "./collection.model";
4
- export * from "./collection.query-builder";
5
2
  export * from "./collection.repository";
6
- export * from "./collection.utils";
7
- export * from "./collection.query-params.model";
3
+ export * from "./collection.model";
4
+ export * from "./collection.types";
5
+ export * from "./collection.query";
@@ -1,5 +1,5 @@
1
1
  export * from "./payout.api-contract";
2
- export * from "./payout.dtos";
3
- export * from "./payout.model";
4
- export * from "./payout.query-builder";
5
2
  export * from "./payout.repository";
3
+ export * from "./payout.types";
4
+ export * from "./payout.model";
5
+ export * from "./payout.query";
@@ -2,8 +2,8 @@ import { z } from "zod";
2
2
  export declare const payoutContract: {
3
3
  getPayouts: {
4
4
  query: z.ZodObject<{
5
- page: z.ZodDefault<z.ZodNumber>;
6
- limit: z.ZodDefault<z.ZodNumber>;
5
+ page: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
6
+ limit: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
7
7
  sortBy: z.ZodDefault<z.ZodString>;
8
8
  sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
9
9
  startDate: z.ZodOptional<z.ZodString>;
@@ -11,40 +11,40 @@ export declare const payoutContract: {
11
11
  msisdn: z.ZodOptional<z.ZodString>;
12
12
  id: z.ZodOptional<z.ZodString>;
13
13
  ref: z.ZodOptional<z.ZodString>;
14
- channel: z.ZodOptional<z.ZodUnion<[z.ZodNativeEnum<typeof import("./payout.dtos").MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof import("./payout.dtos").BANK_PAYOUT_CHANNEL>]>>;
15
- status: z.ZodOptional<z.ZodNativeEnum<typeof import("./payout.dtos").PAYOUT_STATUS>>;
16
- minAmount: z.ZodOptional<z.ZodNumber>;
17
- maxAmount: z.ZodOptional<z.ZodNumber>;
14
+ channel: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL, string>>;
15
+ status: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./payout.types").PAYOUT_STATUS, string>>;
16
+ minAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
17
+ maxAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
18
18
  search: z.ZodOptional<z.ZodString>;
19
19
  }, "strip", z.ZodTypeAny, {
20
- page: number;
21
- limit: number;
22
20
  sortBy: string;
23
21
  sortOrder: "asc" | "desc";
24
- status?: import("./payout.dtos").PAYOUT_STATUS | undefined;
22
+ status?: import("./payout.types").PAYOUT_STATUS | undefined;
25
23
  startDate?: string | undefined;
26
24
  endDate?: string | undefined;
25
+ page?: number | undefined;
26
+ limit?: number | undefined;
27
27
  search?: string | undefined;
28
28
  id?: string | undefined;
29
29
  msisdn?: string | undefined;
30
- channel?: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL | undefined;
30
+ channel?: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL | undefined;
31
31
  minAmount?: number | undefined;
32
32
  maxAmount?: number | undefined;
33
33
  ref?: string | undefined;
34
34
  }, {
35
- status?: import("./payout.dtos").PAYOUT_STATUS | undefined;
35
+ status?: string | undefined;
36
36
  startDate?: string | undefined;
37
37
  endDate?: string | undefined;
38
- page?: number | undefined;
39
- limit?: number | undefined;
38
+ page?: string | undefined;
39
+ limit?: string | undefined;
40
40
  search?: string | undefined;
41
41
  id?: string | undefined;
42
42
  msisdn?: string | undefined;
43
- channel?: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL | undefined;
43
+ channel?: string | undefined;
44
44
  sortBy?: string | undefined;
45
45
  sortOrder?: "asc" | "desc" | undefined;
46
- minAmount?: number | undefined;
47
- maxAmount?: number | undefined;
46
+ minAmount?: string | undefined;
47
+ maxAmount?: string | undefined;
48
48
  ref?: string | undefined;
49
49
  }>;
50
50
  summary: "List payouts";
@@ -56,10 +56,10 @@ export declare const payoutContract: {
56
56
  results: z.ZodArray<z.ZodObject<{
57
57
  id: z.ZodString;
58
58
  statusCode: z.ZodString;
59
- statusCodeText: z.ZodNativeEnum<typeof import("./payout.dtos").PAYOUT_STATUS>;
59
+ statusCodeText: z.ZodNativeEnum<typeof import("./payout.types").PAYOUT_STATUS>;
60
60
  statusDescription: z.ZodString;
61
61
  countryCode: z.ZodString;
62
- serviceCode: z.ZodUnion<[z.ZodNativeEnum<typeof import("./payout.dtos").MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof import("./payout.dtos").BANK_PAYOUT_CHANNEL>]>;
62
+ serviceCode: z.ZodUnion<[z.ZodNativeEnum<typeof import("./payout.types").MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof import("./payout.types").BANK_PAYOUT_CHANNEL>]>;
63
63
  amount: z.ZodNumber;
64
64
  serviceFee: z.ZodOptional<z.ZodString>;
65
65
  postedAmount: z.ZodOptional<z.ZodString>;
@@ -92,10 +92,10 @@ export declare const payoutContract: {
92
92
  amount: number;
93
93
  transactionId: string;
94
94
  currencyCode: string;
95
- statusCodeText: import("./payout.dtos").PAYOUT_STATUS;
95
+ statusCodeText: import("./payout.types").PAYOUT_STATUS;
96
96
  statusDescription: string;
97
97
  countryCode: string;
98
- serviceCode: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL;
98
+ serviceCode: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL;
99
99
  transactionRef: string;
100
100
  walletId?: string | undefined;
101
101
  serviceFee?: string | undefined;
@@ -121,10 +121,10 @@ export declare const payoutContract: {
121
121
  amount: number;
122
122
  transactionId: string;
123
123
  currencyCode: string;
124
- statusCodeText: import("./payout.dtos").PAYOUT_STATUS;
124
+ statusCodeText: import("./payout.types").PAYOUT_STATUS;
125
125
  statusDescription: string;
126
126
  countryCode: string;
127
- serviceCode: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL;
127
+ serviceCode: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL;
128
128
  transactionRef: string;
129
129
  walletId?: string | undefined;
130
130
  serviceFee?: string | undefined;
@@ -154,10 +154,10 @@ export declare const payoutContract: {
154
154
  amount: number;
155
155
  transactionId: string;
156
156
  currencyCode: string;
157
- statusCodeText: import("./payout.dtos").PAYOUT_STATUS;
157
+ statusCodeText: import("./payout.types").PAYOUT_STATUS;
158
158
  statusDescription: string;
159
159
  countryCode: string;
160
- serviceCode: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL;
160
+ serviceCode: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL;
161
161
  transactionRef: string;
162
162
  walletId?: string | undefined;
163
163
  serviceFee?: string | undefined;
@@ -186,10 +186,10 @@ export declare const payoutContract: {
186
186
  amount: number;
187
187
  transactionId: string;
188
188
  currencyCode: string;
189
- statusCodeText: import("./payout.dtos").PAYOUT_STATUS;
189
+ statusCodeText: import("./payout.types").PAYOUT_STATUS;
190
190
  statusDescription: string;
191
191
  countryCode: string;
192
- serviceCode: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL;
192
+ serviceCode: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL;
193
193
  transactionRef: string;
194
194
  walletId?: string | undefined;
195
195
  serviceFee?: string | undefined;
@@ -239,10 +239,10 @@ export declare const payoutContract: {
239
239
  200: z.ZodObject<{
240
240
  id: z.ZodString;
241
241
  statusCode: z.ZodString;
242
- statusCodeText: z.ZodNativeEnum<typeof import("./payout.dtos").PAYOUT_STATUS>;
242
+ statusCodeText: z.ZodNativeEnum<typeof import("./payout.types").PAYOUT_STATUS>;
243
243
  statusDescription: z.ZodString;
244
244
  countryCode: z.ZodString;
245
- serviceCode: z.ZodUnion<[z.ZodNativeEnum<typeof import("./payout.dtos").MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof import("./payout.dtos").BANK_PAYOUT_CHANNEL>]>;
245
+ serviceCode: z.ZodUnion<[z.ZodNativeEnum<typeof import("./payout.types").MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof import("./payout.types").BANK_PAYOUT_CHANNEL>]>;
246
246
  amount: z.ZodNumber;
247
247
  serviceFee: z.ZodOptional<z.ZodString>;
248
248
  postedAmount: z.ZodOptional<z.ZodString>;
@@ -275,10 +275,10 @@ export declare const payoutContract: {
275
275
  amount: number;
276
276
  transactionId: string;
277
277
  currencyCode: string;
278
- statusCodeText: import("./payout.dtos").PAYOUT_STATUS;
278
+ statusCodeText: import("./payout.types").PAYOUT_STATUS;
279
279
  statusDescription: string;
280
280
  countryCode: string;
281
- serviceCode: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL;
281
+ serviceCode: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL;
282
282
  transactionRef: string;
283
283
  walletId?: string | undefined;
284
284
  serviceFee?: string | undefined;
@@ -304,10 +304,10 @@ export declare const payoutContract: {
304
304
  amount: number;
305
305
  transactionId: string;
306
306
  currencyCode: string;
307
- statusCodeText: import("./payout.dtos").PAYOUT_STATUS;
307
+ statusCodeText: import("./payout.types").PAYOUT_STATUS;
308
308
  statusDescription: string;
309
309
  countryCode: string;
310
- serviceCode: import("./payout.dtos").MOBILE_PAYOUT_CHANNEL | import("./payout.dtos").BANK_PAYOUT_CHANNEL;
310
+ serviceCode: import("./payout.types").MOBILE_PAYOUT_CHANNEL | import("./payout.types").BANK_PAYOUT_CHANNEL;
311
311
  transactionRef: string;
312
312
  walletId?: string | undefined;
313
313
  serviceFee?: string | undefined;
@@ -385,7 +385,7 @@ export declare const payoutContract: {
385
385
  }>;
386
386
  };
387
387
  };
388
- getBalance: {
388
+ getWalletInfo: {
389
389
  summary: "Get account balance";
390
390
  description: "Retrieve current account balance and status information";
391
391
  method: "GET";
@@ -1,5 +1,5 @@
1
1
  import { Amount, AmountJson, Bank } from "@temboplus/frontend-core";
2
- import { BANK_PAYOUT_CHANNEL, MOBILE_PAYOUT_CHANNEL, PAYOUT_CHANNEL, PAYOUT_STATUS } from "./payout.dtos";
2
+ import { BANK_PAYOUT_CHANNEL, MOBILE_PAYOUT_CHANNEL, PAYOUT_CHANNEL, PAYOUT_STATUS } from "./payout.types";
3
3
  export interface PayoutStatusInfo {
4
4
  label: string;
5
5
  description: string;
@@ -0,0 +1,119 @@
1
+ import { QueryBuilder } from "@/lib/query";
2
+ import { PAYOUT_STATUS, PAYOUT_CHANNEL, PayoutFilters } from "./payout.types";
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: PAYOUT_STATUS): this;
37
+ whereChannel(channel: PAYOUT_CHANNEL): this;
38
+ wherePending(): this;
39
+ whereSuccessful(): this;
40
+ whereFailed(): this;
41
+ whereAmountBetween(min: number, max: number): this;
42
+ whereRecipient(msisdn: string): this;
43
+ whereReference(ref: string): this;
44
+ whereMobile(): this;
45
+ whereBank(): this;
46
+ whereSearch(searchTerm: string): this;
47
+ /**
48
+ * Apply all filters from PayoutFilters object
49
+ */
50
+ private applyFilters;
51
+ /**
52
+ * Convert to PayoutFilters DTO
53
+ */
54
+ toFilters(): PayoutFilters;
55
+ /**
56
+ * Convert to URL-safe string parameters
57
+ */
58
+ toUrlParams(): Record<string, string>;
59
+ /**
60
+ * Convert to URLSearchParams
61
+ */
62
+ toSearchParams(): URLSearchParams;
63
+ /**
64
+ * Convert to query string
65
+ */
66
+ toQueryString(): string;
67
+ /**
68
+ * Create new instance with updated pagination
69
+ */
70
+ withPagination(page: number, limit?: number): PayoutQuery;
71
+ /**
72
+ * Create new instance with updated sorting
73
+ */
74
+ withSorting(sortBy: string, sortOrder?: "asc" | "desc"): PayoutQuery;
75
+ /**
76
+ * Create new instance with date range
77
+ */
78
+ withDateRange(startDate?: string, endDate?: string): PayoutQuery;
79
+ /**
80
+ * Create new instance with status filter
81
+ */
82
+ withStatus(status?: PAYOUT_STATUS): PayoutQuery;
83
+ /**
84
+ * Create new instance with channel filter
85
+ */
86
+ withChannel(channel?: PAYOUT_CHANNEL): PayoutQuery;
87
+ /**
88
+ * Reset to first page
89
+ */
90
+ resetPage(): PayoutQuery;
91
+ /**
92
+ * Check if any filters are applied
93
+ */
94
+ hasFilters(): boolean;
95
+ /**
96
+ * Get human-readable filter descriptions
97
+ */
98
+ getActiveFilters(): string[];
99
+ /**
100
+ * Extract filter values from QueryBuilder options
101
+ */
102
+ private extractFilterValues;
103
+ /**
104
+ * Extract primary sort field
105
+ */
106
+ private extractSortField;
107
+ /**
108
+ * Extract primary sort order
109
+ */
110
+ private extractSortOrder;
111
+ /**
112
+ * Type guard for valid channels
113
+ */
114
+ private isValidChannel;
115
+ /**
116
+ * Type guard for valid statuses
117
+ */
118
+ private isValidStatus;
119
+ }