diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_DescuentoGlobal.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_DescuentoGlobal.java new file mode 100644 index 00000000..b168cd1c --- /dev/null +++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_DescuentoGlobal.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.project.openubl.xbuilder.content.catalogs; + +public enum Catalog53_DescuentoGlobal implements Catalog { + DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP("02"), + DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("03"); + + private final String code; + + Catalog53_DescuentoGlobal(String code) { + this.code = code; + } + + @Override + public String getCode() { + return code; + } +} diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Descuento.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Descuento.java new file mode 100644 index 00000000..77ce04b9 --- /dev/null +++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Descuento.java @@ -0,0 +1,45 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.project.openubl.xbuilder.content.models.standard.general; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +public class Descuento { + + @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalogo 53") + private String tipoDescuento; + + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private BigDecimal factor; + + @Schema(requiredMode = Schema.RequiredMode.REQUIRED) + private BigDecimal monto; + + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private BigDecimal montoBase; + +} diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java index 26a502c4..50e67b9d 100644 --- a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java +++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java @@ -69,4 +69,7 @@ public class Invoice extends SalesDocument { @Singular private List otrosDocumentosTributariosRelacionados; + + @Singular + private List descuentos; } diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java index 99ac82d3..57243599 100644 --- a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java +++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java @@ -34,4 +34,7 @@ public class TotalImporteInvoice extends TotalImporte { @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) private BigDecimal anticipos; + + @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) + private BigDecimal descuentos; } diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java index 657b5f4a..8adb8091 100644 --- a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java @@ -66,7 +66,9 @@ public void enrich(Invoice input) { .build(); RuleUnit ruleUnitBody = new BodyRuleUnit(phaseType, defaults, ruleContextBody); input.getDetalles().forEach(ruleUnitBody::modify); + input.getAnticipos().forEach(ruleUnitBody::modify); + input.getDescuentos().forEach(ruleUnitBody::modify); }); } diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/FactorRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/FactorRule.java new file mode 100644 index 00000000..fff20dd6 --- /dev/null +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/FactorRule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento; + +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; +import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; +import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; + +import java.math.BigDecimal; +import java.util.function.Consumer; + +import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDescuento; +import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDescuento; + +@RulePhase(type = RulePhase.PhaseType.ENRICH) +public class FactorRule extends AbstractBodyRule { + + @Override + public boolean test(Object object) { + return isDescuento.test(object) && whenDescuento.apply(object) + .map(descuento -> descuento.getFactor() == null) + .orElse(false); + } + + @Override + public void modify(Object object) { + Consumer consumer = descuento -> { + descuento.setFactor(BigDecimal.ONE); + }; + whenDescuento.apply(object).ifPresent(consumer); + } +} diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/MontoBaseRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/MontoBaseRule.java new file mode 100644 index 00000000..fe219738 --- /dev/null +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/MontoBaseRule.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento; + +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; +import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; +import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; + +import java.math.BigDecimal; +import java.util.function.Consumer; + +import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDescuento; +import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDescuento; + +@RulePhase(type = RulePhase.PhaseType.ENRICH) +public class MontoBaseRule extends AbstractBodyRule { + + @Override + public boolean test(Object object) { + return isDescuento.test(object) && whenDescuento.apply(object) + .map(descuento -> descuento.getMontoBase() == null && descuento.getMonto() != null) + .orElse(false); + } + + @Override + public void modify(Object object) { + Consumer consumer = descuento -> { + descuento.setMontoBase(descuento.getMonto()); + }; + whenDescuento.apply(object).ifPresent(consumer); + } +} diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/TipoDescuentoRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/TipoDescuentoRule.java new file mode 100644 index 00000000..3517339c --- /dev/null +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/TipoDescuentoRule.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento; + +import io.github.project.openubl.xbuilder.content.catalogs.Catalog; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_DescuentoGlobal; +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; +import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; +import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; + +import java.util.function.Consumer; + +import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDescuento; +import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDescuento; + +/** + * Rule for: {@link Descuento#tipoDescuento} + * + * @author Carlos Feria + */ +@RulePhase(type = RulePhase.PhaseType.ENRICH) +public class TipoDescuentoRule extends AbstractBodyRule { + + @Override + public boolean test(Object object) { + return isDescuento.test(object); + } + + @Override + public void modify(Object object) { + Consumer consumer = descuento -> { + String tipoDescuento; + if (descuento.getTipoDescuento() == null) { + tipoDescuento = Catalog53_DescuentoGlobal.DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP.getCode(); + } else { + Catalog53_DescuentoGlobal catalog53 = Catalog + .valueOfCode(Catalog53_DescuentoGlobal.class, descuento.getTipoDescuento()) + .orElseThrow(Catalog.invalidCatalogValue); + tipoDescuento = catalog53.getCode(); + } + + descuento.setTipoDescuento(tipoDescuento); + }; + whenDescuento.apply(object).ifPresent(consumer); + } +} diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java index 6e97d6c7..79ab3b18 100644 --- a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java @@ -16,7 +16,10 @@ */ package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_DescuentoGlobal; import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo; +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImporteInvoice; import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; @@ -24,8 +27,10 @@ import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.DetalleUtils; import java.math.BigDecimal; +import java.util.Map; import java.util.Objects; import java.util.function.Consumer; +import java.util.stream.Collectors; import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice; import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice; @@ -35,12 +40,9 @@ public class TotalImporteRule extends AbstractHeaderRule { @Override public boolean test(Object object) { - return ( - isInvoice.test(object) && - whenInvoice - .apply(object) - .map(invoice -> invoice.getTotalImporte() == null && invoice.getDetalles() != null) - .orElse(false) + return (isInvoice.test(object) && whenInvoice.apply(object) + .map(invoice -> invoice.getTotalImporte() == null && invoice.getDetalles() != null) + .orElse(false) ); } @@ -52,23 +54,42 @@ public void modify(Object object) { BigDecimal importeSinImpuestos = DetalleUtils.getImporteSinImpuestos(invoice.getDetalles()); BigDecimal importeConImpuestos = importeSinImpuestos.add(totalImpuestos); - BigDecimal anticipos = invoice - .getAnticipos() - .stream() + // Anticipos + BigDecimal anticipos = invoice.getAnticipos().stream() .map(Anticipo::getMonto) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal importeTotal = importeConImpuestos.subtract(anticipos); - invoice.setTotalImporte( - TotalImporteInvoice - .builder() - .importeSinImpuestos(importeSinImpuestos) - .importeConImpuestos(importeConImpuestos) - .anticipos(anticipos) - .importe(importeTotal) - .build() + // Descuentos + Map descuentos = invoice.getDescuentos().stream() + .filter(descuento -> descuento.getTipoDescuento() != null && descuento.getMonto() != null) + .collect(Collectors.groupingBy( + descuento -> Catalog.valueOfCode(Catalog53_DescuentoGlobal.class, descuento.getTipoDescuento()).orElseThrow(Catalog.invalidCatalogValue), + Collectors.reducing(BigDecimal.ZERO, Descuento::getMonto, BigDecimal::add) + )); + + BigDecimal descuentosQueAfectanBaseImponible_sinImpuestos = descuentos.getOrDefault(Catalog53_DescuentoGlobal.DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP, BigDecimal.ZERO); + BigDecimal descuentosQueAfectanBaseImponible_conImpuestos = descuentosQueAfectanBaseImponible_sinImpuestos.multiply(invoice.getTasaIgv().add(BigDecimal.ONE)); + + BigDecimal descuentosQueNoAfectanBaseImponible_sinImpuestos = descuentos.getOrDefault(Catalog53_DescuentoGlobal.DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP, BigDecimal.ZERO); + + // + importeSinImpuestos = importeSinImpuestos.subtract(descuentosQueAfectanBaseImponible_sinImpuestos); + importeConImpuestos = importeConImpuestos.subtract(descuentosQueAfectanBaseImponible_conImpuestos); + importeTotal = importeTotal + .subtract(descuentosQueAfectanBaseImponible_conImpuestos) + .subtract(descuentosQueNoAfectanBaseImponible_sinImpuestos); + + // Set final values + invoice.setTotalImporte(TotalImporteInvoice.builder() + .importeSinImpuestos(importeSinImpuestos) + .importeConImpuestos(importeConImpuestos) + .descuentos(descuentosQueNoAfectanBaseImponible_sinImpuestos) + .anticipos(anticipos) + .importe(importeTotal) + .build() ); }; whenInvoice.apply(object).ifPresent(consumer); diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java index 9b3fef02..e626b49f 100644 --- a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java @@ -19,7 +19,9 @@ import io.github.project.openubl.xbuilder.content.catalogs.Catalog; import io.github.project.openubl.xbuilder.content.catalogs.Catalog5; import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_Anticipo; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_DescuentoGlobal; import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo; +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImpuestos; @@ -29,9 +31,11 @@ import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Impuesto; import java.math.BigDecimal; +import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; +import java.util.stream.Collectors; import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice; import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice; @@ -41,12 +45,9 @@ public class TotalImpuestosRule extends AbstractHeaderRule { @Override public boolean test(Object object) { - return ( - isInvoice.test(object) && - whenInvoice - .apply(object) - .map(documento -> documento.getTotalImpuestos() == null && documento.getDetalles() != null) - .orElse(false) + return (isInvoice.test(object) && whenInvoice.apply(object) + .map(documento -> documento.getTotalImpuestos() == null && documento.getDetalles() != null) + .orElse(false) ); } @@ -59,39 +60,39 @@ public void modify(Object object) { Impuesto exonerado = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.EXONERADO); Impuesto gratuito = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.GRATUITO); - BigDecimal icb = invoice - .getDetalles() - .stream() + BigDecimal icb = invoice.getDetalles().stream() .map(DocumentoVentaDetalle::getIcb) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal totalAnticiposGravados = invoice - .getAnticipos() - .stream() + // Anticipos + BigDecimal totalAnticiposGravados = invoice.getAnticipos().stream() .filter(f -> { - Optional catalog53_anticipo = Catalog.valueOfCode( - Catalog53_Anticipo.class, - f.getTipo() - ); - return ( - catalog53_anticipo.isPresent() && - catalog53_anticipo - .get() - .equals( - Catalog53_Anticipo.DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP - ) - ); + Optional catalog53_anticipo = Catalog.valueOfCode(Catalog53_Anticipo.class, f.getTipo()); + return (catalog53_anticipo.isPresent() && catalog53_anticipo.get().equals(Catalog53_Anticipo.DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP)); }) .map(Anticipo::getMonto) .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal gravadoBaseImponible = gravado.getBaseImponible().subtract(totalAnticiposGravados); - BigDecimal gravadoImporte = gravadoBaseImponible.multiply(invoice.getTasaIgv()); + // Descuentos + Map descuentos = invoice.getDescuentos().stream() + .filter(descuento -> descuento.getTipoDescuento() != null && descuento.getMonto() != null) + .collect(Collectors.groupingBy( + descuento -> Catalog.valueOfCode(Catalog53_DescuentoGlobal.class, descuento.getTipoDescuento()).orElseThrow(Catalog.invalidCatalogValue), + Collectors.reducing(BigDecimal.ZERO, Descuento::getMonto, BigDecimal::add) + )); + BigDecimal descuentosQueAfectanBaseImponible_sinImpuestos = descuentos.getOrDefault(Catalog53_DescuentoGlobal.DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP, BigDecimal.ZERO); + + // Gravado + BigDecimal gravadoBaseImponible = gravado.getBaseImponible() + .subtract(totalAnticiposGravados) + .subtract(descuentosQueAfectanBaseImponible_sinImpuestos); + + BigDecimal gravadoImporte = gravadoBaseImponible.multiply(invoice.getTasaIgv()); BigDecimal total = ivap.getImporte().add(gravadoImporte).add(icb); - TotalImpuestos totalImpuestos = TotalImpuestos - .builder() + // Set final values + TotalImpuestos totalImpuestos = TotalImpuestos.builder() .ivapImporte(ivap.getImporte()) .ivapBaseImponible(ivap.getBaseImponible()) .gravadoImporte(gravadoImporte) diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java index 4219124c..24c7c3d0 100644 --- a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java +++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java @@ -20,6 +20,7 @@ import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo; import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote; import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote; +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; import io.github.project.openubl.xbuilder.content.models.standard.general.Note; @@ -61,6 +62,7 @@ public class Helpers { public static final Predicate isSalesDocumentItem = o -> o instanceof DocumentoVentaDetalle; public static final Predicate isAnticipo = o -> o instanceof Anticipo; + public static final Predicate isDescuento = o -> o instanceof Descuento; public static final Function> whenInvoice = o -> { if (o instanceof Invoice) { @@ -118,6 +120,13 @@ public class Helpers { return Optional.empty(); }; + public static final Function> whenDescuento = o -> { + if (o instanceof Descuento) { + return Optional.of((Descuento) o); + } + return Optional.empty(); + }; + public static final Function> whenVoidedDocumentsItem = o -> { if (o instanceof VoidedDocumentsItem) { return Optional.of((VoidedDocumentsItem) o); diff --git a/core/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory b/core/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory index bbd272f4..d43d0ccf 100644 --- a/core/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory +++ b/core/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory @@ -45,6 +45,11 @@ io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.TasaIg io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.anticipo.TipoAnticipoRule io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.anticipo.ComprobanteTipoAnticipoRule +## Enrich - Descuentos +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento.TipoDescuentoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento.FactorRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento.MontoBaseRule + ## Process - Detalle io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.PrecioDeReferenciaRule io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.PrecioRule diff --git a/core/src/main/resources/templates/Renderer/invoice.xml b/core/src/main/resources/templates/Renderer/invoice.xml index de0f68b4..cfccdc84 100644 --- a/core/src/main/resources/templates/Renderer/invoice.xml +++ b/core/src/main/resources/templates/Renderer/invoice.xml @@ -83,6 +83,17 @@ {it.monto} {/each} + {#each descuentos.orEmpty} + + false + {it.tipoDescuento} + {#if it.factor} + {it.factor.scale(2)} + {/if} + {it.monto.scale(2)} + {it.montoBase.scale(2)} + + {/each} {#if percepcion} true @@ -96,6 +107,7 @@ {totalImporte.importeSinImpuestos.scale(2)} {totalImporte.importeConImpuestos.scale(2)} + {totalImporte.descuentos} {totalImporte.anticipos} {totalImporte.importe.scale(2)} diff --git a/core/src/test/java/e2e/homologacion/Group4Test.java b/core/src/test/java/e2e/homologacion/Group4Test.java new file mode 100644 index 00000000..6400d77d --- /dev/null +++ b/core/src/test/java/e2e/homologacion/Group4Test.java @@ -0,0 +1,428 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package e2e.homologacion; + +import e2e.AbstractTest; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog7; +import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote; +import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote; +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; +import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; +import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; + +public class Group4Test extends AbstractTest { + + @Order(1) + @Test + public void factura1Con2Items() throws Exception { + Invoice input = Invoice.builder() + .serie("FF14") + .numero(1) + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .descuento(Descuento.builder() + .monto(new BigDecimal("100")) + .build() + ) + .build(); + + assertInput(input, "factura1Con2Items.xml"); + } + + @Order(2) + @Test + public void factura2Con1Items() throws Exception { + Invoice input = Invoice.builder() + .serie("FF14") + .numero(2) + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .descuento(Descuento.builder() + .monto(new BigDecimal("100")) + .build() + ) + .build(); + + assertInput(input, "factura2Con2Items.xml"); + } + + @Order(3) + @Test + public void factura3Con4Items() throws Exception { + Invoice input = Invoice.builder() + .serie("FF14") + .numero(3) + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item4") + .cantidad(new BigDecimal("4")) + .precio(new BigDecimal("400")) + .build() + ) + .descuento(Descuento.builder() + .monto(new BigDecimal("100")) + .build() + ) + .build(); + + assertInput(input, "factura3Con4Items.xml"); + } + + @Order(4) + @Test + public void factura4Con3Items() throws Exception { + Invoice input = Invoice.builder() + .serie("FF14") + .numero(4) + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .igvTipo(Catalog7.GRAVADO_RETIRO.getCode()) + .build() + ) + .descuento(Descuento.builder() + .monto(new BigDecimal("100")) + .build() + ) + .build(); + + assertInput(input, "factura4Con3Items.xml"); + } + + @Order(5) + @Test + public void factura5Con5Items() throws Exception { + Invoice input = Invoice.builder() + .serie("FF14") + .numero(5) + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item4") + .cantidad(new BigDecimal("4")) + .precio(new BigDecimal("400")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item5") + .cantidad(new BigDecimal("5")) + .precio(new BigDecimal("500")) + .build() + ) + .descuento(Descuento.builder() + .monto(new BigDecimal("100")) + .build() + ) + .build(); + + assertInput(input, "factura5Con5Items.xml"); + } + + // + + @Order(6) + @Test + public void notaDeCreditoDeFactura2() throws Exception { + CreditNote input = CreditNote.builder() + .serie("FF14") + .numero(1) + .comprobanteAfectadoSerieNumero("FF14-2") + .sustentoDescripcion("Homologacion") + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .build(); + + assertInput(input, "notaDeCreditoDeFactura2.xml"); + } + + @Order(7) + @Test + public void notaDeCreditoDeFactura3() throws Exception { + CreditNote input = CreditNote.builder() + .serie("FF14") + .numero(1) + .comprobanteAfectadoSerieNumero("FF14-3") + .sustentoDescripcion("Homologacion") + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .build() + ) + .build(); + + assertInput(input, "notaDeCreditoDeFactura3.xml"); + } + + @Order(8) + @Test + public void notaDeCreditoDeFactura5() throws Exception { + CreditNote input = CreditNote.builder() + .serie("FF14") + .numero(1) + .comprobanteAfectadoSerieNumero("FF14-5") + .sustentoDescripcion("Homologacion") + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item4") + .cantidad(new BigDecimal("4")) + .precio(new BigDecimal("400")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item5") + .cantidad(new BigDecimal("5")) + .precio(new BigDecimal("500")) + .build() + ) + .build(); + + assertInput(input, "notaDeCreditoDeFactura5.xml"); + } + + // + + @Order(9) + @Test + public void notaDeDebitoDeFactura2() throws Exception { + DebitNote input = DebitNote.builder() + .serie("FF14") + .numero(1) + .comprobanteAfectadoSerieNumero("FF14-2") + .sustentoDescripcion("Homologacion") + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .build(); + + assertInput(input, "notaDeDebitoDeFactura2.xml"); + } + + @Order(10) + @Test + public void notaDeDebitoDeFactura3() throws Exception { + DebitNote input = DebitNote.builder() + .serie("FF14") + .numero(1) + .comprobanteAfectadoSerieNumero("FF14-3") + .sustentoDescripcion("Homologacion") + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .build() + ) + .build(); + + assertInput(input, "notaDeDebitoDeFactura3.xml"); + } + + @Order(11) + @Test + public void notaDeDebitoDeFactura5() throws Exception { + DebitNote input = DebitNote.builder() + .serie("FF14") + .numero(1) + .comprobanteAfectadoSerieNumero("FF14-5") + .sustentoDescripcion("Homologacion") + .proveedor(HomologacionConstants.proveedor) + .cliente(HomologacionConstants.cliente) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("200")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item3") + .cantidad(new BigDecimal("3")) + .precio(new BigDecimal("300")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item4") + .cantidad(new BigDecimal("4")) + .precio(new BigDecimal("400")) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item5") + .cantidad(new BigDecimal("5")) + .precio(new BigDecimal("500")) + .build() + ) + .build(); + + assertInput(input, "notaDeDebitoDeFactura5.xml"); + } +} diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java new file mode 100644 index 00000000..a25087b4 --- /dev/null +++ b/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java @@ -0,0 +1,163 @@ +/* + * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License - 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog53; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo; +import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; +import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; +import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; +import io.github.project.openubl.xbuilder.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; + +public class InvoiceDescuentosTest extends AbstractTest { + + @Test + public void descuentoGlobal() throws Exception { + // Given + Invoice input = Invoice.builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder() + .ruc("12345678912") + .razonSocial("Softgreen S.A.C.") + .build() + ) + .cliente(Cliente.builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .descuento(Descuento.builder() + .monto(new BigDecimal("50")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "descuentoGlobal.xml"); + XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD); + } + + @Test + public void descuentoGlobal_tipo02() throws Exception { + // Given + Invoice input = Invoice.builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder() + .ruc("12345678912") + .razonSocial("Softgreen S.A.C.") + .build() + ) + .cliente(Cliente.builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .descuento(Descuento.builder() + .tipoDescuento(Catalog53.DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP.getCode()) + .monto(new BigDecimal("50")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "descuentoGlobal_tipo02.xml"); + XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD); + } + + @Test + public void descuentoGlobal_tipo03() throws Exception { + // Given + Invoice input = Invoice.builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder() + .ruc("12345678912") + .razonSocial("Softgreen S.A.C.") + .build() + ) + .cliente(Cliente.builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle(DocumentoVentaDetalle.builder() + .descripcion("Item1") + .cantidad(new BigDecimal("1")) + .precio(new BigDecimal("100")) + .build() + ) + .descuento(Descuento.builder() + .tipoDescuento(Catalog53.DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP.getCode()) + .monto(new BigDecimal("50")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "descuentoGlobal_tipo03.xml"); + XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD); + } + +} diff --git a/core/src/test/resources/e2e/homologacion/Group1Test/factura1Con3Items.xml b/core/src/test/resources/e2e/homologacion/Group1Test/factura1Con3Items.xml index 5ed388f8..e14815d6 100644 --- a/core/src/test/resources/e2e/homologacion/Group1Test/factura1Con3Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group1Test/factura1Con3Items.xml @@ -83,6 +83,7 @@ 1400.00 1652.00 + 0 0 1652.00 diff --git a/core/src/test/resources/e2e/homologacion/Group1Test/factura2Con2Items.xml b/core/src/test/resources/e2e/homologacion/Group1Test/factura2Con2Items.xml index 02264612..c107a0d9 100644 --- a/core/src/test/resources/e2e/homologacion/Group1Test/factura2Con2Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group1Test/factura2Con2Items.xml @@ -83,6 +83,7 @@ 500.00 590.00 + 0 0 590.00 diff --git a/core/src/test/resources/e2e/homologacion/Group1Test/factura3Con1Items.xml b/core/src/test/resources/e2e/homologacion/Group1Test/factura3Con1Items.xml index 4f3d0999..be924df0 100644 --- a/core/src/test/resources/e2e/homologacion/Group1Test/factura3Con1Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group1Test/factura3Con1Items.xml @@ -83,6 +83,7 @@ 100.00 118.00 + 0 0 118.00 diff --git a/core/src/test/resources/e2e/homologacion/Group1Test/factura4Con5Items.xml b/core/src/test/resources/e2e/homologacion/Group1Test/factura4Con5Items.xml index 26b64ade..9e4cfe20 100644 --- a/core/src/test/resources/e2e/homologacion/Group1Test/factura4Con5Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group1Test/factura4Con5Items.xml @@ -83,6 +83,7 @@ 5500.00 6490.00 + 0 0 6490.00 diff --git a/core/src/test/resources/e2e/homologacion/Group1Test/factura5Con4Items.xml b/core/src/test/resources/e2e/homologacion/Group1Test/factura5Con4Items.xml index 3101218f..714f1cde 100644 --- a/core/src/test/resources/e2e/homologacion/Group1Test/factura5Con4Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group1Test/factura5Con4Items.xml @@ -83,6 +83,7 @@ 3000.00 3540.00 + 0 0 3540.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura1Con1Items.xml b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura1Con1Items.xml index ede1f10b..f13ffc96 100644 --- a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura1Con1Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura1Con1Items.xml @@ -83,6 +83,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura2Con4Items.xml b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura2Con4Items.xml index 1a3c37f7..bec10d65 100644 --- a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura2Con4Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura2Con4Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura3Con7Items.xml b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura3Con7Items.xml index c8222527..f177ca3f 100644 --- a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura3Con7Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura3Con7Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura4Con5Items.xml b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura4Con5Items.xml index c59522c1..ce16ef69 100644 --- a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura4Con5Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura4Con5Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura5Con6Items.xml b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura5Con6Items.xml index f2d9bb23..1a2b856f 100644 --- a/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura5Con6Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2ExoneradoTest/factura5Con6Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura1Con1Items.xml b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura1Con1Items.xml index 171ac48b..71acdf4f 100644 --- a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura1Con1Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura1Con1Items.xml @@ -83,6 +83,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura2Con4Items.xml b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura2Con4Items.xml index bb9bea15..ff783032 100644 --- a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura2Con4Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura2Con4Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura3Con7Items.xml b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura3Con7Items.xml index f6123ada..4cfc0d12 100644 --- a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura3Con7Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura3Con7Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura4Con5Items.xml b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura4Con5Items.xml index e38f5451..356b3f0f 100644 --- a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura4Con5Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura4Con5Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura5Con6Items.xml b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura5Con6Items.xml index 17f7f88e..31605ab6 100644 --- a/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura5Con6Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group2InafectoTest/factura5Con6Items.xml @@ -95,6 +95,7 @@ 100.00 100.00 + 0 0 100.00 diff --git a/core/src/test/resources/e2e/homologacion/Group3Test/factura1Con7Items.xml b/core/src/test/resources/e2e/homologacion/Group3Test/factura1Con7Items.xml index d124b5fb..315a1164 100644 --- a/core/src/test/resources/e2e/homologacion/Group3Test/factura1Con7Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group3Test/factura1Con7Items.xml @@ -83,6 +83,7 @@ 0.00 0.00 + 0 0 0.00 diff --git a/core/src/test/resources/e2e/homologacion/Group3Test/factura2Con2Items.xml b/core/src/test/resources/e2e/homologacion/Group3Test/factura2Con2Items.xml index 1f3aa575..777d66ba 100644 --- a/core/src/test/resources/e2e/homologacion/Group3Test/factura2Con2Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group3Test/factura2Con2Items.xml @@ -83,6 +83,7 @@ 0.00 0.00 + 0 0 0.00 diff --git a/core/src/test/resources/e2e/homologacion/Group3Test/factura3Con5Items.xml b/core/src/test/resources/e2e/homologacion/Group3Test/factura3Con5Items.xml index cdc626a3..59564bd4 100644 --- a/core/src/test/resources/e2e/homologacion/Group3Test/factura3Con5Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group3Test/factura3Con5Items.xml @@ -83,6 +83,7 @@ 0.00 0.00 + 0 0 0.00 diff --git a/core/src/test/resources/e2e/homologacion/Group3Test/factura4Con4Items.xml b/core/src/test/resources/e2e/homologacion/Group3Test/factura4Con4Items.xml index ac6df0f0..f35dcba4 100644 --- a/core/src/test/resources/e2e/homologacion/Group3Test/factura4Con4Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group3Test/factura4Con4Items.xml @@ -83,6 +83,7 @@ 0.00 0.00 + 0 0 0.00 diff --git a/core/src/test/resources/e2e/homologacion/Group3Test/factura5Con3Items.xml b/core/src/test/resources/e2e/homologacion/Group3Test/factura5Con3Items.xml index 984aff17..aa1b7cc1 100644 --- a/core/src/test/resources/e2e/homologacion/Group3Test/factura5Con3Items.xml +++ b/core/src/test/resources/e2e/homologacion/Group3Test/factura5Con3Items.xml @@ -83,6 +83,7 @@ 0.00 0.00 + 0 0 0.00 diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/factura1Con2Items.xml b/core/src/test/resources/e2e/homologacion/Group4Test/factura1Con2Items.xml new file mode 100644 index 00000000..8cb89a30 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/factura1Con2Items.xml @@ -0,0 +1,165 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 100.00 + 100.00 + + + 90.00 + + 500.00 + 90.00 + + S + + 1000 + IGV + VAT + + + + + + 500.00 + 590.00 + 100 + 0 + 490.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/factura2Con2Items.xml b/core/src/test/resources/e2e/homologacion/Group4Test/factura2Con2Items.xml new file mode 100644 index 00000000..427afffd --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/factura2Con2Items.xml @@ -0,0 +1,165 @@ + + + + + + + + 2.1 + 2.0 + FF14-2 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 100.00 + 100.00 + + + 90.00 + + 500.00 + 90.00 + + S + + 1000 + IGV + VAT + + + + + + 500.00 + 590.00 + 100 + 0 + 490.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/factura3Con4Items.xml b/core/src/test/resources/e2e/homologacion/Group4Test/factura3Con4Items.xml new file mode 100644 index 00000000..e210b731 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/factura3Con4Items.xml @@ -0,0 +1,233 @@ + + + + + + + + 2.1 + 2.0 + FF14-3 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 100.00 + 100.00 + + + 540.00 + + 3000.00 + 540.00 + + S + + 1000 + IGV + VAT + + + + + + 3000.00 + 3540.00 + 100 + 0 + 3440.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 354.00 + 01 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 300.00 + + + + 4 + 4 + 1600.00 + + + 472.00 + 01 + + + + 288.00 + + 1600.00 + 288.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 400.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/factura4Con3Items.xml b/core/src/test/resources/e2e/homologacion/Group4Test/factura4Con3Items.xml new file mode 100644 index 00000000..c0cecb18 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/factura4Con3Items.xml @@ -0,0 +1,211 @@ + + + + + + + + 2.1 + 2.0 + FF14-4 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 100.00 + 100.00 + + + 90.00 + + 500.00 + 90.00 + + S + + 1000 + IGV + VAT + + + + + 900.00 + 162.00 + + S + + 9996 + GRA + FRE + + + + + + 500.00 + 590.00 + 100 + 0 + 490.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 300.00 + 02 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 13 + + 9996 + GRA + FRE + + + + + + + + + 0.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/factura5Con5Items.xml b/core/src/test/resources/e2e/homologacion/Group4Test/factura5Con5Items.xml new file mode 100644 index 00000000..8893a7bd --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/factura5Con5Items.xml @@ -0,0 +1,267 @@ + + + + + + + + 2.1 + 2.0 + FF14-5 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 100.00 + 100.00 + + + 990.00 + + 5500.00 + 990.00 + + S + + 1000 + IGV + VAT + + + + + + 5500.00 + 6490.00 + 100 + 0 + 6390.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 354.00 + 01 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 300.00 + + + + 4 + 4 + 1600.00 + + + 472.00 + 01 + + + + 288.00 + + 1600.00 + 288.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 400.00 + + + + 5 + 5 + 2500.00 + + + 590.00 + 01 + + + + 450.00 + + 2500.00 + 450.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 500.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura2.xml b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura2.xml new file mode 100644 index 00000000..7d5330b2 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura2.xml @@ -0,0 +1,162 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + PEN + + FF14-2 + 01 + + + + + FF14-2 + 01 + + + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + 90.00 + + 500.00 + 90.00 + + S + + 1000 + IGV + VAT + + + + + + 500.00 + 590.00 + 590.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura3.xml b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura3.xml new file mode 100644 index 00000000..585c7196 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura3.xml @@ -0,0 +1,196 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + PEN + + FF14-3 + 01 + + + + + FF14-3 + 01 + + + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + 252.00 + + 1400.00 + 252.00 + + S + + 1000 + IGV + VAT + + + + + + 1400.00 + 1652.00 + 1652.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 354.00 + 01 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 300.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura5.xml b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura5.xml new file mode 100644 index 00000000..b86030bb --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeCreditoDeFactura5.xml @@ -0,0 +1,264 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + PEN + + FF14-5 + 01 + + + + + FF14-5 + 01 + + + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + 990.00 + + 5500.00 + 990.00 + + S + + 1000 + IGV + VAT + + + + + + 5500.00 + 6490.00 + 6490.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 354.00 + 01 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 300.00 + + + + 4 + 4 + 1600.00 + + + 472.00 + 01 + + + + 288.00 + + 1600.00 + 288.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 400.00 + + + + 5 + 5 + 2500.00 + + + 590.00 + 01 + + + + 450.00 + + 2500.00 + 450.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 500.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura2.xml b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura2.xml new file mode 100644 index 00000000..378eae96 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura2.xml @@ -0,0 +1,162 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + PEN + + FF14-2 + 01 + + + + + FF14-2 + 01 + + + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + 90.00 + + 500.00 + 90.00 + + S + + 1000 + IGV + VAT + + + + + + 500.00 + 590.00 + 590.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura3.xml b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura3.xml new file mode 100644 index 00000000..4a644ac3 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura3.xml @@ -0,0 +1,196 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + PEN + + FF14-3 + 01 + + + + + FF14-3 + 01 + + + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + 252.00 + + 1400.00 + 252.00 + + S + + 1000 + IGV + VAT + + + + + + 1400.00 + 1652.00 + 1652.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 354.00 + 01 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 300.00 + + + diff --git a/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura5.xml b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura5.xml new file mode 100644 index 00000000..c03d1932 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group4Test/notaDeDebitoDeFactura5.xml @@ -0,0 +1,264 @@ + + + + + + + + 2.1 + 2.0 + FF14-1 + 2019-12-24 + PEN + + FF14-5 + 01 + + + + + FF14-5 + 01 + + + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + 990.00 + + 5500.00 + 990.00 + + S + + 1000 + IGV + VAT + + + + + + 5500.00 + 6490.00 + 6490.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 400.00 + + + 236.00 + 01 + + + + 72.00 + + 400.00 + 72.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + + 3 + 3 + 900.00 + + + 354.00 + 01 + + + + 162.00 + + 900.00 + 162.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 300.00 + + + + 4 + 4 + 1600.00 + + + 472.00 + 01 + + + + 288.00 + + 1600.00 + 288.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 400.00 + + + + 5 + 5 + 2500.00 + + + 590.00 + 01 + + + + 450.00 + + 2500.00 + 450.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 500.00 + + + diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml index ece35b1a..ca030260 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml @@ -104,6 +104,7 @@ 400.00 472.00 + 0 100 372.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal.xml new file mode 100644 index 00000000..4c2a6cef --- /dev/null +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal.xml @@ -0,0 +1,131 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 50.00 + 50.00 + + + 18.00 + + 100.00 + 18.00 + + S + + 1000 + IGV + VAT + + + + + + 100.00 + 118.00 + 50 + 0 + 68.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal_tipo02.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal_tipo02.xml new file mode 100644 index 00000000..5c057755 --- /dev/null +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal_tipo02.xml @@ -0,0 +1,131 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 02 + 1.00 + 50.00 + 50.00 + + + 9.00 + + 50.00 + 9.00 + + S + + 1000 + IGV + VAT + + + + + + 50.00 + 59.00 + 0 + 0 + 59.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal_tipo03.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal_tipo03.xml new file mode 100644 index 00000000..4c2a6cef --- /dev/null +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDescuentosTest/descuentoGlobal_tipo03.xml @@ -0,0 +1,131 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + false + 03 + 1.00 + 50.00 + 50.00 + + + 18.00 + + 100.00 + 18.00 + + S + + 1000 + IGV + VAT + + + + + + 100.00 + 118.00 + 50 + 0 + 68.00 + + + 1 + 1 + 100.00 + + + 118.00 + 01 + + + + 18.00 + + 100.00 + 18.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml index f3b6e4a6..655ad4e7 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml @@ -97,6 +97,7 @@ 800.00 944.00 + 0 0 944.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml index 226dd169..86ff3825 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml @@ -102,6 +102,7 @@ 400.00 472.00 + 0 0 472.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml index e6425af1..0f6e6250 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml @@ -93,6 +93,7 @@ 400.00 472.00 + 0 0 472.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest/documentoRelacionado.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest/documentoRelacionado.xml index db254c00..46d267a7 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest/documentoRelacionado.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest/documentoRelacionado.xml @@ -90,6 +90,7 @@ 400.00 472.00 + 0 0 472.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml index 0b556c48..d8f03de4 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml @@ -84,6 +84,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml index 8a2cdf2c..84b53720 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml @@ -96,6 +96,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml index 1dd0840d..e8a7fdfe 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml @@ -83,6 +83,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceGuiasTest/guiaSerieT.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceGuiasTest/guiaSerieT.xml index b8ea4dad..4b508962 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceGuiasTest/guiaSerieT.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceGuiasTest/guiaSerieT.xml @@ -87,6 +87,7 @@ 400.00 472.00 + 0 0 472.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml index afd766fa..fb6d8408 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml @@ -94,6 +94,7 @@ 66.80 80.82 + 0 0 80.82 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml index 2eb45afc..04dcb41a 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml @@ -94,6 +94,7 @@ 66.78 80.80 + 0 0 80.80 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml index 20a1f925..a12fd181 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml @@ -83,6 +83,7 @@ 66.80 78.82 + 0 0 78.82 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml index 6277ad21..d31ef14a 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml @@ -83,6 +83,7 @@ 66.78 78.80 + 0 0 78.80 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceOrdeDeCompraTest/ordenDeCompra.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceOrdeDeCompraTest/ordenDeCompra.xml index dac0bb24..403c9f80 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceOrdeDeCompraTest/ordenDeCompra.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceOrdeDeCompraTest/ordenDeCompra.xml @@ -86,6 +86,7 @@ 400.00 472.00 + 0 0 472.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml b/core/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml index 7026dc36..df918885 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml @@ -95,6 +95,7 @@ 800.00 944.00 + 0 0 944.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml index 06cea7ef..b022fbf4 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml @@ -101,6 +101,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml index 2d236ef9..2227c808 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml @@ -86,6 +86,7 @@ 2360.00 2784.80 + 0 0 2784.80 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml index 5e004108..e4f50d63 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml @@ -84,6 +84,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml index fcf351c4..0aa75942 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml @@ -83,6 +83,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml index cbf39cce..5afb3059 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml @@ -98,6 +98,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml index cd6a10c8..d7ca588e 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml @@ -83,6 +83,7 @@ 2000.00 2360.00 + 0 0 2360.00 diff --git a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml index 602759e3..0cdccec0 100644 --- a/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml +++ b/core/src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml @@ -94,6 +94,7 @@ 2000.00 2364.00 + 0 0 2364.00 diff --git a/quarkus-extension/integration-tests/src/test/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResourceTest.java b/quarkus-extension/integration-tests/src/test/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResourceTest.java index 8fb73120..123666a1 100644 --- a/quarkus-extension/integration-tests/src/test/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResourceTest.java +++ b/quarkus-extension/integration-tests/src/test/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResourceTest.java @@ -178,6 +178,7 @@ public void testInvoice() { " \n" + " 1000.00\n" + " 1200.00\n" + + " 0\n" + " 0\n" + " 1200.00\n" + " \n" +