@devizovaburza/mdm-sdk 2.2.3 → 2.2.5
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.mjs +19 -5
- package/package.json +1 -1
package/dist/v1/index.mjs
CHANGED
|
@@ -355,13 +355,13 @@ function logAuditEvent(context, input) {
|
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
const requireRoutableAccount = (data, ctx) => {
|
|
358
|
+
const requireRoutableAccount = (data, ctx, basePath = []) => {
|
|
359
359
|
if (data.iban?.trim()) return;
|
|
360
360
|
if (!data.number?.trim()) {
|
|
361
361
|
ctx.addIssue({
|
|
362
362
|
code: "custom",
|
|
363
363
|
message: "Vypl\u0148te IBAN, nebo \u010D\xEDslo \xFA\u010Dtu spolu se SWIFT/BIC (alespo\u0148 jedna varianta je povinn\xE1)",
|
|
364
|
-
path: ["number"]
|
|
364
|
+
path: [...basePath, "number"]
|
|
365
365
|
});
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
@@ -369,7 +369,7 @@ const requireRoutableAccount = (data, ctx) => {
|
|
|
369
369
|
ctx.addIssue({
|
|
370
370
|
code: "custom",
|
|
371
371
|
message: "Pro \xFA\u010Det bez IBAN je nutn\xE9 vyplnit SWIFT/BIC (banka p\u0159\xEDjemce ho pot\u0159ebuje pro sm\u011Brov\xE1n\xED platby)",
|
|
372
|
-
path: ["swiftBic"]
|
|
372
|
+
path: [...basePath, "swiftBic"]
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
375
|
};
|
|
@@ -502,7 +502,7 @@ const bankAccountInputSchema = updateBankAccountSchema.required({
|
|
|
502
502
|
holderName: true,
|
|
503
503
|
currency: true,
|
|
504
504
|
countryCode: true
|
|
505
|
-
}).omit({ id: true, partyId: true })
|
|
505
|
+
}).omit({ id: true, partyId: true });
|
|
506
506
|
const disponentSchema = z.object({
|
|
507
507
|
partyType: z.literal("INDIVIDUAL"),
|
|
508
508
|
data: individualInsertSchema
|
|
@@ -665,6 +665,13 @@ const createPartyInputSchema = z.object({
|
|
|
665
665
|
).refine((b) => b.party.blockReason !== "OTHER" || !!b.party.blockReasonNote, {
|
|
666
666
|
message: "blockReasonNote is required when blockReason is OTHER",
|
|
667
667
|
path: ["party", "blockReasonNote"]
|
|
668
|
+
}).superRefine((b, ctx) => {
|
|
669
|
+
b.bankAccounts.forEach(
|
|
670
|
+
(acc, i) => requireRoutableAccount(acc, ctx, ["bankAccounts", i])
|
|
671
|
+
);
|
|
672
|
+
b.recipients.forEach(
|
|
673
|
+
(acc, i) => requireRoutableAccount(acc, ctx, ["recipients", i])
|
|
674
|
+
);
|
|
668
675
|
});
|
|
669
676
|
const partyCreateOutputSchema = z.object({
|
|
670
677
|
customerStatus: z.enum(CUSTOMER_STATUS),
|
|
@@ -1059,7 +1066,7 @@ const syncBankAccountSchema = z.object({
|
|
|
1059
1066
|
countryCode: bankAccountMetadataSchema.shape.countryCode.nonoptional(),
|
|
1060
1067
|
id: z.uuid().optional(),
|
|
1061
1068
|
statementUri: z.string().optional()
|
|
1062
|
-
})
|
|
1069
|
+
});
|
|
1063
1070
|
const disponentIndividualSyncDataSchema = z.object({
|
|
1064
1071
|
id: z.uuid().optional(),
|
|
1065
1072
|
name: z.string(),
|
|
@@ -1243,6 +1250,13 @@ const partyUpdateInputSchema = z.object({
|
|
|
1243
1250
|
).refine((b) => b.party.blockReason !== "OTHER" || !!b.party.blockReasonNote, {
|
|
1244
1251
|
message: "blockReasonNote is required when blockReason is OTHER",
|
|
1245
1252
|
path: ["party", "blockReasonNote"]
|
|
1253
|
+
}).superRefine((b, ctx) => {
|
|
1254
|
+
b.bankAccounts?.forEach(
|
|
1255
|
+
(acc, i) => requireRoutableAccount(acc, ctx, ["bankAccounts", i])
|
|
1256
|
+
);
|
|
1257
|
+
b.recipients?.forEach(
|
|
1258
|
+
(acc, i) => requireRoutableAccount(acc, ctx, ["recipients", i])
|
|
1259
|
+
);
|
|
1246
1260
|
});
|
|
1247
1261
|
const updatePartyOuputSchema = z.object({
|
|
1248
1262
|
id: z.uuid(),
|