@artu-ai/compliance-sdk 0.4.1 → 0.4.3
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.
- package/package.json +3 -4
- package/src/errors/api.ts +0 -305
- package/src/errors/base.ts +0 -127
- package/src/errors/index.ts +0 -63
- package/src/errors/upload.ts +0 -204
- package/src/errors/validation.ts +0 -163
- package/src/exports/base.ts +0 -139
- package/src/exports/index.ts +0 -187
- package/src/exports/mexico/actividad-vulnerable/avi.ts +0 -207
- package/src/exports/mexico/actividad-vulnerable/jys.ts +0 -214
- package/src/exports/mexico/actividad-vulnerable/tsc.ts +0 -202
- package/src/exports/mexico/index.ts +0 -215
- package/src/models/Address.ts +0 -235
- package/src/models/BankAccount.ts +0 -235
- package/src/models/Client.ts +0 -363
- package/src/models/ContactMethod.ts +0 -197
- package/src/models/Document.ts +0 -355
- package/src/models/LinkedClient.ts +0 -84
- package/src/models/Report.ts +0 -193
- package/src/models/ReportItem.ts +0 -211
- package/src/models/Transaction.ts +0 -219
- package/src/models/base.ts +0 -56
- package/src/models/index.ts +0 -148
- package/src/models/mex/MexAddress.ts +0 -184
- package/src/models/mex/MexBankAccount.ts +0 -121
- package/src/models/mex/MexClient.ts +0 -177
- package/src/models/mex/MexDocument.ts +0 -890
- package/src/models/mex/MexReport.ts +0 -99
- package/src/models/mex/MexReportItem.ts +0 -79
- package/src/models/mex/MexTransaction.ts +0 -105
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableClient.ts +0 -66
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReport.ts +0 -73
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableReportItem.ts +0 -74
- package/src/models/mex/actividad-vulnerable/MexActividadVulnerableTransaction.ts +0 -50
- package/src/models/mex/actividad-vulnerable/avi/MexAVIClient.ts +0 -80
- package/src/models/mex/actividad-vulnerable/avi/MexAVIReport.ts +0 -114
- package/src/models/mex/actividad-vulnerable/avi/MexAVIReportItem.ts +0 -105
- package/src/models/mex/actividad-vulnerable/avi/MexAVITransaction.ts +0 -157
- package/src/models/mex/actividad-vulnerable/index.ts +0 -78
- package/src/models/mex/actividad-vulnerable/jys/MexJYSClient.ts +0 -73
- package/src/models/mex/actividad-vulnerable/jys/MexJYSReport.ts +0 -114
- package/src/models/mex/actividad-vulnerable/jys/MexJYSReportItem.ts +0 -105
- package/src/models/mex/actividad-vulnerable/jys/MexJYSTransaction.ts +0 -178
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCClient.ts +0 -73
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCReport.ts +0 -114
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCReportItem.ts +0 -105
- package/src/models/mex/actividad-vulnerable/tsc/MexTSCTransaction.ts +0 -104
- package/src/models/mex/index.ts +0 -57
- package/src/models/types.ts +0 -196
- package/src/namespaces/index.ts +0 -29
- package/src/namespaces/mexico/actividad-vulnerable/avi/index.ts +0 -62
- package/src/namespaces/mexico/actividad-vulnerable/index.ts +0 -79
- package/src/namespaces/mexico/actividad-vulnerable/jys/index.ts +0 -72
- package/src/namespaces/mexico/actividad-vulnerable/tsc/index.ts +0 -60
- package/src/namespaces/mexico/index.ts +0 -325
- package/src/resources/addresses.ts +0 -391
- package/src/resources/bank-accounts.ts +0 -417
- package/src/resources/base.ts +0 -327
- package/src/resources/clients.ts +0 -808
- package/src/resources/contact-methods.ts +0 -412
- package/src/resources/documents.ts +0 -688
- package/src/resources/index.ts +0 -40
- package/src/resources/mex/actividad-vulnerable/avi/clients.ts +0 -559
- package/src/resources/mex/actividad-vulnerable/avi/index.ts +0 -7
- package/src/resources/mex/actividad-vulnerable/avi/reports.ts +0 -609
- package/src/resources/mex/actividad-vulnerable/avi/transactions.ts +0 -404
- package/src/resources/mex/actividad-vulnerable/index.ts +0 -12
- package/src/resources/mex/actividad-vulnerable/jys/clients.ts +0 -445
- package/src/resources/mex/actividad-vulnerable/jys/index.ts +0 -7
- package/src/resources/mex/actividad-vulnerable/jys/reports.ts +0 -591
- package/src/resources/mex/actividad-vulnerable/jys/transactions.ts +0 -395
- package/src/resources/mex/actividad-vulnerable/tsc/clients.ts +0 -445
- package/src/resources/mex/actividad-vulnerable/tsc/index.ts +0 -7
- package/src/resources/mex/actividad-vulnerable/tsc/reports.ts +0 -591
- package/src/resources/mex/actividad-vulnerable/tsc/transactions.ts +0 -404
- package/src/resources/mex/addresses.ts +0 -493
- package/src/resources/mex/bank-accounts.ts +0 -283
- package/src/resources/mex/clients.ts +0 -758
- package/src/resources/mex/ebr.ts +0 -621
- package/src/resources/mex/index.ts +0 -23
- package/src/resources/mex/reports.ts +0 -643
- package/src/resources/mex/transactions.ts +0 -422
- package/src/resources/reports.ts +0 -515
- package/src/resources/transactions.ts +0 -358
- package/src/sdk/ComplianceSDK.ts +0 -812
- package/src/sdk/base.ts +0 -43
- package/src/sdk/index.ts +0 -98
- package/src/sdk/mex/ComplianceSDK.ts +0 -147
- package/src/sdk/mex/actividad-vulnerable/avi/ComplianceSDK.ts +0 -55
- package/src/sdk/mex/actividad-vulnerable/avi/index.ts +0 -16
- package/src/sdk/mex/actividad-vulnerable/avi/types.ts +0 -86
- package/src/sdk/mex/actividad-vulnerable/index.ts +0 -58
- package/src/sdk/mex/actividad-vulnerable/jys/ComplianceSDK.ts +0 -54
- package/src/sdk/mex/actividad-vulnerable/jys/index.ts +0 -16
- package/src/sdk/mex/actividad-vulnerable/jys/types.ts +0 -86
- package/src/sdk/mex/actividad-vulnerable/tsc/ComplianceSDK.ts +0 -54
- package/src/sdk/mex/actividad-vulnerable/tsc/index.ts +0 -16
- package/src/sdk/mex/actividad-vulnerable/tsc/types.ts +0 -86
- package/src/sdk/mex/index.ts +0 -66
- package/src/sdk/mex/types.ts +0 -88
- package/src/sdk/resource-registry.ts +0 -204
- package/src/sdk/sdk-registry.ts +0 -99
- package/src/sdk/types.ts +0 -304
- package/src/utils/environment.ts +0 -187
- package/src/utils/filters.ts +0 -412
- package/src/utils/index.ts +0 -134
- package/src/utils/pagination.ts +0 -143
- package/src/utils/session.ts +0 -303
- package/src/utils/trpc-client.ts +0 -242
- package/src/utils/upload.ts +0 -388
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mexico Transactions Resource
|
|
3
|
-
*
|
|
4
|
-
* Extends TransactionsResource with Mexico-specific behavior:
|
|
5
|
-
* - Accepts flattened CreateMexTransactionInput (MX fields at root level)
|
|
6
|
-
* - Automatically sets primaryJurisdiction to Mexico
|
|
7
|
-
* - Filters list/iterate to Mexico transactions only
|
|
8
|
-
* - Returns MexTransaction models
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
import type {
|
|
13
|
-
CreateTransactionInput,
|
|
14
|
-
UpdateTransactionInput,
|
|
15
|
-
TransactionFilter,
|
|
16
|
-
TransactionSort,
|
|
17
|
-
ListOptions,
|
|
18
|
-
PaginatedResponse,
|
|
19
|
-
CreateMexTransactionInput,
|
|
20
|
-
UpdateMexTransactionInput,
|
|
21
|
-
AtomicBatchResult,
|
|
22
|
-
PartialBatchResult,
|
|
23
|
-
RelatedClient,
|
|
24
|
-
MexTransactionFilter,
|
|
25
|
-
MexTransactionSort,
|
|
26
|
-
} from "@artu-ai/shared";
|
|
27
|
-
import {
|
|
28
|
-
Jurisdiction,
|
|
29
|
-
createMexTransactionInputSchema,
|
|
30
|
-
updateMexTransactionInputSchema,
|
|
31
|
-
ClientRole,
|
|
32
|
-
transformSort,
|
|
33
|
-
mexTransactionFieldMapping,
|
|
34
|
-
} from "@artu-ai/shared";
|
|
35
|
-
import { TransactionsResource } from "../transactions";
|
|
36
|
-
import { type BatchOptions } from "../clients";
|
|
37
|
-
import { MexTransaction, type TransactionData } from "../../models";
|
|
38
|
-
|
|
39
|
-
// ===========================
|
|
40
|
-
// MexTransactionsResource
|
|
41
|
-
// ===========================
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Mexico-scoped transactions resource.
|
|
45
|
-
*
|
|
46
|
-
* Provides the same operations as TransactionsResource but with:
|
|
47
|
-
* - Flattened input types (MX fields at root level)
|
|
48
|
-
* - Automatic jurisdiction scoping
|
|
49
|
-
* - MexTransaction model return type
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* const mexSdk = new ComplianceSDK({
|
|
54
|
-
* apiKey,
|
|
55
|
-
* environment: "test",
|
|
56
|
-
* jurisdiction: Jurisdiction.Mexico,
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* // Create with flattened input
|
|
60
|
-
* const txn = await mexSdk.transactions.create({
|
|
61
|
-
* amount: 50000,
|
|
62
|
-
* currency: "MXN",
|
|
63
|
-
* timestamp: new Date(),
|
|
64
|
-
* actividadVulnerable: {
|
|
65
|
-
* AVI: { tipoOperacion: "compra" },
|
|
66
|
-
* },
|
|
67
|
-
* });
|
|
68
|
-
*
|
|
69
|
-
* // List returns only Mexico transactions
|
|
70
|
-
* const { data } = await mexSdk.transactions.list();
|
|
71
|
-
* // data is MexTransaction[]
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export class MexTransactionsResource<
|
|
75
|
-
TSort = MexTransactionSort,
|
|
76
|
-
> extends TransactionsResource<TSort> {
|
|
77
|
-
// ─────────────────────────────────────────────────────────────────
|
|
78
|
-
// CRUD Operations (override with flattened input types)
|
|
79
|
-
// ─────────────────────────────────────────────────────────────────
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Creates a new Mexico transaction with flattened input.
|
|
83
|
-
*/
|
|
84
|
-
async create(data: CreateMexTransactionInput): Promise<MexTransaction> {
|
|
85
|
-
const validated = this.validate(createMexTransactionInputSchema, data);
|
|
86
|
-
const nestedData = this.transformToNested(validated);
|
|
87
|
-
|
|
88
|
-
const response = await this.execute(() =>
|
|
89
|
-
this.trpc.transactions.create.mutate(nestedData)
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
return this.instantiate(response);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Retrieves a transaction by ID.
|
|
97
|
-
*/
|
|
98
|
-
async retrieve(id: string): Promise<MexTransaction> {
|
|
99
|
-
const response = await this.execute(() =>
|
|
100
|
-
this.trpc.transactions.retrieve.query({ id })
|
|
101
|
-
);
|
|
102
|
-
return this.instantiate(response);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async retrieveByMetadata(
|
|
106
|
-
key: string,
|
|
107
|
-
value: string
|
|
108
|
-
): Promise<MexTransaction> {
|
|
109
|
-
const response = await this.execute(() =>
|
|
110
|
-
this.trpc.transactions.retrieveByMetadata.query({ key, value })
|
|
111
|
-
);
|
|
112
|
-
return this.instantiate(response);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async retrieveByExternalId(externalId: string): Promise<MexTransaction> {
|
|
116
|
-
const response = await this.execute(() =>
|
|
117
|
-
this.trpc.transactions.retrieveByExternalId.query({ externalId })
|
|
118
|
-
);
|
|
119
|
-
return this.instantiate(response);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Updates a Mexico transaction with flattened input.
|
|
124
|
-
*/
|
|
125
|
-
async update(
|
|
126
|
-
id: string,
|
|
127
|
-
data: UpdateMexTransactionInput
|
|
128
|
-
): Promise<MexTransaction> {
|
|
129
|
-
const validated = this.validate(updateMexTransactionInputSchema, data);
|
|
130
|
-
const nestedData = this.transformUpdateToNested(validated);
|
|
131
|
-
|
|
132
|
-
const response = await this.execute(() =>
|
|
133
|
-
this.trpc.transactions.update.mutate({ id, data: nestedData })
|
|
134
|
-
);
|
|
135
|
-
return this.instantiate(response);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// ─────────────────────────────────────────────────────────────────
|
|
139
|
-
// List & Pagination (scoped to Mexico)
|
|
140
|
-
// ─────────────────────────────────────────────────────────────────
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Lists Mexico transactions with optional filtering.
|
|
144
|
-
*
|
|
145
|
-
* Accepts flattened MX filter (future MX-specific transaction fields at root level).
|
|
146
|
-
*/
|
|
147
|
-
async list(
|
|
148
|
-
options?: ListOptions<MexTransactionFilter, TSort>
|
|
149
|
-
): Promise<PaginatedResponse<MexTransaction>> {
|
|
150
|
-
const scopedFilter = this.applyScopeToFilter(options?.filter);
|
|
151
|
-
const scopedSort = this.applyScopeToSort(options?.sort);
|
|
152
|
-
|
|
153
|
-
const response = await this.execute(() =>
|
|
154
|
-
this.trpc.transactions.list.query({
|
|
155
|
-
...options,
|
|
156
|
-
filter: scopedFilter,
|
|
157
|
-
sort: scopedSort,
|
|
158
|
-
})
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
163
|
-
pagination: response.pagination,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Iterates over Mexico transactions.
|
|
169
|
-
*
|
|
170
|
-
* Accepts flattened MX filter (future MX-specific transaction fields at root level).
|
|
171
|
-
*/
|
|
172
|
-
iterate(
|
|
173
|
-
filter?: MexTransactionFilter
|
|
174
|
-
): AsyncGenerator<MexTransaction, void, undefined> {
|
|
175
|
-
const scopedFilter = this.applyScopeToFilter(filter);
|
|
176
|
-
return this.createIterator<MexTransaction>({ filter: scopedFilter });
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// ─────────────────────────────────────────────────────────────────
|
|
180
|
-
// Client Relationship Management (scoped returns)
|
|
181
|
-
// ─────────────────────────────────────────────────────────────────
|
|
182
|
-
|
|
183
|
-
async listByClient(
|
|
184
|
-
clientId: string,
|
|
185
|
-
options?: { cursor?: string; limit?: number }
|
|
186
|
-
): Promise<PaginatedResponse<MexTransaction>> {
|
|
187
|
-
const response = await this.execute(() =>
|
|
188
|
-
this.trpc.transactions.listByClient.query({ clientId, ...options })
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
return {
|
|
192
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
193
|
-
pagination: response.pagination,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
async linkClient(
|
|
198
|
-
transactionId: string,
|
|
199
|
-
clientId: string,
|
|
200
|
-
role?: ClientRole
|
|
201
|
-
): Promise<MexTransaction> {
|
|
202
|
-
const response = await this.execute(() =>
|
|
203
|
-
this.trpc.transactions.linkClient.mutate({
|
|
204
|
-
transactionId,
|
|
205
|
-
clientId,
|
|
206
|
-
role,
|
|
207
|
-
})
|
|
208
|
-
);
|
|
209
|
-
return this.instantiate(response);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
async unlinkClient(
|
|
213
|
-
transactionId: string,
|
|
214
|
-
clientId: string
|
|
215
|
-
): Promise<MexTransaction> {
|
|
216
|
-
const response = await this.execute(() =>
|
|
217
|
-
this.trpc.transactions.unlinkClient.mutate({
|
|
218
|
-
transactionId,
|
|
219
|
-
clientId,
|
|
220
|
-
})
|
|
221
|
-
);
|
|
222
|
-
return this.instantiate(response);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
async setClients(
|
|
226
|
-
transactionId: string,
|
|
227
|
-
clients: RelatedClient[]
|
|
228
|
-
): Promise<MexTransaction> {
|
|
229
|
-
const response = await this.execute(() =>
|
|
230
|
-
this.trpc.transactions.setClients.mutate({
|
|
231
|
-
transactionId,
|
|
232
|
-
clients,
|
|
233
|
-
})
|
|
234
|
-
);
|
|
235
|
-
return this.instantiate(response);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// ─────────────────────────────────────────────────────────────────
|
|
239
|
-
// Batch Operations
|
|
240
|
-
// ─────────────────────────────────────────────────────────────────
|
|
241
|
-
|
|
242
|
-
async createMany(
|
|
243
|
-
transactions: CreateMexTransactionInput[],
|
|
244
|
-
options?: { atomic?: true }
|
|
245
|
-
): Promise<AtomicBatchResult<MexTransaction>>;
|
|
246
|
-
async createMany(
|
|
247
|
-
transactions: CreateMexTransactionInput[],
|
|
248
|
-
options: { atomic: false }
|
|
249
|
-
): Promise<PartialBatchResult<MexTransaction>>;
|
|
250
|
-
async createMany(
|
|
251
|
-
transactions: CreateMexTransactionInput[],
|
|
252
|
-
options: BatchOptions = {}
|
|
253
|
-
): Promise<
|
|
254
|
-
AtomicBatchResult<MexTransaction> | PartialBatchResult<MexTransaction>
|
|
255
|
-
> {
|
|
256
|
-
const atomic = options.atomic ?? true;
|
|
257
|
-
const validated = this.validate(
|
|
258
|
-
z.array(createMexTransactionInputSchema),
|
|
259
|
-
transactions
|
|
260
|
-
);
|
|
261
|
-
const nestedItems = validated.map((t) => this.transformToNested(t));
|
|
262
|
-
|
|
263
|
-
const response = await this.execute(() =>
|
|
264
|
-
this.trpc.transactions.createMany.mutate({ items: nestedItems, atomic })
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
if (response.atomic) {
|
|
268
|
-
return {
|
|
269
|
-
atomic: true,
|
|
270
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
271
|
-
};
|
|
272
|
-
} else {
|
|
273
|
-
return {
|
|
274
|
-
atomic: false,
|
|
275
|
-
succeeded: response.succeeded.map((item) => ({
|
|
276
|
-
index: item.index,
|
|
277
|
-
data: this.instantiate(item.data),
|
|
278
|
-
})),
|
|
279
|
-
failed: response.failed,
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
async updateMany(
|
|
285
|
-
updates: { id: string; data: UpdateMexTransactionInput }[],
|
|
286
|
-
options?: { atomic?: true }
|
|
287
|
-
): Promise<AtomicBatchResult<MexTransaction>>;
|
|
288
|
-
async updateMany(
|
|
289
|
-
updates: { id: string; data: UpdateMexTransactionInput }[],
|
|
290
|
-
options: { atomic: false }
|
|
291
|
-
): Promise<PartialBatchResult<MexTransaction>>;
|
|
292
|
-
async updateMany(
|
|
293
|
-
updates: { id: string; data: UpdateMexTransactionInput }[],
|
|
294
|
-
options: BatchOptions = {}
|
|
295
|
-
): Promise<
|
|
296
|
-
AtomicBatchResult<MexTransaction> | PartialBatchResult<MexTransaction>
|
|
297
|
-
> {
|
|
298
|
-
const atomic = options.atomic ?? true;
|
|
299
|
-
const updateItemSchema = z.object({
|
|
300
|
-
id: z.uuid(),
|
|
301
|
-
data: updateMexTransactionInputSchema,
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
const validated = this.validate(z.array(updateItemSchema), updates);
|
|
305
|
-
const nestedUpdates = validated.map((u) => ({
|
|
306
|
-
id: u.id,
|
|
307
|
-
data: this.transformUpdateToNested(u.data),
|
|
308
|
-
}));
|
|
309
|
-
|
|
310
|
-
const response = await this.execute(() =>
|
|
311
|
-
this.trpc.transactions.updateMany.mutate({ items: nestedUpdates, atomic })
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
if (response.atomic) {
|
|
315
|
-
return {
|
|
316
|
-
atomic: true,
|
|
317
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
318
|
-
};
|
|
319
|
-
} else {
|
|
320
|
-
return {
|
|
321
|
-
atomic: false,
|
|
322
|
-
succeeded: response.succeeded.map((item) => ({
|
|
323
|
-
index: item.index,
|
|
324
|
-
data: this.instantiate(item.data),
|
|
325
|
-
})),
|
|
326
|
-
failed: response.failed,
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// ─────────────────────────────────────────────────────────────────
|
|
332
|
-
// Protected Helpers
|
|
333
|
-
// ─────────────────────────────────────────────────────────────────
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Applies Mexico jurisdiction filter.
|
|
337
|
-
*
|
|
338
|
-
* Currently MexTransactionFilter has the same fields as the base filter,
|
|
339
|
-
* but this method ensures the jurisdiction scope is applied.
|
|
340
|
-
*/
|
|
341
|
-
protected applyScopeToFilter(filter?: MexTransactionFilter): TransactionFilter {
|
|
342
|
-
if (!filter) {
|
|
343
|
-
return {
|
|
344
|
-
availableJurisdictions: Jurisdiction.Mexico,
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// Currently no MX-specific transaction filter fields to nest
|
|
349
|
-
// Just pass through and add jurisdiction scope
|
|
350
|
-
return {
|
|
351
|
-
...filter,
|
|
352
|
-
availableJurisdictions: Jurisdiction.Mexico,
|
|
353
|
-
} as TransactionFilter;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Transforms a flattened MexTransactionSort to nested TransactionSort format.
|
|
358
|
-
*
|
|
359
|
-
* Maps flattened field names to their full API paths.
|
|
360
|
-
*
|
|
361
|
-
* Note: Uses unknown parameter to allow derived classes to override with their own sort types.
|
|
362
|
-
*/
|
|
363
|
-
protected applyScopeToSort(sort?: TSort): TransactionSort | undefined {
|
|
364
|
-
if (!sort || !Array.isArray(sort) || sort.length === 0) {
|
|
365
|
-
return undefined;
|
|
366
|
-
}
|
|
367
|
-
return transformSort(sort as MexTransactionSort, mexTransactionFieldMapping);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Transforms flattened MX input to nested API format.
|
|
372
|
-
*/
|
|
373
|
-
protected transformToNested(
|
|
374
|
-
data: CreateMexTransactionInput
|
|
375
|
-
): CreateTransactionInput {
|
|
376
|
-
const { actividadVulnerable, ...baseFields } = data;
|
|
377
|
-
|
|
378
|
-
// Build MX jurisdiction data
|
|
379
|
-
const mexData: Record<string, unknown> = {};
|
|
380
|
-
if (actividadVulnerable !== undefined) {
|
|
381
|
-
mexData.actividadVulnerable = actividadVulnerable;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return {
|
|
385
|
-
...baseFields,
|
|
386
|
-
primaryJurisdiction: Jurisdiction.Mexico,
|
|
387
|
-
jurisdictions:
|
|
388
|
-
Object.keys(mexData).length > 0
|
|
389
|
-
? {
|
|
390
|
-
MX: mexData,
|
|
391
|
-
}
|
|
392
|
-
: undefined,
|
|
393
|
-
} as CreateTransactionInput;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Transforms flattened MX update input to nested API format.
|
|
398
|
-
*/
|
|
399
|
-
protected transformUpdateToNested(
|
|
400
|
-
data: UpdateMexTransactionInput
|
|
401
|
-
): UpdateTransactionInput {
|
|
402
|
-
const { actividadVulnerable, ...baseFields } = data;
|
|
403
|
-
|
|
404
|
-
if (actividadVulnerable === undefined) {
|
|
405
|
-
return baseFields as UpdateTransactionInput;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
return {
|
|
409
|
-
...baseFields,
|
|
410
|
-
jurisdictions: {
|
|
411
|
-
MX: { actividadVulnerable },
|
|
412
|
-
},
|
|
413
|
-
} as UpdateTransactionInput;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* Instantiates a MexTransaction model.
|
|
418
|
-
*/
|
|
419
|
-
protected override instantiate(data: TransactionData): MexTransaction {
|
|
420
|
-
return new MexTransaction(data);
|
|
421
|
-
}
|
|
422
|
-
}
|