facturas 0.23.0 → 0.24.0

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.
@@ -548,7 +548,7 @@ function validateFiscalHeader(data) {
548
548
  bad("service");
549
549
  }
550
550
  if (data.concept === 2 || data.concept === 3) {
551
- if (!(data.serviceStartDate && data.serviceEndDate && data.paymentDueDate)) {
551
+ if (!(data.serviceStartDate && data.serviceEndDate && (isNonAnnulmentFceNote(data) || data.paymentDueDate))) {
552
552
  bad("service");
553
553
  }
554
554
  const start = normalizeWsfeDateInput(data.serviceStartDate, "service.from");
@@ -564,6 +564,10 @@ function validateFiscalHeader(data) {
564
564
  bad("paidInForeignCurrency");
565
565
  }
566
566
  }
567
+ function isNonAnnulmentFceNote(data) {
568
+ const { family, types } = voucherFamily(data.voucherType);
569
+ return family === "fce" && data.voucherType !== types[0] && normalizedFceAnnulment({ optionalFields: data.optionalFields }) === false;
570
+ }
567
571
  function applyFceFields(data, fce) {
568
572
  if (fce === void 0) {
569
573
  return;
@@ -629,6 +633,9 @@ function validateFceHeader(data) {
629
633
  } else if (!["S", "N"].includes(options.get("22") ?? "") || options.has("2101") || options.has("2102") || options.has("27")) {
630
634
  bad("fce.annulment");
631
635
  }
636
+ if (isNonAnnulmentFceNote(data) && data.paymentDueDate !== void 0) {
637
+ bad("dueDate");
638
+ }
632
639
  }
633
640
  }
634
641
  function validateFceOptions(fce) {
@@ -5882,6 +5889,9 @@ function copyServiceDates(original, header) {
5882
5889
  original.serviceEndDate,
5883
5890
  "serviceEndDate"
5884
5891
  );
5892
+ if (isNonAnnulmentFceNote(header)) {
5893
+ return;
5894
+ }
5885
5895
  const due = normalizeWsfeDateInput(
5886
5896
  required(original.paymentDueDate, "paymentDueDate"),
5887
5897
  "original.paymentDueDate"
@@ -8316,4 +8326,4 @@ export {
8316
8326
  createArcaClient,
8317
8327
  createFileStore
8318
8328
  };
8319
- //# sourceMappingURL=chunk-HSC3KLPL.mjs.map
8329
+ //# sourceMappingURL=chunk-GERGSYQC.mjs.map