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