@temboplus/afloat 0.1.48 → 0.1.49

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.
Files changed (39) hide show
  1. package/esm/src/features/wallet/contract.d.ts +10 -10
  2. package/esm/src/features/wallet/repository.d.ts +3 -3
  3. package/esm/src/features/wallet/repository.d.ts.map +1 -1
  4. package/esm/src/features/wallet/repository.js +4 -3
  5. package/esm/src/models/wallet/index.d.ts +2 -1
  6. package/esm/src/models/wallet/index.d.ts.map +1 -1
  7. package/esm/src/models/wallet/index.js +2 -1
  8. package/esm/src/models/wallet/schemas.d.ts +62 -44
  9. package/esm/src/models/wallet/schemas.d.ts.map +1 -1
  10. package/esm/src/models/wallet/schemas.js +4 -51
  11. package/esm/src/models/wallet/statement_entry.d.ts +160 -0
  12. package/esm/src/models/wallet/statement_entry.d.ts.map +1 -0
  13. package/esm/src/models/wallet/statement_entry.js +255 -0
  14. package/esm/src/models/wallet/wallet.d.ts +147 -0
  15. package/esm/src/models/wallet/wallet.d.ts.map +1 -0
  16. package/esm/src/models/wallet/wallet.js +279 -0
  17. package/package.json +1 -1
  18. package/script/src/features/wallet/contract.d.ts +10 -10
  19. package/script/src/features/wallet/repository.d.ts +3 -3
  20. package/script/src/features/wallet/repository.d.ts.map +1 -1
  21. package/script/src/features/wallet/repository.js +7 -6
  22. package/script/src/models/wallet/index.d.ts +2 -1
  23. package/script/src/models/wallet/index.d.ts.map +1 -1
  24. package/script/src/models/wallet/index.js +2 -1
  25. package/script/src/models/wallet/schemas.d.ts +62 -44
  26. package/script/src/models/wallet/schemas.d.ts.map +1 -1
  27. package/script/src/models/wallet/schemas.js +4 -51
  28. package/script/src/models/wallet/statement_entry.d.ts +160 -0
  29. package/script/src/models/wallet/statement_entry.d.ts.map +1 -0
  30. package/script/src/models/wallet/statement_entry.js +259 -0
  31. package/script/src/models/wallet/wallet.d.ts +147 -0
  32. package/script/src/models/wallet/wallet.d.ts.map +1 -0
  33. package/script/src/models/wallet/wallet.js +283 -0
  34. package/esm/src/models/wallet/guards.d.ts +0 -11
  35. package/esm/src/models/wallet/guards.d.ts.map +0 -1
  36. package/esm/src/models/wallet/guards.js +0 -20
  37. package/script/src/models/wallet/guards.d.ts +0 -11
  38. package/script/src/models/wallet/guards.d.ts.map +0 -1
  39. package/script/src/models/wallet/guards.js +0 -23
@@ -10,11 +10,11 @@ export declare const contract: {
10
10
  accountNo: z.ZodString;
11
11
  accountName: z.ZodString;
12
12
  channel: z.ZodString;
13
- currencyCode: z.ZodString;
14
- countryCode: z.ZodString;
13
+ countryCode: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
14
+ currencyCode: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
15
15
  createdAt: z.ZodString;
16
16
  updatedAt: z.ZodString;
17
- }, z.UnknownKeysParam, z.ZodTypeAny, {
17
+ }, "strip", z.ZodTypeAny, {
18
18
  id: string;
19
19
  accountNo: string;
20
20
  channel: string;
@@ -22,8 +22,8 @@ export declare const contract: {
22
22
  createdAt: string;
23
23
  updatedAt: string;
24
24
  accountName: string;
25
- currencyCode: string;
26
25
  countryCode: string;
26
+ currencyCode: string;
27
27
  }, {
28
28
  id: string;
29
29
  accountNo: string;
@@ -32,8 +32,8 @@ export declare const contract: {
32
32
  createdAt: string;
33
33
  updatedAt: string;
34
34
  accountName: string;
35
- currencyCode: string;
36
- countryCode: string;
35
+ countryCode?: string | undefined;
36
+ currencyCode?: string | undefined;
37
37
  }>, "many">;
38
38
  };
39
39
  };
