@artu-ai/compliance-sdk 0.4.1 → 0.4.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.
Files changed (110) hide show
  1. package/package.json +3 -4
  2. package/src/errors/api.ts +0 -305
  3. package/src/errors/base.ts +0 -127
  4. package/src/errors/index.ts +0 -63
  5. package/src/errors/upload.ts +0 -204
  6. package/src/errors/validation.ts +0 -163
  7. package/src/exports/base.ts +0 -139
  8. package/src/exports/index.ts +0 -187
  9. package/src/exports/mexico/actividad-vulnerable/avi.ts +0 -207
  10. package/src/exports/mexico/actividad-vulnerable/jys.ts +0 -214
  11. package/src/exports/mexico/actividad-vulnerable/tsc.ts +0 -202
  12. package/src/exports/mexico/index.ts +0 -215
  13. package/src/models/Address.ts +0 -235
  14. package/src/models/BankAccount.ts +0 -235
  15. package/src/models/Client.ts +0 -363
  16. package/src/models/ContactMethod.ts +0 -197
  17. package/src/models/Document.ts +0 -355
  18. package/src/models/LinkedClient.ts +0 -84
  19. package/src/models/Report.ts +0 -193
  20. package/src/models/ReportItem.ts +0 -211
  21. package/src/models/Transaction.ts +0 -219
  22. package/src/models/base.ts +0 -56
  23. package/src/models/index.ts +0 -148
  24. package/src/models/mex/MexAddress.ts +0 -184
  25. package/src/models/mex/MexBankAccount.ts +0 -121
  26. package/src/models/mex/MexClient.ts +0 -177
  27. package/src/models/mex/MexDocument.ts +0 -890
  28. package/src/models/mex/MexReport.ts +0 -99
  29. package/src/models/mex/MexReportItem.ts +0 -79
  30. package/src/models/mex/MexTransaction.ts +0 -105
  31. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableClient.ts +0 -66
  32. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReport.ts +0 -73
  33. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.ts +0 -74
  34. package/src/models/mex/actividad-vulnerable/MexActividadVulnerableTransaction.ts +0 -50
  35. package/src/models/mex/actividad-vulnerable/avi/MexAVIClient.ts +0 -80
  36. package/src/models/mex/actividad-vulnerable/avi/MexAVIReport.ts +0 -114
  37. package/src/models/mex/actividad-vulnerable/avi/MexAVIReportItem.ts +0 -105
  38. package/src/models/mex/actividad-vulnerable/avi/MexAVITransaction.ts +0 -157
  39. package/src/models/mex/actividad-vulnerable/index.ts +0 -78
  40. package/src/models/mex/actividad-vulnerable/jys/MexJYSClient.ts +0 -73
  41. package/src/models/mex/actividad-vulnerable/jys/MexJYSReport.ts +0 -114
  42. package/src/models/mex/actividad-vulnerable/jys/MexJYSReportItem.ts +0 -105
  43. package/src/models/mex/actividad-vulnerable/jys/MexJYSTransaction.ts +0 -178
  44. package/src/models/mex/actividad-vulnerable/tsc/MexTSCClient.ts +0 -73
  45. package/src/models/mex/actividad-vulnerable/tsc/MexTSCReport.ts +0 -114
  46. package/src/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.ts +0 -105
  47. package/src/models/mex/actividad-vulnerable/tsc/MexTSCTransaction.ts +0 -104
  48. package/src/models/mex/index.ts +0 -57
  49. package/src/models/types.ts +0 -196
  50. package/src/namespaces/index.ts +0 -29
  51. package/src/namespaces/mexico/actividad-vulnerable/avi/index.ts +0 -62
  52. package/src/namespaces/mexico/actividad-vulnerable/index.ts +0 -79
  53. package/src/namespaces/mexico/actividad-vulnerable/jys/index.ts +0 -72
  54. package/src/namespaces/mexico/actividad-vulnerable/tsc/index.ts +0 -60
  55. package/src/namespaces/mexico/index.ts +0 -325
  56. package/src/resources/addresses.ts +0 -391
  57. package/src/resources/bank-accounts.ts +0 -417
  58. package/src/resources/base.ts +0 -327
  59. package/src/resources/clients.ts +0 -808
  60. package/src/resources/contact-methods.ts +0 -412
  61. package/src/resources/documents.ts +0 -688
  62. package/src/resources/index.ts +0 -40
  63. package/src/resources/mex/actividad-vulnerable/avi/clients.ts +0 -559
  64. package/src/resources/mex/actividad-vulnerable/avi/index.ts +0 -7
  65. package/src/resources/mex/actividad-vulnerable/avi/reports.ts +0 -609
  66. package/src/resources/mex/actividad-vulnerable/avi/transactions.ts +0 -404
  67. package/src/resources/mex/actividad-vulnerable/index.ts +0 -12
  68. package/src/resources/mex/actividad-vulnerable/jys/clients.ts +0 -445
  69. package/src/resources/mex/actividad-vulnerable/jys/index.ts +0 -7
  70. package/src/resources/mex/actividad-vulnerable/jys/reports.ts +0 -591
  71. package/src/resources/mex/actividad-vulnerable/jys/transactions.ts +0 -395
  72. package/src/resources/mex/actividad-vulnerable/tsc/clients.ts +0 -445
  73. package/src/resources/mex/actividad-vulnerable/tsc/index.ts +0 -7
  74. package/src/resources/mex/actividad-vulnerable/tsc/reports.ts +0 -591
  75. package/src/resources/mex/actividad-vulnerable/tsc/transactions.ts +0 -404
  76. package/src/resources/mex/addresses.ts +0 -493
  77. package/src/resources/mex/bank-accounts.ts +0 -283
  78. package/src/resources/mex/clients.ts +0 -758
  79. package/src/resources/mex/ebr.ts +0 -621
  80. package/src/resources/mex/index.ts +0 -23
  81. package/src/resources/mex/reports.ts +0 -643
  82. package/src/resources/mex/transactions.ts +0 -422
  83. package/src/resources/reports.ts +0 -515
  84. package/src/resources/transactions.ts +0 -358
  85. package/src/sdk/ComplianceSDK.ts +0 -812
  86. package/src/sdk/base.ts +0 -43
  87. package/src/sdk/index.ts +0 -98
  88. package/src/sdk/mex/ComplianceSDK.ts +0 -147
  89. package/src/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.ts +0 -55
  90. package/src/sdk/mex/actividad-vulnerable/avi/index.ts +0 -16
  91. package/src/sdk/mex/actividad-vulnerable/avi/types.ts +0 -86
  92. package/src/sdk/mex/actividad-vulnerable/index.ts +0 -58
  93. package/src/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.ts +0 -54
  94. package/src/sdk/mex/actividad-vulnerable/jys/index.ts +0 -16
  95. package/src/sdk/mex/actividad-vulnerable/jys/types.ts +0 -86
  96. package/src/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.ts +0 -54
  97. package/src/sdk/mex/actividad-vulnerable/tsc/index.ts +0 -16
  98. package/src/sdk/mex/actividad-vulnerable/tsc/types.ts +0 -86
  99. package/src/sdk/mex/index.ts +0 -66
  100. package/src/sdk/mex/types.ts +0 -88
  101. package/src/sdk/resource-registry.ts +0 -204
  102. package/src/sdk/sdk-registry.ts +0 -99
  103. package/src/sdk/types.ts +0 -304
  104. package/src/utils/environment.ts +0 -187
  105. package/src/utils/filters.ts +0 -412
  106. package/src/utils/index.ts +0 -134
  107. package/src/utils/pagination.ts +0 -143
  108. package/src/utils/session.ts +0 -303
  109. package/src/utils/trpc-client.ts +0 -242
  110. package/src/utils/upload.ts +0 -388
