@temboplus/tembo-dashboard 0.0.16 → 0.0.17

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,82 @@
1
+ import { Amount, AmountJson, CurrencyCode } from "@temboplus/frontend-core";
2
+ import { StatementEntryDTO } from "../api";
3
+ export interface StatementEntryJson {
4
+ accountNo?: string | null;
5
+ debitOrCredit: "CR" | "DR";
6
+ tranRefNo?: string | null;
7
+ narration?: string | null;
8
+ txnDate?: string | null;
9
+ valueDate?: string | null;
10
+ amountCredited?: AmountJson | null;
11
+ amountDebited?: AmountJson | null;
12
+ balance: AmountJson;
13
+ currency: CurrencyCode;
14
+ }
15
+ /**
16
+ * Represents a bank statement entry transaction
17
+ */
18
+ export declare class StatementEntry {
19
+ readonly accountNo?: string | null;
20
+ readonly debitOrCredit: "CR" | "DR";
21
+ readonly tranRefNo?: string | null;
22
+ readonly narration?: string | null;
23
+ readonly txnDate?: Date | null;
24
+ readonly valueDate?: Date | null;
25
+ readonly amountCredited: Amount | null;
26
+ readonly amountDebited: Amount | null;
27
+ readonly balance: Amount;
28
+ readonly currency: CurrencyCode;
29
+ constructor(data: StatementEntryDTO, currency?: CurrencyCode);
30
+ /**
31
+ * Parse amount value from number, string, or empty string
32
+ */
33
+ private parseAmountValue;
34
+ /**
35
+ * Check if this is a credit transaction
36
+ */
37
+ isCredit(): boolean;
38
+ /**
39
+ * Check if this is a debit transaction
40
+ */
41
+ isDebit(): boolean;
42
+ /**
43
+ * Get the transaction amount (credited or debited, whichever is non-null)
44
+ */
45
+ getTransactionAmount(): Amount | null;
46
+ /**
47
+ * Get the absolute transaction amount as a number
48
+ */
49
+ getTransactionValue(): number;
50
+ /**
51
+ * Create StatementEntry from raw data
52
+ */
53
+ static from(data: any, currency?: CurrencyCode): StatementEntry | undefined;
54
+ /**
55
+ * Create multiple StatementEntry instances from raw data array
56
+ */
57
+ static createMany(dataArray: any[], currency?: CurrencyCode): StatementEntry[];
58
+ /**
59
+ * Convert to JSON representation with serialized Amount objects
60
+ */
61
+ toJson(): StatementEntryJson;
62
+ /**
63
+ * Create StatementEntry instance from JSON representation
64
+ */
65
+ static fromJson(json: StatementEntryJson): StatementEntry | undefined;
66
+ /**
67
+ * Create multiple StatementEntry instances from JSON array
68
+ */
69
+ static createManyFromJson(jsonArray: StatementEntryJson[]): StatementEntry[];
70
+ /**
71
+ * Calculate total credits from entries
72
+ */
73
+ static getTotalCredits(entries: StatementEntry[]): Amount;
74
+ /**
75
+ * Calculate total debits from entries
76
+ */
77
+ static getTotalDebits(entries: StatementEntry[]): Amount;
78
+ /**
79
+ * Get net change from entries (credits - debits)
80
+ */
81
+ static getNetChange(entries: StatementEntry[]): Amount;
82
+ }
@@ -34,12 +34,12 @@ export declare const collectionContract: {
34
34
  }, "strip", z.ZodTypeAny, {
35
35
  status: import("./collection.types").COLLECTION_STATUS;
36
36
  createdAt: string;
37
+ accountNo: string;
38
+ narration: string;
37
39
  id: string;
38
40
  statusMessage: string;
39
- accountNo: string;
40
41
  walletId: string;
41
42
  transactionDate: string;
42
- narration: string;
43
43
  msisdn: string;
44
44
  channel: import("./collection.types").COLLECTION_CHANNEL;
45
45
  amount: number;
@@ -57,12 +57,12 @@ export declare const collectionContract: {
57
57
  }, {
58
58
  status: import("./collection.types").COLLECTION_STATUS;
59
59
  createdAt: string;
60
+ accountNo: string;
61
+ narration: string;
60
62
  id: string;
61
63
  statusMessage: string;
62
- accountNo: string;
63
64
  walletId: string;
64
65
  transactionDate: string;
65
- narration: string;
66
66
  msisdn: string;
67
67
  channel: import("./collection.types").COLLECTION_CHANNEL;
68
68
  amount: number;
@@ -84,12 +84,12 @@ export declare const collectionContract: {
84
84
  results: {
85
85
  status: import("./collection.types").COLLECTION_STATUS;
86
86
  createdAt: string;
87
+ accountNo: string;
88
+ narration: string;
87
89
  id: string;
88
90
  statusMessage: string;
89
- accountNo: string;
90
91
  walletId: string;
91
92
  transactionDate: string;
92
- narration: string;
93
93
  msisdn: string;
94
94
  channel: import("./collection.types").COLLECTION_CHANNEL;
95
95
  amount: number;
@@ -110,12 +110,12 @@ export declare const collectionContract: {
110
110
  results: {
111
111
  status: import("./collection.types").COLLECTION_STATUS;
112
112
  createdAt: string;
113
+ accountNo: string;
114
+ narration: string;
113
115
  id: string;
114
116
  statusMessage: string;
115
- accountNo: string;
116
117
  walletId: string;
117
118
  transactionDate: string;
118
- narration: string;
119
119
  msisdn: string;
120
120
  channel: import("./collection.types").COLLECTION_CHANNEL;
121
121
  amount: number;
@@ -187,12 +187,12 @@ export declare const collectionContract: {
187
187
  }, "strip", z.ZodTypeAny, {
188
188
  status: import("./collection.types").COLLECTION_STATUS;
189
189
  createdAt: string;
190
+ accountNo: string;
191
+ narration: string;
190
192
  id: string;
191
193
  statusMessage: string;
192
- accountNo: string;
193
194
  walletId: string;
194
195
  transactionDate: string;
195
- narration: string;
196
196
  msisdn: string;
197
197
  channel: import("./collection.types").COLLECTION_CHANNEL;
198
198
  amount: number;
@@ -210,12 +210,12 @@ export declare const collectionContract: {
210
210
  }, {
211
211
  status: import("./collection.types").COLLECTION_STATUS;
212
212
  createdAt: string;
213
+ accountNo: string;
214
+ narration: string;
213
215
  id: string;
214
216
  statusMessage: string;
215
- accountNo: string;
216
217
  walletId: string;
217
218
  transactionDate: string;
218
- narration: string;
219
219
  msisdn: string;
220
220
  channel: import("./collection.types").COLLECTION_CHANNEL;
221
221
  amount: number;
@@ -330,5 +330,67 @@ export declare const collectionContract: {
330
330
  }>;
331
331
  };
332
332
  };
333
+ getStatement: {
334
+ summary: "Get account statement";
335
+ method: "POST";
336
+ body: z.ZodObject<{
337
+ startDate: z.ZodString;
338
+ endDate: z.ZodString;
339
+ }, "strip", z.ZodTypeAny, {
340
+ startDate: string;
341
+ endDate: string;
342
+ }, {
343
+ startDate: string;
344
+ endDate: string;
345
+ }>;
346
+ path: "/collection-statement";
347
+ responses: {
348
+ 200: z.ZodObject<{
349
+ accountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
350
+ debitOrCredit: z.ZodEnum<["CR", "DR"]>;
351
+ tranRefNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
352
+ narration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
+ txnDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
354
+ valueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
355
+ amountCredited: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>;
356
+ amountDebited: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>;
357
+ balance: z.ZodNumber;
358
+ }, "strip", z.ZodTypeAny, {
359
+ balance: number;
360
+ debitOrCredit: "CR" | "DR";
361
+ txnDate: string | null;
362
+ valueDate: string | null;
363
+ amountCredited: number;
364
+ amountDebited: number;
365
+ accountNo?: string | null | undefined;
366
+ tranRefNo?: string | null | undefined;
367
+ narration?: string | null | undefined;
368
+ }, {
369
+ balance: number;
370
+ debitOrCredit: "CR" | "DR";
371
+ amountCredited: string | number;
372
+ amountDebited: string | number;
373
+ accountNo?: string | null | undefined;
374
+ tranRefNo?: string | null | undefined;
375
+ narration?: string | null | undefined;
376
+ txnDate?: string | null | undefined;
377
+ valueDate?: string | null | undefined;
378
+ }>;
379
+ 401: z.ZodObject<{
380
+ message: z.ZodOptional<z.ZodString>;
381
+ }, "strip", z.ZodTypeAny, {
382
+ message?: string | undefined;
383
+ }, {
384
+ message?: string | undefined;
385
+ }>;
386
+ 403: z.ZodObject<{
387
+ message: z.ZodOptional<z.ZodString>;
388
+ }, "strip", z.ZodTypeAny, {
389
+ message?: string | undefined;
390
+ }, {
391
+ message?: string | undefined;
392
+ }>;
393
+ };
394
+ };
333
395
  };
334
396
  export type CollectionContract = typeof collectionContract;
@@ -4,6 +4,7 @@ import { Collection } from "./collection.model";
4
4
  import { CollectionQuery } from "./collection.query";
5
5
  import { CollectionFilters } from "./collection.types";
6
6
  import { TransactionSummary, WalletInfo } from "@/lib/models";
7
+ import { StatementEntry } from "@/lib/models/statement-entry.model";
7
8
  /**
8
9
  * Flexible query input type - supports the class, filters interface, URL params, etc.
9
10
  */
@@ -64,4 +65,8 @@ export declare class CollectionRepository extends BaseRepository<typeof collecti
64
65
  * Get wallet information
65
66
  */
66
67
  getWalletInfo(): Promise<WalletInfo>;
68
+ getCollectionStatement(range: {
69
+ startDate: Date;
70
+ endDate: Date;
71
+ }): Promise<StatementEntry[]>;
67
72
  }
@@ -37,12 +37,12 @@ export declare const CollectionDTOSchemas: {
37
37
  }, "strip", z.ZodTypeAny, {
38
38
  status: COLLECTION_STATUS;
39
39
  createdAt: string;
40
+ accountNo: string;
41
+ narration: string;
40
42
  id: string;
41
43
  statusMessage: string;
42
- accountNo: string;
43
44
  walletId: string;
44
45
  transactionDate: string;
45
- narration: string;
46
46
  msisdn: string;
47
47
  channel: COLLECTION_CHANNEL;
48
48
  amount: number;
@@ -60,12 +60,12 @@ export declare const CollectionDTOSchemas: {
60
60
  }, {
61
61
  status: COLLECTION_STATUS;
62
62
  createdAt: string;
63
+ accountNo: string;
64
+ narration: string;
63
65
  id: string;
64
66
  statusMessage: string;
65
- accountNo: string;
66
67
  walletId: string;
67
68
  transactionDate: string;
68
- narration: string;
69
69
  msisdn: string;
70
70
  channel: COLLECTION_CHANNEL;
71
71
  amount: number;
@@ -106,9 +106,9 @@ export declare const CollectionDTOSchemas: {
106
106
  status?: COLLECTION_STATUS | undefined;
107
107
  startDate?: string | undefined;
108
108
  endDate?: string | undefined;
109
+ accountNo?: string | undefined;
109
110
  search?: string | undefined;
110
111
  id?: string | undefined;
111
- accountNo?: string | undefined;
112
112
  msisdn?: string | undefined;
113
113
  channel?: COLLECTION_CHANNEL | undefined;
114
114
  reference?: string | undefined;
@@ -121,9 +121,9 @@ export declare const CollectionDTOSchemas: {
121
121
  endDate?: string | undefined;
122
122
  page?: number | undefined;
123
123
  limit?: number | undefined;
124
+ accountNo?: string | undefined;
124
125
  search?: string | undefined;
125
126
  id?: string | undefined;
126
- accountNo?: string | undefined;
127
127
  msisdn?: string | undefined;
128
128
  channel?: COLLECTION_CHANNEL | undefined;
129
129
  reference?: string | undefined;
@@ -158,9 +158,9 @@ export declare const CollectionDTOSchemas: {
158
158
  endDate?: string | undefined;
159
159
  page?: number | undefined;
160
160
  limit?: number | undefined;
161
+ accountNo?: string | undefined;
161
162
  search?: string | undefined;
162
163
  id?: string | undefined;
163
- accountNo?: string | undefined;
164
164
  msisdn?: string | undefined;
165
165
  channel?: COLLECTION_CHANNEL | undefined;
166
166
  reference?: string | undefined;
@@ -173,9 +173,9 @@ export declare const CollectionDTOSchemas: {
173
173
  endDate?: string | undefined;
174
174
  page?: string | undefined;
175
175
  limit?: string | undefined;
176
+ accountNo?: string | undefined;
176
177
  search?: string | undefined;
177
178
  id?: string | undefined;
178
- accountNo?: string | undefined;
179
179
  msisdn?: string | undefined;
180
180
  channel?: string | undefined;
181
181
  reference?: string | undefined;
@@ -85,9 +85,9 @@ export declare const payoutContract: {
85
85
  }, "strip", z.ZodTypeAny, {
86
86
  statusCode: string;
87
87
  createdAt: string;
88
+ narration: string;
88
89
  id: string;
89
90
  transactionDate: string;
90
- narration: string;
91
91
  msisdn: string;
92
92
  amount: number;
93
93
  transactionId: string;
@@ -114,9 +114,9 @@ export declare const payoutContract: {
114
114
  }, {
115
115
  statusCode: string;
116
116
  createdAt: string;
117
+ narration: string;
117
118
  id: string;
118
119
  transactionDate: string;
119
- narration: string;
120
120
  msisdn: string;
121
121
  amount: number;
122
122
  transactionId: string;
@@ -147,9 +147,9 @@ export declare const payoutContract: {
147
147
  results: {
148
148
  statusCode: string;
149
149
  createdAt: string;
150
+ narration: string;
150
151
  id: string;
151
152
  transactionDate: string;
152
- narration: string;
153
153
  msisdn: string;
154
154
  amount: number;
155
155
  transactionId: string;
@@ -179,9 +179,9 @@ export declare const payoutContract: {
179
179
  results: {
180
180
  statusCode: string;
181
181
  createdAt: string;
182
+ narration: string;
182
183
  id: string;
183
184
  transactionDate: string;
184
- narration: string;
185
185
  msisdn: string;
186
186
  amount: number;
187
187
  transactionId: string;
@@ -268,9 +268,9 @@ export declare const payoutContract: {
268
268
  }, "strip", z.ZodTypeAny, {
269
269
  statusCode: string;
270
270
  createdAt: string;
271
+ narration: string;
271
272
  id: string;
272
273
  transactionDate: string;
273
- narration: string;
274
274
  msisdn: string;
275
275
  amount: number;
276
276
  transactionId: string;
@@ -297,9 +297,9 @@ export declare const payoutContract: {
297
297
  }, {
298
298
  statusCode: string;
299
299
  createdAt: string;
300
+ narration: string;
300
301
  id: string;
301
302
  transactionDate: string;
302
- narration: string;
303
303
  msisdn: string;
304
304
  amount: number;
305
305
  transactionId: string;
@@ -423,5 +423,67 @@ export declare const payoutContract: {
423
423
  }>;
424
424
  };
425
425
  };
426
+ getStatement: {
427
+ summary: "Get account statement";
428
+ method: "POST";
429
+ body: z.ZodObject<{
430
+ startDate: z.ZodString;
431
+ endDate: z.ZodString;
432
+ }, "strip", z.ZodTypeAny, {
433
+ startDate: string;
434
+ endDate: string;
435
+ }, {
436
+ startDate: string;
437
+ endDate: string;
438
+ }>;
439
+ path: "/collection-statement";
440
+ responses: {
441
+ 200: z.ZodObject<{
442
+ accountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
443
+ debitOrCredit: z.ZodEnum<["CR", "DR"]>;
444
+ tranRefNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
445
+ narration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
446
+ txnDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
447
+ valueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
448
+ amountCredited: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>;
449
+ amountDebited: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>;
450
+ balance: z.ZodNumber;
451
+ }, "strip", z.ZodTypeAny, {
452
+ balance: number;
453
+ debitOrCredit: "CR" | "DR";
454
+ txnDate: string | null;
455
+ valueDate: string | null;
456
+ amountCredited: number;
457
+ amountDebited: number;
458
+ accountNo?: string | null | undefined;
459
+ tranRefNo?: string | null | undefined;
460
+ narration?: string | null | undefined;
461
+ }, {
462
+ balance: number;
463
+ debitOrCredit: "CR" | "DR";
464
+ amountCredited: string | number;
465
+ amountDebited: string | number;
466
+ accountNo?: string | null | undefined;
467
+ tranRefNo?: string | null | undefined;
468
+ narration?: string | null | undefined;
469
+ txnDate?: string | null | undefined;
470
+ valueDate?: string | null | undefined;
471
+ }>;
472
+ 401: z.ZodObject<{
473
+ message: z.ZodOptional<z.ZodString>;
474
+ }, "strip", z.ZodTypeAny, {
475
+ message?: string | undefined;
476
+ }, {
477
+ message?: string | undefined;
478
+ }>;
479
+ 403: z.ZodObject<{
480
+ message: z.ZodOptional<z.ZodString>;
481
+ }, "strip", z.ZodTypeAny, {
482
+ message?: string | undefined;
483
+ }, {
484
+ message?: string | undefined;
485
+ }>;
486
+ };
487
+ };
426
488
  };
427
489
  export type PayoutContract = typeof payoutContract;
@@ -3,7 +3,7 @@ import { payoutContract } from "./payout.api-contract";
3
3
  import { Payout } from "./payout.model";
4
4
  import { PayoutQuery } from "./payout.query";
5
5
  import { PayoutFilters } from "./payout.types";
6
- import { TransactionSummary, WalletInfo } from "@/lib/models";
6
+ import { StatementEntry, TransactionSummary, WalletInfo } from "@/lib/models";
7
7
  /**
8
8
  * Flexible query input type - supports the class, filters interface, URL params, etc.
9
9
  */
@@ -64,4 +64,8 @@ export declare class PayoutRepository extends BaseRepository<typeof payoutContra
64
64
  * Get wallet information
65
65
  */
66
66
  getWalletInfo(): Promise<WalletInfo>;
67
+ getCollectionStatement(range: {
68
+ startDate: Date;
69
+ endDate: Date;
70
+ }): Promise<StatementEntry[]>;
67
71
  }
@@ -55,9 +55,9 @@ export declare const PayoutDTOSchemas: {
55
55
  }, "strip", z.ZodTypeAny, {
56
56
  statusCode: string;
57
57
  createdAt: string;
58
+ narration: string;
58
59
  id: string;
59
60
  transactionDate: string;
60
- narration: string;
61
61
  msisdn: string;
62
62
  amount: number;
63
63
  transactionId: string;
@@ -84,9 +84,9 @@ export declare const PayoutDTOSchemas: {
84
84
  }, {
85
85
  statusCode: string;
86
86
  createdAt: string;
87
+ narration: string;
87
88
  id: string;
88
89
  transactionDate: string;
89
- narration: string;
90
90
  msisdn: string;
91
91
  amount: number;
92
92
  transactionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/tembo-dashboard",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",