facturas 0.12.2 → 0.12.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.
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-GX5ERXT6.mjs";
24
24
  import {
25
25
  createWsmtxcaService
26
- } from "./chunk-D5ZWXTCV.mjs";
26
+ } from "./chunk-ZPVXXSUC.mjs";
27
27
  import {
28
28
  ArcaConfigurationError,
29
29
  ArcaError,
@@ -1882,6 +1882,10 @@ function wsmtxcaRequest(data, number) {
1882
1882
  "Item totals must equal the voucher total excluding tributes"
1883
1883
  );
1884
1884
  }
1885
+ const tributes = data.taxes?.length ? data.taxes : void 0;
1886
+ if (tributes === void 0 && normalizeArcaAmountToMinorUnits(data.taxAmount, "taxes") !== 0n) {
1887
+ invalid("taxes", "Tribute amount requires tribute details");
1888
+ }
1885
1889
  return {
1886
1890
  comprobanteCAERequest: {
1887
1891
  codigoTipoComprobante: data.voucherType,
@@ -1897,7 +1901,7 @@ function wsmtxcaRequest(data, number) {
1897
1901
  importeSubtotal: Number(
1898
1902
  normalizeArcaAmountToMinorUnits(data.netAmount, "net") + normalizeArcaAmountToMinorUnits(data.nonTaxableAmount, "untaxed") + normalizeArcaAmountToMinorUnits(data.exemptAmount, "exempt")
1899
1903
  ) / 100,
1900
- importeOtrosTributos: data.taxAmount,
1904
+ ...tributes === void 0 ? {} : { importeOtrosTributos: data.taxAmount },
1901
1905
  importeTotal: data.totalAmount,
1902
1906
  codigoMoneda: data.currencyId,
1903
1907
  cotizacionMoneda: data.exchangeRate,
@@ -1928,14 +1932,16 @@ function wsmtxcaRequest(data, number) {
1928
1932
  porcentaje: b.percentage
1929
1933
  }))
1930
1934
  } : void 0,
1931
- arrayOtrosTributos: data.taxes?.length ? {
1932
- otroTributo: data.taxes.map((t) => ({
1933
- codigo: t.id,
1934
- descripcion: t.description,
1935
- baseImponible: t.baseAmount,
1936
- importe: t.amount
1937
- }))
1938
- } : void 0,
1935
+ ...tributes ? {
1936
+ arrayOtrosTributos: {
1937
+ otroTributo: tributes.map((t) => ({
1938
+ codigo: t.id,
1939
+ descripcion: t.description,
1940
+ baseImponible: t.baseAmount,
1941
+ importe: t.amount
1942
+ }))
1943
+ }
1944
+ } : {},
1939
1945
  arrayItems: { item: items },
1940
1946
  arraySubtotalesIVA: data.vatRates?.length ? {
1941
1947
  subtotalIVA: data.vatRates.map((v) => ({
@@ -4272,4 +4278,4 @@ export {
4272
4278
  withLease,
4273
4279
  createFileStore
4274
4280
  };
4275
- //# sourceMappingURL=chunk-BP72XNPS.mjs.map
4281
+ //# sourceMappingURL=chunk-G7BWMDFT.mjs.map