@@ -70,7 +70,7 @@ export declare const contract: {
70
70
  path: "/statement";
71
71
  responses: {
72
72
  201: z.ZodArray<z.ZodObject<{
73
- accountNo: z.ZodString;
73
+ accountNo: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
74
74
  debitOrCredit: z.ZodString;
75
75
  tranRefNo: z.ZodString;
76
76
  narration: z.ZodString;
@@ -79,8 +79,7 @@ export declare const contract: {
79
79
  amountCredited: z.ZodNumber;
80
80
  amountDebited: z.ZodNumber;
81
81
  balance: z.ZodNumber;
82
- }, z.UnknownKeysParam, z.ZodTypeAny, {
83
- accountNo: string;
82
+ }, "strip", z.ZodTypeAny, {
84
83
  debitOrCredit: string;
85
84
  tranRefNo: string;
86
85
  narration: string;
@@ -89,8 +88,8 @@ export declare const contract: {
89
88
  amountCredited: number;
90
89
  amountDebited: number;
91
90
  balance: number;
91
+ accountNo?: string | undefined;
92
92
  }, {
93
- accountNo: string;
94
93
  debitOrCredit: string;
95
94
  tranRefNo: string;
96
95
  narration: string;
@@ -99,6 +98,7 @@ export declare const contract: {
99
98
  amountCredited: number;
100
99
  amountDebited: number;
101
100
  balance: number;
101
+ accountNo?: string | undefined;
102
102
  }>, "many">;
103
103
  };
104
104
  };
@@ -1,6 +1,6 @@
1
1
  import { BaseRepository } from "../../shared/base_repository.js";
2
2
  import { contract } from "./contract.js";
3
- import type { Wallet, WalletStatementItem } from "../../models/wallet/index.js";
3
+ import { Wallet, WalletStatementEntry } from "../../models/wallet/index.js";
4
4
  import type { AfloatAuth } from "../auth/manager.js";
5
5
  /**
6
6
  * Repository class for managing wallet operations including balance checking,
@@ -41,7 +41,7 @@ export declare class WalletRepo extends BaseRepository<typeof contract> {
41
41
  * @param {string} [props.accountNo] - Optional account number to fetch statement for
42
42
  * @throws {PermissionError} If user lacks the ViewStatement permission
43
43
  * @throws {Error} If the statement fetch operation fails
44
- * @returns {Promise<WalletStatementItem[]>} Array of statement items for the specified period
44
+ * @returns {Promise<WalletStatementEntry[]>} Array of statement items for the specified period
45
45
  */
46
46
  getStatement(props: {
47
47
  range?: {
@@ -49,6 +49,6 @@ export declare class WalletRepo extends BaseRepository<typeof contract> {
49
49
  endDate: Date;
50
50
  };
51
51
  accountNo?: string;
52
- }): Promise<WalletStatementItem[]>;
52
+ }): Promise<WalletStatementEntry[]>;
53
53
  }
54
54
  //# sourceMappingURL=repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc,CAAC,OAAO,QAAQ,CAAC;IAC7D;;;;;OAKG;gBACS,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,UAAU,CAAA;KAAE;IAOxD;;;;;OAKG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAoBnC;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAUrC;;;;;;;;;;;OAWG;IACG,YAAY,CAChB,KAAK,EAAE;QACL,KAAK,CAAC,EAAE;YAAE,SAAS,EAAE,IAAI,CAAC;YAAC,OAAO,EAAE,IAAI,CAAA;SAAE,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,mBAAmB,EAAE,CAAC;CA2BlC"}
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc,CAAC,OAAO,QAAQ,CAAC;IAC7D;;;;;OAKG;gBACS,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,UAAU,CAAA;KAAE;IAOxD;;;;;OAKG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAoBnC;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAUrC;;;;;;;;;;;OAWG;IACG,YAAY,CAChB,KAAK,EAAE;QACL,KAAK,CAAC,EAAE;YAAE,SAAS,EAAE,IAAI,CAAC;YAAC,OAAO,EAAE,IAAI,CAAA;SAAE,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,oBAAoB,EAAE,CAAC;CA2BnC"}
@@ -1,5 +1,6 @@
1
1
  import { BaseRepository } from "../../shared/base_repository.js";
2
2
  import { contract } from "./contract.js";
3
+ import { Wallet, WalletStatementEntry } from "../../models/wallet/index.js";
3
4
  import { Permissions } from "../../models/permission.js";
4
5
  import { PermissionError } from "../../errors/index.js";
5
6
  /**
@@ -49,7 +50,7 @@ export class WalletRepo extends BaseRepository {
49
50
  async getWallets() {
50
51
  const result = await this.client.getWallets();
51
52
  if (result.status === 200) {
52
- return result.body;
53
+ return result.body.map((w) => Wallet.from(w));
53
54
  }
54
55
  throw new Error("An error occured while fetching wallets");
55
56
  }
@@ -63,7 +64,7 @@ export class WalletRepo extends BaseRepository {
63
64
  * @param {string} [props.accountNo] - Optional account number to fetch statement for
64
65
  * @throws {PermissionError} If user lacks the ViewStatement permission
65
66
  * @throws {Error} If the statement fetch operation fails
66
- * @returns {Promise<WalletStatementItem[]>} Array of statement items for the specified period
67
+ * @returns {Promise<WalletStatementEntry[]>} Array of statement items for the specified period
67
68
  */
68
69
  async getStatement(props) {
69
70
  const auth = this.getAuthForPermissionCheck();
@@ -83,7 +84,7 @@ export class WalletRepo extends BaseRepository {
83
84
  const body = { ...range, accountNo: props.accountNo };
84
85
  const result = await this.client.getStatement({ body });
85
86
  if (result.status === 201) {
86
- return result.body;
87
+ return result.body.map((e) => WalletStatementEntry.from(e));
87
88
  }
88
89
  throw new Error("An error occured while fetching statement");
89
90
  }
@@ -1,3 +1,4 @@
1
- export * from "./guards.js";
1
+ export * from "./statement_entry.js";
2
+ export * from "./wallet.js";
2
3
  export * from "./schemas.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -1,2 +1,3 @@
1
- export * from "./guards.js";
1
+ export * from "./statement_entry.js";
2
+ export * from "./wallet.js";
2
3
  export * from "./schemas.js";
@@ -1,51 +1,69 @@
1
- import { z } from "zod";
2
- /**
3
- * Type definition for statement entry schema using Zod.
4
- * This is used as a TypeScript type helper for the actual schema implementation.
5
- */
6
- type _StatementEntryType = z.ZodObject<{
7
- accountNo: z.ZodString;
8
- debitOrCredit: z.ZodString;
9
- tranRefNo: z.ZodString;
10
- narration: z.ZodString;
11
- txnDate: z.ZodDate;
12
- valueDate: z.ZodDate;
13
- amountCredited: z.ZodNumber;
14
- amountDebited: z.ZodNumber;
15
- balance: z.ZodNumber;
16
- }>;
17
- /**
18
- * Type definition for wallet schema using Zod.
19
- * This is used as a TypeScript type helper for the actual schema implementation.
20
- */
21
- type _WalletType = z.ZodObject<{
22
- id: z.ZodString;
23
- profileId: z.ZodString;
24
- accountNo: z.ZodString;
25
- accountName: z.ZodString;
26
- channel: z.ZodString;
27
- currencyCode: z.ZodString;
28
- countryCode: z.ZodString;
29
- createdAt: z.ZodString;
30
- updatedAt: z.ZodString;
31
- }>;
32
1
  /**
33
2
  * Collection of wallet-related schemas for export.
34
3
  * Provides access to both wallet and statement entry validation schemas.
35
4
  */
36
5
  export declare const WalletSchemas: {
37
- wallet: _WalletType;
38
- statementEntry: _StatementEntryType;
6
+ wallet: import("zod").ZodObject<{
7
+ id: import("zod").ZodString;
8
+ profileId: import("zod").ZodString;
9
+ accountNo: import("zod").ZodString;
10
+ accountName: import("zod").ZodString;
11
+ channel: import("zod").ZodString;
12
+ countryCode: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodString>, string, string | undefined>;
13
+ currencyCode: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodString>, string, string | undefined>;
14
+ createdAt: import("zod").ZodString;
15
+ updatedAt: import("zod").ZodString;
16
+ }, "strip", import("zod").ZodTypeAny, {
17
+ id: string;
18
+ accountNo: string;
19
+ channel: string;
20
+ profileId: string;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ accountName: string;
24
+ countryCode: string;
25
+ currencyCode: string;
26
+ }, {
27
+ id: string;
28
+ accountNo: string;
29
+ channel: string;
30
+ profileId: string;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ accountName: string;
34
+ countryCode?: string | undefined;
35
+ currencyCode?: string | undefined;
36
+ }>;
37
+ statementEntry: import("zod").ZodObject<{
38
+ accountNo: import("zod").ZodEffects<import("zod").ZodOptional<import("zod").ZodString>, string | undefined, string | undefined>;
39
+ debitOrCredit: import("zod").ZodString;
40
+ tranRefNo: import("zod").ZodString;
41
+ narration: import("zod").ZodString;
42
+ txnDate: import("zod").ZodDate;
43
+ valueDate: import("zod").ZodDate;
44
+ amountCredited: import("zod").ZodNumber;
45
+ amountDebited: import("zod").ZodNumber;
46
+ balance: import("zod").ZodNumber;
47
+ }, "strip", import("zod").ZodTypeAny, {
48
+ debitOrCredit: string;
49
+ tranRefNo: string;
50
+ narration: string;
51
+ txnDate: Date;
52
+ valueDate: Date;
53
+ amountCredited: number;
54
+ amountDebited: number;
55
+ balance: number;
56
+ accountNo?: string | undefined;
57
+ }, {
58
+ debitOrCredit: string;
59
+ tranRefNo: string;
60
+ narration: string;
61
+ txnDate: Date;
62
+ valueDate: Date;
63
+ amountCredited: number;
64
+ amountDebited: number;
65
+ balance: number;
66
+ accountNo?: string | undefined;
67
+ }>;
39
68
  };
40
- /**
41
- * TypeScript type for a validated wallet object.
42
- * Use this type for wallet instances that have been validated against the schema.
43
- */
44
- export type Wallet = z.infer<typeof WalletSchemas.wallet>;
45
- /**
46
- * TypeScript type for a validated statement entry object.
47
- * Use this type for statement entries that have been validated against the schema.
48
- */
49
- export type WalletStatementItem = z.infer<typeof WalletSchemas.statementEntry>;
50
- export {};
51
69
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,KAAK,mBAAmB,GAAG,CAAC,CAAC,SAAS,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC;IACnB,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;IACrB,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC;IAC5B,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;CACtB,CAAC,CAAC;AA4BH;;;GAGG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC;IAC1B,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;CACxB,CAAC,CAAC;AA0BH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/schemas.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGzB,CAAC"}
@@ -1,57 +1,10 @@
1
- import { z } from "zod";
2
- /**
3
- * Schema definition for a statement entry.
4
- * Represents a single transaction in a wallet's statement history.
5
- *
6
- * @property {string} accountNo - The account number associated with the transaction
7
- * @property {string} debitOrCredit - Indicator if transaction is debit or credit
8
- * @property {string} tranRefNo - Transaction reference number
9
- * @property {string} narration - Description of the transaction
10
- * @property {Date} txnDate - Date when transaction was initiated
11
- * @property {Date} valueDate - Date when transaction value was applied
12
- * @property {number} amountCredited - Amount credited in transaction (if credit)
13
- * @property {number} amountDebited - Amount debited in transaction (if debit)
14
- * @property {number} balance - Running balance after transaction
15
- */
16
- const statementEntrySchema = z.object({
17
- accountNo: z.string(),
18
- debitOrCredit: z.string().min(1, "Transaction type is required"),
19
- tranRefNo: z.string().min(1, "Transaction reference is required"),
20
- narration: z.string().min(1, "Transaction description is required"),
21
- txnDate: z.coerce.date(),
22
- valueDate: z.coerce.date(),
23
- amountCredited: z.coerce.number().min(0, "Credited amount must be non-negative"),
24
- amountDebited: z.coerce.number().min(0, "Debited amount must be non-negative"),
25
- balance: z.coerce.number(),
26
- });
27
- /**
28
- * Schema definition for a wallet.
29
- * Represents a digital wallet that can hold funds and process transactions.
30
- *
31
- * @property {string} id - Unique identifier for the wallet
32
- * @property {string} profileId - ID of the profile that owns this wallet
33
- * @property {string} accountNo - Account number associated with the wallet
34
- * @property {string} accountName - Name of the account holder
35
- * @property {string} channel - Payment channel or provider (e.g., "MPESA", "BANK")
36
- * @property {string} createdAt - ISO datetime string of wallet creation
37
- * @property {string} updatedAt - ISO datetime string of last wallet update
38
- */
39
- const walletSchema = z.object({
40
- id: z.string().min(1),
41
- profileId: z.string().min(1, "Profile ID is required"),
42
- accountNo: z.string().min(1, "Account number is required"),
43
- accountName: z.string().min(1, "Account name is required"),
44
- channel: z.string().min(1, "Channel is required"),
45
- currencyCode: z.string().min(1, "Currency code is required"),
46
- countryCode: z.string().min(1, "Country code is required"),
47
- createdAt: z.string().datetime("Invalid creation timestamp"),
48
- updatedAt: z.string().datetime("Invalid update timestamp"),
49
- });
1
+ import { Wallet } from "./wallet.js";
2
+ import { WalletStatementEntry } from "./statement_entry.js";
50
3
  /**
51
4
  * Collection of wallet-related schemas for export.
52
5
  * Provides access to both wallet and statement entry validation schemas.
53
6
  */
54
7
  export const WalletSchemas = {
55
- wallet: walletSchema,
56
- statementEntry: statementEntrySchema,
8
+ wallet: Wallet.schema,
9
+ statementEntry: WalletStatementEntry.schema,
57
10
  };
@@ -0,0 +1,160 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Schema definition for a statement entry.
4
+ */
5
+ declare const statementEntrySchema: z.ZodObject<{
6
+ accountNo: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
7
+ debitOrCredit: z.ZodString;
8
+ tranRefNo: z.ZodString;
9
+ narration: z.ZodString;
10
+ txnDate: z.ZodDate;
11
+ valueDate: z.ZodDate;
12
+ amountCredited: z.ZodNumber;
13
+ amountDebited: z.ZodNumber;
14
+ balance: z.ZodNumber;
15
+ }, "strip", z.ZodTypeAny, {
16
+ debitOrCredit: string;
17
+ tranRefNo: string;
18
+ narration: string;
19
+ txnDate: Date;
20
+ valueDate: Date;
21
+ amountCredited: number;
22
+ amountDebited: number;
23
+ balance: number;
24
+ accountNo?: string | undefined;
25
+ }, {
26
+ debitOrCredit: string;
27
+ tranRefNo: string;
28
+ narration: string;
29
+ txnDate: Date;
30
+ valueDate: Date;
31
+ amountCredited: number;
32
+ amountDebited: number;
33
+ balance: number;
34
+ accountNo?: string | undefined;
35
+ }>;
36
+ type WalletStatementEntryDTO = z.infer<typeof statementEntrySchema>;
37
+ /**
38
+ * Represents a single entry in a Wallet's statement history.
39
+ *
40
+ * This class provides methods for creating, validating, and accessing statement entry data.
41
+ * It integrates with the Zod schema validation for data integrity.
42
+ */
43
+ export declare class WalletStatementEntry {
44
+ private _accountNo?;
45
+ private _debitOrCredit;
46
+ private _tranRefNo;
47
+ private _narration;
48
+ private _txnDate;
49
+ private _valueDate;
50
+ private _amountCredited;
51
+ private _amountDebited;
52
+ private _balance;
53
+ /**
54
+ * Gets the statement entry schema used for validation.
55
+ */
56
+ static get schema(): z.ZodObject<{
57
+ accountNo: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
58
+ debitOrCredit: z.ZodString;
59
+ tranRefNo: z.ZodString;
60
+ narration: z.ZodString;
61
+ txnDate: z.ZodDate;
62
+ valueDate: z.ZodDate;
63
+ amountCredited: z.ZodNumber;
64
+ amountDebited: z.ZodNumber;
65
+ balance: z.ZodNumber;
66
+ }, "strip", z.ZodTypeAny, {
67
+ debitOrCredit: string;
68
+ tranRefNo: string;
69
+ narration: string;
70
+ txnDate: Date;
71
+ valueDate: Date;
72
+ amountCredited: number;
73
+ amountDebited: number;
74
+ balance: number;
75
+ accountNo?: string | undefined;
76
+ }, {
77
+ debitOrCredit: string;
78
+ tranRefNo: string;
79
+ narration: string;
80
+ txnDate: Date;
81
+ valueDate: Date;
82
+ amountCredited: number;
83
+ amountDebited: number;
84
+ balance: number;
85
+ accountNo?: string | undefined;
86
+ }>;
87
+ /**
88
+ * Private constructor to enforce use of static factory methods.
89
+ * Assumes data is already validated and dates are Date objects.
90
+ * @param data - Object containing statement entry information conforming to WalletStatementItem.
91
+ */
92
+ private constructor();
93
+ /**
94
+ * Creates a new WalletStatementEntry instance after validating the input data.
95
+ * Handles date coercion via the schema.
96
+ *
97
+ * @param data - Object containing statement entry information. Dates can be strings or Date objects.
98
+ * @returns A new WalletStatementEntry instance, or undefined if validation fails.
99
+ */
100
+ static create(data: {
101
+ accountNo?: string | null;
102
+ cbaRefNo?: string | null;
103
+ debitOrCredit: string;
104
+ tranRefNo: string;
105
+ narration: string;
106
+ txnDate: string | Date;
107
+ valueDate: string | Date;
108
+ amountCredited: number;
109
+ amountDebited: number;
110
+ balance: number;
111
+ }): WalletStatementEntry | undefined;
112
+ get accountNo(): string | undefined;
113
+ get debitOrCredit(): string;
114
+ get tranRefNo(): string;
115
+ get narration(): string;
116
+ get txnDate(): Date;
117
+ get valueDate(): Date;
118
+ get amountCredited(): number;
119
+ get amountDebited(): number;
120
+ get balance(): number;
121
+ /**
122
+ * Creates a plain object representation of the statement entry for validation or serialization.
123
+ * @returns A plain object matching the WalletStatementItem interface.
124
+ */
125
+ toObject(): WalletStatementEntryDTO;
126
+ /**
127
+ * Converts the statement entry to a JSON string.
128
+ * Dates will be serialized to ISO strings automatically by JSON.stringify.
129
+ * @returns A JSON string representation of the statement entry.
130
+ */
131
+ toJSON(): string;
132
+ /**
133
+ * Validates the current statement entry instance data against the Zod schema.
134
+ * @returns True if the statement entry instance data is valid, false otherwise.
135
+ */
136
+ validate(): boolean;
137
+ /**
138
+ * Creates a WalletStatementEntry instance from a JSON string.
139
+ * Validates the data after parsing, including date coercion.
140
+ * @param jsonString - JSON string containing statement entry data.
141
+ * @returns A new WalletStatementEntry instance, or undefined if parsing or validation fails.
142
+ */
143
+ static fromJSON(jsonString: string): WalletStatementEntry | undefined;
144
+ /**
145
+ * Creates a WalletStatementEntry instance from a plain object.
146
+ * Validates the data using the schema, including date coercion.
147
+ * @param data - Object containing statement entry data. Dates can be strings or Date objects.
148
+ * @returns A new WalletStatementEntry instance, or undefined if the object is invalid.
149
+ */
150
+ static from(data: any): WalletStatementEntry | undefined;
151
+ /**
152
+ * Type guard to check if an unknown object is a valid WalletStatementEntry instance.
153
+ * Performs structural checks (duck typing).
154
+ * @param obj - The object to check.
155
+ * @returns Type predicate indicating if the object is a WalletStatementEntry instance.
156
+ */
157
+ static is(obj: unknown): obj is WalletStatementEntry;
158
+ }
159
+ export {};
160
+ //# sourceMappingURL=statement_entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement_entry.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/statement_entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcxB,CAAC;AAEH,KAAK,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAS;IAEzB;;OAEG;IACH,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAEhB;IAED;;;;OAIG;IACH,OAAO;IAYP;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAClB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,oBAAoB,GAAG,SAAS;IAgBpC,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;IACD,IAAI,aAAa,IAAI,MAAM,CAE1B;IACD,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,IAAI,OAAO,IAAI,IAAI,CAElB;IACD,IAAI,SAAS,IAAI,IAAI,CAEpB;IACD,IAAI,cAAc,IAAI,MAAM,CAE3B;IACD,IAAI,aAAa,IAAI,MAAM,CAE1B;IACD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;OAGG;IACH,QAAQ,IAAI,uBAAuB;IAcnC;;;;OAIG;IACH,MAAM,IAAI,MAAM;IAIhB;;;OAGG;IACH,QAAQ,IAAI,OAAO;IAWnB;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAWrE;;;;;OAKG;IAEH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,oBAAoB,GAAG,SAAS;IAsBxD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB;CAmBrD"}