@@ -1,215 +0,0 @@
1
- /**
2
- * @artu/compliance-sdk/mexico
3
- *
4
- * Mexico-scoped SDK entry point.
5
- * Import from here for Mexico-specific compliance workflows.
6
- *
7
- * @example
8
- * ```typescript
9
- * import {
10
- * ComplianceSDK,
11
- * ActividadVulnerable,
12
- * Enums,
13
- * Validators,
14
- * Models,
15
- * Resources,
16
- * TypeGuards,
17
- * } from "@artu/compliance-sdk/mexico";
18
- *
19
- * const sdk = new ComplianceSDK({
20
- * apiKey: process.env.COMPLIANCE_API_KEY!,
21
- * jurisdiction: "MX",
22
- * });
23
- *
24
- * // Access Mexico-specific enums directly
25
- * Enums.ActividadEconomica.Comercio
26
- * Enums.DocumentType.INE
27
- *
28
- * // Validate Mexican identifiers
29
- * Validators.Rfc.validate("GOAP820528H00")
30
- *
31
- * // Actividad Vulnerable namespace for AML compliance
32
- * ActividadVulnerable.AVI.Enums.TipoOperacion.Buy
33
- * ```
34
- */
35
-
36
- // ===========================
37
- // SDK
38
- // ===========================
39
-
40
- import {
41
- MexicoComplianceSDKScoped,
42
- type MexicoScopedSDKOptions,
43
- } from "../../sdk/mex";
44
-
45
- /** Options for Mexico-scoped SDK */
46
- export type ComplianceSDKOptions = MexicoScopedSDKOptions;
47
-
48
- /** Mexico-scoped ComplianceSDK - re-exported from sdk */
49
- export { MexicoComplianceSDKScoped as ComplianceSDK };
50
-
51
- // ===========================
52
- // Mexico Namespace Contents (flat exports)
53
- // ===========================
54
-
55
- export {
56
- Enums,
57
- Validators,
58
- Models,
59
- Resources,
60
- TypeGuards,
61
- type Types,
62
- } from "../../namespaces/mexico";
63
-
64
- // ===========================
65
- // Actividad Vulnerable Namespace
66
- // ===========================
67
-
68
- export { ActividadVulnerable, AVI, JYS, TSC } from "../../namespaces/mexico";
69
-
70
- // ===========================
71
- // Types
72
- // ===========================
73
-
74
- export type {
75
- MexJurisdictionData,
76
- MexPersonJurisdictionData,
77
- MexCompanyJurisdictionData,
78
- MexTrustJurisdictionData,
79
- ActividadVulnerableClientData,
80
- MexBankAccountData,
81
- MexDocument,
82
- CreateMexDocumentInput,
83
- UpdateMexDocumentInput,
84
- // Document field types
85
- IneFrontFields,
86
- IneBackFields,
87
- CurpDocumentFields,
88
- RfcConstanciaFields,
89
- AddressProofFields,
90
- ActaConstitutivaFields,
91
- PoderNotarialFields,
92
- // Create input types per document type
93
- CreateMexIneFrontInput,
94
- CreateMexIneBackInput,
95
- CreateMexPassportInput,
96
- CreateMexCurpInput,
97
- CreateMexRfcConstanciaInput,
98
- CreateMexAddressProofInput,
99
- CreateMexActaConstitutivaInput,
100
- CreateMexPoderNotarialInput,
101
- // Update input types per document type
102
- UpdateMexIneFrontInput,
103
- UpdateMexIneBackInput,
104
- UpdateMexPassportInput,
105
- UpdateMexCurpInput,
106
- UpdateMexRfcConstanciaInput,
107
- UpdateMexAddressProofInput,
108
- UpdateMexActaConstitutivaInput,
109
- UpdateMexPoderNotarialInput,
110
- } from "../../namespaces/mexico";
111
-
112
- // ===========================
113
- // Models (Mexico scoped) - direct exports
114
- // ===========================
115
-
116
- export {
117
- MexClient as Client,
118
- MexTransaction as Transaction,
119
- MexBankAccount as BankAccount,
120
- MexAddress as Address,
121
- MexReport as Report,
122
- MexReportItem as ReportItem,
123
- // Document models
124
- MexDocument as Document,
125
- MexIneFrontDocument as IneFrontDocument,
126
- MexIneBackDocument as IneBackDocument,
127
- MexPassportDocument as PassportDocument,
128
- MexCurpDocument as CurpDocument,
129
- MexRfcConstanciaDocument as RfcConstanciaDocument,
130
- MexAddressProofDocument as AddressProofDocument,
131
- MexActaConstitutivaDocument as ActaConstitutivaDocument,
132
- MexPoderNotarialDocument as PoderNotarialDocument,
133
- // Types
134
- type MexClientData as ClientData,
135
- type MexTransactionData as TransactionData,
136
- type MexBankAccountData as BankAccountData,
137
- type MexAddressData as AddressData,
138
- type MexReportData as ReportData,
139
- type MexReportItemData as ReportItemData,
140
- } from "../../models";
141
-
142
- // ===========================
143
- // Resources (Mexico scoped) - direct exports
144
- // ===========================
145
-
146
- export {
147
- MexClientsResource as ClientsResource,
148
- MexTransactionsResource as TransactionsResource,
149
- MexBankAccountsResource as BankAccountsResource,
150
- MexReportsResource as ReportsResource,
151
- // EBR (Evaluación Basada en Riesgos) resource
152
- EBRResource,
153
- type EBRResourceContext,
154
- type EBRPresetsResource,
155
- type EBRWeightsResource,
156
- type EBRThresholdsResource,
157
- type EBRRiskLevelResource,
158
- type WeightPreset,
159
- type PresetConfidence,
160
- } from "../../resources";
161
-
162
- // ===========================
163
- // TypeGuards (Mexico scoped) - direct exports
164
- // ===========================
165
-
166
- export {
167
- isMexClient as isClient,
168
- isMexTransaction as isTransaction,
169
- isMexBankAccount as isBankAccount,
170
- isMexAddress as isAddress,
171
- isMexReport as isReport,
172
- isMexReportItem as isReportItem,
173
- // Document guards
174
- isMexDocument as isDocument,
175
- isMexIneFront as isIneFront,
176
- isMexIneBack as isIneBack,
177
- isMexPassport as isPassport,
178
- isMexCurp as isCurp,
179
- isMexRfcConstancia as isRfcConstancia,
180
- isMexAddressProof as isAddressProof,
181
- isMexActaConstitutiva as isActaConstitutiva,
182
- isMexPoderNotarial as isPoderNotarial,
183
- } from "../../models";
184
-
185
- // ===========================
186
- // Scoped Types (Mexico) - aliased for convenience
187
- // ===========================
188
-
189
- export type {
190
- // Client types
191
- CreateMexClientInput as CreateClientInput,
192
- UpdateMexClientInput as UpdateClientInput,
193
- // Transaction types
194
- CreateMexTransactionInput as CreateTransactionInput,
195
- UpdateMexTransactionInput as UpdateTransactionInput,
196
- // Report types
197
- CreateMexReportInput as CreateReportInput,
198
- UpdateMexReportInput as UpdateReportInput,
199
- CreateMexReportItemInput as CreateReportItemInput,
200
- UpdateMexReportItemInput as UpdateReportItemInput,
201
- ReportValidationError,
202
- ValidationSummary,
203
- ValidationResult,
204
- GenerateResult,
205
- SubmissionResult,
206
- // Bank account types
207
- CreateMexBankAccountInput as CreateBankAccountInput,
208
- UpdateMexBankAccountInput as UpdateBankAccountInput,
209
- } from "@artu-ai/shared";
210
-
211
- // ===========================
212
- // Base Exports (errors, utilities, base models/resources)
213
- // ===========================
214
-
215
- export * from "../base";
@@ -1,235 +0,0 @@
1
- /**
2
- * Address Model
3
- *
4
- * Physical or mailing address for a client.
5
- */
6
-
7
- import {
8
- AddressType,
9
- type Address as AddressSchema,
10
- type CountryIso2,
11
- } from "@artu-ai/shared";
12
- import { BaseModel } from "./base";
13
-
14
- // ===========================
15
- // Types
16
- // ===========================
17
-
18
- /**
19
- * Address data structure from the API
20
- */
21
- export interface AddressData extends AddressSchema {
22
- id: string;
23
- createdAt: string;
24
- updatedAt: string;
25
- }
26
-
27
- // ===========================
28
- // Address Model
29
- // ===========================
30
-
31
- /**
32
- * Address Model.
33
- *
34
- * Provides typed accessors for address data with formatting helpers.
35
- *
36
- * @example
37
- * ```typescript
38
- * const addresses = await sdk.addresses.listByClient("client_123");
39
- * for (const addr of addresses) {
40
- * console.log(addr.formatted);
41
- * console.log(`Primary: ${addr.isPrimary}`);
42
- * }
43
- * ```
44
- */
45
- export class Address extends BaseModel<AddressData> {
46
- // ─────────────────────────────────────────────────────────────────
47
- // Core Properties
48
- // ─────────────────────────────────────────────────────────────────
49
-
50
- /**
51
- * Unique address identifier
52
- */
53
- get id(): string {
54
- return this._data.id;
55
- }
56
-
57
- /**
58
- * ID of the client this address belongs to
59
- */
60
- get clientId(): string {
61
- return this._data.clientId;
62
- }
63
-
64
- /**
65
- * Address type (home, business, mailing, legal, other)
66
- */
67
- get type(): AddressType {
68
- return this._data.type;
69
- }
70
-
71
- /**
72
- * Whether this is the primary address
73
- */
74
- get isPrimary(): boolean {
75
- return this._data.isPrimary ?? false;
76
- }
77
-
78
- // ─────────────────────────────────────────────────────────────────
79
- // Address Fields
80
- // ─────────────────────────────────────────────────────────────────
81
-
82
- /**
83
- * Street address line
84
- */
85
- get street(): string {
86
- return this._data.street;
87
- }
88
-
89
- /**
90
- * City name
91
- */
92
- get city(): string {
93
- return this._data.city;
94
- }
95
-
96
- /**
97
- * State or province
98
- */
99
- get state(): string {
100
- return this._data.state;
101
- }
102
-
103
- /**
104
- * Postal/ZIP code
105
- */
106
- get postalCode(): string {
107
- return this._data.postalCode;
108
- }
109
-
110
- /**
111
- * Country code (ISO 3166-1 alpha-2)
112
- */
113
- get country(): CountryIso2 {
114
- return this._data.country;
115
- }
116
-
117
- // ─────────────────────────────────────────────────────────────────
118
- // Jurisdictions & Metadata
119
- // ─────────────────────────────────────────────────────────────────
120
-
121
- /**
122
- * Jurisdiction-scoped data
123
- * (e.g., Mexico: exteriorNumber, neighborhood)
124
- */
125
- get jurisdictions(): AddressSchema["jurisdictions"] {
126
- return this._data.jurisdictions;
127
- }
128
-
129
- /**
130
- * External ID
131
- */
132
- get externalId(): string | undefined {
133
- return this._data.externalId;
134
- }
135
-
136
- /**
137
- * Additional metadata
138
- */
139
- get metadata(): Record<string, unknown> | undefined {
140
- return this._data.metadata;
141
- }
142
-
143
- /**
144
- * When the address was created
145
- */
146
- get createdAt(): Date {
147
- return new Date(this._data.createdAt);
148
- }
149
-
150
- /**
151
- * When the address was last updated
152
- */
153
- get updatedAt(): Date {
154
- return new Date(this._data.updatedAt);
155
- }
156
-
157
- // ─────────────────────────────────────────────────────────────────
158
- // Type Helpers
159
- // ─────────────────────────────────────────────────────────────────
160
-
161
- /**
162
- * Whether this is a home address
163
- */
164
- get isHome(): boolean {
165
- return this.type === AddressType.Home;
166
- }
167
-
168
- /**
169
- * Whether this is a business address
170
- */
171
- get isBusiness(): boolean {
172
- return this.type === AddressType.Business;
173
- }
174
-
175
- /**
176
- * Whether this is a mailing address
177
- */
178
- get isMailing(): boolean {
179
- return this.type === AddressType.Mailing;
180
- }
181
-
182
- /**
183
- * Whether this is a legal address
184
- */
185
- get isLegal(): boolean {
186
- return this.type === AddressType.Legal;
187
- }
188
-
189
- // ─────────────────────────────────────────────────────────────────
190
- // Formatting
191
- // ─────────────────────────────────────────────────────────────────
192
-
193
- /**
194
- * Returns a formatted single-line address string
195
- */
196
- get formatted(): string {
197
- const parts = [
198
- this.street,
199
- `${this.city}, ${this.state} ${this.postalCode}`,
200
- this.country,
201
- ].filter(Boolean);
202
- return parts.join(", ");
203
- }
204
-
205
- /**
206
- * Returns a formatted multi-line address string
207
- */
208
- get formattedMultiLine(): string {
209
- const lines = [
210
- this.street,
211
- `${this.city}, ${this.state} ${this.postalCode}`,
212
- this.country,
213
- ].filter(Boolean);
214
- return lines.join("\n");
215
- }
216
-
217
- // ─────────────────────────────────────────────────────────────────
218
- // String Representation
219
- // ─────────────────────────────────────────────────────────────────
220
-
221
- override toString(): string {
222
- return `Address(${this.id}, ${this.type}, ${this.city})`;
223
- }
224
- }
225
-
226
- // ===========================
227
- // Type Guards
228
- // ===========================
229
-
230
- /**
231
- * Check if value is any type of Address model
232
- */
233
- export function isAddress(value: unknown): value is Address {
234
- return value instanceof Address;
235
- }
@@ -1,235 +0,0 @@
1
- /**
2
- * BankAccount Model
3
- *
4
- * Bank account information for a client.
5
- * Uses discriminated union based on `country` field.
6
- */
7
-
8
- import {
9
- BankAccountType,
10
- type BankAccount as BankAccountSchema,
11
- type CurrencyCode,
12
- } from "@artu-ai/shared";
13
- import { BaseModel } from "./base";
14
-
15
- // ===========================
16
- // Types
17
- // ===========================
18
-
19
- /**
20
- * Bank account data structure from the API (discriminated union)
21
- */
22
- export type BankAccountData = BankAccountSchema;
23
-
24
- // ===========================
25
- // BankAccount Model
26
- // ===========================
27
-
28
- /**
29
- * BankAccount Model.
30
- *
31
- * Base class for bank account data. The concrete type depends on
32
- * the `country` field:
33
- * - `country === "MX"` → MexBankAccount with clabe, codigoBanco, codigoPlaza
34
- * - Other countries → GenericBankAccount
35
- *
36
- * @example
37
- * ```typescript
38
- * const account = await sdk.bankAccounts.retrieve(id);
39
- *
40
- * // Check country for type narrowing
41
- * if (account.country === "MX") {
42
- * console.log(account.clabe); // MexBankAccount
43
- * }
44
- * ```
45
- */
46
- export class BankAccount extends BaseModel<BankAccountData> {
47
- // ─────────────────────────────────────────────────────────────────
48
- // Core Properties
49
- // ─────────────────────────────────────────────────────────────────
50
-
51
- /**
52
- * Unique bank account identifier
53
- */
54
- get id(): string {
55
- return this._data.id;
56
- }
57
-
58
- /**
59
- * ID of the client this bank account belongs to
60
- */
61
- get clientId(): string {
62
- return this._data.clientId;
63
- }
64
-
65
- /**
66
- * Account number
67
- */
68
- get accountNumber(): string {
69
- return this._data.accountNumber;
70
- }
71
-
72
- /**
73
- * Bank name
74
- */
75
- get bankName(): string {
76
- return this._data.bankName;
77
- }
78
-
79
- /**
80
- * Bank code (e.g., SWIFT, routing number)
81
- */
82
- get bankCode(): string | undefined {
83
- return this._data.bankCode;
84
- }
85
-
86
- /**
87
- * Country where the bank account is held (ISO 3166-1 alpha-2)
88
- *
89
- * This is the discriminator field - determines which fields are available.
90
- */
91
- get country(): string {
92
- return this._data.country;
93
- }
94
-
95
- /**
96
- * Account type (checking, savings, investment, other)
97
- */
98
- get type(): BankAccountType {
99
- return this._data.type;
100
- }
101
-
102
- /**
103
- * Account currency (ISO 4217 code)
104
- */
105
- get currency(): CurrencyCode {
106
- return this._data.currency;
107
- }
108
-
109
- // ─────────────────────────────────────────────────────────────────
110
- // Status
111
- // ─────────────────────────────────────────────────────────────────
112
-
113
- /**
114
- * Whether this is the primary bank account
115
- */
116
- get isPrimary(): boolean {
117
- return this._data.isPrimary ?? false;
118
- }
119
-
120
- /**
121
- * Whether this account is active
122
- */
123
- get isActive(): boolean {
124
- return this._data.isActive ?? true;
125
- }
126
-
127
- // ─────────────────────────────────────────────────────────────────
128
- // Metadata
129
- // ─────────────────────────────────────────────────────────────────
130
-
131
- /**
132
- * Optional label (e.g., "Personal Checking")
133
- */
134
- get label(): string | undefined {
135
- return this._data.label;
136
- }
137
-
138
- /**
139
- * External ID
140
- */
141
- get externalId(): string | undefined {
142
- return this._data.externalId;
143
- }
144
-
145
- /**
146
- * Additional metadata
147
- */
148
- get metadata(): Record<string, unknown> | undefined {
149
- return this._data.metadata;
150
- }
151
-
152
- /**
153
- * When the bank account was created
154
- */
155
- get createdAt(): Date {
156
- return new Date(this._data.createdAt);
157
- }
158
-
159
- /**
160
- * When the bank account was last updated
161
- */
162
- get updatedAt(): Date {
163
- return new Date(this._data.updatedAt);
164
- }
165
-
166
- // ─────────────────────────────────────────────────────────────────
167
- // Type Helpers
168
- // ─────────────────────────────────────────────────────────────────
169
-
170
- /**
171
- * Whether this is a checking account
172
- */
173
- get isChecking(): boolean {
174
- return this.type === BankAccountType.Checking;
175
- }
176
-
177
- /**
178
- * Whether this is a savings account
179
- */
180
- get isSavings(): boolean {
181
- return this.type === BankAccountType.Savings;
182
- }
183
-
184
- /**
185
- * Whether this is an investment account
186
- */
187
- get isInvestment(): boolean {
188
- return this.type === BankAccountType.Investment;
189
- }
190
-
191
- /**
192
- * Whether this is a Mexican bank account
193
- */
194
- get isMexican(): boolean {
195
- return this.country === "MX";
196
- }
197
-
198
- // ─────────────────────────────────────────────────────────────────
199
- // Formatting
200
- // ─────────────────────────────────────────────────────────────────
201
-
202
- /**
203
- * Returns a masked account number (shows last 4 digits)
204
- */
205
- get maskedAccountNumber(): string {
206
- const lastFour = this.accountNumber.slice(-4);
207
- return `****${lastFour}`;
208
- }
209
-
210
- /**
211
- * Returns a display string with bank name and masked account
212
- */
213
- get display(): string {
214
- return `${this.bankName} (${this.maskedAccountNumber})`;
215
- }
216
-
217
- // ─────────────────────────────────────────────────────────────────
218
- // String Representation
219
- // ─────────────────────────────────────────────────────────────────
220
-
221
- override toString(): string {
222
- return `BankAccount(${this.id}, ${this.bankName}, ${this.country})`;
223
- }
224
- }
225
-
226
- // ===========================
227
- // Type Guards
228
- // ===========================
229
-
230
- /**
231
- * Check if value is any type of BankAccount model
232
- */
233
- export function isBankAccount(value: unknown): value is BankAccount {
234
- return value instanceof BankAccount;
235
- }