@temboplus/tembo-dashboard 0.0.1
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/README.md +130 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/lib/api/base-repository.d.ts +168 -0
- package/dist/lib/api/common-schemas.d.ts +115 -0
- package/dist/lib/api/index.d.ts +2 -0
- package/dist/lib/error/error.api.d.ts +62 -0
- package/dist/lib/error/index.d.ts +1 -0
- package/dist/lib/models/index.d.ts +2 -0
- package/dist/lib/models/transaction-summary.model.d.ts +22 -0
- package/dist/lib/models/wallet-info.model.d.ts +17 -0
- package/dist/lib/query/index.d.ts +2 -0
- package/dist/lib/query/query.builder.d.ts +65 -0
- package/dist/lib/query/query.types.d.ts +36 -0
- package/dist/modules/auth/auth.api-contract.d.ts +52 -0
- package/dist/modules/auth/auth.dtos.d.ts +31 -0
- package/dist/modules/auth/auth.repository.d.ts +17 -0
- package/dist/modules/auth/index.d.ts +4 -0
- package/dist/modules/auth/user.model.d.ts +48 -0
- package/dist/modules/collection/collection.api-contract.d.ts +385 -0
- package/dist/modules/collection/collection.dtos.d.ts +195 -0
- package/dist/modules/collection/collection.model.d.ts +145 -0
- package/dist/modules/collection/collection.query-builder.d.ts +18 -0
- package/dist/modules/collection/collection.repository.d.ts +38 -0
- package/dist/modules/collection/index.d.ts +5 -0
- package/dist/modules/payout/index.d.ts +5 -0
- package/dist/modules/payout/payout.api-contract.d.ts +427 -0
- package/dist/modules/payout/payout.dtos.d.ts +188 -0
- package/dist/modules/payout/payout.model.d.ts +156 -0
- package/dist/modules/payout/payout.query-builder.d.ts +15 -0
- package/dist/modules/payout/payout.repository.d.ts +34 -0
- package/package.json +60 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare enum COLLECTION_STATUS {
|
|
3
|
+
PAYMENT_ACCEPTED = "PAYMENT_ACCEPTED",
|
|
4
|
+
GENERIC_FAILURE = "GENERIC_FAILURE",
|
|
5
|
+
PAYMENT_REJECTED = "PAYMENT_REJECTED",
|
|
6
|
+
PENDING_ACK = "PENDING_ACK"
|
|
7
|
+
}
|
|
8
|
+
export declare enum COLLECTION_CHANNEL {
|
|
9
|
+
AIRTEL = "TZ-AIRTEL-C2B",
|
|
10
|
+
TIGO = "TZ-TIGO-C2B",
|
|
11
|
+
HALOTEL = "TZ-HALOTEL-C2B"
|
|
12
|
+
}
|
|
13
|
+
export declare const accountSummarySchema: z.ZodObject<{
|
|
14
|
+
balance: z.ZodNumber;
|
|
15
|
+
availableBalance: z.ZodNumber;
|
|
16
|
+
accountNumber: z.ZodString;
|
|
17
|
+
accountName: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
balance: number;
|
|
20
|
+
availableBalance: number;
|
|
21
|
+
accountNumber: string;
|
|
22
|
+
accountName: string;
|
|
23
|
+
}, {
|
|
24
|
+
balance: number;
|
|
25
|
+
availableBalance: number;
|
|
26
|
+
accountNumber: string;
|
|
27
|
+
accountName: string;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const CollectionDTOSchemas: {
|
|
30
|
+
collection: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
status: z.ZodNativeEnum<typeof COLLECTION_STATUS>;
|
|
33
|
+
statusMessage: z.ZodString;
|
|
34
|
+
accountNo: z.ZodString;
|
|
35
|
+
walletId: z.ZodString;
|
|
36
|
+
transactionDate: z.ZodString;
|
|
37
|
+
narration: z.ZodString;
|
|
38
|
+
msisdn: z.ZodString;
|
|
39
|
+
channel: z.ZodNativeEnum<typeof COLLECTION_CHANNEL>;
|
|
40
|
+
amount: z.ZodNumber;
|
|
41
|
+
serviceFee: z.ZodOptional<z.ZodString>;
|
|
42
|
+
postedAmount: z.ZodOptional<z.ZodString>;
|
|
43
|
+
reference: z.ZodString;
|
|
44
|
+
partnerReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
transactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
serviceFeeTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
createdAt: z.ZodString;
|
|
50
|
+
updatedAt: z.ZodString;
|
|
51
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
52
|
+
currencyCode: z.ZodDefault<z.ZodString>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
status: COLLECTION_STATUS;
|
|
55
|
+
id: string;
|
|
56
|
+
statusMessage: string;
|
|
57
|
+
accountNo: string;
|
|
58
|
+
walletId: string;
|
|
59
|
+
transactionDate: string;
|
|
60
|
+
narration: string;
|
|
61
|
+
msisdn: string;
|
|
62
|
+
channel: COLLECTION_CHANNEL;
|
|
63
|
+
amount: number;
|
|
64
|
+
reference: string;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
currencyCode: string;
|
|
68
|
+
serviceFee?: string | undefined;
|
|
69
|
+
postedAmount?: string | undefined;
|
|
70
|
+
partnerReference?: string | null | undefined;
|
|
71
|
+
transactionId?: string | null | undefined;
|
|
72
|
+
serviceFeeTransactionId?: string | null | undefined;
|
|
73
|
+
requestId?: string | null | undefined;
|
|
74
|
+
completedAt?: string | null | undefined;
|
|
75
|
+
notes?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
status: COLLECTION_STATUS;
|
|
78
|
+
id: string;
|
|
79
|
+
statusMessage: string;
|
|
80
|
+
accountNo: string;
|
|
81
|
+
walletId: string;
|
|
82
|
+
transactionDate: string;
|
|
83
|
+
narration: string;
|
|
84
|
+
msisdn: string;
|
|
85
|
+
channel: COLLECTION_CHANNEL;
|
|
86
|
+
amount: number;
|
|
87
|
+
reference: string;
|
|
88
|
+
createdAt: string;
|
|
89
|
+
updatedAt: string;
|
|
90
|
+
serviceFee?: string | undefined;
|
|
91
|
+
postedAmount?: string | undefined;
|
|
92
|
+
partnerReference?: string | null | undefined;
|
|
93
|
+
transactionId?: string | null | undefined;
|
|
94
|
+
serviceFeeTransactionId?: string | null | undefined;
|
|
95
|
+
requestId?: string | null | undefined;
|
|
96
|
+
completedAt?: string | null | undefined;
|
|
97
|
+
notes?: string | undefined;
|
|
98
|
+
currencyCode?: string | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
collectionQueryParams: z.ZodObject<{
|
|
101
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
102
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
103
|
+
sortBy: z.ZodDefault<z.ZodEnum<["transactionDate", "amount", "status", "createdAt"]>>;
|
|
104
|
+
sortOrder: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
105
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
106
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
107
|
+
msisdn: z.ZodOptional<z.ZodString>;
|
|
108
|
+
id: z.ZodOptional<z.ZodString>;
|
|
109
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
110
|
+
accountNo: z.ZodOptional<z.ZodString>;
|
|
111
|
+
partnerReference: z.ZodOptional<z.ZodString>;
|
|
112
|
+
channel: z.ZodOptional<z.ZodNativeEnum<typeof COLLECTION_CHANNEL>>;
|
|
113
|
+
status: z.ZodOptional<z.ZodNativeEnum<typeof COLLECTION_STATUS>>;
|
|
114
|
+
minAmount: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
maxAmount: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
search: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
page: number;
|
|
119
|
+
limit: number;
|
|
120
|
+
sortBy: "status" | "transactionDate" | "amount" | "createdAt";
|
|
121
|
+
sortOrder: "asc" | "desc";
|
|
122
|
+
status?: COLLECTION_STATUS | undefined;
|
|
123
|
+
search?: string | undefined;
|
|
124
|
+
id?: string | undefined;
|
|
125
|
+
accountNo?: string | undefined;
|
|
126
|
+
msisdn?: string | undefined;
|
|
127
|
+
channel?: COLLECTION_CHANNEL | undefined;
|
|
128
|
+
reference?: string | undefined;
|
|
129
|
+
partnerReference?: string | undefined;
|
|
130
|
+
startDate?: string | undefined;
|
|
131
|
+
endDate?: string | undefined;
|
|
132
|
+
minAmount?: number | undefined;
|
|
133
|
+
maxAmount?: number | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
status?: COLLECTION_STATUS | undefined;
|
|
136
|
+
page?: number | undefined;
|
|
137
|
+
limit?: number | undefined;
|
|
138
|
+
search?: string | undefined;
|
|
139
|
+
id?: string | undefined;
|
|
140
|
+
accountNo?: string | undefined;
|
|
141
|
+
msisdn?: string | undefined;
|
|
142
|
+
channel?: COLLECTION_CHANNEL | undefined;
|
|
143
|
+
reference?: string | undefined;
|
|
144
|
+
partnerReference?: string | undefined;
|
|
145
|
+
sortBy?: "status" | "transactionDate" | "amount" | "createdAt" | undefined;
|
|
146
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
147
|
+
startDate?: string | undefined;
|
|
148
|
+
endDate?: string | undefined;
|
|
149
|
+
minAmount?: number | undefined;
|
|
150
|
+
maxAmount?: number | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
pagination: z.ZodObject<{
|
|
153
|
+
page: z.ZodNumber;
|
|
154
|
+
limit: z.ZodNumber;
|
|
155
|
+
total: z.ZodNumber;
|
|
156
|
+
totalPages: z.ZodNumber;
|
|
157
|
+
hasNext: z.ZodBoolean;
|
|
158
|
+
hasPrev: z.ZodBoolean;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
page: number;
|
|
161
|
+
limit: number;
|
|
162
|
+
total: number;
|
|
163
|
+
totalPages: number;
|
|
164
|
+
hasNext: boolean;
|
|
165
|
+
hasPrev: boolean;
|
|
166
|
+
}, {
|
|
167
|
+
page: number;
|
|
168
|
+
limit: number;
|
|
169
|
+
total: number;
|
|
170
|
+
totalPages: number;
|
|
171
|
+
hasNext: boolean;
|
|
172
|
+
hasPrev: boolean;
|
|
173
|
+
}>;
|
|
174
|
+
paymentStatus: z.ZodNativeEnum<typeof COLLECTION_STATUS>;
|
|
175
|
+
paymentChannel: z.ZodNativeEnum<typeof COLLECTION_CHANNEL>;
|
|
176
|
+
accountSummary: z.ZodObject<{
|
|
177
|
+
balance: z.ZodNumber;
|
|
178
|
+
availableBalance: z.ZodNumber;
|
|
179
|
+
accountNumber: z.ZodString;
|
|
180
|
+
accountName: z.ZodString;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
balance: number;
|
|
183
|
+
availableBalance: number;
|
|
184
|
+
accountNumber: string;
|
|
185
|
+
accountName: string;
|
|
186
|
+
}, {
|
|
187
|
+
balance: number;
|
|
188
|
+
availableBalance: number;
|
|
189
|
+
accountNumber: string;
|
|
190
|
+
accountName: string;
|
|
191
|
+
}>;
|
|
192
|
+
};
|
|
193
|
+
export type CollectionDTO = z.infer<typeof CollectionDTOSchemas.collection>;
|
|
194
|
+
export type CollectionQueryParamsDTO = z.infer<typeof CollectionDTOSchemas.collectionQueryParams>;
|
|
195
|
+
export type AccountSummaryDTO = z.infer<typeof CollectionDTOSchemas.accountSummary>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Amount, AmountJson } from "@temboplus/frontend-core";
|
|
2
|
+
import { COLLECTION_CHANNEL, COLLECTION_STATUS } from "./collection.dtos";
|
|
3
|
+
export interface CollectionStatusInfo {
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
category: "success" | "pending" | "failed";
|
|
7
|
+
color: "success" | "warning" | "error";
|
|
8
|
+
userFriendlyMessage: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const COLLECTION_STATUS_INFO: Record<COLLECTION_STATUS, CollectionStatusInfo>;
|
|
11
|
+
export interface ChannelInfo {
|
|
12
|
+
networkOperator: string;
|
|
13
|
+
serviceName: string;
|
|
14
|
+
type: "mobile" | "bank";
|
|
15
|
+
}
|
|
16
|
+
export declare const CHANNEL_INFO: Record<COLLECTION_CHANNEL, ChannelInfo>;
|
|
17
|
+
export interface CollectionData {
|
|
18
|
+
id: string;
|
|
19
|
+
status: COLLECTION_STATUS;
|
|
20
|
+
statusMessage: string;
|
|
21
|
+
accountNo: string;
|
|
22
|
+
walletId: string;
|
|
23
|
+
transactionDate: string;
|
|
24
|
+
narration: string;
|
|
25
|
+
msisdn: string;
|
|
26
|
+
channel: COLLECTION_CHANNEL;
|
|
27
|
+
amount: number;
|
|
28
|
+
serviceFee?: string;
|
|
29
|
+
postedAmount?: string;
|
|
30
|
+
reference: string;
|
|
31
|
+
partnerReference?: string | null;
|
|
32
|
+
transactionId?: string | null;
|
|
33
|
+
serviceFeeTransactionId?: string | null;
|
|
34
|
+
requestId?: string | null;
|
|
35
|
+
completedAt?: string | null;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
notes?: string;
|
|
39
|
+
currencyCode: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CollectionJson {
|
|
42
|
+
id: string;
|
|
43
|
+
status: COLLECTION_STATUS;
|
|
44
|
+
statusMessage: string;
|
|
45
|
+
accountNo: string;
|
|
46
|
+
walletId: string;
|
|
47
|
+
transactionDate: string;
|
|
48
|
+
narration: string;
|
|
49
|
+
msisdn: string;
|
|
50
|
+
channel: COLLECTION_CHANNEL;
|
|
51
|
+
amount: AmountJson;
|
|
52
|
+
serviceFee?: AmountJson;
|
|
53
|
+
postedAmount?: AmountJson;
|
|
54
|
+
reference: string;
|
|
55
|
+
partnerReference?: string | null;
|
|
56
|
+
transactionId?: string | null;
|
|
57
|
+
serviceFeeTransactionId?: string | null;
|
|
58
|
+
requestId?: string | null;
|
|
59
|
+
completedAt?: string | null;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
notes?: string;
|
|
63
|
+
currencyCode: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents a collection transaction
|
|
67
|
+
*/
|
|
68
|
+
export declare class Collection {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly status: COLLECTION_STATUS;
|
|
71
|
+
readonly statusMessage: string;
|
|
72
|
+
readonly accountNo: string;
|
|
73
|
+
readonly walletId: string;
|
|
74
|
+
readonly transactionDate: Date;
|
|
75
|
+
readonly narration: string;
|
|
76
|
+
readonly msisdn: string;
|
|
77
|
+
readonly channel: COLLECTION_CHANNEL;
|
|
78
|
+
readonly amount: Amount;
|
|
79
|
+
readonly serviceFee?: Amount;
|
|
80
|
+
readonly postedAmount?: Amount;
|
|
81
|
+
readonly reference: string;
|
|
82
|
+
readonly partnerReference?: string | null;
|
|
83
|
+
readonly transactionId?: string | null;
|
|
84
|
+
readonly serviceFeeTransactionId?: string | null;
|
|
85
|
+
readonly requestId?: string | null;
|
|
86
|
+
readonly completedAt?: Date | null;
|
|
87
|
+
readonly createdAt: Date;
|
|
88
|
+
readonly updatedAt: Date;
|
|
89
|
+
readonly notes?: string;
|
|
90
|
+
readonly currencyCode: string;
|
|
91
|
+
constructor(data: CollectionData);
|
|
92
|
+
/**
|
|
93
|
+
* Check if collection is pending
|
|
94
|
+
*/
|
|
95
|
+
isPending(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Check if collection was successful
|
|
98
|
+
*/
|
|
99
|
+
isSuccessful(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Check if collection failed
|
|
102
|
+
*/
|
|
103
|
+
isFailed(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get status color and label
|
|
106
|
+
*/
|
|
107
|
+
getStatusInfo(): CollectionStatusInfo;
|
|
108
|
+
/**
|
|
109
|
+
* Get channel information
|
|
110
|
+
*/
|
|
111
|
+
getChannelInfo(): ChannelInfo;
|
|
112
|
+
/**
|
|
113
|
+
* Get provider name from channel
|
|
114
|
+
*/
|
|
115
|
+
getProviderName(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Get service name from channel
|
|
118
|
+
*/
|
|
119
|
+
getServiceName(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Check if this is a mobile money collection
|
|
122
|
+
*/
|
|
123
|
+
isMobileCollection(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Check if this is a bank collection
|
|
126
|
+
*/
|
|
127
|
+
isBankCollection(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Create Collection instance from raw API data
|
|
130
|
+
*/
|
|
131
|
+
static from(data: any): Collection | undefined;
|
|
132
|
+
static createMany(dataArray: any[]): Collection[];
|
|
133
|
+
/**
|
|
134
|
+
* Create Collection instance from JSON representation
|
|
135
|
+
*/
|
|
136
|
+
static fromJson(json: CollectionJson): Collection | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Create multiple Collection instances from JSON array
|
|
139
|
+
*/
|
|
140
|
+
static createManyFromJson(jsonArray: CollectionJson[]): Collection[];
|
|
141
|
+
/**
|
|
142
|
+
* Convert to JSON representation with proper typing
|
|
143
|
+
*/
|
|
144
|
+
toJson(): CollectionJson;
|
|
145
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { QueryBuilder } from "@/lib/query";
|
|
2
|
+
import { COLLECTION_STATUS, COLLECTION_CHANNEL, CollectionQueryParamsDTO } from "./collection.dtos";
|
|
3
|
+
/**
|
|
4
|
+
* Specialized query builder for collection queries
|
|
5
|
+
*/
|
|
6
|
+
export declare class CollectionQueryBuilder extends QueryBuilder {
|
|
7
|
+
whereStatus(status: COLLECTION_STATUS): this;
|
|
8
|
+
whereChannel(channel: COLLECTION_CHANNEL): this;
|
|
9
|
+
wherePending(): this;
|
|
10
|
+
whereSuccessful(): this;
|
|
11
|
+
whereFailed(): this;
|
|
12
|
+
whereAmountBetween(min: number, max: number): this;
|
|
13
|
+
whereSender(msisdn: string): this;
|
|
14
|
+
whereAccount(accountNo: string): this;
|
|
15
|
+
whereReference(reference: string): this;
|
|
16
|
+
wherePartnerReference(partnerReference: string): this;
|
|
17
|
+
toCollectionQuery(): CollectionQueryParamsDTO;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseRepository, PaginationDTO } from "@/lib/api";
|
|
2
|
+
import { collectionContract } from "./collection.api-contract";
|
|
3
|
+
import { type CollectionQueryParamsDTO, AccountSummaryDTO } from "./collection.dtos";
|
|
4
|
+
import { Collection } from "./collection.model";
|
|
5
|
+
/**
|
|
6
|
+
* Repository class for managing collections through API interactions.
|
|
7
|
+
* Handles collection operations, filtering, and summary data retrieval.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CollectionRepository extends BaseRepository<typeof collectionContract> {
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
token?: string;
|
|
12
|
+
root?: string;
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Get all collections with filtering and pagination
|
|
16
|
+
*/
|
|
17
|
+
getCollections(query?: CollectionQueryParamsDTO): Promise<{
|
|
18
|
+
collections: Collection[];
|
|
19
|
+
pagination: PaginationDTO;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Get a specific collection by ID
|
|
23
|
+
*/
|
|
24
|
+
getCollection(id: string): Promise<Collection>;
|
|
25
|
+
/**
|
|
26
|
+
* Get collections summary statistics
|
|
27
|
+
*/
|
|
28
|
+
getSummary(): Promise<{
|
|
29
|
+
yesterday: number;
|
|
30
|
+
today: number;
|
|
31
|
+
thisMonth: number;
|
|
32
|
+
lastMonth: number;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Get account balance and summary information
|
|
36
|
+
*/
|
|
37
|
+
getBalance(): Promise<AccountSummaryDTO>;
|
|
38
|
+
}
|