@temboplus/tembo-dashboard 0.0.26-beta.0 → 0.0.26-beta.2

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,535 @@
1
+ import { z } from "zod";
2
+ export declare const walletContract: {
3
+ listWallets: {
4
+ summary: "List wallets";
5
+ description: "Retrieve all wallets linked to the account across supported currencies.";
6
+ method: "GET";
7
+ path: "";
8
+ responses: {
9
+ 200: z.ZodArray<z.ZodObject<{
10
+ accountNo: z.ZodString;
11
+ accountName: z.ZodString;
12
+ type: z.ZodString;
13
+ balance: z.ZodNumber;
14
+ currency: z.ZodString;
15
+ countryCode: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type: string;
18
+ balance: number;
19
+ accountName: string;
20
+ accountNo: string;
21
+ countryCode: string;
22
+ currency: string;
23
+ }, {
24
+ type: string;
25
+ balance: number;
26
+ accountName: string;
27
+ accountNo: string;
28
+ countryCode: string;
29
+ currency: string;
30
+ }>, "many">;
31
+ 401: z.ZodObject<{
32
+ reason: z.ZodOptional<z.ZodString>;
33
+ error: z.ZodOptional<z.ZodString>;
34
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
35
+ message: z.ZodOptional<z.ZodString>;
36
+ } & {
37
+ statusCode: z.ZodLiteral<401>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ statusCode: 401;
40
+ message?: string | undefined;
41
+ error?: string | undefined;
42
+ details?: Record<string, unknown> | undefined;
43
+ reason?: string | undefined;
44
+ }, {
45
+ statusCode: 401;
46
+ message?: string | undefined;
47
+ error?: string | undefined;
48
+ details?: Record<string, unknown> | undefined;
49
+ reason?: string | undefined;
50
+ }>;
51
+ 500: z.ZodObject<{
52
+ reason: z.ZodOptional<z.ZodString>;
53
+ error: z.ZodOptional<z.ZodString>;
54
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
55
+ message: z.ZodOptional<z.ZodString>;
56
+ } & {
57
+ statusCode: z.ZodLiteral<500>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ statusCode: 500;
60
+ message?: string | undefined;
61
+ error?: string | undefined;
62
+ details?: Record<string, unknown> | undefined;
63
+ reason?: string | undefined;
64
+ }, {
65
+ statusCode: 500;
66
+ message?: string | undefined;
67
+ error?: string | undefined;
68
+ details?: Record<string, unknown> | undefined;
69
+ reason?: string | undefined;
70
+ }>;
71
+ };
72
+ };
73
+ getWalletInfo: {
74
+ pathParams: z.ZodObject<{
75
+ accountNo: z.ZodString;
76
+ }, "strip", z.ZodTypeAny, {
77
+ accountNo: string;
78
+ }, {
79
+ accountNo: string;
80
+ }>;
81
+ summary: "Get wallet info";
82
+ description: "Retrieve wallet metadata including balance, currency, and type for a specific wallet.";
83
+ method: "GET";
84
+ path: "/:accountNo";
85
+ responses: {
86
+ 200: z.ZodObject<{
87
+ accountNo: z.ZodString;
88
+ accountName: z.ZodString;
89
+ type: z.ZodString;
90
+ balance: z.ZodNumber;
91
+ currency: z.ZodString;
92
+ countryCode: z.ZodString;
93
+ }, "strip", z.ZodTypeAny, {
94
+ type: string;
95
+ balance: number;
96
+ accountName: string;
97
+ accountNo: string;
98
+ countryCode: string;
99
+ currency: string;
100
+ }, {
101
+ type: string;
102
+ balance: number;
103
+ accountName: string;
104
+ accountNo: string;
105
+ countryCode: string;
106
+ currency: string;
107
+ }>;
108
+ 401: z.ZodObject<{
109
+ reason: z.ZodOptional<z.ZodString>;
110
+ error: z.ZodOptional<z.ZodString>;
111
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
112
+ message: z.ZodOptional<z.ZodString>;
113
+ } & {
114
+ statusCode: z.ZodLiteral<401>;
115
+ }, "strip", z.ZodTypeAny, {
116
+ statusCode: 401;
117
+ message?: string | undefined;
118
+ error?: string | undefined;
119
+ details?: Record<string, unknown> | undefined;
120
+ reason?: string | undefined;
121
+ }, {
122
+ statusCode: 401;
123
+ message?: string | undefined;
124
+ error?: string | undefined;
125
+ details?: Record<string, unknown> | undefined;
126
+ reason?: string | undefined;
127
+ }>;
128
+ 500: z.ZodObject<{
129
+ reason: z.ZodOptional<z.ZodString>;
130
+ error: z.ZodOptional<z.ZodString>;
131
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
132
+ message: z.ZodOptional<z.ZodString>;
133
+ } & {
134
+ statusCode: z.ZodLiteral<500>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ statusCode: 500;
137
+ message?: string | undefined;
138
+ error?: string | undefined;
139
+ details?: Record<string, unknown> | undefined;
140
+ reason?: string | undefined;
141
+ }, {
142
+ statusCode: 500;
143
+ message?: string | undefined;
144
+ error?: string | undefined;
145
+ details?: Record<string, unknown> | undefined;
146
+ reason?: string | undefined;
147
+ }>;
148
+ };
149
+ };
150
+ getWalletBalance: {
151
+ summary: "Get wallet balance";
152
+ description: "Retrieve the current and available balance for a specific wallet account number.";
153
+ method: "POST";
154
+ body: z.ZodObject<{
155
+ accountNo: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ accountNo: string;
158
+ }, {
159
+ accountNo: string;
160
+ }>;
161
+ path: "/balance";
162
+ responses: {
163
+ 200: z.ZodObject<{
164
+ availableBalance: z.ZodNumber;
165
+ currentBalance: z.ZodNumber;
166
+ accountStatus: z.ZodString;
167
+ accountNo: z.ZodString;
168
+ accountName: z.ZodString;
169
+ type: z.ZodString;
170
+ currencyCode: z.ZodString;
171
+ countryCode: z.ZodString;
172
+ }, "strip", z.ZodTypeAny, {
173
+ type: string;
174
+ availableBalance: number;
175
+ accountName: string;
176
+ accountNo: string;
177
+ currencyCode: string;
178
+ countryCode: string;
179
+ currentBalance: number;
180
+ accountStatus: string;
181
+ }, {
182
+ type: string;
183
+ availableBalance: number;
184
+ accountName: string;
185
+ accountNo: string;
186
+ currencyCode: string;
187
+ countryCode: string;
188
+ currentBalance: number;
189
+ accountStatus: string;
190
+ }>;
191
+ 400: z.ZodObject<{
192
+ reason: z.ZodOptional<z.ZodString>;
193
+ error: z.ZodOptional<z.ZodString>;
194
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
195
+ message: z.ZodOptional<z.ZodString>;
196
+ } & {
197
+ statusCode: z.ZodLiteral<400>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ statusCode: 400;
200
+ message?: string | undefined;
201
+ error?: string | undefined;
202
+ details?: Record<string, unknown> | undefined;
203
+ reason?: string | undefined;
204
+ }, {
205
+ statusCode: 400;
206
+ message?: string | undefined;
207
+ error?: string | undefined;
208
+ details?: Record<string, unknown> | undefined;
209
+ reason?: string | undefined;
210
+ }>;
211
+ 401: z.ZodObject<{
212
+ reason: z.ZodOptional<z.ZodString>;
213
+ error: z.ZodOptional<z.ZodString>;
214
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
215
+ message: z.ZodOptional<z.ZodString>;
216
+ } & {
217
+ statusCode: z.ZodLiteral<401>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ statusCode: 401;
220
+ message?: string | undefined;
221
+ error?: string | undefined;
222
+ details?: Record<string, unknown> | undefined;
223
+ reason?: string | undefined;
224
+ }, {
225
+ statusCode: 401;
226
+ message?: string | undefined;
227
+ error?: string | undefined;
228
+ details?: Record<string, unknown> | undefined;
229
+ reason?: string | undefined;
230
+ }>;
231
+ 404: z.ZodObject<{
232
+ reason: z.ZodOptional<z.ZodString>;
233
+ error: z.ZodOptional<z.ZodString>;
234
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
235
+ message: z.ZodOptional<z.ZodString>;
236
+ } & {
237
+ statusCode: z.ZodLiteral<404>;
238
+ }, "strip", z.ZodTypeAny, {
239
+ statusCode: 404;
240
+ message?: string | undefined;
241
+ error?: string | undefined;
242
+ details?: Record<string, unknown> | undefined;
243
+ reason?: string | undefined;
244
+ }, {
245
+ statusCode: 404;
246
+ message?: string | undefined;
247
+ error?: string | undefined;
248
+ details?: Record<string, unknown> | undefined;
249
+ reason?: string | undefined;
250
+ }>;
251
+ 500: z.ZodObject<{
252
+ reason: z.ZodOptional<z.ZodString>;
253
+ error: z.ZodOptional<z.ZodString>;
254
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
255
+ message: z.ZodOptional<z.ZodString>;
256
+ } & {
257
+ statusCode: z.ZodLiteral<500>;
258
+ }, "strip", z.ZodTypeAny, {
259
+ statusCode: 500;
260
+ message?: string | undefined;
261
+ error?: string | undefined;
262
+ details?: Record<string, unknown> | undefined;
263
+ reason?: string | undefined;
264
+ }, {
265
+ statusCode: 500;
266
+ message?: string | undefined;
267
+ error?: string | undefined;
268
+ details?: Record<string, unknown> | undefined;
269
+ reason?: string | undefined;
270
+ }>;
271
+ };
272
+ };
273
+ getWalletStatement: {
274
+ summary: "Get wallet statement";
275
+ description: "Retrieve statement entries for a specific wallet within a date range.";
276
+ method: "POST";
277
+ body: z.ZodObject<{
278
+ accountNo: z.ZodString;
279
+ startDate: z.ZodString;
280
+ endDate: z.ZodString;
281
+ }, "strip", z.ZodTypeAny, {
282
+ startDate: string;
283
+ endDate: string;
284
+ accountNo: string;
285
+ }, {
286
+ startDate: string;
287
+ endDate: string;
288
+ accountNo: string;
289
+ }>;
290
+ path: "/statement";
291
+ responses: {
292
+ 200: z.ZodArray<z.ZodObject<{
293
+ accountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
294
+ debitOrCredit: z.ZodEnum<["CR", "DR"]>;
295
+ tranRefNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
296
+ narration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ txnDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
298
+ valueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
299
+ amountCredited: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>>>;
300
+ amountDebited: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>>>;
301
+ balance: z.ZodNumber;
302
+ }, "strip", z.ZodTypeAny, {
303
+ balance: number;
304
+ debitOrCredit: "CR" | "DR";
305
+ txnDate: string | null;
306
+ valueDate: string | null;
307
+ accountNo?: string | null | undefined;
308
+ tranRefNo?: string | null | undefined;
309
+ narration?: string | null | undefined;
310
+ amountCredited?: number | null | undefined;
311
+ amountDebited?: number | null | undefined;
312
+ }, {
313
+ balance: number;
314
+ debitOrCredit: "CR" | "DR";
315
+ accountNo?: string | null | undefined;
316
+ tranRefNo?: string | null | undefined;
317
+ narration?: string | null | undefined;
318
+ txnDate?: string | null | undefined;
319
+ valueDate?: string | null | undefined;
320
+ amountCredited?: string | number | null | undefined;
321
+ amountDebited?: string | number | null | undefined;
322
+ }>, "many">;
323
+ 400: z.ZodObject<{
324
+ reason: z.ZodOptional<z.ZodString>;
325
+ error: z.ZodOptional<z.ZodString>;
326
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
327
+ message: z.ZodOptional<z.ZodString>;
328
+ } & {
329
+ statusCode: z.ZodLiteral<400>;
330
+ }, "strip", z.ZodTypeAny, {
331
+ statusCode: 400;
332
+ message?: string | undefined;
333
+ error?: string | undefined;
334
+ details?: Record<string, unknown> | undefined;
335
+ reason?: string | undefined;
336
+ }, {
337
+ statusCode: 400;
338
+ message?: string | undefined;
339
+ error?: string | undefined;
340
+ details?: Record<string, unknown> | undefined;
341
+ reason?: string | undefined;
342
+ }>;
343
+ 401: z.ZodObject<{
344
+ reason: z.ZodOptional<z.ZodString>;
345
+ error: z.ZodOptional<z.ZodString>;
346
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
347
+ message: z.ZodOptional<z.ZodString>;
348
+ } & {
349
+ statusCode: z.ZodLiteral<401>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ statusCode: 401;
352
+ message?: string | undefined;
353
+ error?: string | undefined;
354
+ details?: Record<string, unknown> | undefined;
355
+ reason?: string | undefined;
356
+ }, {
357
+ statusCode: 401;
358
+ message?: string | undefined;
359
+ error?: string | undefined;
360
+ details?: Record<string, unknown> | undefined;
361
+ reason?: string | undefined;
362
+ }>;
363
+ 404: z.ZodObject<{
364
+ reason: z.ZodOptional<z.ZodString>;
365
+ error: z.ZodOptional<z.ZodString>;
366
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
367
+ message: z.ZodOptional<z.ZodString>;
368
+ } & {
369
+ statusCode: z.ZodLiteral<404>;
370
+ }, "strip", z.ZodTypeAny, {
371
+ statusCode: 404;
372
+ message?: string | undefined;
373
+ error?: string | undefined;
374
+ details?: Record<string, unknown> | undefined;
375
+ reason?: string | undefined;
376
+ }, {
377
+ statusCode: 404;
378
+ message?: string | undefined;
379
+ error?: string | undefined;
380
+ details?: Record<string, unknown> | undefined;
381
+ reason?: string | undefined;
382
+ }>;
383
+ 500: z.ZodObject<{
384
+ reason: z.ZodOptional<z.ZodString>;
385
+ error: z.ZodOptional<z.ZodString>;
386
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
387
+ message: z.ZodOptional<z.ZodString>;
388
+ } & {
389
+ statusCode: z.ZodLiteral<500>;
390
+ }, "strip", z.ZodTypeAny, {
391
+ statusCode: 500;
392
+ message?: string | undefined;
393
+ error?: string | undefined;
394
+ details?: Record<string, unknown> | undefined;
395
+ reason?: string | undefined;
396
+ }, {
397
+ statusCode: 500;
398
+ message?: string | undefined;
399
+ error?: string | undefined;
400
+ details?: Record<string, unknown> | undefined;
401
+ reason?: string | undefined;
402
+ }>;
403
+ };
404
+ };
405
+ transferLocal: {
406
+ summary: "Transfer between disbursement wallets";
407
+ description: "Transfer funds between disbursement wallets. Both wallets must be in the same currency.";
408
+ method: "POST";
409
+ body: z.ZodObject<{
410
+ amount: z.ZodNumber;
411
+ from: z.ZodString;
412
+ to: z.ZodString;
413
+ description: z.ZodString;
414
+ }, "strip", z.ZodTypeAny, {
415
+ description: string;
416
+ amount: number;
417
+ from: string;
418
+ to: string;
419
+ }, {
420
+ description: string;
421
+ amount: number;
422
+ from: string;
423
+ to: string;
424
+ }>;
425
+ path: "/transfer-local";
426
+ responses: {
427
+ 200: z.ZodObject<{
428
+ transactionId: z.ZodString;
429
+ from: z.ZodString;
430
+ to: z.ZodString;
431
+ transactionDate: z.ZodString;
432
+ narration: z.ZodString;
433
+ amount: z.ZodNumber;
434
+ transactionRef: z.ZodString;
435
+ }, "strip", z.ZodTypeAny, {
436
+ narration: string;
437
+ transactionDate: string;
438
+ amount: number;
439
+ transactionId: string;
440
+ transactionRef: string;
441
+ from: string;
442
+ to: string;
443
+ }, {
444
+ narration: string;
445
+ transactionDate: string;
446
+ amount: number;
447
+ transactionId: string;
448
+ transactionRef: string;
449
+ from: string;
450
+ to: string;
451
+ }>;
452
+ 400: z.ZodObject<{
453
+ reason: z.ZodOptional<z.ZodString>;
454
+ error: z.ZodOptional<z.ZodString>;
455
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
456
+ message: z.ZodOptional<z.ZodString>;
457
+ } & {
458
+ statusCode: z.ZodLiteral<400>;
459
+ }, "strip", z.ZodTypeAny, {
460
+ statusCode: 400;
461
+ message?: string | undefined;
462
+ error?: string | undefined;
463
+ details?: Record<string, unknown> | undefined;
464
+ reason?: string | undefined;
465
+ }, {
466
+ statusCode: 400;
467
+ message?: string | undefined;
468
+ error?: string | undefined;
469
+ details?: Record<string, unknown> | undefined;
470
+ reason?: string | undefined;
471
+ }>;
472
+ 401: z.ZodObject<{
473
+ reason: z.ZodOptional<z.ZodString>;
474
+ error: z.ZodOptional<z.ZodString>;
475
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
476
+ message: z.ZodOptional<z.ZodString>;
477
+ } & {
478
+ statusCode: z.ZodLiteral<401>;
479
+ }, "strip", z.ZodTypeAny, {
480
+ statusCode: 401;
481
+ message?: string | undefined;
482
+ error?: string | undefined;
483
+ details?: Record<string, unknown> | undefined;
484
+ reason?: string | undefined;
485
+ }, {
486
+ statusCode: 401;
487
+ message?: string | undefined;
488
+ error?: string | undefined;
489
+ details?: Record<string, unknown> | undefined;
490
+ reason?: string | undefined;
491
+ }>;
492
+ 404: z.ZodObject<{
493
+ reason: z.ZodOptional<z.ZodString>;
494
+ error: z.ZodOptional<z.ZodString>;
495
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
496
+ message: z.ZodOptional<z.ZodString>;
497
+ } & {
498
+ statusCode: z.ZodLiteral<404>;
499
+ }, "strip", z.ZodTypeAny, {
500
+ statusCode: 404;
501
+ message?: string | undefined;
502
+ error?: string | undefined;
503
+ details?: Record<string, unknown> | undefined;
504
+ reason?: string | undefined;
505
+ }, {
506
+ statusCode: 404;
507
+ message?: string | undefined;
508
+ error?: string | undefined;
509
+ details?: Record<string, unknown> | undefined;
510
+ reason?: string | undefined;
511
+ }>;
512
+ 500: z.ZodObject<{
513
+ reason: z.ZodOptional<z.ZodString>;
514
+ error: z.ZodOptional<z.ZodString>;
515
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
516
+ message: z.ZodOptional<z.ZodString>;
517
+ } & {
518
+ statusCode: z.ZodLiteral<500>;
519
+ }, "strip", z.ZodTypeAny, {
520
+ statusCode: 500;
521
+ message?: string | undefined;
522
+ error?: string | undefined;
523
+ details?: Record<string, unknown> | undefined;
524
+ reason?: string | undefined;
525
+ }, {
526
+ statusCode: 500;
527
+ message?: string | undefined;
528
+ error?: string | undefined;
529
+ details?: Record<string, unknown> | undefined;
530
+ reason?: string | undefined;
531
+ }>;
532
+ };
533
+ };
534
+ };
535
+ export type WalletContract = typeof walletContract;
@@ -0,0 +1,35 @@
1
+ import { Amount, AmountJson, CurrencyCode } from "@temboplus/frontend-core";
2
+ export interface WalletData {
3
+ accountNo: string;
4
+ accountName: string;
5
+ type: string;
6
+ balance: number;
7
+ currency: string;
8
+ countryCode: string;
9
+ }
10
+ export interface WalletJson {
11
+ accountNo: string;
12
+ accountName: string;
13
+ type: string;
14
+ balance: AmountJson;
15
+ currency: CurrencyCode;
16
+ countryCode: string;
17
+ }
18
+ export declare class Wallet {
19
+ readonly accountNo: string;
20
+ readonly accountName: string;
21
+ readonly type: string;
22
+ readonly balance: Amount;
23
+ readonly currency: CurrencyCode;
24
+ readonly countryCode: string;
25
+ private readonly _originalData;
26
+ constructor(data: WalletData);
27
+ getOriginalData(): Readonly<WalletData>;
28
+ isCollectionWallet(): boolean;
29
+ isDisbursementWallet(): boolean;
30
+ isDefaultWallet(): boolean;
31
+ static from(data: WalletData): Wallet;
32
+ static createMany(dataArray: WalletData[]): Wallet[];
33
+ toJSON(): WalletJson;
34
+ static fromJSON(json: WalletJson): Wallet | undefined;
35
+ }
@@ -0,0 +1,22 @@
1
+ import { BaseRepository } from "@/lib/api";
2
+ import { StatementEntry, WalletInfo } from "@/lib/models";
3
+ import { Wallet } from "./wallet.model";
4
+ import { walletContract } from "./wallet.api-contract";
5
+ import { TransferRequestDTO, TransferResponseDTO } from "./wallet.types";
6
+ export interface WalletStatementInput {
7
+ accountNo: string;
8
+ startDate: Date | string;
9
+ endDate: Date | string;
10
+ }
11
+ export declare class WalletRepository extends BaseRepository<typeof walletContract> {
12
+ constructor(options?: {
13
+ token?: string;
14
+ root?: string;
15
+ });
16
+ listWallets(): Promise<Wallet[]>;
17
+ getWalletInfo(accountNo: string): Promise<Wallet>;
18
+ getWalletBalance(accountNo: string): Promise<WalletInfo>;
19
+ getWalletStatement(input: WalletStatementInput): Promise<StatementEntry[]>;
20
+ transferLocal(input: TransferRequestDTO): Promise<TransferResponseDTO>;
21
+ private formatStatementDate;
22
+ }