@devizovaburza/mdm-sdk 2.2.2 → 2.2.4
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 +33 -0
- package/package.json +1 -1
package/dist/v1/index.mjs
CHANGED
|
@@ -355,6 +355,25 @@ function logAuditEvent(context, input) {
|
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
+
const requireRoutableAccount = (data, ctx, basePath = []) => {
|
|
359
|
+
if (data.iban?.trim()) return;
|
|
360
|
+
if (!data.number?.trim()) {
|
|
361
|
+
ctx.addIssue({
|
|
362
|
+
code: "custom",
|
|
363
|
+
message: "Vypl\u0148te IBAN, nebo \u010D\xEDslo \xFA\u010Dtu spolu se SWIFT/BIC (alespo\u0148 jedna varianta je povinn\xE1)",
|
|
364
|
+
path: [...basePath, "number"]
|
|
365
|
+
});
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (!data.swiftBic?.trim() && !data.bicCor?.trim()) {
|
|
369
|
+
ctx.addIssue({
|
|
370
|
+
code: "custom",
|
|
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: [...basePath, "swiftBic"]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
358
377
|
z.object({
|
|
359
378
|
message: z.string(),
|
|
360
379
|
data: z.null(),
|
|
@@ -646,6 +665,13 @@ const createPartyInputSchema = z.object({
|
|
|
646
665
|
).refine((b) => b.party.blockReason !== "OTHER" || !!b.party.blockReasonNote, {
|
|
647
666
|
message: "blockReasonNote is required when blockReason is OTHER",
|
|
648
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
|
+
);
|
|
649
675
|
});
|
|
650
676
|
const partyCreateOutputSchema = z.object({
|
|
651
677
|
customerStatus: z.enum(CUSTOMER_STATUS),
|
|
@@ -1224,6 +1250,13 @@ const partyUpdateInputSchema = z.object({
|
|
|
1224
1250
|
).refine((b) => b.party.blockReason !== "OTHER" || !!b.party.blockReasonNote, {
|
|
1225
1251
|
message: "blockReasonNote is required when blockReason is OTHER",
|
|
1226
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
|
+
);
|
|
1227
1260
|
});
|
|
1228
1261
|
const updatePartyOuputSchema = z.object({
|
|
1229
1262
|
id: z.uuid(),
|