From 3f97755f6a8e97a25cad6c87e901c195e6481cfa Mon Sep 17 00:00:00 2001 From: "Carlos E. Feria Vila" Date: Sat, 21 Jan 2023 20:22:00 +0100 Subject: [PATCH] Add homologacion group6 tests (#181) --- .../java/e2e/homologacion/Group6Test.java | 177 ++++++++++++ .../Group6Test/factura1Con5Items.xml | 272 ++++++++++++++++++ .../Group6Test/notaDeCreditoDeFactura1.xml | 264 +++++++++++++++++ .../Group6Test/notaDeDebitoDeFactura1.xml | 264 +++++++++++++++++ 4 files changed, 977 insertions(+) create mode 100644 core/src/test/java/e2e/homologacion/Group6Test.java create mode 100644 core/src/test/resources/e2e/homologacion/Group6Test/factura1Con5Items.xml create mode 100644 core/src/test/resources/e2e/homologacion/Group6Test/notaDeCreditoDeFactura1.xml create mode 100644 core/src/test/resources/e2e/homologacion/Group6Test/notaDeDebitoDeFactura1.xml diff --git a/core/src/test/java/e2e/homologacion/Group6Test.java b/core/src/test/java/e2e/homologacion/Group6Test.java new file mode 100644 index 00000000..b988419b --- /dev/null +++ b/core/src/test/java/e2e/homologacion/Group6Test.java @@ -0,0 +1,177 @@ +/* + * 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.Catalog53; +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 io.github.project.openubl.xbuilder.content.models.standard.general.Percepcion; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; + +public class Group6Test extends AbstractTest { + + @Order(1) + @Test + public void factura1Con5Items() throws Exception { + Invoice input = Invoice.builder() + .serie("FF40") + .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() + ) + .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() + ) + + .percepcion(Percepcion.builder() + .tipo(Catalog53.PERCEPCION_VENTA_INTERNA.getCode()) + .porcentaje(new BigDecimal("0.02")) + .build() + ) + .build(); + + assertInput(input, "factura1Con5Items.xml"); + } + + // + + @Order(2) + @Test + public void notaDeCreditoDeFactura1() throws Exception { + CreditNote input = CreditNote.builder() + .serie("FF40") + .numero(1) + .comprobanteAfectadoSerieNumero("FF40-1") + .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, "notaDeCreditoDeFactura1.xml"); + } + + // + + @Order(3) + @Test + public void notaDeDebitoDeFactura1() throws Exception { + DebitNote input = DebitNote.builder() + .serie("FF40") + .numero(1) + .comprobanteAfectadoSerieNumero("FF40-1") + .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, "notaDeDebitoDeFactura1.xml"); + } +} diff --git a/core/src/test/resources/e2e/homologacion/Group6Test/factura1Con5Items.xml b/core/src/test/resources/e2e/homologacion/Group6Test/factura1Con5Items.xml new file mode 100644 index 00000000..21bdb65b --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group6Test/factura1Con5Items.xml @@ -0,0 +1,272 @@ + + + + + + + + 2.1 + 2.0 + FF40-1 + 2019-12-24 + 01 + + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + Percepcion + 5610.00 + + + FormaPago + Contado + + + true + 51 + 0.02 + 110.00 + 5500.00 + + + 990.00 + + 5500.00 + 990.00 + + S + + 1000 + IGV + VAT + + + + + + 5500.00 + 6490.00 + 0 + 0 + 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/Group6Test/notaDeCreditoDeFactura1.xml b/core/src/test/resources/e2e/homologacion/Group6Test/notaDeCreditoDeFactura1.xml new file mode 100644 index 00000000..82c7ba39 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group6Test/notaDeCreditoDeFactura1.xml @@ -0,0 +1,264 @@ + + + + + + + + 2.1 + 2.0 + FF40-1 + 2019-12-24 + PEN + + FF40-1 + 01 + + + + + FF40-1 + 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/Group6Test/notaDeDebitoDeFactura1.xml b/core/src/test/resources/e2e/homologacion/Group6Test/notaDeDebitoDeFactura1.xml new file mode 100644 index 00000000..1c164132 --- /dev/null +++ b/core/src/test/resources/e2e/homologacion/Group6Test/notaDeDebitoDeFactura1.xml @@ -0,0 +1,264 @@ + + + + + + + + 2.1 + 2.0 + FF40-1 + 2019-12-24 + PEN + + FF40-1 + 01 + + + + + FF40-1 + 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 + + +