@devizovaburza/mdm-sdk 2.2.2 → 2.2.3

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.
Files changed (2) hide show
  1. package/dist/v1/index.mjs +21 -2
  2. 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) => {
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: ["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: ["swiftBic"]
373
+ });
374
+ }
375
+ };
376
+
358
377
  z.object({
359
378
  message: z.string(),
360
379
  data: z.null(),
@@ -483,7 +502,7 @@ const bankAccountInputSchema = updateBankAccountSchema.required({
483
502
  holderName: true,
484
503
  currency: true,
485
504
  countryCode: true
486
- }).omit({ id: true, partyId: true });
505
+ }).omit({ id: true, partyId: true }).superRefine(requireRoutableAccount);
487
506
  const disponentSchema = z.object({
488
507
  partyType: z.literal("INDIVIDUAL"),
489
508
  data: individualInsertSchema
@@ -1040,7 +1059,7 @@ const syncBankAccountSchema = z.object({
1040
1059
  countryCode: bankAccountMetadataSchema.shape.countryCode.nonoptional(),
1041
1060
  id: z.uuid().optional(),
1042
1061
  statementUri: z.string().optional()
1043
- });
1062
+ }).superRefine(requireRoutableAccount);
1044
1063
  const disponentIndividualSyncDataSchema = z.object({
1045
1064
  id: z.uuid().optional(),
1046
1065
  name: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devizovaburza/mdm-sdk",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "author": "Devizová burza a.s.",
5
5
  "license": "ISC",
6
6
  "type": "module",