@temboplus/afloat 0.1.50 → 0.1.52

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.
@@ -85,7 +85,7 @@ export declare const contract: {
85
85
  identity: string;
86
86
  } | null>>;
87
87
  }, z.UnknownKeysParam, z.ZodTypeAny, {
88
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
88
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
89
89
  id: string;
90
90
  channel: string;
91
91
  profileId: string;
@@ -108,7 +108,7 @@ export declare const contract: {
108
108
  identity: string;
109
109
  } | undefined;
110
110
  }, {
111
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
111
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
112
112
  id: string;
113
113
  channel: string;
114
114
  profileId: string;
@@ -134,7 +134,7 @@ export declare const contract: {
134
134
  total: z.ZodNumber;
135
135
  }, "strip", z.ZodTypeAny, {
136
136
  results: {
137
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
137
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
138
138
  id: string;
139
139
  channel: string;
140
140
  profileId: string;
@@ -160,7 +160,7 @@ export declare const contract: {
160
160
  total: number;
161
161
  }, {
162
162
  results: {
163
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
163
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
164
164
  id: string;
165
165
  channel: string;
166
166
  profileId: string;
@@ -259,7 +259,7 @@ export declare const contract: {
259
259
  identity: string;
260
260
  } | null>>;
261
261
  }, z.UnknownKeysParam, z.ZodTypeAny, {
262
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
262
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
263
263
  id: string;
264
264
  channel: string;
265
265
  profileId: string;
@@ -282,7 +282,7 @@ export declare const contract: {
282
282
  identity: string;
283
283
  } | undefined;
284
284
  }, {
285
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
285
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
286
286
  id: string;
287
287
  channel: string;
288
288
  profileId: string;
@@ -308,7 +308,7 @@ export declare const contract: {
308
308
  total: z.ZodNumber;
309
309
  }, "strip", z.ZodTypeAny, {
310
310
  results: {
311
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
311
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
312
312
  id: string;
313
313
  channel: string;
314
314
  profileId: string;
@@ -334,7 +334,7 @@ export declare const contract: {
334
334
  total: number;
335
335
  }, {
336
336
  results: {
337
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
337
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
338
338
  id: string;
339
339
  channel: string;
340
340
  profileId: string;
@@ -435,7 +435,7 @@ export declare const contract: {
435
435
  identity: string;
436
436
  } | null>>;
437
437
  }, z.UnknownKeysParam, z.ZodTypeAny, {
438
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
438
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
439
439
  id: string;
440
440
  channel: string;
441
441
  profileId: string;
@@ -458,7 +458,7 @@ export declare const contract: {
458
458
  identity: string;
459
459
  } | undefined;
460
460
  }, {
461
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
461
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
462
462
  id: string;
463
463
  channel: string;
464
464
  profileId: string;
@@ -565,7 +565,7 @@ export declare const contract: {
565
565
  identity: string;
566
566
  } | null>>;
567
567
  }, z.UnknownKeysParam, z.ZodTypeAny, {
568
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
568
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
569
569
  id: string;
570
570
  channel: string;
571
571
  profileId: string;
@@ -588,7 +588,7 @@ export declare const contract: {
588
588
  identity: string;
589
589
  } | undefined;
590
590
  }, {
591
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
591
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
592
592
  id: string;
593
593
  channel: string;
594
594
  profileId: string;
@@ -1,6 +1,31 @@
1
1
  import { z } from "zod";
2
2
  export declare const contract: {
3
3
  getWallets: {
4
+ query: z.ZodObject<{
5
+ id: z.ZodOptional<z.ZodString>;
6
+ profileId: z.ZodOptional<z.ZodString>;
7
+ accountNo: z.ZodOptional<z.ZodString>;
8
+ accountName: z.ZodOptional<z.ZodString>;
9
+ channel: z.ZodOptional<z.ZodString>;
10
+ countryCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
11
+ currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ id?: string | undefined;
14
+ accountNo?: string | undefined;
15
+ channel?: string | undefined;
16
+ profileId?: string | undefined;
17
+ accountName?: string | undefined;
18
+ countryCode?: string | undefined;
19
+ currencyCode?: string | undefined;
20
+ }, {
21
+ id?: string | undefined;
22
+ accountNo?: string | undefined;
23
+ channel?: string | undefined;
24
+ profileId?: string | undefined;
25
+ accountName?: string | undefined;
26
+ countryCode?: string | undefined;
27
+ currencyCode?: string | undefined;
28
+ }>;
4
29
  method: "GET";
5
30
  path: "/";
6
31
  responses: {
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCnB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCnB,CAAC"}
@@ -5,6 +5,7 @@ export const contract = initContract().router({
5
5
  getWallets: {
6
6
  method: "GET",
7
7
  path: "/",
8
+ query: WalletSchemas.walletQuery,
8
9
  responses: {
9
10
  200: z.array(WalletSchemas.wallet),
10
11
  },
@@ -1,7 +1,8 @@
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
+ import { Wallet, type WalletSchemas, WalletStatementEntry } from "../../models/wallet/index.js";
4
4
  import type { AfloatAuth } from "../auth/manager.js";
5
+ import type z from "zod";
5
6
  /**
6
7
  * Repository class for managing wallet operations including balance checking,
7
8
  * statement generation, and wallet information retrieval.
@@ -25,14 +26,14 @@ export declare class WalletRepo extends BaseRepository<typeof contract> {
25
26
  * @returns {Promise<number>} The available balance amount
26
27
  */
27
28
  getBalance(props: {
28
- accountNo: string;
29
+ accountNo?: string;
29
30
  }): Promise<number>;
30
31
  /**
31
32
  * Retrieves all wallets associated with the current context.
32
33
  * @throws {Error} If the wallet fetch operation fails
33
34
  * @returns {Promise<Wallet[]>} Array of wallet objects
34
35
  */
35
- getWallets(): Promise<Wallet[]>;
36
+ getWallets(args?: z.infer<typeof WalletSchemas.walletQuery>): Promise<Wallet[]>;
36
37
  /**
37
38
  * Retrieves wallet statement items for a specified date range and account.
38
39
  * If no range is provided, defaults to the current month (1st to 30th).
@@ -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,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,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsB/D;;;;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
+ {"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,EACL,MAAM,EACN,KAAK,aAAa,EAClB,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;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,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBhE;;;;OAIG;IACG,UAAU,CACd,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,GAC/C,OAAO,CAAC,MAAM,EAAE,CAAC;IAUpB;;;;;;;;;;;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,6 +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
+ import { Wallet, WalletStatementEntry, } from "../../models/wallet/index.js";
4
4
  import { Permissions } from "../../models/permission.js";
5
5
  import { PermissionError } from "../../errors/index.js";
6
6
  /**
@@ -49,8 +49,8 @@ export class WalletRepo extends BaseRepository {
49
49
  * @throws {Error} If the wallet fetch operation fails
50
50
  * @returns {Promise<Wallet[]>} Array of wallet objects
51
51
  */
52
- async getWallets() {
53
- const result = await this.client.getWallets();
52
+ async getWallets(args) {
53
+ const result = await this.client.getWallets({ query: args });
54
54
  if (result.status === 200) {
55
55
  return result.body.map((w) => Wallet.from(w));
56
56
  }
@@ -14,7 +14,8 @@ export declare enum PAYOUT_STATUS {
14
14
  /** Payout has been rejected */
15
15
  REJECTED = "REJECTED",
16
16
  /** Payout has been initially created but not yet processed */
17
- CREATED = "CREATED"
17
+ CREATED = "CREATED",
18
+ REVERSED = "REVERSED"
18
19
  }
19
20
  /**
20
21
  * Represents the approval status for payouts that require authorization.
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IAEjB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IAEjB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;IAEnB,QAAQ,aAAa;CACtB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
@@ -16,6 +16,7 @@ export var PAYOUT_STATUS;
16
16
  PAYOUT_STATUS["REJECTED"] = "REJECTED";
17
17
  /** Payout has been initially created but not yet processed */
18
18
  PAYOUT_STATUS["CREATED"] = "CREATED";
19
+ PAYOUT_STATUS["REVERSED"] = "REVERSED";
19
20
  })(PAYOUT_STATUS || (PAYOUT_STATUS = {}));
20
21
  /**
21
22
  * Represents the approval status for payouts that require authorization.
@@ -1,19 +1,20 @@
1
+ import { z } from "zod";
1
2
  /**
2
3
  * Collection of wallet-related schemas for export.
3
4
  * Provides access to both wallet and statement entry validation schemas.
4
5
  */
5
6
  export declare const WalletSchemas: {
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, {
7
+ wallet: z.ZodObject<{
8
+ id: z.ZodString;
9
+ profileId: z.ZodString;
10
+ accountNo: z.ZodString;
11
+ accountName: z.ZodString;
12
+ channel: 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
+ createdAt: z.ZodString;
16
+ updatedAt: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
17
18
  id: string;
18
19
  accountNo: string;
19
20
  channel: string;
@@ -34,17 +35,42 @@ export declare const WalletSchemas: {
34
35
  countryCode?: string | undefined;
35
36
  currencyCode?: string | undefined;
36
37
  }>;
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, {
38
+ walletQuery: z.ZodObject<{
39
+ id: z.ZodOptional<z.ZodString>;
40
+ profileId: z.ZodOptional<z.ZodString>;
41
+ accountNo: z.ZodOptional<z.ZodString>;
42
+ accountName: z.ZodOptional<z.ZodString>;
43
+ channel: z.ZodOptional<z.ZodString>;
44
+ countryCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
45
+ currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ id?: string | undefined;
48
+ accountNo?: string | undefined;
49
+ channel?: string | undefined;
50
+ profileId?: string | undefined;
51
+ accountName?: string | undefined;
52
+ countryCode?: string | undefined;
53
+ currencyCode?: string | undefined;
54
+ }, {
55
+ id?: string | undefined;
56
+ accountNo?: string | undefined;
57
+ channel?: string | undefined;
58
+ profileId?: string | undefined;
59
+ accountName?: string | undefined;
60
+ countryCode?: string | undefined;
61
+ currencyCode?: string | undefined;
62
+ }>;
63
+ statementEntry: z.ZodObject<{
64
+ accountNo: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
65
+ debitOrCredit: z.ZodString;
66
+ tranRefNo: z.ZodString;
67
+ narration: z.ZodString;
68
+ txnDate: z.ZodDate;
69
+ valueDate: z.ZodDate;
70
+ amountCredited: z.ZodNumber;
71
+ amountDebited: z.ZodNumber;
72
+ balance: z.ZodNumber;
73
+ }, "strip", z.ZodTypeAny, {
48
74
  debitOrCredit: string;
49
75
  tranRefNo: string;
50
76
  narration: string;
@@ -1 +1 @@
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
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/schemas.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIzB,CAAC"}
@@ -1,10 +1,35 @@
1
1
  import { Wallet } from "./wallet.js";
2
2
  import { WalletStatementEntry } from "./statement_entry.js";
3
+ import { Currency, ISO2CountryCodesSet, ValidCurrencyCodesSet, } from "@temboplus/frontend-core";
4
+ import { z } from "zod";
5
+ /**
6
+ * Zod schema definition for validating Wallet data structures.
7
+ * Ensures data integrity for wallet objects, including runtime validation
8
+ * of country codes against the imported ISO2CountryCodesSet.
9
+ */
10
+ const walletQuerySchema = z.object({
11
+ id: z.string().optional(),
12
+ profileId: z.string().optional(),
13
+ accountNo: z.string().optional(),
14
+ accountName: z.string().optional(),
15
+ channel: z.string().optional(),
16
+ // Validate countryCode as a string present in the imported Set
17
+ countryCode: z.string().default("TZ")
18
+ .refine((code) => ISO2CountryCodesSet.has(code), { message: "Provided country code is not a valid ISO2 code." }).optional(),
19
+ // Validate currencyCode as a string present in the imported Set
20
+ currencyCode: z.string().default("TZS")
21
+ .refine((code) => {
22
+ const currency = Currency.from(code);
23
+ return currency !== undefined &&
24
+ ValidCurrencyCodesSet.has(currency.code);
25
+ }, { message: "Provided currency code is not a valid currency code." }).optional(),
26
+ });
3
27
  /**
4
28
  * Collection of wallet-related schemas for export.
5
29
  * Provides access to both wallet and statement entry validation schemas.
6
30
  */
7
31
  export const WalletSchemas = {
8
32
  wallet: Wallet.schema,
33
+ walletQuery: walletQuerySchema,
9
34
  statementEntry: WalletStatementEntry.schema,
10
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "A JavaScript/TypeScript package providing common utilities and logic shared across all Temboplus-Afloat Projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -85,7 +85,7 @@ export declare const contract: {
85
85
  identity: string;
86
86
  } | null>>;
87
87
  }, z.UnknownKeysParam, z.ZodTypeAny, {
88
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
88
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
89
89
  id: string;
90
90
  channel: string;
91
91
  profileId: string;
@@ -108,7 +108,7 @@ export declare const contract: {
108
108
  identity: string;
109
109
  } | undefined;
110
110
  }, {
111
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
111
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
112
112
  id: string;
113
113
  channel: string;
114
114
  profileId: string;
@@ -134,7 +134,7 @@ export declare const contract: {
134
134
  total: z.ZodNumber;
135
135
  }, "strip", z.ZodTypeAny, {
136
136
  results: {
137
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
137
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
138
138
  id: string;
139
139
  channel: string;
140
140
  profileId: string;
@@ -160,7 +160,7 @@ export declare const contract: {
160
160
  total: number;
161
161
  }, {
162
162
  results: {
163
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
163
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
164
164
  id: string;
165
165
  channel: string;
166
166
  profileId: string;
@@ -259,7 +259,7 @@ export declare const contract: {
259
259
  identity: string;
260
260
  } | null>>;
261
261
  }, z.UnknownKeysParam, z.ZodTypeAny, {
262
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
262
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
263
263
  id: string;
264
264
  channel: string;
265
265
  profileId: string;
@@ -282,7 +282,7 @@ export declare const contract: {
282
282
  identity: string;
283
283
  } | undefined;
284
284
  }, {
285
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
285
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
286
286
  id: string;
287
287
  channel: string;
288
288
  profileId: string;
@@ -308,7 +308,7 @@ export declare const contract: {
308
308
  total: z.ZodNumber;
309
309
  }, "strip", z.ZodTypeAny, {
310
310
  results: {
311
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
311
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
312
312
  id: string;
313
313
  channel: string;
314
314
  profileId: string;
@@ -334,7 +334,7 @@ export declare const contract: {
334
334
  total: number;
335
335
  }, {
336
336
  results: {
337
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
337
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
338
338
  id: string;
339
339
  channel: string;
340
340
  profileId: string;
@@ -435,7 +435,7 @@ export declare const contract: {
435
435
  identity: string;
436
436
  } | null>>;
437
437
  }, z.UnknownKeysParam, z.ZodTypeAny, {
438
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
438
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
439
439
  id: string;
440
440
  channel: string;
441
441
  profileId: string;
@@ -458,7 +458,7 @@ export declare const contract: {
458
458
  identity: string;
459
459
  } | undefined;
460
460
  }, {
461
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
461
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
462
462
  id: string;
463
463
  channel: string;
464
464
  profileId: string;
@@ -565,7 +565,7 @@ export declare const contract: {
565
565
  identity: string;
566
566
  } | null>>;
567
567
  }, z.UnknownKeysParam, z.ZodTypeAny, {
568
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
568
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
569
569
  id: string;
570
570
  channel: string;
571
571
  profileId: string;
@@ -588,7 +588,7 @@ export declare const contract: {
588
588
  identity: string;
589
589
  } | undefined;
590
590
  }, {
591
- status: import("../../models/payout/status.js").PAYOUT_STATUS;
591
+ status: import("../../models/payout/status.js").PAYOUT_STATUS.QUEUED | import("../../models/payout/status.js").PAYOUT_STATUS.PENDING | import("../../models/payout/status.js").PAYOUT_STATUS.PAID | import("../../models/payout/status.js").PAYOUT_STATUS.FAILED | import("../../models/payout/status.js").PAYOUT_STATUS.REJECTED | import("../../models/payout/status.js").PAYOUT_STATUS.CREATED;
592
592
  id: string;
593
593
  channel: string;
594
594
  profileId: string;
@@ -1,6 +1,31 @@
1
1
  import { z } from "zod";
2
2
  export declare const contract: {
3
3
  getWallets: {
4
+ query: z.ZodObject<{
5
+ id: z.ZodOptional<z.ZodString>;
6
+ profileId: z.ZodOptional<z.ZodString>;
7
+ accountNo: z.ZodOptional<z.ZodString>;
8
+ accountName: z.ZodOptional<z.ZodString>;
9
+ channel: z.ZodOptional<z.ZodString>;
10
+ countryCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
11
+ currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ id?: string | undefined;
14
+ accountNo?: string | undefined;
15
+ channel?: string | undefined;
16
+ profileId?: string | undefined;
17
+ accountName?: string | undefined;
18
+ countryCode?: string | undefined;
19
+ currencyCode?: string | undefined;
20
+ }, {
21
+ id?: string | undefined;
22
+ accountNo?: string | undefined;
23
+ channel?: string | undefined;
24
+ profileId?: string | undefined;
25
+ accountName?: string | undefined;
26
+ countryCode?: string | undefined;
27
+ currencyCode?: string | undefined;
28
+ }>;
4
29
  method: "GET";
5
30
  path: "/";
6
31
  responses: {
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCnB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCnB,CAAC"}
@@ -8,6 +8,7 @@ exports.contract = (0, core_1.initContract)().router({
8
8
  getWallets: {
9
9
  method: "GET",
10
10
  path: "/",
11
+ query: index_js_1.WalletSchemas.walletQuery,
11
12
  responses: {
12
13
  200: zod_1.z.array(index_js_1.WalletSchemas.wallet),
13
14
  },
@@ -1,7 +1,8 @@
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
+ import { Wallet, type WalletSchemas, WalletStatementEntry } from "../../models/wallet/index.js";
4
4
  import type { AfloatAuth } from "../auth/manager.js";
5
+ import type z from "zod";
5
6
  /**
6
7
  * Repository class for managing wallet operations including balance checking,
7
8
  * statement generation, and wallet information retrieval.
@@ -25,14 +26,14 @@ export declare class WalletRepo extends BaseRepository<typeof contract> {
25
26
  * @returns {Promise<number>} The available balance amount
26
27
  */
27
28
  getBalance(props: {
28
- accountNo: string;
29
+ accountNo?: string;
29
30
  }): Promise<number>;
30
31
  /**
31
32
  * Retrieves all wallets associated with the current context.
32
33
  * @throws {Error} If the wallet fetch operation fails
33
34
  * @returns {Promise<Wallet[]>} Array of wallet objects
34
35
  */
35
- getWallets(): Promise<Wallet[]>;
36
+ getWallets(args?: z.infer<typeof WalletSchemas.walletQuery>): Promise<Wallet[]>;
36
37
  /**
37
38
  * Retrieves wallet statement items for a specified date range and account.
38
39
  * If no range is provided, defaults to the current month (1st to 30th).
@@ -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,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,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsB/D;;;;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
+ {"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,EACL,MAAM,EACN,KAAK,aAAa,EAClB,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;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,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBhE;;;;OAIG;IACG,UAAU,CACd,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,GAC/C,OAAO,CAAC,MAAM,EAAE,CAAC;IAUpB;;;;;;;;;;;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"}
@@ -52,8 +52,8 @@ class WalletRepo extends base_repository_js_1.BaseRepository {
52
52
  * @throws {Error} If the wallet fetch operation fails
53
53
  * @returns {Promise<Wallet[]>} Array of wallet objects
54
54
  */
55
- async getWallets() {
56
- const result = await this.client.getWallets();
55
+ async getWallets(args) {
56
+ const result = await this.client.getWallets({ query: args });
57
57
  if (result.status === 200) {
58
58
  return result.body.map((w) => index_js_1.Wallet.from(w));
59
59
  }
@@ -14,7 +14,8 @@ export declare enum PAYOUT_STATUS {
14
14
  /** Payout has been rejected */
15
15
  REJECTED = "REJECTED",
16
16
  /** Payout has been initially created but not yet processed */
17
- CREATED = "CREATED"
17
+ CREATED = "CREATED",
18
+ REVERSED = "REVERSED"
18
19
  }
19
20
  /**
20
21
  * Represents the approval status for payouts that require authorization.
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IAEjB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IAEjB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;IAEnB,QAAQ,aAAa;CACtB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
@@ -19,6 +19,7 @@ var PAYOUT_STATUS;
19
19
  PAYOUT_STATUS["REJECTED"] = "REJECTED";
20
20
  /** Payout has been initially created but not yet processed */
21
21
  PAYOUT_STATUS["CREATED"] = "CREATED";
22
+ PAYOUT_STATUS["REVERSED"] = "REVERSED";
22
23
  })(PAYOUT_STATUS || (exports.PAYOUT_STATUS = PAYOUT_STATUS = {}));
23
24
  /**
24
25
  * Represents the approval status for payouts that require authorization.
@@ -1,19 +1,20 @@
1
+ import { z } from "zod";
1
2
  /**
2
3
  * Collection of wallet-related schemas for export.
3
4
  * Provides access to both wallet and statement entry validation schemas.
4
5
  */
5
6
  export declare const WalletSchemas: {
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, {
7
+ wallet: z.ZodObject<{
8
+ id: z.ZodString;
9
+ profileId: z.ZodString;
10
+ accountNo: z.ZodString;
11
+ accountName: z.ZodString;
12
+ channel: 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
+ createdAt: z.ZodString;
16
+ updatedAt: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
17
18
  id: string;
18
19
  accountNo: string;
19
20
  channel: string;
@@ -34,17 +35,42 @@ export declare const WalletSchemas: {
34
35
  countryCode?: string | undefined;
35
36
  currencyCode?: string | undefined;
36
37
  }>;
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, {
38
+ walletQuery: z.ZodObject<{
39
+ id: z.ZodOptional<z.ZodString>;
40
+ profileId: z.ZodOptional<z.ZodString>;
41
+ accountNo: z.ZodOptional<z.ZodString>;
42
+ accountName: z.ZodOptional<z.ZodString>;
43
+ channel: z.ZodOptional<z.ZodString>;
44
+ countryCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
45
+ currencyCode: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ id?: string | undefined;
48
+ accountNo?: string | undefined;
49
+ channel?: string | undefined;
50
+ profileId?: string | undefined;
51
+ accountName?: string | undefined;
52
+ countryCode?: string | undefined;
53
+ currencyCode?: string | undefined;
54
+ }, {
55
+ id?: string | undefined;
56
+ accountNo?: string | undefined;
57
+ channel?: string | undefined;
58
+ profileId?: string | undefined;
59
+ accountName?: string | undefined;
60
+ countryCode?: string | undefined;
61
+ currencyCode?: string | undefined;
62
+ }>;
63
+ statementEntry: z.ZodObject<{
64
+ accountNo: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
65
+ debitOrCredit: z.ZodString;
66
+ tranRefNo: z.ZodString;
67
+ narration: z.ZodString;
68
+ txnDate: z.ZodDate;
69
+ valueDate: z.ZodDate;
70
+ amountCredited: z.ZodNumber;
71
+ amountDebited: z.ZodNumber;
72
+ balance: z.ZodNumber;
73
+ }, "strip", z.ZodTypeAny, {
48
74
  debitOrCredit: string;
49
75
  tranRefNo: string;
50
76
  narration: string;
@@ -1 +1 @@
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
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/schemas.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIzB,CAAC"}
@@ -3,11 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WalletSchemas = void 0;
4
4
  const wallet_js_1 = require("./wallet.js");
5
5
  const statement_entry_js_1 = require("./statement_entry.js");
6
+ const frontend_core_1 = require("@temboplus/frontend-core");
7
+ const zod_1 = require("zod");
8
+ /**
9
+ * Zod schema definition for validating Wallet data structures.
10
+ * Ensures data integrity for wallet objects, including runtime validation
11
+ * of country codes against the imported ISO2CountryCodesSet.
12
+ */
13
+ const walletQuerySchema = zod_1.z.object({
14
+ id: zod_1.z.string().optional(),
15
+ profileId: zod_1.z.string().optional(),
16
+ accountNo: zod_1.z.string().optional(),
17
+ accountName: zod_1.z.string().optional(),
18
+ channel: zod_1.z.string().optional(),
19
+ // Validate countryCode as a string present in the imported Set
20
+ countryCode: zod_1.z.string().default("TZ")
21
+ .refine((code) => frontend_core_1.ISO2CountryCodesSet.has(code), { message: "Provided country code is not a valid ISO2 code." }).optional(),
22
+ // Validate currencyCode as a string present in the imported Set
23
+ currencyCode: zod_1.z.string().default("TZS")
24
+ .refine((code) => {
25
+ const currency = frontend_core_1.Currency.from(code);
26
+ return currency !== undefined &&
27
+ frontend_core_1.ValidCurrencyCodesSet.has(currency.code);
28
+ }, { message: "Provided currency code is not a valid currency code." }).optional(),
29
+ });
6
30
  /**
7
31
  * Collection of wallet-related schemas for export.
8
32
  * Provides access to both wallet and statement entry validation schemas.
9
33
  */
10
34
  exports.WalletSchemas = {
11
35
  wallet: wallet_js_1.Wallet.schema,
36
+ walletQuery: walletQuerySchema,
12
37
  statementEntry: statement_entry_js_1.WalletStatementEntry.schema,
13
38
  };