@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.
- 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,404 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TSC (Tarjetas de Servicio y Crédito) Transactions Resource
|
|
3
|
-
*
|
|
4
|
-
* Extends MexTransactionsResource with TSC-specific behavior:
|
|
5
|
-
* - Accepts flattened CreateTSCTransactionInput (TSC fields at root level)
|
|
6
|
-
* - Returns MexTSCTransaction models
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
import type {
|
|
11
|
-
CreateTransactionInput,
|
|
12
|
-
UpdateTransactionInput,
|
|
13
|
-
ListOptions,
|
|
14
|
-
PaginatedResponse,
|
|
15
|
-
CreateTSCTransactionInput,
|
|
16
|
-
UpdateTSCTransactionInput,
|
|
17
|
-
AtomicBatchResult,
|
|
18
|
-
PartialBatchResult,
|
|
19
|
-
RelatedClient,
|
|
20
|
-
TSCTransactionFilter,
|
|
21
|
-
TSCTransactionSort,
|
|
22
|
-
} from "@artu-ai/shared";
|
|
23
|
-
import {
|
|
24
|
-
Jurisdiction,
|
|
25
|
-
CodigoActividad,
|
|
26
|
-
createTSCTransactionInputSchema,
|
|
27
|
-
updateTSCTransactionInputSchema,
|
|
28
|
-
ClientRole,
|
|
29
|
-
transformSort,
|
|
30
|
-
tscTransactionFieldMapping,
|
|
31
|
-
} from "@artu-ai/shared";
|
|
32
|
-
import type { TransactionSort } from "@artu-ai/shared";
|
|
33
|
-
import { MexTransactionsResource } from "../../transactions";
|
|
34
|
-
import { type BatchOptions } from "../../../clients";
|
|
35
|
-
import { MexTSCTransaction, type TransactionData } from "../../../../models";
|
|
36
|
-
|
|
37
|
-
// ===========================
|
|
38
|
-
// TSCTransactionsResource
|
|
39
|
-
// ===========================
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* TSC (Tarjetas de Servicio y Crédito) scoped transactions resource.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const tscSdk = new ComplianceSDK({
|
|
47
|
-
* apiKey,
|
|
48
|
-
* jurisdiction: Jurisdiction.Mexico,
|
|
49
|
-
* actividadVulnerable: CodigoActividad.TSC,
|
|
50
|
-
* });
|
|
51
|
-
*
|
|
52
|
-
* // Create with fully flattened input
|
|
53
|
-
* const txn = await tscSdk.transactions.create({
|
|
54
|
-
* amount: 10000,
|
|
55
|
-
* currency: "MXN",
|
|
56
|
-
* timestamp: new Date(),
|
|
57
|
-
* cardType: "credit",
|
|
58
|
-
* idNumber: "4111111111111111",
|
|
59
|
-
* operationType: "cardConsumption",
|
|
60
|
-
* });
|
|
61
|
-
*
|
|
62
|
-
* // Returns MexTSCTransaction
|
|
63
|
-
* console.log(txn.cardType);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export class TSCTransactionsResource extends MexTransactionsResource<TSCTransactionSort> {
|
|
67
|
-
// ─────────────────────────────────────────────────────────────────
|
|
68
|
-
// CRUD Operations
|
|
69
|
-
// ─────────────────────────────────────────────────────────────────
|
|
70
|
-
|
|
71
|
-
async create(data: CreateTSCTransactionInput): Promise<MexTSCTransaction> {
|
|
72
|
-
const validated = this.validate(createTSCTransactionInputSchema, data);
|
|
73
|
-
const nestedData = this.transformToNested(validated);
|
|
74
|
-
|
|
75
|
-
const response = await this.execute(() =>
|
|
76
|
-
this.trpc.transactions.create.mutate(nestedData)
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
return this.instantiate(response);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async retrieve(id: string): Promise<MexTSCTransaction> {
|
|
83
|
-
const response = await this.execute(() =>
|
|
84
|
-
this.trpc.transactions.retrieve.query({ id })
|
|
85
|
-
);
|
|
86
|
-
return this.instantiate(response);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async retrieveByMetadata(
|
|
90
|
-
key: string,
|
|
91
|
-
value: string
|
|
92
|
-
): Promise<MexTSCTransaction> {
|
|
93
|
-
const response = await this.execute(() =>
|
|
94
|
-
this.trpc.transactions.retrieveByMetadata.query({ key, value })
|
|
95
|
-
);
|
|
96
|
-
return this.instantiate(response);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async update(
|
|
100
|
-
id: string,
|
|
101
|
-
data: UpdateTSCTransactionInput
|
|
102
|
-
): Promise<MexTSCTransaction> {
|
|
103
|
-
const validated = this.validate(updateTSCTransactionInputSchema, data);
|
|
104
|
-
const nestedData = this.transformUpdateToNested(validated);
|
|
105
|
-
|
|
106
|
-
const response = await this.execute(() =>
|
|
107
|
-
this.trpc.transactions.update.mutate({ id, data: nestedData })
|
|
108
|
-
);
|
|
109
|
-
return this.instantiate(response);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// ─────────────────────────────────────────────────────────────────
|
|
113
|
-
// List & Pagination
|
|
114
|
-
// ─────────────────────────────────────────────────────────────────
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Lists TSC transactions with optional filtering.
|
|
118
|
-
*
|
|
119
|
-
* Accepts flattened TSC filter (future TSC-specific transaction fields at root level).
|
|
120
|
-
*/
|
|
121
|
-
async list(
|
|
122
|
-
options?: ListOptions<TSCTransactionFilter, TSCTransactionSort>
|
|
123
|
-
): Promise<PaginatedResponse<MexTSCTransaction>> {
|
|
124
|
-
const scopedFilter = this.applyScopeToFilter(options?.filter);
|
|
125
|
-
const scopedSort = this.applyScopeToSort(options?.sort);
|
|
126
|
-
|
|
127
|
-
const response = await this.execute(() =>
|
|
128
|
-
this.trpc.transactions.list.query({
|
|
129
|
-
...options,
|
|
130
|
-
filter: scopedFilter,
|
|
131
|
-
sort: scopedSort,
|
|
132
|
-
})
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
137
|
-
pagination: response.pagination,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Iterates over TSC transactions.
|
|
143
|
-
*
|
|
144
|
-
* Accepts flattened TSC filter (future TSC-specific transaction fields at root level).
|
|
145
|
-
*/
|
|
146
|
-
iterate(
|
|
147
|
-
filter?: TSCTransactionFilter
|
|
148
|
-
): AsyncGenerator<MexTSCTransaction, void, undefined> {
|
|
149
|
-
const scopedFilter = this.applyScopeToFilter(filter);
|
|
150
|
-
return this.createIterator<MexTSCTransaction>({ filter: scopedFilter });
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// ─────────────────────────────────────────────────────────────────
|
|
154
|
-
// Client Relationship Management (scoped returns)
|
|
155
|
-
// ─────────────────────────────────────────────────────────────────
|
|
156
|
-
|
|
157
|
-
async listByClient(
|
|
158
|
-
clientId: string,
|
|
159
|
-
options?: { cursor?: string; limit?: number }
|
|
160
|
-
): Promise<PaginatedResponse<MexTSCTransaction>> {
|
|
161
|
-
const response = await this.execute(() =>
|
|
162
|
-
this.trpc.transactions.listByClient.query({ clientId, ...options })
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
167
|
-
pagination: response.pagination,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async linkClient(
|
|
172
|
-
transactionId: string,
|
|
173
|
-
clientId: string,
|
|
174
|
-
role?: ClientRole
|
|
175
|
-
): Promise<MexTSCTransaction> {
|
|
176
|
-
const response = await this.execute(() =>
|
|
177
|
-
this.trpc.transactions.linkClient.mutate({
|
|
178
|
-
transactionId,
|
|
179
|
-
clientId,
|
|
180
|
-
role,
|
|
181
|
-
})
|
|
182
|
-
);
|
|
183
|
-
return this.instantiate(response);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
async unlinkClient(
|
|
187
|
-
transactionId: string,
|
|
188
|
-
clientId: string
|
|
189
|
-
): Promise<MexTSCTransaction> {
|
|
190
|
-
const response = await this.execute(() =>
|
|
191
|
-
this.trpc.transactions.unlinkClient.mutate({
|
|
192
|
-
transactionId,
|
|
193
|
-
clientId,
|
|
194
|
-
})
|
|
195
|
-
);
|
|
196
|
-
return this.instantiate(response);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async setClients(
|
|
200
|
-
transactionId: string,
|
|
201
|
-
clients: RelatedClient[]
|
|
202
|
-
): Promise<MexTSCTransaction> {
|
|
203
|
-
const response = await this.execute(() =>
|
|
204
|
-
this.trpc.transactions.setClients.mutate({
|
|
205
|
-
transactionId,
|
|
206
|
-
clients,
|
|
207
|
-
})
|
|
208
|
-
);
|
|
209
|
-
return this.instantiate(response);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// ─────────────────────────────────────────────────────────────────
|
|
213
|
-
// Batch Operations
|
|
214
|
-
// ─────────────────────────────────────────────────────────────────
|
|
215
|
-
|
|
216
|
-
async createMany(
|
|
217
|
-
transactions: CreateTSCTransactionInput[],
|
|
218
|
-
options?: { atomic?: true }
|
|
219
|
-
): Promise<AtomicBatchResult<MexTSCTransaction>>;
|
|
220
|
-
async createMany(
|
|
221
|
-
transactions: CreateTSCTransactionInput[],
|
|
222
|
-
options: { atomic: false }
|
|
223
|
-
): Promise<PartialBatchResult<MexTSCTransaction>>;
|
|
224
|
-
async createMany(
|
|
225
|
-
transactions: CreateTSCTransactionInput[],
|
|
226
|
-
options: BatchOptions = {}
|
|
227
|
-
): Promise<
|
|
228
|
-
AtomicBatchResult<MexTSCTransaction> | PartialBatchResult<MexTSCTransaction>
|
|
229
|
-
> {
|
|
230
|
-
const atomic = options.atomic ?? true;
|
|
231
|
-
const validated = this.validate(
|
|
232
|
-
z.array(createTSCTransactionInputSchema),
|
|
233
|
-
transactions
|
|
234
|
-
);
|
|
235
|
-
const nestedItems = validated.map((t) => this.transformToNested(t));
|
|
236
|
-
|
|
237
|
-
const response = await this.execute(() =>
|
|
238
|
-
this.trpc.transactions.createMany.mutate({ items: nestedItems, atomic })
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
if (response.atomic) {
|
|
242
|
-
return {
|
|
243
|
-
atomic: true,
|
|
244
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
245
|
-
};
|
|
246
|
-
} else {
|
|
247
|
-
return {
|
|
248
|
-
atomic: false,
|
|
249
|
-
succeeded: response.succeeded.map((item) => ({
|
|
250
|
-
index: item.index,
|
|
251
|
-
data: this.instantiate(item.data),
|
|
252
|
-
})),
|
|
253
|
-
failed: response.failed,
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
async updateMany(
|
|
259
|
-
updates: { id: string; data: UpdateTSCTransactionInput }[],
|
|
260
|
-
options?: { atomic?: true }
|
|
261
|
-
): Promise<AtomicBatchResult<MexTSCTransaction>>;
|
|
262
|
-
async updateMany(
|
|
263
|
-
updates: { id: string; data: UpdateTSCTransactionInput }[],
|
|
264
|
-
options: { atomic: false }
|
|
265
|
-
): Promise<PartialBatchResult<MexTSCTransaction>>;
|
|
266
|
-
async updateMany(
|
|
267
|
-
updates: { id: string; data: UpdateTSCTransactionInput }[],
|
|
268
|
-
options: BatchOptions = {}
|
|
269
|
-
): Promise<
|
|
270
|
-
AtomicBatchResult<MexTSCTransaction> | PartialBatchResult<MexTSCTransaction>
|
|
271
|
-
> {
|
|
272
|
-
const atomic = options.atomic ?? true;
|
|
273
|
-
const updateItemSchema = z.object({
|
|
274
|
-
id: z.uuid(),
|
|
275
|
-
data: updateTSCTransactionInputSchema,
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
const validated = this.validate(z.array(updateItemSchema), updates);
|
|
279
|
-
const nestedUpdates = validated.map((u) => ({
|
|
280
|
-
id: u.id,
|
|
281
|
-
data: this.transformUpdateToNested(u.data),
|
|
282
|
-
}));
|
|
283
|
-
|
|
284
|
-
const response = await this.execute(() =>
|
|
285
|
-
this.trpc.transactions.updateMany.mutate({ items: nestedUpdates, atomic })
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
if (response.atomic) {
|
|
289
|
-
return {
|
|
290
|
-
atomic: true,
|
|
291
|
-
data: response.data.map((t) => this.instantiate(t)),
|
|
292
|
-
};
|
|
293
|
-
} else {
|
|
294
|
-
return {
|
|
295
|
-
atomic: false,
|
|
296
|
-
succeeded: response.succeeded.map((item) => ({
|
|
297
|
-
index: item.index,
|
|
298
|
-
data: this.instantiate(item.data),
|
|
299
|
-
})),
|
|
300
|
-
failed: response.failed,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// ─────────────────────────────────────────────────────────────────
|
|
306
|
-
// Protected Helpers
|
|
307
|
-
// ─────────────────────────────────────────────────────────────────
|
|
308
|
-
|
|
309
|
-
protected override transformToNested(
|
|
310
|
-
data: CreateTSCTransactionInput
|
|
311
|
-
): CreateTransactionInput {
|
|
312
|
-
const {
|
|
313
|
-
amount,
|
|
314
|
-
currency,
|
|
315
|
-
timestamp,
|
|
316
|
-
relatedClientIds,
|
|
317
|
-
description,
|
|
318
|
-
externalId,
|
|
319
|
-
metadata,
|
|
320
|
-
cardType,
|
|
321
|
-
idNumber,
|
|
322
|
-
operationType,
|
|
323
|
-
} = data;
|
|
324
|
-
|
|
325
|
-
// Build base fields (relatedClientIds is required)
|
|
326
|
-
const baseFields: Record<string, unknown> = {
|
|
327
|
-
amount,
|
|
328
|
-
currency,
|
|
329
|
-
timestamp,
|
|
330
|
-
relatedClientIds,
|
|
331
|
-
};
|
|
332
|
-
if (description !== undefined) baseFields.description = description;
|
|
333
|
-
if (externalId !== undefined) baseFields.externalId = externalId;
|
|
334
|
-
if (metadata !== undefined) baseFields.metadata = metadata;
|
|
335
|
-
|
|
336
|
-
// TSC-specific fields (operationType has a default from schema)
|
|
337
|
-
const tscFields: Record<string, unknown> = {
|
|
338
|
-
cardType,
|
|
339
|
-
idNumber,
|
|
340
|
-
operationType,
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
...baseFields,
|
|
345
|
-
primaryJurisdiction: Jurisdiction.Mexico,
|
|
346
|
-
jurisdictions: {
|
|
347
|
-
MX: {
|
|
348
|
-
actividadVulnerable: {
|
|
349
|
-
[CodigoActividad.TSC]: tscFields,
|
|
350
|
-
},
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
} as CreateTransactionInput;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
protected override transformUpdateToNested(
|
|
357
|
-
data: UpdateTSCTransactionInput
|
|
358
|
-
): UpdateTransactionInput {
|
|
359
|
-
// Cast to access fields - Zod validation ensures correctness
|
|
360
|
-
const input = data as Record<string, unknown>;
|
|
361
|
-
const { status, description, externalId, metadata, primaryJurisdiction, cardType, idNumber, operationType } = input;
|
|
362
|
-
|
|
363
|
-
// Build base update fields
|
|
364
|
-
const result: UpdateTransactionInput = {};
|
|
365
|
-
if (status !== undefined) result.status = status as UpdateTransactionInput["status"];
|
|
366
|
-
if (description !== undefined) result.description = description as string;
|
|
367
|
-
if (externalId !== undefined) result.externalId = externalId as string;
|
|
368
|
-
if (metadata !== undefined) result.metadata = metadata as Record<string, unknown>;
|
|
369
|
-
if (primaryJurisdiction !== undefined) result.primaryJurisdiction = primaryJurisdiction as UpdateTransactionInput["primaryJurisdiction"];
|
|
370
|
-
|
|
371
|
-
// If TSC fields are present (all-or-nothing), nest them in jurisdictions
|
|
372
|
-
if (cardType !== undefined) {
|
|
373
|
-
(result as Record<string, unknown>).jurisdictions = {
|
|
374
|
-
MX: {
|
|
375
|
-
actividadVulnerable: {
|
|
376
|
-
[CodigoActividad.TSC]: {
|
|
377
|
-
cardType,
|
|
378
|
-
idNumber,
|
|
379
|
-
operationType,
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
},
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
return result;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
protected override instantiate(data: TransactionData): MexTSCTransaction {
|
|
390
|
-
return new MexTSCTransaction(data);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Transforms a flattened TSCTransactionSort to nested TransactionSort format.
|
|
395
|
-
*
|
|
396
|
-
* Maps flattened field names to their full API paths using TSC-specific field mapping.
|
|
397
|
-
*/
|
|
398
|
-
protected override applyScopeToSort(sort?: TSCTransactionSort): TransactionSort | undefined {
|
|
399
|
-
if (!sort || sort.length === 0) {
|
|
400
|
-
return undefined;
|
|
401
|
-
}
|
|
402
|
-
return transformSort(sort, tscTransactionFieldMapping);
|
|
403
|
-
}
|
|
404
|
-
}
|