@temboplus/afloat 0.1.73 → 0.1.75-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/admin/admin.contract.d.ts +64 -64
- package/dist/features/contact/contact.api-contract.d.ts +24 -29
- package/dist/features/contact/contact.dtos.d.ts +6 -6
- package/dist/features/payout/payout.api-contract.d.ts +25 -46
- package/dist/features/payout/payout.dtos.d.ts +239 -5
- 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 +8 -8
- package/dist/features/wallet/wallet.dtos.d.ts +12 -12
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- 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
|
@@ -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
|
}
|
|
@@ -11,16 +11,16 @@ 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;
|
|
15
14
|
accountNo?: string | undefined;
|
|
15
|
+
profileId?: string | undefined;
|
|
16
16
|
channel?: 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;
|
|
23
22
|
accountNo?: string | undefined;
|
|
23
|
+
profileId?: string | undefined;
|
|
24
24
|
channel?: string | undefined;
|
|
25
25
|
countryCode?: string | undefined;
|
|
26
26
|
currencyCode?: string | undefined;
|
|
@@ -41,20 +41,20 @@ export declare const contract: {
|
|
|
41
41
|
updatedAt: z.ZodString;
|
|
42
42
|
}, "strip", z.ZodTypeAny, {
|
|
43
43
|
id: string;
|
|
44
|
-
|
|
44
|
+
accountNo: string;
|
|
45
45
|
createdAt: string;
|
|
46
|
+
profileId: string;
|
|
46
47
|
updatedAt: string;
|
|
47
|
-
accountNo: string;
|
|
48
48
|
channel: string;
|
|
49
49
|
countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
|
|
50
50
|
currencyCode: import("@temboplus/frontend-core").CurrencyCode;
|
|
51
51
|
accountName: string;
|
|
52
52
|
}, {
|
|
53
53
|
id: string;
|
|
54
|
-
|
|
54
|
+
accountNo: string;
|
|
55
55
|
createdAt: string;
|
|
56
|
+
profileId: string;
|
|
56
57
|
updatedAt: string;
|
|
57
|
-
accountNo: string;
|
|
58
58
|
channel: string;
|
|
59
59
|
accountName: string;
|
|
60
60
|
countryCode?: 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";
|
|
@@ -16,20 +16,20 @@ declare const walletSchema: z.ZodObject<{
|
|
|
16
16
|
updatedAt: z.ZodString;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
id: string;
|
|
19
|
-
|
|
19
|
+
accountNo: string;
|
|
20
20
|
createdAt: string;
|
|
21
|
+
profileId: string;
|
|
21
22
|
updatedAt: string;
|
|
22
|
-
accountNo: string;
|
|
23
23
|
channel: string;
|
|
24
24
|
countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
|
|
25
25
|
currencyCode: import("@temboplus/frontend-core").CurrencyCode;
|
|
26
26
|
accountName: string;
|
|
27
27
|
}, {
|
|
28
28
|
id: string;
|
|
29
|
-
|
|
29
|
+
accountNo: string;
|
|
30
30
|
createdAt: string;
|
|
31
|
+
profileId: string;
|
|
31
32
|
updatedAt: string;
|
|
32
|
-
accountNo: string;
|
|
33
33
|
channel: string;
|
|
34
34
|
accountName: string;
|
|
35
35
|
countryCode?: string | undefined;
|
|
@@ -50,16 +50,16 @@ declare const walletQuerySchema: z.ZodObject<{
|
|
|
50
50
|
currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
|
|
51
51
|
}, "strip", z.ZodTypeAny, {
|
|
52
52
|
id?: string | undefined;
|
|
53
|
-
profileId?: string | undefined;
|
|
54
53
|
accountNo?: string | undefined;
|
|
54
|
+
profileId?: string | undefined;
|
|
55
55
|
channel?: string | undefined;
|
|
56
56
|
countryCode?: string | undefined;
|
|
57
57
|
currencyCode?: string | undefined;
|
|
58
58
|
accountName?: string | undefined;
|
|
59
59
|
}, {
|
|
60
60
|
id?: string | undefined;
|
|
61
|
-
profileId?: string | undefined;
|
|
62
61
|
accountNo?: string | undefined;
|
|
62
|
+
profileId?: string | undefined;
|
|
63
63
|
channel?: string | undefined;
|
|
64
64
|
countryCode?: string | undefined;
|
|
65
65
|
currencyCode?: string | undefined;
|
|
@@ -119,20 +119,20 @@ export declare const WalletDTOSchemas: {
|
|
|
119
119
|
updatedAt: z.ZodString;
|
|
120
120
|
}, "strip", z.ZodTypeAny, {
|
|
121
121
|
id: string;
|
|
122
|
-
|
|
122
|
+
accountNo: string;
|
|
123
123
|
createdAt: string;
|
|
124
|
+
profileId: string;
|
|
124
125
|
updatedAt: string;
|
|
125
|
-
accountNo: string;
|
|
126
126
|
channel: string;
|
|
127
127
|
countryCode: import("@temboplus/frontend-core").ISO2CountryCode;
|
|
128
128
|
currencyCode: import("@temboplus/frontend-core").CurrencyCode;
|
|
129
129
|
accountName: string;
|
|
130
130
|
}, {
|
|
131
131
|
id: string;
|
|
132
|
-
|
|
132
|
+
accountNo: string;
|
|
133
133
|
createdAt: string;
|
|
134
|
+
profileId: string;
|
|
134
135
|
updatedAt: string;
|
|
135
|
-
accountNo: string;
|
|
136
136
|
channel: string;
|
|
137
137
|
accountName: string;
|
|
138
138
|
countryCode?: string | undefined;
|
|
@@ -148,16 +148,16 @@ export declare const WalletDTOSchemas: {
|
|
|
148
148
|
currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
|
|
149
149
|
}, "strip", z.ZodTypeAny, {
|
|
150
150
|
id?: string | undefined;
|
|
151
|
-
profileId?: string | undefined;
|
|
152
151
|
accountNo?: string | undefined;
|
|
152
|
+
profileId?: string | undefined;
|
|
153
153
|
channel?: string | undefined;
|
|
154
154
|
countryCode?: string | undefined;
|
|
155
155
|
currencyCode?: string | undefined;
|
|
156
156
|
accountName?: string | undefined;
|
|
157
157
|
}, {
|
|
158
158
|
id?: string | undefined;
|
|
159
|
-
profileId?: string | undefined;
|
|
160
159
|
accountNo?: string | undefined;
|
|
160
|
+
profileId?: string | undefined;
|
|
161
161
|
channel?: string | undefined;
|
|
162
162
|
countryCode?: string | undefined;
|
|
163
163
|
currencyCode?: string | undefined;
|