@devizovaburza/mdm-sdk 0.0.19 → 0.0.20
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/dist/v1/index.cjs +546 -337
- package/dist/v1/index.d.cts +3065 -1828
- package/dist/v1/index.d.mts +3065 -1828
- package/dist/v1/index.d.ts +3065 -1828
- package/dist/v1/index.mjs +546 -337
- package/package.json +1 -1
package/dist/v1/index.mjs
CHANGED
|
@@ -12623,7 +12623,8 @@ const organization = sqliteTable("organization", {
|
|
|
12623
12623
|
enum: COUNTRY_CODES_2
|
|
12624
12624
|
}),
|
|
12625
12625
|
vatId: text("vat_id"),
|
|
12626
|
-
court: text("court", { enum: COURT })
|
|
12626
|
+
court: text("court", { enum: COURT }),
|
|
12627
|
+
registerUri: text("register_uri")
|
|
12627
12628
|
});
|
|
12628
12629
|
|
|
12629
12630
|
const partyRelationship = sqliteTable("party_relationship", {
|
|
@@ -12668,7 +12669,8 @@ const bankAccount = sqliteTable("bank_account", {
|
|
|
12668
12669
|
...base,
|
|
12669
12670
|
internalId: text("internal_id"),
|
|
12670
12671
|
...bankAccount$1,
|
|
12671
|
-
partyId: text("party_id").notNull().references(() => party.id)
|
|
12672
|
+
partyId: text("party_id").notNull().references(() => party.id),
|
|
12673
|
+
statementUri: text("statement_uri")
|
|
12672
12674
|
});
|
|
12673
12675
|
|
|
12674
12676
|
const aml = sqliteTable("aml", {
|
|
@@ -12980,7 +12982,8 @@ const bankAccountUpsertSchema = bankAccountBaseInsertSchema.required({
|
|
|
12980
12982
|
id: true
|
|
12981
12983
|
});
|
|
12982
12984
|
const bankAccountSelectSchema = bankAccountUpdateSchema.required().extend({
|
|
12983
|
-
bankCode: z$3.string().nullable()
|
|
12985
|
+
bankCode: z$3.string().nullable(),
|
|
12986
|
+
statementUri: z$3.string().nullable()
|
|
12984
12987
|
});
|
|
12985
12988
|
z$3.array(bankAccountSelectSchema);
|
|
12986
12989
|
|
|
@@ -13068,7 +13071,8 @@ const organizationInsertSchema = z$3.object({
|
|
|
13068
13071
|
operationCountries: z$3.string(),
|
|
13069
13072
|
riskyBusinessType: z$3.string().optional().nullable(),
|
|
13070
13073
|
vatId: z$3.string().optional().nullable(),
|
|
13071
|
-
court: z$3.enum(COURT).optional().nullable()
|
|
13074
|
+
court: z$3.enum(COURT).optional().nullable(),
|
|
13075
|
+
registerUri: z$3.string().optional().nullable()
|
|
13072
13076
|
});
|
|
13073
13077
|
const organizationUpdateSchema$1 = z$3.object({
|
|
13074
13078
|
partyId: z$3.uuid().optional(),
|
|
@@ -13096,7 +13100,8 @@ const organizationUpdateSchema$1 = z$3.object({
|
|
|
13096
13100
|
operationCountries: z$3.string(),
|
|
13097
13101
|
riskyBusinessType: z$3.string().optional().nullable(),
|
|
13098
13102
|
vatId: z$3.string().optional().nullable(),
|
|
13099
|
-
court: z$3.enum(COURT).optional().nullable()
|
|
13103
|
+
court: z$3.enum(COURT).optional().nullable(),
|
|
13104
|
+
registerUri: z$3.string().optional().nullable()
|
|
13100
13105
|
});
|
|
13101
13106
|
const organizationOutputSchema = z$3.object({
|
|
13102
13107
|
id: z$3.uuid(),
|
|
@@ -13128,12 +13133,48 @@ const organizationOutputSchema = z$3.object({
|
|
|
13128
13133
|
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
13129
13134
|
vatId: z$3.string().nullable(),
|
|
13130
13135
|
court: z$3.enum(COURT).nullable(),
|
|
13136
|
+
registerUri: z$3.string().nullable(),
|
|
13131
13137
|
createdAt: z$3.coerce.date().nullable(),
|
|
13132
13138
|
updatedAt: z$3.coerce.date().nullable()
|
|
13133
13139
|
});
|
|
13134
13140
|
const organizationSelectSchema = organizationOutputSchema;
|
|
13135
13141
|
z$3.array(organizationOutputSchema);
|
|
13136
13142
|
|
|
13143
|
+
createInsertSchema(idDocument);
|
|
13144
|
+
createUpdateSchema(idDocument);
|
|
13145
|
+
const idDocumentBaseSelectSchema = createSelectSchema(idDocument);
|
|
13146
|
+
const idDocumentInsertSchema = z$3.object({
|
|
13147
|
+
partyId: z$3.uuid(),
|
|
13148
|
+
internalId: z$3.string().optional().nullable(),
|
|
13149
|
+
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
13150
|
+
idDocNumber: z$3.string(),
|
|
13151
|
+
idDocHolderName: z$3.string(),
|
|
13152
|
+
issueDate: z$3.date().optional().nullable(),
|
|
13153
|
+
expirationDate: z$3.date().optional().nullable(),
|
|
13154
|
+
issuer: z$3.string().optional().nullable(),
|
|
13155
|
+
countryOfIssue: z$3.enum(COUNTRY_CODES_2).optional().nullable(),
|
|
13156
|
+
frontImageUri: z$3.url().optional().nullable(),
|
|
13157
|
+
backImageUri: z$3.url().optional().nullable(),
|
|
13158
|
+
idDocStatus: z$3.enum(ID_DOC_STATUS).optional().nullable()
|
|
13159
|
+
});
|
|
13160
|
+
const idDocumentUpdateSchema = z$3.object({
|
|
13161
|
+
id: z$3.uuid(),
|
|
13162
|
+
partyId: z$3.uuid().optional(),
|
|
13163
|
+
internalId: z$3.string().optional().nullable(),
|
|
13164
|
+
idDocType: z$3.enum(ID_DOC_TYPE).optional(),
|
|
13165
|
+
idDocNumber: z$3.string().optional(),
|
|
13166
|
+
idDocHolderName: z$3.string().optional(),
|
|
13167
|
+
issueDate: z$3.date().optional().nullable(),
|
|
13168
|
+
expirationDate: z$3.date().optional().nullable(),
|
|
13169
|
+
issuer: z$3.string().optional().nullable(),
|
|
13170
|
+
countryOfIssue: z$3.enum(COUNTRY_CODES_2).optional().nullable(),
|
|
13171
|
+
frontImageUri: z$3.url("Invalid URL format").optional().nullable(),
|
|
13172
|
+
backImageUri: z$3.url("Invalid URL format").optional().nullable(),
|
|
13173
|
+
idDocStatus: z$3.enum(ID_DOC_STATUS).optional().nullable()
|
|
13174
|
+
});
|
|
13175
|
+
const idDocumentSelectSchema = idDocumentBaseSelectSchema;
|
|
13176
|
+
const idDocumentSyncSchema = idDocumentInsertSchema.omit({ partyId: true }).extend({ id: z$3.uuid().optional(), idDocHolderName: z$3.string().optional() });
|
|
13177
|
+
|
|
13137
13178
|
z$3.discriminatedUnion("partyType", [
|
|
13138
13179
|
z$3.object({
|
|
13139
13180
|
partyType: z$3.literal("INDIVIDUAL"),
|
|
@@ -13148,7 +13189,9 @@ const disponentCreateSchema = z$3.discriminatedUnion("partyType", [
|
|
|
13148
13189
|
z$3.object({
|
|
13149
13190
|
partyType: z$3.literal("INDIVIDUAL"),
|
|
13150
13191
|
relationshipType: z$3.enum(PARTY_RELATIONSHIP_TYPE).optional(),
|
|
13151
|
-
data: individualInsertSchema$1.omit({ partyId: true })
|
|
13192
|
+
data: individualInsertSchema$1.omit({ partyId: true }).extend({
|
|
13193
|
+
identityDocuments: z$3.array(idDocumentSyncSchema).nullable().optional()
|
|
13194
|
+
})
|
|
13152
13195
|
}),
|
|
13153
13196
|
z$3.object({
|
|
13154
13197
|
partyType: z$3.literal("ORGANIZATION"),
|
|
@@ -13170,7 +13213,10 @@ const disponentSyncSchema$1 = z$3.discriminatedUnion("partyType", [
|
|
|
13170
13213
|
z$3.object({
|
|
13171
13214
|
partyType: z$3.literal("INDIVIDUAL"),
|
|
13172
13215
|
relationshipType: z$3.enum(PARTY_RELATIONSHIP_TYPE).optional(),
|
|
13173
|
-
data: individualInsertSchema$1.omit({ partyId: true }).extend({
|
|
13216
|
+
data: individualInsertSchema$1.omit({ partyId: true }).extend({
|
|
13217
|
+
id: z$3.uuid().optional(),
|
|
13218
|
+
identityDocuments: z$3.array(idDocumentSyncSchema).nullable().optional()
|
|
13219
|
+
})
|
|
13174
13220
|
}),
|
|
13175
13221
|
z$3.object({
|
|
13176
13222
|
partyType: z$3.literal("ORGANIZATION"),
|
|
@@ -13181,7 +13227,9 @@ const disponentSyncSchema$1 = z$3.discriminatedUnion("partyType", [
|
|
|
13181
13227
|
const disponentSelectSchema = z$3.discriminatedUnion("partyType", [
|
|
13182
13228
|
z$3.object({
|
|
13183
13229
|
partyType: z$3.literal("INDIVIDUAL"),
|
|
13184
|
-
data: individualSelectSchema
|
|
13230
|
+
data: individualSelectSchema.extend({
|
|
13231
|
+
identityDocuments: z$3.array(idDocumentSelectSchema).nullable()
|
|
13232
|
+
})
|
|
13185
13233
|
}),
|
|
13186
13234
|
z$3.object({
|
|
13187
13235
|
partyType: z$3.literal("ORGANIZATION"),
|
|
@@ -13191,39 +13239,6 @@ const disponentSelectSchema = z$3.discriminatedUnion("partyType", [
|
|
|
13191
13239
|
z$3.array(disponentSelectSchema).optional();
|
|
13192
13240
|
z$3.array(disponentUpdateSchema).optional();
|
|
13193
13241
|
|
|
13194
|
-
createInsertSchema(idDocument);
|
|
13195
|
-
createUpdateSchema(idDocument);
|
|
13196
|
-
createSelectSchema(idDocument);
|
|
13197
|
-
const idDocumentInsertSchema = z$3.object({
|
|
13198
|
-
partyId: z$3.uuid(),
|
|
13199
|
-
internalId: z$3.string().optional().nullable(),
|
|
13200
|
-
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
13201
|
-
idDocNumber: z$3.string(),
|
|
13202
|
-
idDocHolderName: z$3.string(),
|
|
13203
|
-
issueDate: z$3.date().optional().nullable(),
|
|
13204
|
-
expirationDate: z$3.date().optional().nullable(),
|
|
13205
|
-
issuer: z$3.string().optional().nullable(),
|
|
13206
|
-
countryOfIssue: z$3.enum(COUNTRY_CODES_2).optional().nullable(),
|
|
13207
|
-
frontImageUri: z$3.url().optional().nullable(),
|
|
13208
|
-
backImageUri: z$3.url().optional().nullable(),
|
|
13209
|
-
idDocStatus: z$3.enum(ID_DOC_STATUS).optional().nullable()
|
|
13210
|
-
});
|
|
13211
|
-
const idDocumentUpdateSchema = z$3.object({
|
|
13212
|
-
id: z$3.uuid(),
|
|
13213
|
-
partyId: z$3.uuid().optional(),
|
|
13214
|
-
internalId: z$3.string().optional().nullable(),
|
|
13215
|
-
idDocType: z$3.enum(ID_DOC_TYPE).optional(),
|
|
13216
|
-
idDocNumber: z$3.string().optional(),
|
|
13217
|
-
idDocHolderName: z$3.string().optional(),
|
|
13218
|
-
issueDate: z$3.date().optional().nullable(),
|
|
13219
|
-
expirationDate: z$3.date().optional().nullable(),
|
|
13220
|
-
issuer: z$3.string().optional().nullable(),
|
|
13221
|
-
countryOfIssue: z$3.enum(COUNTRY_CODES_2).optional().nullable(),
|
|
13222
|
-
frontImageUri: z$3.url("Invalid URL format").optional().nullable(),
|
|
13223
|
-
backImageUri: z$3.url("Invalid URL format").optional().nullable(),
|
|
13224
|
-
idDocStatus: z$3.enum(ID_DOC_STATUS).optional().nullable()
|
|
13225
|
-
});
|
|
13226
|
-
|
|
13227
13242
|
const recipientBaseInsertSchema = createInsertSchema(recipient);
|
|
13228
13243
|
const recipientBaseUpdateSchema = createUpdateSchema(recipient);
|
|
13229
13244
|
createSelectSchema(recipient);
|
|
@@ -13234,7 +13249,9 @@ const recipientInsertSchema = bankAccountInsertSchema;
|
|
|
13234
13249
|
const recipientUpdateSchema = recipientBaseUpdateSchema.required({
|
|
13235
13250
|
id: true
|
|
13236
13251
|
});
|
|
13237
|
-
const recipientSelectSchema = bankAccountSelectSchema
|
|
13252
|
+
const recipientSelectSchema = bankAccountSelectSchema.omit({
|
|
13253
|
+
statementUri: true
|
|
13254
|
+
});
|
|
13238
13255
|
|
|
13239
13256
|
const productTxsConfigSchema = z$3.object({
|
|
13240
13257
|
fee: z$3.number(),
|
|
@@ -13279,7 +13296,6 @@ const productsOutputSchema$1 = z$3.object({
|
|
|
13279
13296
|
cbs: productCbsConfigSchema.nullable()
|
|
13280
13297
|
});
|
|
13281
13298
|
|
|
13282
|
-
const idDocumentSyncSchema = idDocumentInsertSchema.omit({ partyId: true }).extend({ id: z$3.uuid().optional(), idDocHolderName: z$3.string().optional() });
|
|
13283
13299
|
const legalRepresentativeSyncSchema$1 = individualInsertSchema$1.omit({ partyId: true }).extend({
|
|
13284
13300
|
id: z$3.uuid().optional(),
|
|
13285
13301
|
dateOfEstablishment: z$3.string(),
|
|
@@ -13328,20 +13344,24 @@ const partyOutputSchema$1 = z$3.object({
|
|
|
13328
13344
|
const createPartySchema = partySchema$2.omit({ id: true });
|
|
13329
13345
|
z$3.object({
|
|
13330
13346
|
party: createPartySchema,
|
|
13331
|
-
personalData: individualInsertSchema$1.omit({ partyId: true }).
|
|
13347
|
+
personalData: individualInsertSchema$1.omit({ partyId: true }).extend({
|
|
13348
|
+
identityDocuments: z$3.array(idDocumentSyncSchema).nullable().optional()
|
|
13349
|
+
}).nullable(),
|
|
13332
13350
|
organizationData: organizationInsertSchema.omit({ partyId: true }).nullable(),
|
|
13333
13351
|
bankAccounts: z$3.array(bankAccountInsertSchema.omit({ partyId: true })).nullable(),
|
|
13334
13352
|
recipients: z$3.array(recipientInsertSchema.omit({ partyId: true })).nullable(),
|
|
13335
13353
|
disponents: z$3.array(disponentCreateSchema).nullable(),
|
|
13336
13354
|
addresses: z$3.array(addressInsertSchema.omit({ partyId: true })),
|
|
13337
|
-
aml: amlInsertSchema.omit({ partyId: true }),
|
|
13355
|
+
aml: amlInsertSchema.omit({ partyId: true }).optional().nullable(),
|
|
13338
13356
|
products: productsInputSchema$2.optional(),
|
|
13339
13357
|
traderIds: z$3.array(z$3.uuid()).optional()
|
|
13340
13358
|
});
|
|
13341
13359
|
z$3.object({
|
|
13342
13360
|
partyId: z$3.uuid(),
|
|
13343
13361
|
party: partySchema$2,
|
|
13344
|
-
personalData: individualUpdateSchema$1.
|
|
13362
|
+
personalData: individualUpdateSchema$1.extend({
|
|
13363
|
+
identityDocuments: z$3.array(idDocumentSyncSchema).nullable().optional()
|
|
13364
|
+
}).optional(),
|
|
13345
13365
|
organizationData: organizationUpdateSchema$1.optional(),
|
|
13346
13366
|
bankAccounts: z$3.array(bankAccountUpsertSchema.partial({ id: true })).optional(),
|
|
13347
13367
|
recipients: z$3.array(recipientUpsertSchema.partial({ id: true })).optional(),
|
|
@@ -13355,7 +13375,9 @@ z$3.object({
|
|
|
13355
13375
|
});
|
|
13356
13376
|
const partySelectOutputSchema = z$3.object({
|
|
13357
13377
|
party: partyOutputSchema$1.nullable(),
|
|
13358
|
-
personalData: individualSelectSchema.
|
|
13378
|
+
personalData: individualSelectSchema.extend({
|
|
13379
|
+
identityDocuments: z$3.array(idDocumentSelectSchema).nullable()
|
|
13380
|
+
}).nullable(),
|
|
13359
13381
|
organizationData: organizationSelectSchema.nullable(),
|
|
13360
13382
|
aml: amlSelectSchema.nullable(),
|
|
13361
13383
|
bankAccounts: z$3.array(bankAccountSelectSchema).nullable(),
|
|
@@ -13370,7 +13392,9 @@ const partySelectOutputSchema = z$3.object({
|
|
|
13370
13392
|
z$3.array(partySelectOutputSchema);
|
|
13371
13393
|
const partySelectDataSchema = z$3.object({
|
|
13372
13394
|
party: partyOutputSchema$1.nullable(),
|
|
13373
|
-
personalData: individualSelectSchema.
|
|
13395
|
+
personalData: individualSelectSchema.extend({
|
|
13396
|
+
identityDocuments: z$3.array(idDocumentSelectSchema).nullable()
|
|
13397
|
+
}).nullable(),
|
|
13374
13398
|
organizationData: organizationSelectSchema.nullable(),
|
|
13375
13399
|
aml: amlSelectSchema.nullable()
|
|
13376
13400
|
});
|
|
@@ -13725,6 +13749,15 @@ const partySchema$1 = z$3.object({
|
|
|
13725
13749
|
note: z$3.string().optional(),
|
|
13726
13750
|
countryCode: z$3.enum(COUNTRY_CODES_2).optional()
|
|
13727
13751
|
});
|
|
13752
|
+
const idDocumentInputSchema$1 = z$3.object({
|
|
13753
|
+
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
13754
|
+
idDocNumber: z$3.string(),
|
|
13755
|
+
issueDate: z$3.date().optional(),
|
|
13756
|
+
expirationDate: z$3.date().optional(),
|
|
13757
|
+
issuer: z$3.string().optional(),
|
|
13758
|
+
frontImageUri: z$3.string().optional(),
|
|
13759
|
+
backImageUri: z$3.string().optional()
|
|
13760
|
+
});
|
|
13728
13761
|
const individualInsertSchema = z$3.object({
|
|
13729
13762
|
internalId: z$3.string().optional(),
|
|
13730
13763
|
name: z$3.string().min(1, "Jm\xE9no je povinn\xE9"),
|
|
@@ -13750,7 +13783,8 @@ const individualInsertSchema = z$3.object({
|
|
|
13750
13783
|
deathNotification: z$3.date().optional(),
|
|
13751
13784
|
pin: z$3.string().optional(),
|
|
13752
13785
|
stayAbroad: z$3.boolean().optional(),
|
|
13753
|
-
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).optional()
|
|
13786
|
+
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).optional(),
|
|
13787
|
+
identityDocuments: z$3.array(idDocumentInputSchema$1).optional()
|
|
13754
13788
|
});
|
|
13755
13789
|
const createOrganizationInputSchema = z$3.object({
|
|
13756
13790
|
internalId: z$3.string().optional(),
|
|
@@ -13777,7 +13811,8 @@ const createOrganizationInputSchema = z$3.object({
|
|
|
13777
13811
|
operationCountries: z$3.string(),
|
|
13778
13812
|
riskyBusinessType: z$3.string().optional(),
|
|
13779
13813
|
vatId: z$3.string().optional(),
|
|
13780
|
-
court: z$3.enum(COURT).optional()
|
|
13814
|
+
court: z$3.enum(COURT).optional(),
|
|
13815
|
+
registerUri: z$3.string().optional()
|
|
13781
13816
|
});
|
|
13782
13817
|
const updateBankAccountSchema = z$3.object({
|
|
13783
13818
|
...bankAccountMetadataSchema.shape,
|
|
@@ -13790,7 +13825,8 @@ const updateBankAccountSchema = z$3.object({
|
|
|
13790
13825
|
number: z$3.string().min(1, "\u010C\xEDslo \xFA\u010Dtu je povinn\xE9").optional(),
|
|
13791
13826
|
currency: z$3.enum(CURRENCY_CODES, "M\u011Bna je povinn\xE1"),
|
|
13792
13827
|
countryCode: bankAccountMetadataSchema.shape.countryCode.nonoptional(),
|
|
13793
|
-
id: bankAccountMetadataSchema.shape.id.nonoptional()
|
|
13828
|
+
id: bankAccountMetadataSchema.shape.id.nonoptional(),
|
|
13829
|
+
statementUri: z$3.string().optional()
|
|
13794
13830
|
});
|
|
13795
13831
|
const bankAccountInputSchema = updateBankAccountSchema.required({
|
|
13796
13832
|
holderName: true,
|
|
@@ -13918,15 +13954,6 @@ const ownerInputSchema = z$3.object({
|
|
|
13918
13954
|
sharePercentage: z$3.number({ error: "Pod\xEDl na spole\u010Dnosti je povinn\xFD" }).min(1, "Pod\xEDl na spole\u010Dnosti je povinn\xFD").max(100),
|
|
13919
13955
|
shareEstablishedAt: z$3.string().min(1, "Datum vzniku pod\xEDlu je povinn\xFD")
|
|
13920
13956
|
});
|
|
13921
|
-
const idDocumentInputSchema$1 = z$3.object({
|
|
13922
|
-
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
13923
|
-
idDocNumber: z$3.string(),
|
|
13924
|
-
issueDate: z$3.date().optional(),
|
|
13925
|
-
expirationDate: z$3.date().optional(),
|
|
13926
|
-
issuer: z$3.string().optional(),
|
|
13927
|
-
frontImageUri: z$3.string().optional(),
|
|
13928
|
-
backImageUri: z$3.string().optional()
|
|
13929
|
-
});
|
|
13930
13957
|
const legalRepresentativeInputSchema = z$3.object({
|
|
13931
13958
|
titleBefore: z$3.string().optional(),
|
|
13932
13959
|
name: z$3.string().min(1, "Jm\xE9no je povinn\xE9"),
|
|
@@ -14006,8 +14033,15 @@ new OpenAPIHono().openapi(
|
|
|
14006
14033
|
createPartyRoute,
|
|
14007
14034
|
async (context) => {
|
|
14008
14035
|
const { owners, legalRepresentatives, ...partyInput } = context.req.valid("json");
|
|
14036
|
+
const disponentsWithDocs = (partyInput.disponents ?? []).filter(
|
|
14037
|
+
(d) => d.partyType === "INDIVIDUAL" && !!d.data.identityDocuments?.length
|
|
14038
|
+
);
|
|
14039
|
+
const disponentsForBatch = (partyInput.disponents ?? []).filter(
|
|
14040
|
+
(d) => !(d.partyType === "INDIVIDUAL" && !!d.data.identityDocuments?.length)
|
|
14041
|
+
);
|
|
14009
14042
|
const { data: partyData, error } = await context.env.MASTER_DATA_MANAGEMENT_SERVICE.createParty({
|
|
14010
14043
|
...partyInput,
|
|
14044
|
+
disponents: disponentsForBatch,
|
|
14011
14045
|
party: { ...partyInput.party, isRoot: true }
|
|
14012
14046
|
});
|
|
14013
14047
|
if (!partyData || error) {
|
|
@@ -14019,6 +14053,104 @@ new OpenAPIHono().openapi(
|
|
|
14019
14053
|
);
|
|
14020
14054
|
}
|
|
14021
14055
|
const mdm = context.env.MASTER_DATA_MANAGEMENT_SERVICE;
|
|
14056
|
+
const docService = context.env.DOCUMENT_SERVICE;
|
|
14057
|
+
if (partyInput.organizationData?.registerUri) {
|
|
14058
|
+
await docService.acknowledgeDocument({
|
|
14059
|
+
storageUrl: partyInput.organizationData.registerUri,
|
|
14060
|
+
entityId: partyData.id
|
|
14061
|
+
});
|
|
14062
|
+
}
|
|
14063
|
+
for (const ba of partyInput.bankAccounts ?? []) {
|
|
14064
|
+
if (ba.statementUri) {
|
|
14065
|
+
await docService.acknowledgeDocument({
|
|
14066
|
+
storageUrl: ba.statementUri,
|
|
14067
|
+
entityId: partyData.id
|
|
14068
|
+
});
|
|
14069
|
+
}
|
|
14070
|
+
}
|
|
14071
|
+
for (const [i, doc] of (partyInput.personalData?.identityDocuments ?? []).entries()) {
|
|
14072
|
+
const idDocId = partyData.personalIdDocIds?.[i] ?? partyData.id;
|
|
14073
|
+
if (doc.frontImageUri) {
|
|
14074
|
+
await docService.acknowledgeDocument({
|
|
14075
|
+
storageUrl: doc.frontImageUri,
|
|
14076
|
+
entityId: idDocId
|
|
14077
|
+
});
|
|
14078
|
+
}
|
|
14079
|
+
if (doc.backImageUri) {
|
|
14080
|
+
await docService.acknowledgeDocument({
|
|
14081
|
+
storageUrl: doc.backImageUri,
|
|
14082
|
+
entityId: idDocId
|
|
14083
|
+
});
|
|
14084
|
+
}
|
|
14085
|
+
}
|
|
14086
|
+
for (const disponent of disponentsWithDocs) {
|
|
14087
|
+
const { identityDocuments, ...individualData } = disponent.data;
|
|
14088
|
+
const { data: disponentParty, error: disponentError } = await mdm.createParty({
|
|
14089
|
+
party: {
|
|
14090
|
+
partyType: "INDIVIDUAL",
|
|
14091
|
+
language: partyInput.party.language,
|
|
14092
|
+
customerStatus: "NEW"
|
|
14093
|
+
},
|
|
14094
|
+
personalData: individualData,
|
|
14095
|
+
organizationData: null,
|
|
14096
|
+
bankAccounts: null,
|
|
14097
|
+
recipients: null,
|
|
14098
|
+
disponents: null,
|
|
14099
|
+
addresses: [],
|
|
14100
|
+
aml: null
|
|
14101
|
+
});
|
|
14102
|
+
if (!disponentParty || disponentError) {
|
|
14103
|
+
return context.json(
|
|
14104
|
+
{ message: "Could not create disponent party" },
|
|
14105
|
+
500
|
|
14106
|
+
);
|
|
14107
|
+
}
|
|
14108
|
+
const { error: linkDisponentError } = await mdm.linkPartyToParty({
|
|
14109
|
+
fromPartyId: disponentParty.id,
|
|
14110
|
+
toPartyId: partyData.id,
|
|
14111
|
+
relationshipType: "AUTHORIZED_SIGNATORY"
|
|
14112
|
+
});
|
|
14113
|
+
if (linkDisponentError) {
|
|
14114
|
+
return context.json(
|
|
14115
|
+
{ message: "Could not link disponent to party" },
|
|
14116
|
+
500
|
|
14117
|
+
);
|
|
14118
|
+
}
|
|
14119
|
+
for (const doc of identityDocuments ?? []) {
|
|
14120
|
+
const { data: createdIdDoc, error: idDocError } = await mdm.createIdDocument({
|
|
14121
|
+
partyId: disponentParty.id,
|
|
14122
|
+
idDocument: {
|
|
14123
|
+
partyId: disponentParty.id,
|
|
14124
|
+
idDocType: doc.idDocType,
|
|
14125
|
+
idDocNumber: doc.idDocNumber,
|
|
14126
|
+
idDocHolderName: `${individualData.name} ${individualData.surname}`,
|
|
14127
|
+
issueDate: doc.issueDate,
|
|
14128
|
+
expirationDate: doc.expirationDate,
|
|
14129
|
+
issuer: doc.issuer,
|
|
14130
|
+
frontImageUri: doc.frontImageUri,
|
|
14131
|
+
backImageUri: doc.backImageUri
|
|
14132
|
+
}
|
|
14133
|
+
});
|
|
14134
|
+
if (!createdIdDoc || idDocError) {
|
|
14135
|
+
return context.json(
|
|
14136
|
+
{ message: "Could not create disponent identity document" },
|
|
14137
|
+
500
|
|
14138
|
+
);
|
|
14139
|
+
}
|
|
14140
|
+
if (doc.frontImageUri) {
|
|
14141
|
+
await docService.acknowledgeDocument({
|
|
14142
|
+
storageUrl: doc.frontImageUri,
|
|
14143
|
+
entityId: createdIdDoc.id
|
|
14144
|
+
});
|
|
14145
|
+
}
|
|
14146
|
+
if (doc.backImageUri) {
|
|
14147
|
+
await docService.acknowledgeDocument({
|
|
14148
|
+
storageUrl: doc.backImageUri,
|
|
14149
|
+
entityId: createdIdDoc.id
|
|
14150
|
+
});
|
|
14151
|
+
}
|
|
14152
|
+
}
|
|
14153
|
+
}
|
|
14022
14154
|
if (owners?.length) {
|
|
14023
14155
|
for (const owner of owners) {
|
|
14024
14156
|
const { address, sharePercentage, shareEstablishedAt, ...individual } = owner;
|
|
@@ -14034,7 +14166,7 @@ new OpenAPIHono().openapi(
|
|
|
14034
14166
|
recipients: null,
|
|
14035
14167
|
disponents: null,
|
|
14036
14168
|
addresses: [{ ...address, addressType: "PERMANENT_ADDRESS" }],
|
|
14037
|
-
aml:
|
|
14169
|
+
aml: null
|
|
14038
14170
|
});
|
|
14039
14171
|
if (ownerParty && !ownerError) {
|
|
14040
14172
|
await mdm.linkPartyToParty({
|
|
@@ -14067,45 +14199,60 @@ new OpenAPIHono().openapi(
|
|
|
14067
14199
|
recipients: null,
|
|
14068
14200
|
disponents: null,
|
|
14069
14201
|
addresses: [{ ...address, addressType: "PERMANENT_ADDRESS" }],
|
|
14070
|
-
aml:
|
|
14202
|
+
aml: null
|
|
14071
14203
|
});
|
|
14072
|
-
if (repParty
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
await docService.acknowledgeDocument({
|
|
14104
|
-
storageUrl: doc.backImageUri,
|
|
14105
|
-
entityId: repParty.id
|
|
14106
|
-
});
|
|
14107
|
-
}
|
|
14204
|
+
if (!repParty || repError) {
|
|
14205
|
+
return context.json(
|
|
14206
|
+
{ message: "Could not create legal representative party" },
|
|
14207
|
+
500
|
|
14208
|
+
);
|
|
14209
|
+
}
|
|
14210
|
+
const { error: linkRepError } = await mdm.linkPartyToParty({
|
|
14211
|
+
fromPartyId: repParty.id,
|
|
14212
|
+
toPartyId: partyData.id,
|
|
14213
|
+
relationshipType: "BOARD_MEMBER",
|
|
14214
|
+
fromDate: new Date(dateOfEstablishment)
|
|
14215
|
+
});
|
|
14216
|
+
if (linkRepError) {
|
|
14217
|
+
return context.json(
|
|
14218
|
+
{ message: "Could not link legal representative to party" },
|
|
14219
|
+
500
|
|
14220
|
+
);
|
|
14221
|
+
}
|
|
14222
|
+
for (const doc of identityDocuments ?? []) {
|
|
14223
|
+
const { data: createdIdDoc, error: idDocError } = await mdm.createIdDocument({
|
|
14224
|
+
partyId: repParty.id,
|
|
14225
|
+
idDocument: {
|
|
14226
|
+
partyId: repParty.id,
|
|
14227
|
+
idDocType: doc.idDocType,
|
|
14228
|
+
idDocNumber: doc.idDocNumber,
|
|
14229
|
+
idDocHolderName: `${individual.name} ${individual.surname}`,
|
|
14230
|
+
issueDate: doc.issueDate,
|
|
14231
|
+
expirationDate: doc.expirationDate,
|
|
14232
|
+
issuer: doc.issuer,
|
|
14233
|
+
frontImageUri: doc.frontImageUri,
|
|
14234
|
+
backImageUri: doc.backImageUri
|
|
14108
14235
|
}
|
|
14236
|
+
});
|
|
14237
|
+
if (!createdIdDoc || idDocError) {
|
|
14238
|
+
return context.json(
|
|
14239
|
+
{
|
|
14240
|
+
message: "Could not create legal representative identity document"
|
|
14241
|
+
},
|
|
14242
|
+
500
|
|
14243
|
+
);
|
|
14244
|
+
}
|
|
14245
|
+
if (doc.frontImageUri) {
|
|
14246
|
+
await docService.acknowledgeDocument({
|
|
14247
|
+
storageUrl: doc.frontImageUri,
|
|
14248
|
+
entityId: createdIdDoc.id
|
|
14249
|
+
});
|
|
14250
|
+
}
|
|
14251
|
+
if (doc.backImageUri) {
|
|
14252
|
+
await docService.acknowledgeDocument({
|
|
14253
|
+
storageUrl: doc.backImageUri,
|
|
14254
|
+
entityId: createdIdDoc.id
|
|
14255
|
+
});
|
|
14109
14256
|
}
|
|
14110
14257
|
}
|
|
14111
14258
|
}
|
|
@@ -14128,6 +14275,16 @@ const partySchema = z$3.object({
|
|
|
14128
14275
|
note: z$3.string().optional(),
|
|
14129
14276
|
countryCode: z$3.enum(COUNTRY_CODES_2).optional()
|
|
14130
14277
|
});
|
|
14278
|
+
const idDocumentInputSchema = z$3.object({
|
|
14279
|
+
id: z$3.uuid().optional(),
|
|
14280
|
+
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
14281
|
+
idDocNumber: z$3.string(),
|
|
14282
|
+
issueDate: z$3.date().optional(),
|
|
14283
|
+
expirationDate: z$3.date().optional(),
|
|
14284
|
+
issuer: z$3.string().optional(),
|
|
14285
|
+
frontImageUri: z$3.string().optional(),
|
|
14286
|
+
backImageUri: z$3.string().optional()
|
|
14287
|
+
});
|
|
14131
14288
|
const individualUpdateSchema = z$3.object({
|
|
14132
14289
|
id: z$3.uuid(),
|
|
14133
14290
|
partyId: z$3.uuid(),
|
|
@@ -14155,7 +14312,8 @@ const individualUpdateSchema = z$3.object({
|
|
|
14155
14312
|
deathNotification: z$3.date().optional(),
|
|
14156
14313
|
pin: z$3.string().optional(),
|
|
14157
14314
|
stayAbroad: z$3.boolean().optional(),
|
|
14158
|
-
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).optional()
|
|
14315
|
+
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).optional(),
|
|
14316
|
+
identityDocuments: z$3.array(idDocumentInputSchema).optional()
|
|
14159
14317
|
});
|
|
14160
14318
|
const organizationUpdateSchema = z$3.object({
|
|
14161
14319
|
id: z$3.uuid(),
|
|
@@ -14184,7 +14342,8 @@ const organizationUpdateSchema = z$3.object({
|
|
|
14184
14342
|
operationCountries: z$3.string(),
|
|
14185
14343
|
riskyBusinessType: z$3.string().optional(),
|
|
14186
14344
|
vatId: z$3.string().nullable().optional(),
|
|
14187
|
-
court: z$3.enum(COURT).nullable().optional()
|
|
14345
|
+
court: z$3.enum(COURT).nullable().optional(),
|
|
14346
|
+
registerUri: z$3.string().optional()
|
|
14188
14347
|
});
|
|
14189
14348
|
const syncBankAccountSchema = z$3.object({
|
|
14190
14349
|
...bankAccountMetadataSchema.shape,
|
|
@@ -14194,7 +14353,8 @@ const syncBankAccountSchema = z$3.object({
|
|
|
14194
14353
|
number: z$3.string().optional(),
|
|
14195
14354
|
currency: bankAccountMetadataSchema.shape.currency.nonoptional(),
|
|
14196
14355
|
countryCode: bankAccountMetadataSchema.shape.countryCode.nonoptional(),
|
|
14197
|
-
id: z$3.uuid().optional()
|
|
14356
|
+
id: z$3.uuid().optional(),
|
|
14357
|
+
statementUri: z$3.string().optional()
|
|
14198
14358
|
});
|
|
14199
14359
|
const disponentIndividualSyncDataSchema = z$3.object({
|
|
14200
14360
|
id: z$3.uuid().optional(),
|
|
@@ -14221,7 +14381,8 @@ const disponentIndividualSyncDataSchema = z$3.object({
|
|
|
14221
14381
|
deathNotification: z$3.date().optional(),
|
|
14222
14382
|
pin: z$3.string().optional(),
|
|
14223
14383
|
stayAbroad: z$3.boolean().optional(),
|
|
14224
|
-
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).optional()
|
|
14384
|
+
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).optional(),
|
|
14385
|
+
identityDocuments: z$3.array(idDocumentInputSchema).optional()
|
|
14225
14386
|
});
|
|
14226
14387
|
const disponentOrganizationSyncDataSchema = z$3.object({
|
|
14227
14388
|
id: z$3.uuid().optional(),
|
|
@@ -14246,7 +14407,8 @@ const disponentOrganizationSyncDataSchema = z$3.object({
|
|
|
14246
14407
|
companyObjectsDescription: z$3.string(),
|
|
14247
14408
|
turnover3years: z$3.number(),
|
|
14248
14409
|
operationCountries: z$3.string(),
|
|
14249
|
-
riskyBusinessType: z$3.string().optional()
|
|
14410
|
+
riskyBusinessType: z$3.string().optional(),
|
|
14411
|
+
registerUri: z$3.string().optional()
|
|
14250
14412
|
});
|
|
14251
14413
|
const disponentSyncSchema = z$3.discriminatedUnion("partyType", [
|
|
14252
14414
|
z$3.object({
|
|
@@ -14361,15 +14523,6 @@ const ownerSyncSchema = z$3.object({
|
|
|
14361
14523
|
sharePercentage: z$3.number().max(100),
|
|
14362
14524
|
shareEstablishedAt: z$3.string().min(1, "Datum vzniku pod\xEDlu je povinn\xFD")
|
|
14363
14525
|
});
|
|
14364
|
-
const idDocumentInputSchema = z$3.object({
|
|
14365
|
-
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
14366
|
-
idDocNumber: z$3.string(),
|
|
14367
|
-
issueDate: z$3.date().optional(),
|
|
14368
|
-
expirationDate: z$3.date().optional(),
|
|
14369
|
-
issuer: z$3.string().optional(),
|
|
14370
|
-
frontImageUri: z$3.string().optional(),
|
|
14371
|
-
backImageUri: z$3.string().optional()
|
|
14372
|
-
});
|
|
14373
14526
|
const legalRepresentativeSyncSchema = z$3.object({
|
|
14374
14527
|
id: z$3.uuid().optional(),
|
|
14375
14528
|
titleBefore: z$3.string().optional(),
|
|
@@ -14472,24 +14625,74 @@ new OpenAPIHono().openapi(
|
|
|
14472
14625
|
if (!updatedParty || partyError) {
|
|
14473
14626
|
return context.json({ message: "Could not update a Party" }, 404);
|
|
14474
14627
|
}
|
|
14628
|
+
const docService = context.env.DOCUMENT_SERVICE;
|
|
14629
|
+
if (party.organizationData?.registerUri) {
|
|
14630
|
+
await docService.acknowledgeDocument({
|
|
14631
|
+
storageUrl: party.organizationData.registerUri,
|
|
14632
|
+
entityId: partyId
|
|
14633
|
+
});
|
|
14634
|
+
}
|
|
14635
|
+
for (const ba of party.bankAccounts ?? []) {
|
|
14636
|
+
if (ba.statementUri) {
|
|
14637
|
+
await docService.acknowledgeDocument({
|
|
14638
|
+
storageUrl: ba.statementUri,
|
|
14639
|
+
entityId: partyId
|
|
14640
|
+
});
|
|
14641
|
+
}
|
|
14642
|
+
}
|
|
14643
|
+
if (party.personalData?.identityDocuments?.length) {
|
|
14644
|
+
let newDocIdx = 0;
|
|
14645
|
+
for (const doc of party.personalData.identityDocuments) {
|
|
14646
|
+
const idDocEntityId = doc.id ? doc.id : updatedParty.newPersonalIdDocIds?.[newDocIdx++] ?? partyId;
|
|
14647
|
+
if (doc.frontImageUri) {
|
|
14648
|
+
await docService.acknowledgeDocument({
|
|
14649
|
+
storageUrl: doc.frontImageUri,
|
|
14650
|
+
entityId: idDocEntityId
|
|
14651
|
+
});
|
|
14652
|
+
}
|
|
14653
|
+
if (doc.backImageUri) {
|
|
14654
|
+
await docService.acknowledgeDocument({
|
|
14655
|
+
storageUrl: doc.backImageUri,
|
|
14656
|
+
entityId: idDocEntityId
|
|
14657
|
+
});
|
|
14658
|
+
}
|
|
14659
|
+
}
|
|
14660
|
+
}
|
|
14475
14661
|
if (party.legalRepresentatives?.length) {
|
|
14476
|
-
|
|
14662
|
+
let newBmDocIdx = 0;
|
|
14477
14663
|
for (const rep of party.legalRepresentatives) {
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14664
|
+
if (rep.id) continue;
|
|
14665
|
+
for (const doc of rep.identityDocuments ?? []) {
|
|
14666
|
+
const idDocEntityId = updatedParty.newBoardMemberIdDocIds?.[newBmDocIdx++] ?? partyId;
|
|
14667
|
+
if (doc.frontImageUri) {
|
|
14668
|
+
await docService.acknowledgeDocument({
|
|
14669
|
+
storageUrl: doc.frontImageUri,
|
|
14670
|
+
entityId: idDocEntityId
|
|
14671
|
+
});
|
|
14672
|
+
}
|
|
14673
|
+
if (doc.backImageUri) {
|
|
14674
|
+
await docService.acknowledgeDocument({
|
|
14675
|
+
storageUrl: doc.backImageUri,
|
|
14676
|
+
entityId: idDocEntityId
|
|
14677
|
+
});
|
|
14678
|
+
}
|
|
14679
|
+
}
|
|
14680
|
+
}
|
|
14681
|
+
for (const rep of party.legalRepresentatives) {
|
|
14682
|
+
if (!rep.id) continue;
|
|
14683
|
+
for (const doc of rep.identityDocuments ?? []) {
|
|
14684
|
+
const idDocEntityId = doc.id ? doc.id : updatedParty.newBoardMemberIdDocIds?.[newBmDocIdx++] ?? partyId;
|
|
14685
|
+
if (doc.frontImageUri) {
|
|
14686
|
+
await docService.acknowledgeDocument({
|
|
14687
|
+
storageUrl: doc.frontImageUri,
|
|
14688
|
+
entityId: idDocEntityId
|
|
14689
|
+
});
|
|
14690
|
+
}
|
|
14691
|
+
if (doc.backImageUri) {
|
|
14692
|
+
await docService.acknowledgeDocument({
|
|
14693
|
+
storageUrl: doc.backImageUri,
|
|
14694
|
+
entityId: idDocEntityId
|
|
14695
|
+
});
|
|
14493
14696
|
}
|
|
14494
14697
|
}
|
|
14495
14698
|
}
|
|
@@ -14504,53 +14707,215 @@ new OpenAPIHono().openapi(
|
|
|
14504
14707
|
}
|
|
14505
14708
|
);
|
|
14506
14709
|
|
|
14507
|
-
const
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
language: z$3.enum(LANGUAGE_CODES),
|
|
14511
|
-
id: z$3.uuid(),
|
|
14512
|
-
internalId: z$3.string().nullable(),
|
|
14513
|
-
note: z$3.string().nullable(),
|
|
14514
|
-
countryCode: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14515
|
-
createdAt: z$3.date().nullable(),
|
|
14516
|
-
updatedAt: z$3.date().nullable(),
|
|
14517
|
-
isRoot: z$3.boolean()
|
|
14710
|
+
const DOCUMENT_SIDE = ["front", "back"];
|
|
14711
|
+
const paramsSchema$2 = z$3.object({
|
|
14712
|
+
partyId: z$3.uuid()
|
|
14518
14713
|
});
|
|
14519
|
-
const
|
|
14520
|
-
id: z$3.uuid(),
|
|
14714
|
+
const idDocumentCreateInputSchema = z$3.object({
|
|
14521
14715
|
partyId: z$3.uuid(),
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
personalId: z$3.string(),
|
|
14531
|
-
gender: z$3.enum(GENDER),
|
|
14532
|
-
citizenship: z$3.enum(COUNTRY_CODES_2),
|
|
14533
|
-
citizenshipOther: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14534
|
-
employer: z$3.string().nullable(),
|
|
14535
|
-
employerCountry: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14536
|
-
registeredNumber: z$3.string().nullable(),
|
|
14537
|
-
isPep: z$3.boolean(),
|
|
14538
|
-
titleBefore: z$3.string().nullable(),
|
|
14539
|
-
titleAfter: z$3.string().nullable(),
|
|
14540
|
-
birthSurname: z$3.string().nullable(),
|
|
14541
|
-
vocativeTitle: z$3.string().nullable(),
|
|
14542
|
-
deathDate: z$3.coerce.date().nullable(),
|
|
14543
|
-
deathNotification: z$3.coerce.date().nullable(),
|
|
14544
|
-
pin: z$3.string().nullable(),
|
|
14545
|
-
stayAbroad: z$3.boolean().nullable(),
|
|
14546
|
-
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14547
|
-
createdAt: z$3.coerce.date().nullable(),
|
|
14548
|
-
updatedAt: z$3.coerce.date().nullable()
|
|
14716
|
+
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
14717
|
+
idDocNumber: z$3.string(),
|
|
14718
|
+
idDocHolderName: z$3.string(),
|
|
14719
|
+
issueDate: z$3.coerce.date().optional(),
|
|
14720
|
+
expirationDate: z$3.coerce.date().optional(),
|
|
14721
|
+
issuer: z$3.string().optional(),
|
|
14722
|
+
countryOfIssue: z$3.enum(COUNTRY_CODES_2).optional(),
|
|
14723
|
+
idDocStatus: z$3.enum(ID_DOC_STATUS).optional()
|
|
14549
14724
|
});
|
|
14550
|
-
const
|
|
14725
|
+
const idDocumentMultipartSchema = z$3.object({
|
|
14726
|
+
idDocument: z$3.string(),
|
|
14727
|
+
documentSide: z$3.enum(DOCUMENT_SIDE),
|
|
14728
|
+
file: z$3.any()
|
|
14729
|
+
});
|
|
14730
|
+
const multipartOpenApiSchema = z$3.object({
|
|
14731
|
+
idDocument: z$3.string().openapi({
|
|
14732
|
+
description: "JSON stringified IdDocument payload"
|
|
14733
|
+
}),
|
|
14734
|
+
documentSide: z$3.enum(DOCUMENT_SIDE),
|
|
14735
|
+
file: z$3.any().openapi({
|
|
14736
|
+
type: "string",
|
|
14737
|
+
format: "binary"
|
|
14738
|
+
})
|
|
14739
|
+
});
|
|
14740
|
+
const idDocumentOutputSchema = z$3.object({
|
|
14741
|
+
id: z$3.uuid(),
|
|
14742
|
+
createdAt: z$3.iso.datetime().nullable(),
|
|
14743
|
+
updatedAt: z$3.iso.datetime().nullable(),
|
|
14744
|
+
deletedAt: z$3.iso.datetime().nullable(),
|
|
14551
14745
|
partyId: z$3.uuid(),
|
|
14552
|
-
|
|
14553
|
-
|
|
14746
|
+
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
14747
|
+
idDocNumber: z$3.string(),
|
|
14748
|
+
idDocHolderName: z$3.string(),
|
|
14749
|
+
issueDate: z$3.iso.datetime().nullable(),
|
|
14750
|
+
expirationDate: z$3.iso.datetime().nullable(),
|
|
14751
|
+
issuer: z$3.string().nullable(),
|
|
14752
|
+
countryOfIssue: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14753
|
+
frontImageUri: z$3.string().nullable(),
|
|
14754
|
+
backImageUri: z$3.string().nullable(),
|
|
14755
|
+
idDocStatus: z$3.enum(ID_DOC_STATUS).nullable()
|
|
14756
|
+
});
|
|
14757
|
+
const responseBodySchema$3 = z$3.object({
|
|
14758
|
+
message: z$3.string(),
|
|
14759
|
+
idDocument: idDocumentOutputSchema
|
|
14760
|
+
});
|
|
14761
|
+
const createDocumentRoute = createRoute({
|
|
14762
|
+
method: "post",
|
|
14763
|
+
path: "/",
|
|
14764
|
+
summary: "Create ID Document",
|
|
14765
|
+
tags: ["ID Documents"],
|
|
14766
|
+
description: "Creates a new identification document for the specified party and uploads the document image (front or back side). Accepts multipart form data with the document metadata as a JSON string and the file as a binary attachment.",
|
|
14767
|
+
// middleware: [jwt, signature(), idempotency()],
|
|
14768
|
+
// security: [{ JwtAuth: [] }],
|
|
14769
|
+
request: {
|
|
14770
|
+
// headers: z.object({
|
|
14771
|
+
// 'X-Idempotency-Key': XIdempotencyKeyHeaderSchema,
|
|
14772
|
+
// 'X-Signature': XSignatureHeaderSchema,
|
|
14773
|
+
// 'X-Signature-Key': XSignatureKeyHeaderSchema,
|
|
14774
|
+
// }),
|
|
14775
|
+
body: {
|
|
14776
|
+
content: {
|
|
14777
|
+
"multipart/form-data": {
|
|
14778
|
+
schema: multipartOpenApiSchema
|
|
14779
|
+
}
|
|
14780
|
+
},
|
|
14781
|
+
required: true
|
|
14782
|
+
},
|
|
14783
|
+
params: paramsSchema$2
|
|
14784
|
+
},
|
|
14785
|
+
responses: {
|
|
14786
|
+
200: {
|
|
14787
|
+
description: "Document created and file uploaded",
|
|
14788
|
+
content: {
|
|
14789
|
+
"application/json": {
|
|
14790
|
+
schema: responseBodySchema$3
|
|
14791
|
+
}
|
|
14792
|
+
}
|
|
14793
|
+
},
|
|
14794
|
+
400: {
|
|
14795
|
+
description: "Invalid request",
|
|
14796
|
+
content: {
|
|
14797
|
+
"application/json": {
|
|
14798
|
+
schema: z$3.object({ message: z$3.string() })
|
|
14799
|
+
}
|
|
14800
|
+
}
|
|
14801
|
+
},
|
|
14802
|
+
500: {
|
|
14803
|
+
description: "Internal server error",
|
|
14804
|
+
content: {
|
|
14805
|
+
"application/json": {
|
|
14806
|
+
schema: z$3.object({ message: z$3.string() })
|
|
14807
|
+
}
|
|
14808
|
+
}
|
|
14809
|
+
}
|
|
14810
|
+
}
|
|
14811
|
+
});
|
|
14812
|
+
new OpenAPIHono().openapi(
|
|
14813
|
+
createDocumentRoute,
|
|
14814
|
+
async (context) => {
|
|
14815
|
+
const rawBody = await context.req.parseBody();
|
|
14816
|
+
const { partyId } = context.req.valid("param");
|
|
14817
|
+
const idDocumentRaw = rawBody.idDocument;
|
|
14818
|
+
const documentSide = rawBody.documentSide;
|
|
14819
|
+
const file = rawBody.file;
|
|
14820
|
+
if (typeof idDocumentRaw !== "string" || !DOCUMENT_SIDE.includes(documentSide) || !(file instanceof File)) {
|
|
14821
|
+
return context.json({ message: "Invalid multipart payload" }, 400);
|
|
14822
|
+
}
|
|
14823
|
+
const idDocumentJson = JSON.parse(JSON.parse(idDocumentRaw));
|
|
14824
|
+
const idDocumentResult = idDocumentCreateInputSchema.safeParse(idDocumentJson);
|
|
14825
|
+
if (!idDocumentResult.success) {
|
|
14826
|
+
console.error(idDocumentResult.error);
|
|
14827
|
+
return context.json({ message: "Could not parse IdDocument" }, 400);
|
|
14828
|
+
}
|
|
14829
|
+
const {
|
|
14830
|
+
data: createdIdDocument,
|
|
14831
|
+
error: createError,
|
|
14832
|
+
message
|
|
14833
|
+
} = await context.env.MASTER_DATA_MANAGEMENT_SERVICE.createIdDocument({
|
|
14834
|
+
idDocument: idDocumentResult.data,
|
|
14835
|
+
partyId
|
|
14836
|
+
});
|
|
14837
|
+
if (!createdIdDocument || createError) {
|
|
14838
|
+
console.error(message);
|
|
14839
|
+
return context.json({ message: "Could not create IdDocument" }, 500);
|
|
14840
|
+
}
|
|
14841
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
14842
|
+
const { data: uploadResult, error: uploadError } = await context.env.DOCUMENT_SERVICE.uploadDocument({
|
|
14843
|
+
entityType: "client",
|
|
14844
|
+
entityId: createdIdDocument.id,
|
|
14845
|
+
type: "kyc",
|
|
14846
|
+
metadata: {},
|
|
14847
|
+
file: {
|
|
14848
|
+
bytes,
|
|
14849
|
+
type: file.type,
|
|
14850
|
+
name: file.name,
|
|
14851
|
+
size: file.size
|
|
14852
|
+
}
|
|
14853
|
+
});
|
|
14854
|
+
if (!uploadResult || uploadError) {
|
|
14855
|
+
return context.json({ message: "File upload failed" }, 500);
|
|
14856
|
+
}
|
|
14857
|
+
return context.json(
|
|
14858
|
+
{
|
|
14859
|
+
message: "IdDocument created successfully",
|
|
14860
|
+
idDocument: {
|
|
14861
|
+
...createdIdDocument,
|
|
14862
|
+
frontImageUri: documentSide === "front" ? uploadResult.storageUrl : createdIdDocument.frontImageUri,
|
|
14863
|
+
backImageUri: documentSide === "back" ? uploadResult.storageUrl : createdIdDocument.backImageUri
|
|
14864
|
+
}
|
|
14865
|
+
},
|
|
14866
|
+
200
|
|
14867
|
+
);
|
|
14868
|
+
}
|
|
14869
|
+
);
|
|
14870
|
+
|
|
14871
|
+
const partyBaseOutputSchema = z$3.object({
|
|
14872
|
+
customerStatus: z$3.enum(CUSTOMER_STATUS),
|
|
14873
|
+
partyType: z$3.enum(PARTY_TYPE),
|
|
14874
|
+
language: z$3.enum(LANGUAGE_CODES),
|
|
14875
|
+
id: z$3.uuid(),
|
|
14876
|
+
internalId: z$3.string().nullable(),
|
|
14877
|
+
note: z$3.string().nullable(),
|
|
14878
|
+
countryCode: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14879
|
+
createdAt: z$3.date().nullable(),
|
|
14880
|
+
updatedAt: z$3.date().nullable(),
|
|
14881
|
+
isRoot: z$3.boolean()
|
|
14882
|
+
});
|
|
14883
|
+
const individualOutputSchema = z$3.object({
|
|
14884
|
+
id: z$3.uuid(),
|
|
14885
|
+
partyId: z$3.uuid(),
|
|
14886
|
+
internalId: z$3.string().nullable(),
|
|
14887
|
+
name: z$3.string(),
|
|
14888
|
+
surname: z$3.string(),
|
|
14889
|
+
email: z$3.string().nullable(),
|
|
14890
|
+
phone: z$3.string().nullable(),
|
|
14891
|
+
birthDate: z$3.string().nullable(),
|
|
14892
|
+
birthPlace: z$3.string(),
|
|
14893
|
+
countryOfBirth: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14894
|
+
personalId: z$3.string(),
|
|
14895
|
+
gender: z$3.enum(GENDER),
|
|
14896
|
+
citizenship: z$3.enum(COUNTRY_CODES_2),
|
|
14897
|
+
citizenshipOther: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14898
|
+
employer: z$3.string().nullable(),
|
|
14899
|
+
employerCountry: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14900
|
+
registeredNumber: z$3.string().nullable(),
|
|
14901
|
+
isPep: z$3.boolean(),
|
|
14902
|
+
titleBefore: z$3.string().nullable(),
|
|
14903
|
+
titleAfter: z$3.string().nullable(),
|
|
14904
|
+
birthSurname: z$3.string().nullable(),
|
|
14905
|
+
vocativeTitle: z$3.string().nullable(),
|
|
14906
|
+
deathDate: z$3.coerce.date().nullable(),
|
|
14907
|
+
deathNotification: z$3.coerce.date().nullable(),
|
|
14908
|
+
pin: z$3.string().nullable(),
|
|
14909
|
+
stayAbroad: z$3.boolean().nullable(),
|
|
14910
|
+
stayAbroadCountries: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14911
|
+
createdAt: z$3.coerce.date().nullable(),
|
|
14912
|
+
updatedAt: z$3.coerce.date().nullable(),
|
|
14913
|
+
identityDocuments: z$3.array(idDocumentOutputSchema).nullable()
|
|
14914
|
+
});
|
|
14915
|
+
const createOrganizationOutputSchema = z$3.object({
|
|
14916
|
+
partyId: z$3.uuid(),
|
|
14917
|
+
internalId: z$3.string().nullable(),
|
|
14918
|
+
businessName: z$3.string(),
|
|
14554
14919
|
email: z$3.string().nullable(),
|
|
14555
14920
|
phone: z$3.string().nullable(),
|
|
14556
14921
|
registeredNumber: z$3.string(),
|
|
@@ -14573,7 +14938,8 @@ const createOrganizationOutputSchema = z$3.object({
|
|
|
14573
14938
|
operationCountries: z$3.string(),
|
|
14574
14939
|
riskyBusinessType: z$3.string().nullable(),
|
|
14575
14940
|
vatId: z$3.string().nullable(),
|
|
14576
|
-
court: z$3.enum(COURT).nullable()
|
|
14941
|
+
court: z$3.enum(COURT).nullable(),
|
|
14942
|
+
registerUri: z$3.string().nullable()
|
|
14577
14943
|
});
|
|
14578
14944
|
const bankAccountOutputSchema = z$3.object({
|
|
14579
14945
|
id: z$3.string(),
|
|
@@ -14593,7 +14959,8 @@ const bankAccountOutputSchema = z$3.object({
|
|
|
14593
14959
|
clabe: z$3.string().nullable(),
|
|
14594
14960
|
bsb: z$3.string().nullable(),
|
|
14595
14961
|
brBankNumber: z$3.string().nullable(),
|
|
14596
|
-
updatedAt: z$3.coerce.date().nullable()
|
|
14962
|
+
updatedAt: z$3.coerce.date().nullable(),
|
|
14963
|
+
statementUri: z$3.string().nullable()
|
|
14597
14964
|
});
|
|
14598
14965
|
const disponentOutputSchema = z$3.discriminatedUnion("partyType", [
|
|
14599
14966
|
z$3.object({
|
|
@@ -14730,6 +15097,9 @@ const productsOutputSchema = z$3.object({
|
|
|
14730
15097
|
}).nullable(),
|
|
14731
15098
|
cbs: z$3.object({}).nullable()
|
|
14732
15099
|
});
|
|
15100
|
+
const recipientOutputSchema = bankAccountOutputSchema.omit({
|
|
15101
|
+
statementUri: true
|
|
15102
|
+
});
|
|
14733
15103
|
const partyOutputSchema = z$3.object({
|
|
14734
15104
|
party: partyBaseOutputSchema.nullable(),
|
|
14735
15105
|
personalData: individualOutputSchema.nullable(),
|
|
@@ -14738,13 +15108,13 @@ const partyOutputSchema = z$3.object({
|
|
|
14738
15108
|
disponents: z$3.array(disponentOutputSchema).nullable(),
|
|
14739
15109
|
addresses: z$3.array(createAddressOutputSchema).nullable(),
|
|
14740
15110
|
aml: createAmlOutputSchema.nullable(),
|
|
14741
|
-
recipients: z$3.array(
|
|
15111
|
+
recipients: z$3.array(recipientOutputSchema).nullable(),
|
|
14742
15112
|
products: productsOutputSchema.nullable(),
|
|
14743
15113
|
traderIds: z$3.array(z$3.uuid()).nullable(),
|
|
14744
15114
|
owners: z$3.array(ownerOutputSchema).nullable(),
|
|
14745
15115
|
legalRepresentatives: z$3.array(legalRepresentativeOutputSchema).nullable()
|
|
14746
15116
|
});
|
|
14747
|
-
const responseBodySchema$
|
|
15117
|
+
const responseBodySchema$2 = z$3.object({
|
|
14748
15118
|
message: z$3.string(),
|
|
14749
15119
|
party: partyOutputSchema
|
|
14750
15120
|
});
|
|
@@ -14761,7 +15131,7 @@ const getPartyByPartyIdRoute = createRoute({
|
|
|
14761
15131
|
200: {
|
|
14762
15132
|
content: {
|
|
14763
15133
|
"application/json": {
|
|
14764
|
-
schema: responseBodySchema$
|
|
15134
|
+
schema: responseBodySchema$2
|
|
14765
15135
|
}
|
|
14766
15136
|
},
|
|
14767
15137
|
description: "Get party by party Id"
|
|
@@ -14878,167 +15248,6 @@ new OpenAPIHono().openapi(
|
|
|
14878
15248
|
}
|
|
14879
15249
|
);
|
|
14880
15250
|
|
|
14881
|
-
const DOCUMENT_SIDE = ["front", "back"];
|
|
14882
|
-
const paramsSchema$2 = z$3.object({
|
|
14883
|
-
partyId: z$3.uuid()
|
|
14884
|
-
});
|
|
14885
|
-
const idDocumentCreateInputSchema = z$3.object({
|
|
14886
|
-
partyId: z$3.uuid(),
|
|
14887
|
-
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
14888
|
-
idDocNumber: z$3.string(),
|
|
14889
|
-
idDocHolderName: z$3.string(),
|
|
14890
|
-
issueDate: z$3.coerce.date().optional(),
|
|
14891
|
-
expirationDate: z$3.coerce.date().optional(),
|
|
14892
|
-
issuer: z$3.string().optional(),
|
|
14893
|
-
countryOfIssue: z$3.enum(COUNTRY_CODES_2).optional(),
|
|
14894
|
-
idDocStatus: z$3.enum(ID_DOC_STATUS).optional()
|
|
14895
|
-
});
|
|
14896
|
-
const idDocumentMultipartSchema = z$3.object({
|
|
14897
|
-
idDocument: z$3.string(),
|
|
14898
|
-
documentSide: z$3.enum(DOCUMENT_SIDE),
|
|
14899
|
-
file: z$3.any()
|
|
14900
|
-
});
|
|
14901
|
-
const multipartOpenApiSchema = z$3.object({
|
|
14902
|
-
idDocument: z$3.string().openapi({
|
|
14903
|
-
description: "JSON stringified IdDocument payload"
|
|
14904
|
-
}),
|
|
14905
|
-
documentSide: z$3.enum(DOCUMENT_SIDE),
|
|
14906
|
-
file: z$3.any().openapi({
|
|
14907
|
-
type: "string",
|
|
14908
|
-
format: "binary"
|
|
14909
|
-
})
|
|
14910
|
-
});
|
|
14911
|
-
const idDocumentOutputSchema = z$3.object({
|
|
14912
|
-
id: z$3.uuid(),
|
|
14913
|
-
createdAt: z$3.iso.datetime().nullable(),
|
|
14914
|
-
updatedAt: z$3.iso.datetime().nullable(),
|
|
14915
|
-
deletedAt: z$3.iso.datetime().nullable(),
|
|
14916
|
-
partyId: z$3.uuid(),
|
|
14917
|
-
idDocType: z$3.enum(ID_DOC_TYPE),
|
|
14918
|
-
idDocNumber: z$3.string(),
|
|
14919
|
-
idDocHolderName: z$3.string(),
|
|
14920
|
-
issueDate: z$3.iso.datetime().nullable(),
|
|
14921
|
-
expirationDate: z$3.iso.datetime().nullable(),
|
|
14922
|
-
issuer: z$3.string().nullable(),
|
|
14923
|
-
countryOfIssue: z$3.enum(COUNTRY_CODES_2).nullable(),
|
|
14924
|
-
frontImageUri: z$3.string().nullable(),
|
|
14925
|
-
backImageUri: z$3.string().nullable(),
|
|
14926
|
-
idDocStatus: z$3.enum(ID_DOC_STATUS).nullable()
|
|
14927
|
-
});
|
|
14928
|
-
const responseBodySchema$2 = z$3.object({
|
|
14929
|
-
message: z$3.string(),
|
|
14930
|
-
idDocument: idDocumentOutputSchema
|
|
14931
|
-
});
|
|
14932
|
-
const createDocumentRoute = createRoute({
|
|
14933
|
-
method: "post",
|
|
14934
|
-
path: "/",
|
|
14935
|
-
summary: "Create ID Document",
|
|
14936
|
-
tags: ["ID Documents"],
|
|
14937
|
-
description: "Creates a new identification document for the specified party and uploads the document image (front or back side). Accepts multipart form data with the document metadata as a JSON string and the file as a binary attachment.",
|
|
14938
|
-
// middleware: [jwt, signature(), idempotency()],
|
|
14939
|
-
// security: [{ JwtAuth: [] }],
|
|
14940
|
-
request: {
|
|
14941
|
-
// headers: z.object({
|
|
14942
|
-
// 'X-Idempotency-Key': XIdempotencyKeyHeaderSchema,
|
|
14943
|
-
// 'X-Signature': XSignatureHeaderSchema,
|
|
14944
|
-
// 'X-Signature-Key': XSignatureKeyHeaderSchema,
|
|
14945
|
-
// }),
|
|
14946
|
-
body: {
|
|
14947
|
-
content: {
|
|
14948
|
-
"multipart/form-data": {
|
|
14949
|
-
schema: multipartOpenApiSchema
|
|
14950
|
-
}
|
|
14951
|
-
},
|
|
14952
|
-
required: true
|
|
14953
|
-
},
|
|
14954
|
-
params: paramsSchema$2
|
|
14955
|
-
},
|
|
14956
|
-
responses: {
|
|
14957
|
-
200: {
|
|
14958
|
-
description: "Document created and file uploaded",
|
|
14959
|
-
content: {
|
|
14960
|
-
"application/json": {
|
|
14961
|
-
schema: responseBodySchema$2
|
|
14962
|
-
}
|
|
14963
|
-
}
|
|
14964
|
-
},
|
|
14965
|
-
400: {
|
|
14966
|
-
description: "Invalid request",
|
|
14967
|
-
content: {
|
|
14968
|
-
"application/json": {
|
|
14969
|
-
schema: z$3.object({ message: z$3.string() })
|
|
14970
|
-
}
|
|
14971
|
-
}
|
|
14972
|
-
},
|
|
14973
|
-
500: {
|
|
14974
|
-
description: "Internal server error",
|
|
14975
|
-
content: {
|
|
14976
|
-
"application/json": {
|
|
14977
|
-
schema: z$3.object({ message: z$3.string() })
|
|
14978
|
-
}
|
|
14979
|
-
}
|
|
14980
|
-
}
|
|
14981
|
-
}
|
|
14982
|
-
});
|
|
14983
|
-
new OpenAPIHono().openapi(
|
|
14984
|
-
createDocumentRoute,
|
|
14985
|
-
async (context) => {
|
|
14986
|
-
const rawBody = await context.req.parseBody();
|
|
14987
|
-
const { partyId } = context.req.valid("param");
|
|
14988
|
-
const idDocumentRaw = rawBody.idDocument;
|
|
14989
|
-
const documentSide = rawBody.documentSide;
|
|
14990
|
-
const file = rawBody.file;
|
|
14991
|
-
if (typeof idDocumentRaw !== "string" || !DOCUMENT_SIDE.includes(documentSide) || !(file instanceof File)) {
|
|
14992
|
-
return context.json({ message: "Invalid multipart payload" }, 400);
|
|
14993
|
-
}
|
|
14994
|
-
const idDocumentJson = JSON.parse(JSON.parse(idDocumentRaw));
|
|
14995
|
-
const idDocumentResult = idDocumentCreateInputSchema.safeParse(idDocumentJson);
|
|
14996
|
-
if (!idDocumentResult.success) {
|
|
14997
|
-
console.error(idDocumentResult.error);
|
|
14998
|
-
return context.json({ message: "Could not parse IdDocument" }, 400);
|
|
14999
|
-
}
|
|
15000
|
-
const {
|
|
15001
|
-
data: createdIdDocument,
|
|
15002
|
-
error: createError,
|
|
15003
|
-
message
|
|
15004
|
-
} = await context.env.MASTER_DATA_MANAGEMENT_SERVICE.createIdDocument({
|
|
15005
|
-
idDocument: idDocumentResult.data,
|
|
15006
|
-
partyId
|
|
15007
|
-
});
|
|
15008
|
-
if (!createdIdDocument || createError) {
|
|
15009
|
-
console.error(message);
|
|
15010
|
-
return context.json({ message: "Could not create IdDocument" }, 500);
|
|
15011
|
-
}
|
|
15012
|
-
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
15013
|
-
const { data: uploadResult, error: uploadError } = await context.env.DOCUMENT_SERVICE.uploadDocument({
|
|
15014
|
-
entityType: "client",
|
|
15015
|
-
entityId: createdIdDocument.id,
|
|
15016
|
-
type: "kyc",
|
|
15017
|
-
metadata: {},
|
|
15018
|
-
file: {
|
|
15019
|
-
bytes,
|
|
15020
|
-
type: file.type,
|
|
15021
|
-
name: file.name,
|
|
15022
|
-
size: file.size
|
|
15023
|
-
}
|
|
15024
|
-
});
|
|
15025
|
-
if (!uploadResult || uploadError) {
|
|
15026
|
-
return context.json({ message: "File upload failed" }, 500);
|
|
15027
|
-
}
|
|
15028
|
-
return context.json(
|
|
15029
|
-
{
|
|
15030
|
-
message: "IdDocument created successfully",
|
|
15031
|
-
idDocument: {
|
|
15032
|
-
...createdIdDocument,
|
|
15033
|
-
frontImageUri: documentSide === "front" ? uploadResult.storageUrl : createdIdDocument.frontImageUri,
|
|
15034
|
-
backImageUri: documentSide === "back" ? uploadResult.storageUrl : createdIdDocument.backImageUri
|
|
15035
|
-
}
|
|
15036
|
-
},
|
|
15037
|
-
200
|
|
15038
|
-
);
|
|
15039
|
-
}
|
|
15040
|
-
);
|
|
15041
|
-
|
|
15042
15251
|
const XIdempotencyKeyHeaderSchema = z$3.string().openapi({
|
|
15043
15252
|
description: "Unique identifier header to ensure the request is processed only once.",
|
|
15044
15253
|
example: "4ac15c22-2bd3-426f-b915-bfd5febdb7df"
|