diff --git a/core/pom.xml b/core/pom.xml
index a1d9dcae..9567fc75 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -41,6 +41,12 @@
${lombok.version}
provided
+
+ org.mapstruct
+ mapstruct
+ ${mapstruct.version}
+
+
io.quarkus.qute
qute-core
@@ -52,12 +58,57 @@
jackson-databind
2.14.2
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
+ 2.14.2
+ test
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+ 2.14.2
+ test
+
+
io.swagger.core.v3
swagger-annotations
2.2.8
+
+ jakarta.xml.bind
+ jakarta.xml.bind-api
+ 2.3.3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.3.8
+
+
org.junit.jupiter
junit-jupiter-engine
@@ -99,6 +150,24 @@
${maven.compiler.source}
${maven.compiler.target}
+ ${maven.compiler.parameters}
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${mapstruct.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+ org.projectlombok
+ lombok-mapstruct-binding
+ 0.2.0
+
+
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalDateAdapter.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalDateAdapter.java
new file mode 100644
index 00000000..fc5d5769
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalDateAdapter.java
@@ -0,0 +1,32 @@
+/*
+ * 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.jaxb.adapters;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.time.LocalDate;
+
+public class LocalDateAdapter extends XmlAdapter {
+ @Override
+ public LocalDate unmarshal(String v) throws Exception {
+ return LocalDate.parse(v);
+ }
+
+ @Override
+ public String marshal(LocalDate v) throws Exception {
+ return v.toString();
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalTimeAdapter.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalTimeAdapter.java
new file mode 100644
index 00000000..1e1dcd9d
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalTimeAdapter.java
@@ -0,0 +1,32 @@
+/*
+ * 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.jaxb.adapters;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.time.LocalTime;
+
+public class LocalTimeAdapter extends XmlAdapter {
+ @Override
+ public LocalTime unmarshal(String v) throws Exception {
+ return LocalTime.parse(v);
+ }
+
+ @Override
+ public String marshal(LocalTime v) throws Exception {
+ return v.toString();
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/CreditNoteMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/CreditNoteMapper.java
new file mode 100644
index 00000000..19a1bf00
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/CreditNoteMapper.java
@@ -0,0 +1,56 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentHelperMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNote;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNoteLine;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument;
+import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImporteNote;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.NullValueMappingStrategy;
+
+@Mapper(config = SalesDocumentMapper.class,
+ nullValueIterableMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT
+)
+public interface CreditNoteMapper extends SalesDocumentHelperMapper {
+
+ @Mapping(target = "comprobanteAfectadoSerieNumero", source = "discrepancyResponse.referenceID")
+ @Mapping(target = "comprobanteAfectadoTipo", source = "discrepancyResponse.responseCode")
+ @Mapping(target = "sustentoDescripcion", source = "discrepancyResponse.description")
+
+ @Mapping(target = "totalImporte", source = "monetaryTotal")
+ @Mapping(target = "detalles", source = "lines")
+ CreditNote map(XMLCreditNote xml);
+
+ @Mapping(target = "importe", source = "payableAmount")
+ @Mapping(target = "importeSinImpuestos", source = "lineExtensionAmount")
+ @Mapping(target = "importeConImpuestos", source = "taxInclusiveAmount")
+ TotalImporteNote mapTotalImporteNote(XMLSalesDocument.MonetaryTotal xml);
+
+ default DocumentoVentaDetalle mapDocumentoVentaDetalle(XMLCreditNoteLine xml) {
+ DocumentoVentaDetalle documentoVentaDetalle = mapSalesDocumentDetalle(xml);
+ documentoVentaDetalle.setCantidad(xml.getQuantity().getValue());
+ documentoVentaDetalle.setUnidadMedida(xml.getQuantity().getUnitCode());
+
+ return documentoVentaDetalle;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/DebitNoteMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/DebitNoteMapper.java
new file mode 100644
index 00000000..452661ce
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/DebitNoteMapper.java
@@ -0,0 +1,56 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentHelperMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNote;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNoteLine;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImporteNote;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.NullValueMappingStrategy;
+
+@Mapper(config = SalesDocumentMapper.class,
+ nullValueIterableMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT
+)
+public interface DebitNoteMapper extends SalesDocumentHelperMapper {
+
+ @Mapping(target = "comprobanteAfectadoSerieNumero", source = "discrepancyResponse.referenceID")
+ @Mapping(target = "comprobanteAfectadoTipo", source = "discrepancyResponse.responseCode")
+ @Mapping(target = "sustentoDescripcion", source = "discrepancyResponse.description")
+
+ @Mapping(target = "totalImporte", source = "monetaryTotal")
+ @Mapping(target = "detalles", source = "lines")
+ DebitNote map(XMLDebitNote xml);
+
+ @Mapping(target = "importe", source = "payableAmount")
+ @Mapping(target = "importeSinImpuestos", source = "lineExtensionAmount")
+ @Mapping(target = "importeConImpuestos", source = "taxInclusiveAmount")
+ TotalImporteNote mapTotalImporteNote(XMLSalesDocument.MonetaryTotal xml);
+
+ default DocumentoVentaDetalle mapDocumentoVentaDetalle(XMLDebitNoteLine xml) {
+ DocumentoVentaDetalle documentoVentaDetalle = mapSalesDocumentDetalle(xml);
+ documentoVentaDetalle.setCantidad(xml.getQuantity().getValue());
+ documentoVentaDetalle.setUnidadMedida(xml.getQuantity().getUnitCode());
+
+ return documentoVentaDetalle;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/DespatchAdviceMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/DespatchAdviceMapper.java
new file mode 100644
index 00000000..ac3211b7
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/DespatchAdviceMapper.java
@@ -0,0 +1,128 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.FirmanteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero2Translator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdviceLine;
+import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.DespatchAdvice;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.DespatchAdviceItem;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.Destinatario;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.Destino;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.DocumentoBaja;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.DocumentoRelacionado;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.Envio;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.Partida;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.Remitente;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.Transportista;
+import org.mapstruct.Condition;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(uses = {
+ SerieNumeroMapper.class,
+ FirmanteMapper.class
+})
+public interface DespatchAdviceMapper {
+
+ @Mapping(target = "serie", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, SerieTranslator.class})
+ @Mapping(target = "numero", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, Numero2Translator.class})
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ @Mapping(target = "horaEmision", source = "issueTime")
+ @Mapping(target = "tipoComprobante", source = "despatchAdviceTypeCode")
+ @Mapping(target = "observaciones", source = "note")
+ @Mapping(target = "documentoBaja", source = "orderReference")
+ @Mapping(target = "documentoRelacionado", source = "additionalDocumentReference")
+ @Mapping(target = "firmante", source = "signature")
+ @Mapping(target = "remitente", source = "despatchSupplierParty")
+ @Mapping(target = "destinatario", source = "deliveryCustomerParty")
+ @Mapping(target = "proveedor", source = "sellerSupplierParty")
+ @Mapping(target = "envio", source = "shipment")
+ @Mapping(target = "detalles", source = "lines")
+ DespatchAdvice map(XMLDespatchAdvice xml);
+
+ @Mapping(target = "tipoDocumento", source = "orderTypeCode")
+ @Mapping(target = "serieNumero", source = "id")
+ DocumentoBaja mapDocumentoBaja(XMLDespatchAdvice.OrderReference xml);
+
+ @Mapping(target = "tipoDocumento", source = "documentTypeCode")
+ @Mapping(target = "serieNumero", source = "id")
+ DocumentoRelacionado mapDocumentoRelacionado(XMLDespatchAdvice.AdditionalDocumentReference xml);
+
+ @Mapping(target = "ruc", source = "party.partyIdentification.id.value")
+ @Mapping(target = "razonSocial", source = "party.partyLegalEntity.registrationName")
+ Remitente mapRemitente(XMLDespatchAdvice.DespatchSupplierParty xml);
+
+ @Mapping(target = "numeroDocumentoIdentidad", source = "party.partyIdentification.id.value")
+ @Mapping(target = "tipoDocumentoIdentidad", source = "party.partyIdentification.id.schemeID")
+ @Mapping(target = "nombre", source = "party.partyLegalEntity.registrationName")
+ Destinatario mapDestinatario(XMLDespatchAdvice.DeliveryCustomerParty xml);
+
+ @Mapping(target = "ruc", source = "customerAssignedAccountId")
+ @Mapping(target = "nombreComercial", source = "party.partyLegalEntity.registrationName")
+ Proveedor mapProveedor(XMLDespatchAdvice.SellerSupplierParty xml);
+
+ @Mapping(target = "tipoTraslado", source = "handlingCode")
+ @Mapping(target = "motivoTraslado", source = "information")
+ @Mapping(target = "pesoTotal", source = "grossWeightMeasure.value")
+ @Mapping(target = "pesoTotalUnidadMedida", source = "grossWeightMeasure.unitCode")
+ @Mapping(target = "numeroDeBultos", source = "totalTransportHandlingUnitQuantity")
+ @Mapping(target = "transbordoProgramado", source = "splitConsignmentIndicator")
+ @Mapping(target = "tipoModalidadTraslado", source = "shipmentStage.transportModeCode")
+ @Mapping(target = "fechaTraslado", source = "shipmentStage.transitPeriod.startDate")
+ @Mapping(target = "numeroDeContenedor", source = "transportHandlingUnit.transportEquipment.id")
+ @Mapping(target = "codigoDePuerto", source = "firstArrivalPortLocation.id")
+ @Mapping(target = "transportista", source = "shipmentStage", conditionQualifiedByName = "transportistaRequirements")
+ @Mapping(target = "destino", source = "delivery")
+ @Mapping(target = "partida", source = "originAddress")
+ Envio mapEnvio(XMLDespatchAdvice.Shipment xml);
+
+ @Condition
+ @Named("transportistaRequirements")
+ default boolean conditionTransportista(XMLDespatchAdvice.ShipmentStage xml) {
+ return xml.getCarrierParty() != null && xml.getTransportMeans() != null && xml.getDriverPerson() != null;
+ }
+
+ @Mapping(target = "tipoDocumentoIdentidad", source = "carrierParty.partyIdentification.id.value")
+ @Mapping(target = "numeroDocumentoIdentidad", source = "carrierParty.partyIdentification.id.schemeID")
+ @Mapping(target = "nombre", source = "carrierParty.partyName.name")
+ @Mapping(target = "placaDelVehiculo", source = "transportMeans.roadTransport.licensePlateID")
+ @Mapping(target = "choferTipoDocumentoIdentidad", source = "driverPerson.id.schemeID")
+ @Mapping(target = "choferNumeroDocumentoIdentidad", source = "driverPerson.id.value")
+ Transportista mapTransportista(XMLDespatchAdvice.ShipmentStage xml);
+
+ @Mapping(target = "ubigeo", source = "deliveryAddress.id")
+ @Mapping(target = "direccion", source = "deliveryAddress.addressLine.line")
+ Destino mapDelivery(XMLDespatchAdvice.Delivery xml);
+
+ @Mapping(target = "ubigeo", source = "id")
+ @Mapping(target = "direccion", source = "streetName")
+ Partida mapPartida(XMLDespatchAdvice.OriginAddress xml);
+
+ @Mapping(target = "unidadMedida", source = "deliveredQuantity.unitCode")
+ @Mapping(target = "cantidad", source = "deliveredQuantity.value")
+ @Mapping(target = "descripcion", source = "item.name")
+ @Mapping(target = "codigo", source = "item.sellersItemIdentification.id")
+ @Mapping(target = "codigoSunat", source = "item.commodityClassification.itemClassificationCode")
+ DespatchAdviceItem mapLine(XMLDespatchAdviceLine xml);
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/InvoiceMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/InvoiceMapper.java
new file mode 100644
index 00000000..914ee86f
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/InvoiceMapper.java
@@ -0,0 +1,273 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+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.catalogs.CatalogContadoCredito;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.DireccionMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentHelperMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoice;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoiceLine;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo;
+import io.github.project.openubl.xbuilder.content.models.standard.general.CuotaDePago;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Detraccion;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.FormaDePago;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Percepcion;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImporteInvoice;
+import org.mapstruct.CollectionMappingStrategy;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.NullValueMappingStrategy;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static io.github.project.openubl.xbuilder.content.jaxb.mappers.utils.MapperUtils.mapPorcentaje;
+
+@Mapper(config = SalesDocumentMapper.class,
+ nullValueIterableMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT,
+ uses = {
+ DireccionMapper.class
+ }
+)
+public interface InvoiceMapper extends SalesDocumentHelperMapper {
+
+ @Mapping(target = "fechaVencimiento", source = "dueDate")
+ @Mapping(target = "tipoComprobante", source = "invoiceTypeCode.value")
+ @Mapping(target = "observaciones", source = "notes")
+ @Mapping(target = "tipoOperacion", source = "invoiceTypeCode.listID")
+ @Mapping(target = "formaDePago", source = "paymentTerms")
+
+ @Mapping(target = "totalImporte", source = "monetaryTotal")
+ @Mapping(target = "direccionEntrega", source = "delivery.deliveryLocation.address")
+ @Mapping(target = "detraccion", source = ".")
+ @Mapping(target = "percepcion", source = ".")
+ @Mapping(target = "anticipos", source = ".")
+ @Mapping(target = "descuentos", source = "allowanceCharges")
+
+ @Mapping(target = "detalles", source = "lines")
+ Invoice map(XMLInvoice xml);
+
+ @Mapping(target = "importe", source = "payableAmount")
+ @Mapping(target = "importeSinImpuestos", source = "lineExtensionAmount")
+ @Mapping(target = "importeConImpuestos", source = "taxInclusiveAmount")
+ @Mapping(target = "anticipos", source = "prepaidAmount")
+ @Mapping(target = "descuentos", source = "allowanceTotalAmount")
+ TotalImporteInvoice mapTotalImporteInvoice(XMLSalesDocument.MonetaryTotal xml);
+
+ default String mapObservaciones(List xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ return xml.stream()
+ .filter(e -> e.getLanguageLocaleId() == null)
+ .findFirst()
+ .map(XMLSalesDocument.Note::getValue)
+ .orElse(null);
+ }
+
+ default FormaDePago mapFormaDePago(List paymentTerms) {
+ if (paymentTerms == null) {
+ return null;
+ }
+
+ List formasDePago = paymentTerms.stream()
+ .filter(elem -> Objects.equals(elem.getId(), "FormaPago"))
+ .collect(Collectors.toList());
+ if (formasDePago.isEmpty()) {
+ return null;
+ }
+
+ XMLSalesDocument.PaymentTerms formaDePago = formasDePago.stream()
+ .filter(elem -> Objects.equals(elem.getPaymentMeansID(), CatalogContadoCredito.CREDITO.getCode()) ||
+ Objects.equals(elem.getPaymentMeansID(), CatalogContadoCredito.CONTADO.getCode())
+ )
+ .findFirst()
+ .orElse(new XMLSalesDocument.PaymentTerms());
+
+ List cuotas = formasDePago.stream()
+ .filter(elem -> elem.getPaymentMeansID().startsWith("Cuota"))
+ .collect(Collectors.toList());
+
+ return FormaDePago.builder()
+ .tipo(formaDePago.getPaymentMeansID())
+ .total(formaDePago.getAmount())
+ .cuotas(cuotas.stream()
+ .map(elem -> CuotaDePago.builder()
+ .importe(elem.getAmount())
+ .fechaPago(elem.getPaymentDueDate())
+ .build()
+ )
+ .collect(Collectors.toList())
+ )
+ .build();
+ }
+
+ default Detraccion mapDetraccion(XMLSalesDocument xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ XMLSalesDocument.PaymentMeans paymentMeans = xml.getPaymentMeans();
+ List paymentTerms = xml.getPaymentTerms();
+ if (paymentMeans == null || paymentTerms == null) {
+ return null;
+ }
+
+ String cuentaBancaria = Optional.ofNullable(paymentMeans.getPayeeFinancialAccount())
+ .map(XMLSalesDocument.PayeeFinancialAccount::getId)
+ .orElse(null);
+
+ Detraccion.DetraccionBuilder builder = Detraccion.builder()
+ .medioDePago(paymentMeans.getPaymentMeansCode())
+ .cuentaBancaria(cuentaBancaria);
+
+ paymentTerms.stream()
+ .filter(elem -> Objects.equals(elem.getId(), "Detraccion"))
+ .findFirst()
+ .ifPresent(el -> builder
+ .tipoBienDetraido(el.getPaymentMeansID())
+ .porcentaje(mapPorcentaje(el.getPaymentPercent()))
+ .monto(el.getAmount())
+ );
+
+ return builder.build();
+ }
+
+ default Percepcion mapPercepcion(XMLSalesDocument xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ List paymentTerms = xml.getPaymentTerms();
+ List allowanceCharges = xml.getAllowanceCharges();
+ if (paymentTerms == null || allowanceCharges == null) {
+ return null;
+ }
+
+ Optional paymentTerm = paymentTerms.stream()
+ .filter(elem -> Objects.equals(elem.getId(), "Percepcion"))
+ .findFirst();
+ Optional allowanceCharge = allowanceCharges.stream()
+ .filter(XMLSalesDocument.AllowanceCharge::getChargeIndicator)
+ .findFirst();
+
+ if (paymentTerm.isEmpty() || allowanceCharge.isEmpty()) {
+ return null;
+ }
+
+ Percepcion.PercepcionBuilder builder = Percepcion.builder();
+ paymentTerm.ifPresent(elem -> builder
+ .montoTotal(elem.getAmount())
+ );
+ allowanceCharge.ifPresent(elem -> builder
+ .tipo(elem.getAllowanceChargeReasonCode())
+ .porcentaje(elem.getMultiplierFactorNumeric())
+ .monto(elem.getAmount())
+ .montoBase(elem.getBaseAmount())
+ );
+
+ return builder.build();
+ }
+
+ default List mapAnticipos(XMLSalesDocument xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ List additionalDocumentReferences = xml.getAdditionalDocumentReferences();
+ List prepaidPayments = xml.getPrepaidPayments();
+ List allowanceCharges = xml.getAllowanceCharges();
+ if (additionalDocumentReferences == null || prepaidPayments == null || allowanceCharges == null) {
+ return Collections.emptyList();
+ }
+
+ additionalDocumentReferences = additionalDocumentReferences.stream()
+ .filter(additionalDocumentReference -> additionalDocumentReference.getDocumentStatusCode() != null)
+ .collect(Collectors.toList());
+
+ allowanceCharges = allowanceCharges.stream()
+ .filter(allowanceCharge -> !allowanceCharge.getChargeIndicator())
+ .filter(allowanceCharge -> Catalog
+ .valueOfCode(Catalog53_Anticipo.class, allowanceCharge.getAllowanceChargeReasonCode())
+ .isPresent()
+ )
+ .collect(Collectors.toList());
+
+ if (additionalDocumentReferences.size() != prepaidPayments.size() || additionalDocumentReferences.size() != allowanceCharges.size()) {
+ return Collections.emptyList();
+ }
+
+ List result = new ArrayList<>();
+ for (int i = 0; i < additionalDocumentReferences.size(); i++) {
+ XMLSalesDocument.AdditionalDocumentReference additionalDocumentReference = additionalDocumentReferences.get(i);
+ XMLSalesDocument.PrepaidPayment prepaidPayment = prepaidPayments.get(i);
+ XMLSalesDocument.AllowanceCharge allowanceCharge = allowanceCharges.get(i);
+
+ result.add(Anticipo.builder()
+ .comprobanteSerieNumero(additionalDocumentReference.getId())
+ .comprobanteTipo(additionalDocumentReference.getDocumentTypeCode())
+ .monto(prepaidPayment.getPaidAmount())
+ .tipo(allowanceCharge.getAllowanceChargeReasonCode())
+ .build()
+ );
+ }
+
+ return result;
+ }
+
+ default List mapDescuentos(List xml) {
+ if (xml == null) {
+ return Collections.emptyList();
+ }
+
+ return xml.stream()
+ .filter(allowanceCharge -> !allowanceCharge.getChargeIndicator())
+ .filter(allowanceCharge -> Catalog
+ .valueOfCode(Catalog53_DescuentoGlobal.class, allowanceCharge.getAllowanceChargeReasonCode())
+ .isPresent()
+ )
+ .map(allowanceCharge -> Descuento.builder()
+ .tipoDescuento(allowanceCharge.getAllowanceChargeReasonCode())
+ .factor(allowanceCharge.getMultiplierFactorNumeric())
+ .monto(allowanceCharge.getAmount())
+ .montoBase(allowanceCharge.getBaseAmount())
+ .build()
+ )
+ .collect(Collectors.toList());
+ }
+
+ default DocumentoVentaDetalle mapDocumentoVentaDetalle(XMLInvoiceLine xml) {
+ DocumentoVentaDetalle documentoVentaDetalle = mapSalesDocumentDetalle(xml);
+ documentoVentaDetalle.setCantidad(xml.getQuantity().getValue());
+ documentoVentaDetalle.setUnidadMedida(xml.getQuantity().getUnitCode());
+
+ return documentoVentaDetalle;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/PerceptionMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/PerceptionMapper.java
new file mode 100644
index 00000000..e1a61fbb
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/PerceptionMapper.java
@@ -0,0 +1,77 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ClienteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.FirmanteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero2Translator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ProveedorMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcion;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionSunatDocumentReference;
+import io.github.project.openubl.xbuilder.content.models.common.TipoCambio;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.ComprobanteAfectado;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.PercepcionRetencionOperacion;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.Perception;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper(uses = {
+ SerieNumeroMapper.class,
+ ProveedorMapper.class,
+ ClienteMapper.class,
+ FirmanteMapper.class
+})
+public interface PerceptionMapper {
+
+ @Mapping(target = "serie", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, SerieTranslator.class})
+ @Mapping(target = "numero", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, Numero2Translator.class})
+ @Mapping(target = "tipoRegimen", source = "sunatSystemCode")
+ @Mapping(target = "importeTotalPercibido", source = "sunatDocumentReference.sunatInformation.sunatAmount")
+ @Mapping(target = "importeTotalCobrado", source = "sunatDocumentReference.sunatInformation.sunatNetTotal")
+ // General Document
+ @Mapping(target = "moneda", source = "totalInvoiceAmount.currencyID")
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ @Mapping(target = "proveedor", source = "accountingSupplierParty")
+ @Mapping(target = "firmante", source = "signature")
+ // PerceptionRetention General
+ @Mapping(target = "tipoRegimenPorcentaje", source = "sunatPercent")
+ @Mapping(target = "observacion", source = "note")
+ @Mapping(target = "cliente", source = "accountingCustomerParty")
+ @Mapping(target = "operacion", source = "sunatDocumentReference")
+ Perception map(XMLPercepcion xml);
+
+ @Mapping(target = "numeroOperacion", source = "payment.id")
+ @Mapping(target = "fechaOperacion", source = "payment.paidDate")
+ @Mapping(target = "importeOperacion", source = "payment.paidAmount")
+ @Mapping(target = "comprobante", source = ".")
+ @Mapping(target = "tipoCambio", source = "sunatInformation.exchangeRate")
+ PercepcionRetencionOperacion map(XMLPercepcionSunatDocumentReference xml);
+
+ @Mapping(target = "moneda", source = "totalInvoiceAmount.currencyID")
+ @Mapping(target = "importeTotal", source = "totalInvoiceAmount.value")
+ @Mapping(target = "serieNumero", source = "id.value")
+ @Mapping(target = "tipoComprobante", source = "id.schemeID")
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ ComprobanteAfectado mapComprobante(XMLPercepcionSunatDocumentReference xml);
+
+ @Mapping(target = "fecha", source = "date")
+ @Mapping(target = "valor", source = "calculationRate")
+ TipoCambio mapTipoCambio(XMLPercepcionSunatDocumentReference.ExchangeRate xml);
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/RetentionMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/RetentionMapper.java
new file mode 100644
index 00000000..061c4373
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/RetentionMapper.java
@@ -0,0 +1,77 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ClienteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.FirmanteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero2Translator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ProveedorMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetention;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetentionSunatDocumentReference;
+import io.github.project.openubl.xbuilder.content.models.common.TipoCambio;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.ComprobanteAfectado;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.PercepcionRetencionOperacion;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.Retention;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper(uses = {
+ SerieNumeroMapper.class,
+ ProveedorMapper.class,
+ ClienteMapper.class,
+ FirmanteMapper.class
+})
+public interface RetentionMapper {
+
+ @Mapping(target = "serie", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, SerieTranslator.class})
+ @Mapping(target = "numero", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, Numero2Translator.class})
+ @Mapping(target = "tipoRegimen", source = "sunatSystemCode")
+ @Mapping(target = "importeTotalRetenido", source = "sunatDocumentReference.sunatInformation.sunatAmount")
+ @Mapping(target = "importeTotalPagado", source = "sunatDocumentReference.sunatInformation.sunatNetTotal")
+ // General Document
+ @Mapping(target = "moneda", source = "totalInvoiceAmount.currencyID")
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ @Mapping(target = "proveedor", source = "accountingSupplierParty")
+ @Mapping(target = "firmante", source = "signature")
+ // PerceptionRetention General
+ @Mapping(target = "tipoRegimenPorcentaje", source = "sunatPercent")
+ @Mapping(target = "observacion", source = "note")
+ @Mapping(target = "cliente", source = "accountingCustomerParty")
+ @Mapping(target = "operacion", source = "sunatDocumentReference")
+ Retention map(XMLRetention xml);
+
+ @Mapping(target = "numeroOperacion", source = "payment.id")
+ @Mapping(target = "fechaOperacion", source = "payment.paidDate")
+ @Mapping(target = "importeOperacion", source = "payment.paidAmount")
+ @Mapping(target = "comprobante", source = ".")
+ @Mapping(target = "tipoCambio", source = "sunatInformation.exchangeRate")
+ PercepcionRetencionOperacion map(XMLRetentionSunatDocumentReference xml);
+
+ @Mapping(target = "moneda", source = "totalInvoiceAmount.currencyID")
+ @Mapping(target = "importeTotal", source = "totalInvoiceAmount.value")
+ @Mapping(target = "serieNumero", source = "id.value")
+ @Mapping(target = "tipoComprobante", source = "id.schemeID")
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ ComprobanteAfectado mapComprobante(XMLRetentionSunatDocumentReference xml);
+
+ @Mapping(target = "fecha", source = "date")
+ @Mapping(target = "valor", source = "calculationRate")
+ TipoCambio mapTipoCambio(XMLRetentionSunatDocumentReference.ExchangeRate xml);
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/SummaryDocumentsMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/SummaryDocumentsMapper.java
new file mode 100644
index 00000000..c28dbc7a
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/SummaryDocumentsMapper.java
@@ -0,0 +1,130 @@
+/*
+ * 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.jaxb.mappers;
+
+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.jaxb.mappers.common.FirmanteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero3Translator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ProveedorMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocuments;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine;
+import io.github.project.openubl.xbuilder.content.models.common.Cliente;
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.Comprobante;
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.ComprobanteImpuestos;
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.ComprobanteValorVenta;
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocuments;
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocumentsItem;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+import java.math.BigDecimal;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Mapper(uses = {
+ SerieNumeroMapper.class,
+ FirmanteMapper.class,
+ ProveedorMapper.class
+})
+public interface SummaryDocumentsMapper {
+
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ @Mapping(target = "firmante", source = "signature")
+ @Mapping(target = "proveedor", source = "accountingSupplierParty")
+
+ @Mapping(target = "numero", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, Numero3Translator.class})
+ @Mapping(target = "fechaEmisionComprobantes", source = "referenceDate")
+ @Mapping(target = "comprobantes", source = "lines")
+ SummaryDocuments map(XMLSummaryDocuments xml);
+
+ @Mapping(target = "tipoOperacion", source = "status.conditionCode")
+ @Mapping(target = "comprobante", source = ".")
+ SummaryDocumentsItem mapLines(XMLSummaryDocumentsLine xml);
+
+ @Mapping(target = "moneda", source = "totalAmount.currencyID")
+ @Mapping(target = "tipoComprobante", source = "documentTypeCode")
+ @Mapping(target = "serieNumero", source = "documentId")
+ @Mapping(target = "cliente", source = "accountingCustomerParty")
+ @Mapping(target = "comprobanteAfectado.serieNumero", source = "billingReference.invoiceDocumentReference.id")
+ @Mapping(target = "comprobanteAfectado.tipoComprobante", source = "billingReference.invoiceDocumentReference.documentTypeCode")
+ @Mapping(target = "valorVenta", source = ".")
+ @Mapping(target = "impuestos", source = ".")
+ Comprobante mapLineComprobante(XMLSummaryDocumentsLine xml);
+
+ @Mapping(target = "numeroDocumentoIdentidad", source = "customerAssignedAccountID")
+ @Mapping(target = "tipoDocumentoIdentidad", source = "additionalAccountID")
+ Cliente mapCliente(XMLSummaryDocumentsLine.AccountingCustomerParty xml);
+
+ default ComprobanteValorVenta mapLineComprobanteValorVenta(XMLSummaryDocumentsLine xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ Map billingPayments = Optional.ofNullable(xml.getBillingPayments())
+ .orElse(Collections.emptyList())
+ .stream()
+ .collect(Collectors.toMap(
+ XMLSummaryDocumentsLine.BillingPayment::getInstructionId,
+ XMLSummaryDocumentsLine.BillingPayment::getPaidAmount
+ ));
+
+ BigDecimal importeTotal = Optional.ofNullable(xml.getTotalAmount())
+ .map(XMLSummaryDocumentsLine.TotalAmount::getValue)
+ .orElse(null);
+ BigDecimal otrosCargos = Optional.ofNullable(xml.getAllowanceCharge())
+ .map(XMLSummaryDocumentsLine.AllowanceCharge::getValue)
+ .orElse(null);
+
+ return ComprobanteValorVenta.builder()
+ .importeTotal(importeTotal)
+ .gravado(billingPayments.get("01"))
+ .exonerado(billingPayments.get("02"))
+ .inafecto(billingPayments.get("03"))
+ .gratuito(billingPayments.get("05"))
+ .otrosCargos(otrosCargos)
+ .build();
+ }
+
+ default ComprobanteImpuestos mapLineComprobanteImpuestos(XMLSummaryDocumentsLine xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ Map taxTotals = Optional.ofNullable(xml.getTaxTotals())
+ .orElse(Collections.emptyList())
+ .stream()
+ .collect(Collectors.toMap(
+ taxTotal -> Optional.ofNullable(taxTotal.getTaxSubtotals())
+ .flatMap(f -> Optional.ofNullable(f.getTaxCategory()))
+ .flatMap(f -> Optional.ofNullable(f.getTaxScheme()))
+ .flatMap(taxScheme -> Optional.ofNullable(taxScheme.getId()))
+ .flatMap(code -> Catalog.valueOfCode(Catalog5.class, code))
+ .orElse(null),
+ XMLSummaryDocumentsLine.TaxTotal::getTaxAmount
+ ));
+
+ return ComprobanteImpuestos.builder()
+ .igv(taxTotals.get(Catalog5.IGV))
+ .icb(taxTotals.get(Catalog5.ICBPER))
+ .build();
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/VoidedDocumentsMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/VoidedDocumentsMapper.java
new file mode 100644
index 00000000..642d1be4
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/VoidedDocumentsMapper.java
@@ -0,0 +1,52 @@
+/*
+ * 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.jaxb.mappers;
+
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.FirmanteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero3Translator;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ProveedorMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroTranslator;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocuments;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocumentsLine;
+import io.github.project.openubl.xbuilder.content.models.sunat.baja.VoidedDocuments;
+import io.github.project.openubl.xbuilder.content.models.sunat.baja.VoidedDocumentsItem;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper(uses = {
+ SerieNumeroMapper.class,
+ FirmanteMapper.class,
+ ProveedorMapper.class
+})
+public interface VoidedDocumentsMapper {
+
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ @Mapping(target = "firmante", source = "signature")
+ @Mapping(target = "proveedor", source = "accountingSupplierParty")
+
+ @Mapping(target = "numero", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, Numero3Translator.class})
+ @Mapping(target = "fechaEmisionComprobantes", source = "referenceDate")
+ @Mapping(target = "comprobantes", source = "lines")
+ VoidedDocuments map(XMLVoidedDocuments xml);
+
+ @Mapping(target = "tipoComprobante", source = "documentTypeCode")
+ @Mapping(target = "serie", source = "documentSerialID")
+ @Mapping(target = "numero", source = "documentNumberID")
+ @Mapping(target = "descripcionSustento", source = "voidReasonDescription")
+ VoidedDocumentsItem mapLines(XMLVoidedDocumentsLine xml);
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ClienteMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ClienteMapper.java
new file mode 100644
index 00000000..38821c16
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ClienteMapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLCustomer;
+import io.github.project.openubl.xbuilder.content.models.common.Cliente;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper(uses = {
+ ContactoMapper.class,
+ DireccionMapper.class
+})
+public interface ClienteMapper {
+
+ @Mapping(target = "tipoDocumentoIdentidad", source = "partyIdentification.id.schemeID")
+ @Mapping(target = "numeroDocumentoIdentidad", source = "partyIdentification.id.value")
+ @Mapping(target = "nombre", source = "partyLegalEntity.registrationName")
+ @Mapping(target = "direccion", source = "partyLegalEntity.address")
+ @Mapping(target = "contacto", source = "contact")
+ Cliente map(XMLCustomer xml);
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ContactoMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ContactoMapper.java
new file mode 100644
index 00000000..21cd578c
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ContactoMapper.java
@@ -0,0 +1,31 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLContact;
+import io.github.project.openubl.xbuilder.content.models.common.Contacto;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper
+public interface ContactoMapper {
+
+ @Mapping(target = "telefono", source = "telephone")
+ @Mapping(target = "email", source = "electronicMail")
+ Contacto map(XMLContact xml);
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/DireccionMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/DireccionMapper.java
new file mode 100644
index 00000000..bd32fd54
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/DireccionMapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLAddress;
+import io.github.project.openubl.xbuilder.content.models.common.Direccion;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper
+public interface DireccionMapper {
+
+ @Mapping(target = "ubigeo", source = "id")
+ @Mapping(target = "codigoLocal", source = "addressTypeCode")
+ @Mapping(target = "urbanizacion", source = "citySubdivisionName")
+ @Mapping(target = "provincia", source = "cityName")
+ @Mapping(target = "departamento", source = "countrySubEntity")
+ @Mapping(target = "distrito", source = "district")
+ @Mapping(target = "codigoPais", source = "country.identificationCode")
+ @Mapping(target = "direccion", source = "addressLine.line")
+ Direccion map(XMLAddress xml);
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/FirmanteMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/FirmanteMapper.java
new file mode 100644
index 00000000..0677410d
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/FirmanteMapper.java
@@ -0,0 +1,34 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSignature;
+import io.github.project.openubl.xbuilder.content.models.common.Firmante;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper(uses = {
+ ContactoMapper.class,
+ DireccionMapper.class
+})
+public interface FirmanteMapper {
+
+ @Mapping(target = "ruc", source = "id")
+ @Mapping(target = "razonSocial", source = "signatoryParty.partyName.name")
+ Firmante map(XMLSignature xml);
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/GuiaMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/GuiaMapper.java
new file mode 100644
index 00000000..b5536938
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/GuiaMapper.java
@@ -0,0 +1,31 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Guia;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper
+public interface GuiaMapper {
+
+ @Mapping(target = "serieNumero", source = "id")
+ @Mapping(target = "tipoDocumento", source = "documentTypeCode")
+ Guia mapGuia(XMLSalesDocument.DespatchDocumentReference xml);
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero2Translator.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero2Translator.java
new file mode 100644
index 00000000..5313d6b0
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero2Translator.java
@@ -0,0 +1,30 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import org.mapstruct.Qualifier;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.CLASS)
+public @interface Numero2Translator {
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero3Translator.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero3Translator.java
new file mode 100644
index 00000000..e72e513f
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero3Translator.java
@@ -0,0 +1,30 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import org.mapstruct.Qualifier;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.CLASS)
+public @interface Numero3Translator {
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ProveedorMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ProveedorMapper.java
new file mode 100644
index 00000000..daa8042f
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ProveedorMapper.java
@@ -0,0 +1,44 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplier;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplierSunat;
+import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper(uses = {
+ ContactoMapper.class,
+ DireccionMapper.class
+})
+public interface ProveedorMapper {
+
+ @Mapping(target = "ruc", source = "partyIdentification.id")
+ @Mapping(target = "nombreComercial", source = "partyName.name")
+ @Mapping(target = "razonSocial", source = "partyLegalEntity.registrationName")
+ @Mapping(target = "direccion", source = "partyLegalEntity.address")
+ @Mapping(target = "contacto", source = "contact")
+ Proveedor map(XMLSupplier xml);
+
+ @Mapping(target = "ruc", source = "customerAssignedAccountID")
+ @Mapping(target = "nombreComercial", source = "partyName.name")
+ @Mapping(target = "razonSocial", source = "party.partyLegalEntity.registrationName")
+ @Mapping(target = "direccion", source = "party.partyLegalEntity.address")
+ @Mapping(target = "contacto", source = "contact")
+ Proveedor map(XMLSupplierSunat xml);
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SalesDocumentHelperMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SalesDocumentHelperMapper.java
new file mode 100644
index 00000000..8353d1bb
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SalesDocumentHelperMapper.java
@@ -0,0 +1,194 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog12;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog12_Anticipo;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog5;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoRelacionado;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImpuestos;
+
+import java.math.BigDecimal;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static io.github.project.openubl.xbuilder.content.jaxb.mappers.utils.MapperUtils.mapPorcentaje;
+
+public interface SalesDocumentHelperMapper {
+
+ default Map mapLeyendas(List xml) {
+ return Optional.ofNullable(xml)
+ .map(o -> o.stream()
+ .filter(note -> note.getLanguageLocaleId() != null)
+ .collect(Collectors.toMap(XMLSalesDocument.Note::getLanguageLocaleId, XMLSalesDocument.Note::getValue))
+ )
+ .orElse(Collections.emptyMap());
+ }
+
+ default TotalImpuestos mapTotalImpuestos(XMLSalesDocument.TaxTotal xml) {
+ if (xml == null) {
+ return null;
+ }
+
+ TotalImpuestos.TotalImpuestosBuilder builder = TotalImpuestos.builder()
+ .total(xml.getTaxAmount());
+
+ for (XMLSalesDocument.TaxSubtotal taxSubtotal : xml.getTaxSubtotals()) {
+ Catalog5 catalog5 = Catalog
+ .valueOfCode(Catalog5.class, taxSubtotal.getTaxCategory().getTaxScheme().getId())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ switch (catalog5) {
+ case IGV:
+ builder = builder
+ .gravadoBaseImponible(taxSubtotal.getTaxableAmount())
+ .gravadoImporte(taxSubtotal.getTaxAmount());
+ break;
+ case IMPUESTO_ARROZ_PILADO:
+ builder = builder
+ .ivapBaseImponible(taxSubtotal.getTaxableAmount())
+ .ivapImporte(taxSubtotal.getTaxAmount());
+ break;
+ case ISC:
+ builder = builder
+ .iscBaseImponible(taxSubtotal.getTaxableAmount())
+ .iscImporte(taxSubtotal.getTaxAmount());
+ break;
+ case EXPORTACION:
+ builder = builder
+ .exportacionBaseImponible(taxSubtotal.getTaxableAmount())
+ .exportacionImporte(taxSubtotal.getTaxAmount());
+ break;
+ case GRATUITO:
+ builder = builder
+ .gratuitoBaseImponible(taxSubtotal.getTaxableAmount())
+ .gratuitoImporte(taxSubtotal.getTaxAmount());
+ break;
+ case EXONERADO:
+ builder = builder
+ .exoneradoBaseImponible(taxSubtotal.getTaxableAmount())
+ .exoneradoImporte(taxSubtotal.getTaxAmount());
+ break;
+ case INAFECTO:
+ builder = builder
+ .inafectoBaseImponible(taxSubtotal.getTaxableAmount())
+ .inafectoImporte(taxSubtotal.getTaxAmount());
+ break;
+ case ICBPER:
+ builder = builder
+ .icbImporte(taxSubtotal.getTaxAmount());
+ break;
+ case OTROS:
+ break;
+ }
+ }
+
+ return builder.build();
+ }
+
+ default List mapDocumentosRelacionados(List xml) {
+ if (xml == null) {
+ return Collections.emptyList();
+ }
+
+ return xml.stream()
+ .filter(additionalDocumentReference -> Objects.nonNull(additionalDocumentReference.getDocumentTypeCode()))
+ .filter(additionalDocumentReference -> {
+ Optional catalog12 = Catalog
+ .valueOfCode(Catalog12.class, additionalDocumentReference.getDocumentTypeCode());
+ Optional catalog12_anticipo = Catalog
+ .valueOfCode(Catalog12_Anticipo.class, additionalDocumentReference.getDocumentTypeCode());
+ return catalog12.isPresent() && catalog12_anticipo.isEmpty();
+ })
+ .map(despatchDocumentReference -> DocumentoRelacionado.builder()
+ .serieNumero(despatchDocumentReference.getId())
+ .tipoDocumento(despatchDocumentReference.getDocumentTypeCode())
+ .build())
+ .collect(Collectors.toList());
+ }
+
+ default DocumentoVentaDetalle mapSalesDocumentDetalle(XMLSalesDocumentLine documentLine) {
+ if (documentLine == null) {
+ return null;
+ }
+
+ DocumentoVentaDetalle.DocumentoVentaDetalleBuilder builder = DocumentoVentaDetalle.builder();
+
+ // Extract taxes
+ XMLSalesDocumentLine.TaxTotalLine taxTotal = documentLine.getTaxTotal();
+ Map> subTotals = taxTotal.getTaxSubtotals().stream()
+ .collect(Collectors.groupingBy(
+ taxSubtotalLine -> taxSubtotalLine.getTaxCategory().getTaxScheme().getId(),
+ Collectors.reducing((o, o2) -> o) // Only one element per type is expected
+ ));
+
+ // ISC
+ Optional iscTaxSubtotal = subTotals.getOrDefault(Catalog5.ISC.getCode(), Optional.empty());
+ iscTaxSubtotal.ifPresent(taxSubtotalLine -> {
+ builder.iscBaseImponible(taxSubtotalLine.getTaxableAmount());
+ builder.isc(taxSubtotalLine.getTaxAmount());
+ builder.tasaIsc(mapPorcentaje(taxSubtotalLine.getTaxCategory().getPercent()));
+ builder.iscTipo(taxSubtotalLine.getTaxCategory().getTierRange());
+ });
+
+ // IGV
+ Optional igvTaxSubtotal = taxTotal.getTaxSubtotals().stream()
+ .filter(line -> {
+ String code = line.getTaxCategory().getTaxScheme().getId();
+ return !Objects.equals(code, Catalog5.ISC.getCode()) && !Objects.equals(code, Catalog5.ICBPER.getCode());
+ })
+ .findFirst();
+ igvTaxSubtotal.ifPresent(taxSubtotalLine -> {
+ builder.igvBaseImponible(taxSubtotalLine.getTaxableAmount());
+ builder.igv(taxSubtotalLine.getTaxAmount());
+ builder.tasaIgv(mapPorcentaje(taxSubtotalLine.getTaxCategory().getPercent()));
+ builder.igvTipo(taxSubtotalLine.getTaxCategory().getTaxExemptionReasonCode());
+ });
+
+ // ICB
+ Optional icbTaxSubtotal = subTotals.getOrDefault(Catalog5.ICBPER.getCode(), Optional.empty());
+ icbTaxSubtotal.ifPresent(taxSubtotalLine -> {
+ builder.icb(taxSubtotalLine.getTaxAmount());
+ builder.tasaIcb(taxSubtotalLine.getTaxCategory().getPerUnitAmount());
+ builder.icbAplica(taxSubtotalLine.getTaxAmount() != null && taxSubtotalLine.getTaxAmount().compareTo(BigDecimal.ZERO) > 0);
+ });
+
+ BigDecimal precioReferencia = Optional.ofNullable(documentLine.getPricingReference())
+ .flatMap(pricingReference -> Optional.ofNullable(pricingReference.getAlternativeConditionPrice()))
+ .map(XMLSalesDocumentLine.AlternativeConditionPrice::getAlternativeConditionPrice)
+ .orElse(null);
+ String precioReferenciaTipo = Optional.ofNullable(documentLine.getPricingReference())
+ .flatMap(pricingReference -> Optional.ofNullable(pricingReference.getAlternativeConditionPrice()))
+ .map(XMLSalesDocumentLine.AlternativeConditionPrice::getPriceTypeCode)
+ .orElse(null);
+
+ return builder
+ .descripcion(documentLine.getItem().getDescription())
+ .precio(documentLine.getPrice().getPriceAmount())
+ .precioReferencia(precioReferencia)
+ .precioReferenciaTipo(precioReferenciaTipo)
+ .totalImpuestos(taxTotal.getTaxAmount())
+ .build();
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SalesDocumentMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SalesDocumentMapper.java
new file mode 100644
index 00000000..83a1dc3e
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SalesDocumentMapper.java
@@ -0,0 +1,56 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Guia;
+import io.github.project.openubl.xbuilder.content.models.standard.general.SalesDocument;
+import org.mapstruct.MapperConfig;
+import org.mapstruct.Mapping;
+import org.mapstruct.MappingInheritanceStrategy;
+
+@MapperConfig(
+ mappingInheritanceStrategy = MappingInheritanceStrategy.AUTO_INHERIT_FROM_CONFIG,
+ uses = {
+ SerieNumeroMapper.class,
+ FirmanteMapper.class,
+ ProveedorMapper.class,
+ ClienteMapper.class,
+ GuiaMapper.class
+ }
+)
+public interface SalesDocumentMapper {
+
+ @Mapping(target = "serie", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, SerieTranslator.class})
+ @Mapping(target = "numero", source = "documentId", qualifiedBy = {SerieNumeroTranslator.class, Numero2Translator.class})
+
+ @Mapping(target = "moneda", source = "documentCurrencyCode")
+ @Mapping(target = "fechaEmision", source = "issueDate")
+ @Mapping(target = "horaEmision", source = "issueTime")
+ @Mapping(target = "ordenDeCompra", source = "orderReference.id")
+
+ @Mapping(target = "firmante", source = "signature")
+ @Mapping(target = "proveedor", source = "accountingSupplierParty.party")
+ @Mapping(target = "cliente", source = "accountingCustomerParty.party")
+
+ @Mapping(target = "leyendas", source = "notes")
+ @Mapping(target = "guias", source = "despatchDocumentReferences")
+ @Mapping(target = "totalImpuestos", source = "taxTotal")
+ @Mapping(target = "documentosRelacionados", source = "additionalDocumentReferences")
+ SalesDocument map(XMLSalesDocument xml);
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroMapper.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroMapper.java
new file mode 100644
index 00000000..66375394
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroMapper.java
@@ -0,0 +1,51 @@
+/*
+ * 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.jaxb.mappers.common;
+
+@SerieNumeroTranslator
+public class SerieNumeroMapper {
+
+ @SerieTranslator
+ public String toSerie(String serieNumero) {
+ if (serieNumero == null) {
+ return null;
+ }
+
+ String[] split = serieNumero.split("-");
+ return split.length >= 1 ? split[0] : null;
+ }
+
+ @Numero2Translator
+ public Integer toNumero2(String serieNumero) {
+ if (serieNumero == null) {
+ return null;
+ }
+
+ String[] split = serieNumero.split("-");
+ return split.length >= 2 ? Integer.parseInt(split[1]) : null;
+ }
+
+ @Numero3Translator
+ public Integer toNumero3(String serieNumero) {
+ if (serieNumero == null) {
+ return null;
+ }
+
+ String[] split = serieNumero.split("-");
+ return split.length >= 3 ? Integer.parseInt(split[2]) : null;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroTranslator.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroTranslator.java
new file mode 100644
index 00000000..30dbb0d6
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroTranslator.java
@@ -0,0 +1,30 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import org.mapstruct.Qualifier;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.CLASS)
+public @interface SerieNumeroTranslator {
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieTranslator.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieTranslator.java
new file mode 100644
index 00000000..9d63fb9c
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieTranslator.java
@@ -0,0 +1,30 @@
+/*
+ * 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.jaxb.mappers.common;
+
+import org.mapstruct.Qualifier;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.CLASS)
+public @interface SerieTranslator {
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/utils/MapperUtils.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/utils/MapperUtils.java
new file mode 100644
index 00000000..78fa6651
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/utils/MapperUtils.java
@@ -0,0 +1,31 @@
+/*
+ * 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.jaxb.mappers.utils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Optional;
+
+public class MapperUtils {
+
+ public static BigDecimal mapPorcentaje(BigDecimal number) {
+ return Optional.ofNullable(number)
+ .map(bigDecimal -> bigDecimal.divide(new BigDecimal("100"), 10, RoundingMode.HALF_EVEN))
+ .orElse(null);
+ }
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLAddress.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLAddress.java
new file mode 100644
index 00000000..2893ab89
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLAddress.java
@@ -0,0 +1,74 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "RegistrationAddress")
+@Data
+@NoArgsConstructor
+public class XMLAddress {
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "AddressTypeCode", namespace = XMLConstants.CBC)
+ private String addressTypeCode;
+
+ @XmlElement(name = "CitySubdivisionName", namespace = XMLConstants.CBC)
+ private String citySubdivisionName;
+
+ @XmlElement(name = "CityName", namespace = XMLConstants.CBC)
+ private String cityName;
+
+ @XmlElement(name = "CountrySubentity", namespace = XMLConstants.CBC)
+ private String countrySubEntity;
+
+ @XmlElement(name = "District", namespace = XMLConstants.CBC)
+ private String district;
+
+ @XmlElement(name = "AddressLine", namespace = XMLConstants.CAC)
+ private AddressLine addressLine;
+
+ @XmlElement(name = "Country", namespace = XMLConstants.CAC)
+ private Country country;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "Address.AddressLine")
+ @Data
+ @NoArgsConstructor
+ public static class AddressLine {
+ @XmlElement(name = "Line", namespace = XMLConstants.CBC)
+ private String line;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "Address.Country")
+ @Data
+ @NoArgsConstructor
+ public static class Country {
+ @XmlElement(name = "IdentificationCode", namespace = XMLConstants.CBC)
+ private String identificationCode;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLConstants.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLConstants.java
new file mode 100644
index 00000000..b42ee882
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLConstants.java
@@ -0,0 +1,24 @@
+/*
+ * 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.jaxb.models;
+
+public class XMLConstants {
+ public static final String CBC = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2";
+ public static final String CAC = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2";
+ public static final String SAC = "urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1";
+ public static final String EXT = "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2";
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLContact.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLContact.java
new file mode 100644
index 00000000..e08444f4
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLContact.java
@@ -0,0 +1,38 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Contact")
+@Data
+@NoArgsConstructor
+public class XMLContact {
+
+ @XmlElement(name = "Telephone", namespace = XMLConstants.CBC)
+ private String telephone;
+
+ @XmlElement(name = "ElectronicMail", namespace = XMLConstants.CBC)
+ private String electronicMail;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNote.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNote.java
new file mode 100644
index 00000000..44dacd64
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNote.java
@@ -0,0 +1,40 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "CreditNote", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLCreditNote extends XMLSalesDocument {
+ @XmlElement(name = "LegalMonetaryTotal", namespace = XMLConstants.CAC)
+ private MonetaryTotal monetaryTotal;
+
+ @XmlElement(name = "CreditNoteLine", namespace = XMLConstants.CAC)
+ private List lines;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNoteLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNoteLine.java
new file mode 100644
index 00000000..62955efc
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNoteLine.java
@@ -0,0 +1,52 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import java.math.BigDecimal;
+
+@XmlType(name = "CreditNoteDocumentLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class XMLCreditNoteLine extends XMLSalesDocumentLine {
+ @XmlElement(name = "CreditedQuantity", namespace = XMLConstants.CBC)
+ private Quantity quantity;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "CreditNoteDocumentLine.Quantity")
+ @Data
+ @NoArgsConstructor
+ public static class Quantity {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "unitCode")
+ private String unitCode;
+ }
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCustomer.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCustomer.java
new file mode 100644
index 00000000..2c003deb
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCustomer.java
@@ -0,0 +1,76 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Customer.Party")
+@Data
+@NoArgsConstructor
+public class XMLCustomer {
+
+ @XmlElement(name = "PartyIdentification", namespace = XMLConstants.CAC)
+ private PartyIdentification partyIdentification;
+
+ @XmlElement(name = "PartyLegalEntity", namespace = XMLConstants.CAC)
+ private PartyLegalEntity partyLegalEntity;
+
+ @XmlElement(name = "Contact", namespace = XMLConstants.CAC)
+ private XMLContact contact;
+
+ @XmlType(name = "Customer.PartyIdentification")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyIdentification {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private PartyIdentification_ID id;
+ }
+
+ @XmlType(name = "Customer.ID")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyIdentification_ID {
+ @XmlValue
+ private String value;
+
+ @XmlAttribute(name = "schemeID")
+ private String schemeID;
+ }
+
+ @XmlType(name = "Customer.PartyLegalEntity")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyLegalEntity {
+ @XmlElement(name = "RegistrationName", namespace = XMLConstants.CBC)
+ private String registrationName;
+
+ @XmlElement(name = "RegistrationAddress", namespace = XMLConstants.CAC)
+ private XMLAddress address;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNote.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNote.java
new file mode 100644
index 00000000..ff9fd63f
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNote.java
@@ -0,0 +1,40 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "DebitNote", namespace = "urn:oasis:names:specification:ubl:schema:xsd:DebitNote-2")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLDebitNote extends XMLSalesDocument {
+ @XmlElement(name = "RequestedMonetaryTotal", namespace = XMLConstants.CAC)
+ private MonetaryTotal monetaryTotal;
+
+ @XmlElement(name = "DebitNoteLine", namespace = XMLConstants.CAC)
+ private List lines;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNoteLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNoteLine.java
new file mode 100644
index 00000000..eac67db3
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNoteLine.java
@@ -0,0 +1,52 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import java.math.BigDecimal;
+
+@XmlType(name = "DebitNoteDocumentLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class XMLDebitNoteLine extends XMLSalesDocumentLine {
+ @XmlElement(name = "DebitedQuantity", namespace = XMLConstants.CBC)
+ private Quantity quantity;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DebitnOTEDocumentLine.Quantity")
+ @Data
+ @NoArgsConstructor
+ public static class Quantity {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "unitCode")
+ private String unitCode;
+ }
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDespatchAdvice.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDespatchAdvice.java
new file mode 100644
index 00000000..cd23a0a5
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDespatchAdvice.java
@@ -0,0 +1,376 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalTimeAdapter;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "DespatchAdvice", namespace = "urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2")
+@Data
+@NoArgsConstructor
+public class XMLDespatchAdvice {
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String documentId;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "IssueDate", namespace = XMLConstants.CBC)
+ private LocalDate issueDate;
+
+ @XmlJavaTypeAdapter(LocalTimeAdapter.class)
+ @XmlElement(name = "IssueTime", namespace = XMLConstants.CBC)
+ private LocalTime issueTime;
+
+ @XmlElement(name = "DespatchAdviceTypeCode", namespace = XMLConstants.CBC)
+ private String despatchAdviceTypeCode;
+
+ @XmlElement(name = "Note", namespace = XMLConstants.CBC)
+ private String note;
+
+ @XmlElement(name = "OrderReference", namespace = XMLConstants.CAC)
+ private OrderReference orderReference;
+
+ @XmlElement(name = "AdditionalDocumentReference", namespace = XMLConstants.CAC)
+ private AdditionalDocumentReference additionalDocumentReference;
+
+ @XmlElement(name = "Signature", namespace = XMLConstants.CAC)
+ private XMLSignature signature;
+
+ @XmlElement(name = "DespatchSupplierParty", namespace = XMLConstants.CAC)
+ private DespatchSupplierParty despatchSupplierParty;
+
+ @XmlElement(name = "DeliveryCustomerParty", namespace = XMLConstants.CAC)
+ private DeliveryCustomerParty deliveryCustomerParty;
+
+ @XmlElement(name = "SellerSupplierParty", namespace = XMLConstants.CAC)
+ private SellerSupplierParty sellerSupplierParty;
+
+ @XmlElement(name = "Shipment", namespace = XMLConstants.CAC)
+ private Shipment shipment;
+
+ @XmlElement(name = "DespatchLine", namespace = XMLConstants.CAC)
+ private List lines;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.OrderReference")
+ @Data
+ @NoArgsConstructor
+ public static class OrderReference {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "OrderTypeCode", namespace = XMLConstants.CBC)
+ private String orderTypeCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.AdditionalDocumentReference")
+ @Data
+ @NoArgsConstructor
+ public static class AdditionalDocumentReference {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC)
+ private String documentTypeCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.DespatchSupplierParty")
+ @Data
+ @NoArgsConstructor
+ public static class DespatchSupplierParty {
+ @XmlElement(name = "Party", namespace = XMLConstants.CAC)
+ private Party party;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.Party")
+ @Data
+ @NoArgsConstructor
+ public static class Party {
+ @XmlElement(name = "PartyIdentification", namespace = XMLConstants.CAC)
+ private PartyIdentification partyIdentification;
+
+ @XmlElement(name = "PartyLegalEntity", namespace = XMLConstants.CAC)
+ private PartyLegalEntity partyLegalEntity;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.PartyIdentification")
+ @Data
+ @NoArgsConstructor
+ public static class PartyIdentification {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private ID id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.PartyIdentification.ID")
+ @Data
+ @NoArgsConstructor
+ public static class ID {
+ @XmlValue
+ private String value;
+
+ @XmlAttribute(name = "schemeID")
+ private String schemeID;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.PartyLegalEntity")
+ @Data
+ @NoArgsConstructor
+ public static class PartyLegalEntity {
+ @XmlElement(name = "RegistrationName", namespace = XMLConstants.CBC)
+ private String registrationName;
+ }
+
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.DeliveryCustomerParty")
+ @Data
+ @NoArgsConstructor
+ public static class DeliveryCustomerParty {
+ @XmlElement(name = "Party", namespace = XMLConstants.CAC)
+ private Party party;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.SellerSupplierParty")
+ @Data
+ @NoArgsConstructor
+ public static class SellerSupplierParty {
+ @XmlElement(name = "CustomerAssignedAccountID", namespace = XMLConstants.CBC)
+ private String customerAssignedAccountId;
+
+ @XmlElement(name = "Party", namespace = XMLConstants.CAC)
+ private Party party;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.Shipment")
+ @Data
+ @NoArgsConstructor
+ public static class Shipment {
+ @XmlElement(name = "HandlingCode", namespace = XMLConstants.CBC)
+ private String handlingCode;
+
+ @XmlElement(name = "Information", namespace = XMLConstants.CBC)
+ private String information;
+
+ @XmlElement(name = "GrossWeightMeasure", namespace = XMLConstants.CBC)
+ private GrossWeightMeasure grossWeightMeasure;
+
+ @XmlElement(name = "TotalTransportHandlingUnitQuantity", namespace = XMLConstants.CBC)
+ private Integer totalTransportHandlingUnitQuantity;
+
+ @XmlElement(name = "SplitConsignmentIndicator", namespace = XMLConstants.CBC)
+ private Boolean splitConsignmentIndicator;
+
+ @XmlElement(name = "ShipmentStage", namespace = XMLConstants.CAC)
+ private ShipmentStage shipmentStage;
+
+ @XmlElement(name = "Delivery", namespace = XMLConstants.CAC)
+ private Delivery delivery;
+
+ @XmlElement(name = "TransportHandlingUnit", namespace = XMLConstants.CAC)
+ private TransportHandlingUnit transportHandlingUnit;
+
+ @XmlElement(name = "OriginAddress", namespace = XMLConstants.CAC)
+ private OriginAddress originAddress;
+
+ @XmlElement(name = "FirstArrivalPortLocation", namespace = XMLConstants.CAC)
+ private FirstArrivalPortLocation firstArrivalPortLocation;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.GrossWeightMeasure")
+ @Data
+ @NoArgsConstructor
+ public static class GrossWeightMeasure {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "unitCode")
+ private String unitCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.ShipmentStage")
+ @Data
+ @NoArgsConstructor
+ public static class ShipmentStage {
+ @XmlElement(name = "TransportModeCode", namespace = XMLConstants.CBC)
+ private String transportModeCode;
+
+ @XmlElement(name = "TransitPeriod", namespace = XMLConstants.CAC)
+ private TransitPeriod transitPeriod;
+
+ @XmlElement(name = "CarrierParty", namespace = XMLConstants.CAC)
+ private CarrierParty carrierParty;
+
+ @XmlElement(name = "TransportMeans", namespace = XMLConstants.CAC)
+ private TransportMeans transportMeans;
+
+ @XmlElement(name = "DriverPerson", namespace = XMLConstants.CAC)
+ private DriverPerson driverPerson;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.TransitPeriod")
+ @Data
+ @NoArgsConstructor
+ public static class TransitPeriod {
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "StartDate", namespace = XMLConstants.CBC)
+ private LocalDate startDate;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.CarrierParty")
+ @Data
+ @NoArgsConstructor
+ public static class CarrierParty {
+ @XmlElement(name = "PartyIdentification", namespace = XMLConstants.CAC)
+ private PartyIdentification partyIdentification;
+
+ @XmlElement(name = "PartyName", namespace = XMLConstants.CAC)
+ private PartyName partyName;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.PartyName")
+ @Data
+ @NoArgsConstructor
+ public static class PartyName {
+ @XmlElement(name = "Name", namespace = XMLConstants.CBC)
+ private String name;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.TransportMeans")
+ @Data
+ @NoArgsConstructor
+ public static class TransportMeans {
+ @XmlElement(name = "RoadTransport", namespace = XMLConstants.CAC)
+ private RoadTransport roadTransport;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.RoadTransport")
+ @Data
+ @NoArgsConstructor
+ public static class RoadTransport {
+ @XmlElement(name = "LicensePlateID", namespace = XMLConstants.CBC)
+ private String licensePlateID;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.DriverPerson")
+ @Data
+ @NoArgsConstructor
+ public static class DriverPerson {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private ID id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.Delivery")
+ @Data
+ @NoArgsConstructor
+ public static class Delivery {
+ @XmlElement(name = "DeliveryAddress", namespace = XMLConstants.CAC)
+ private DeliveryAddress deliveryAddress;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.DeliveryAddress")
+ @Data
+ @NoArgsConstructor
+ public static class DeliveryAddress {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "AddressLine", namespace = XMLConstants.CAC)
+ private AddressLine addressLine;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.AddressLine")
+ @Data
+ @NoArgsConstructor
+ public static class AddressLine {
+ @XmlElement(name = "Line", namespace = XMLConstants.CBC)
+ private String line;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.TransportHandlingUnit")
+ @Data
+ @NoArgsConstructor
+ public static class TransportHandlingUnit {
+ @XmlElement(name = "TransportEquipment", namespace = XMLConstants.CAC)
+ private TransportEquipment transportEquipment;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.TransportEquipment")
+ @Data
+ @NoArgsConstructor
+ public static class TransportEquipment {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.OriginAddress")
+ @Data
+ @NoArgsConstructor
+ public static class OriginAddress {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "StreetName", namespace = XMLConstants.CBC)
+ private String streetName;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdvice.FirstArrivalPortLocation")
+ @Data
+ @NoArgsConstructor
+ public static class FirstArrivalPortLocation {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDespatchAdviceLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDespatchAdviceLine.java
new file mode 100644
index 00000000..277caefc
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDespatchAdviceLine.java
@@ -0,0 +1,85 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+@XmlType(name = "DespatchAdviceLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public class XMLDespatchAdviceLine {
+
+ @XmlElement(name = "DeliveredQuantity", namespace = XMLConstants.CBC)
+ private DeliveredQuantity deliveredQuantity;
+
+ @XmlElement(name = "Item", namespace = XMLConstants.CAC)
+ private Item item;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdviceLine.DeliveredQuantity")
+ @Data
+ @NoArgsConstructor
+ public static class DeliveredQuantity {
+ @XmlValue
+ private String value;
+
+ @XmlAttribute(name = "unitCode")
+ private String unitCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdviceLine.Item")
+ @Data
+ @NoArgsConstructor
+ public static class Item {
+ @XmlElement(name = "Name", namespace = XMLConstants.CBC)
+ private String name;
+
+ @XmlElement(name = "SellersItemIdentification", namespace = XMLConstants.CAC)
+ private SellersItemIdentification sellersItemIdentification;
+
+ @XmlElement(name = "CommodityClassification", namespace = XMLConstants.CAC)
+ private CommodityClassification commodityClassification;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdviceLine.SellersItemIdentification")
+ @Data
+ @NoArgsConstructor
+ public static class SellersItemIdentification {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "DespatchAdviceLine.CommodityClassification")
+ @Data
+ @NoArgsConstructor
+ public static class CommodityClassification {
+ @XmlElement(name = "ItemClassificationCode", namespace = XMLConstants.CBC)
+ private String itemClassificationCode;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoice.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoice.java
new file mode 100644
index 00000000..577f929b
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoice.java
@@ -0,0 +1,40 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "Invoice", namespace = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLInvoice extends XMLSalesDocument {
+ @XmlElement(name = "LegalMonetaryTotal", namespace = XMLConstants.CAC)
+ private MonetaryTotal monetaryTotal;
+
+ @XmlElement(name = "InvoiceLine", namespace = XMLConstants.CAC)
+ private List lines;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoiceLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoiceLine.java
new file mode 100644
index 00000000..afda7e4a
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoiceLine.java
@@ -0,0 +1,52 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import java.math.BigDecimal;
+
+@XmlType(name = "InvoiceDocumentLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class XMLInvoiceLine extends XMLSalesDocumentLine {
+ @XmlElement(name = "InvoicedQuantity", namespace = XMLConstants.CBC)
+ private Quantity quantity;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "InvoiceDocumentLine.Quantity")
+ @Data
+ @NoArgsConstructor
+ public static class Quantity {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "unitCode")
+ private String unitCode;
+ }
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcion.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcion.java
new file mode 100644
index 00000000..2952a4de
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcion.java
@@ -0,0 +1,47 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.math.BigDecimal;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "Perception", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:Perception-1")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLPercepcion extends XMLPercepcionRetencionBase {
+
+ @XmlElement(name = "SUNATPerceptionSystemCode", namespace = XMLConstants.SAC)
+ private String sunatSystemCode;
+
+ @XmlElement(name = "SUNATPerceptionPercent", namespace = XMLConstants.SAC)
+ private BigDecimal sunatPercent;
+
+ @XmlElement(name = "SUNATTotalCashed", namespace = XMLConstants.SAC)
+ private BigDecimal sunatTotal;
+
+ @XmlElement(name = "SUNATPerceptionDocumentReference", namespace = XMLConstants.SAC)
+ private XMLPercepcionSunatDocumentReference sunatDocumentReference;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionRetencionBase.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionRetencionBase.java
new file mode 100644
index 00000000..ea41bc2e
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionRetencionBase.java
@@ -0,0 +1,72 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@XmlType(name = "PerceptionRetentionBase")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public abstract class XMLPercepcionRetencionBase {
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String documentId;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "IssueDate", namespace = XMLConstants.CBC)
+ private LocalDate issueDate;
+
+ @XmlElement(name = "Note", namespace = XMLConstants.CBC)
+ private String note;
+
+ @XmlElement(name = "TotalInvoiceAmount", namespace = XMLConstants.CBC)
+ private TotalInvoiceAmount totalInvoiceAmount;
+
+ @XmlElement(name = "Signature", namespace = XMLConstants.CAC)
+ private XMLSignature signature;
+
+ @XmlElement(name = "AgentParty", namespace = XMLConstants.CAC)
+ private XMLSupplier accountingSupplierParty;
+
+ @XmlElement(name = "ReceiverParty", namespace = XMLConstants.CAC)
+ private XMLCustomer accountingCustomerParty;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "PerceptionRetentionBase.TotalInvoiceAmount")
+ @Data
+ @NoArgsConstructor
+ public static class TotalInvoiceAmount {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "currencyID")
+ private String currencyID;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionRetencionSunatDocumentReferenceBase.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionRetencionSunatDocumentReferenceBase.java
new file mode 100644
index 00000000..0b17dfd1
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionRetencionSunatDocumentReferenceBase.java
@@ -0,0 +1,91 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "XMLPercepcionRetencionSunatDocumentReferenceBase")
+@Data
+@NoArgsConstructor
+public abstract class XMLPercepcionRetencionSunatDocumentReferenceBase {
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private ID id;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "IssueDate", namespace = XMLConstants.CBC)
+ private LocalDate issueDate;
+
+ @XmlElement(name = "TotalInvoiceAmount", namespace = XMLConstants.CBC)
+ private TotalInvoiceAmount totalInvoiceAmount;
+
+ @XmlElement(name = "Payment", namespace = XMLConstants.CAC)
+ private Payment payment;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLPercepcionRetencionSunatDocumentReferenceBase.ID")
+ @Data
+ @NoArgsConstructor
+ public static class ID {
+ @XmlValue
+ private String value;
+
+ @XmlAttribute(name = "schemeID")
+ private String schemeID;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLPercepcionRetencionSunatDocumentReferenceBase.TotalInvoiceAmount")
+ @Data
+ @NoArgsConstructor
+ public static class TotalInvoiceAmount {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "currencyID")
+ private String currencyID;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLPercepcionRetencionSunatDocumentReferenceBase.Payment")
+ @Data
+ @NoArgsConstructor
+ public static class Payment {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private Integer id;
+
+ @XmlElement(name = "PaidAmount", namespace = XMLConstants.CBC)
+ private BigDecimal paidAmount;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "PaidDate", namespace = XMLConstants.CBC)
+ private LocalDate paidDate;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionSunatDocumentReference.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionSunatDocumentReference.java
new file mode 100644
index 00000000..85743adf
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcionSunatDocumentReference.java
@@ -0,0 +1,73 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "XMLPercepcionSunatDocumentReference")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLPercepcionSunatDocumentReference extends XMLPercepcionRetencionSunatDocumentReferenceBase {
+
+ @XmlElement(name = "SUNATPerceptionInformation", namespace = XMLConstants.SAC)
+ private XMLPercepcionInformation sunatInformation;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLPercepcionSunatDocumentReference.XMLPercepcionInformation")
+ @Data
+ @NoArgsConstructor
+ public static class XMLPercepcionInformation {
+ @XmlElement(name = "SUNATPerceptionAmount", namespace = XMLConstants.SAC)
+ private BigDecimal sunatAmount;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "SUNATPerceptionDate", namespace = XMLConstants.SAC)
+ private LocalDate sunatDate;
+
+ @XmlElement(name = "SUNATNetTotalCashed", namespace = XMLConstants.SAC)
+ private BigDecimal sunatNetTotal;
+
+ @XmlElement(name = "ExchangeRate", namespace = XMLConstants.CAC)
+ private ExchangeRate exchangeRate;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLPercepcionSunatDocumentReference.ExchangeRate")
+ @Data
+ @NoArgsConstructor
+ public static class ExchangeRate {
+ @XmlElement(name = "CalculationRate", namespace = XMLConstants.CBC)
+ private BigDecimal calculationRate;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "Date", namespace = XMLConstants.CBC)
+ private LocalDate date;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetention.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetention.java
new file mode 100644
index 00000000..4628cc0b
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetention.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.content.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.math.BigDecimal;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "Retention", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:Retention-1")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLRetention extends XMLPercepcionRetencionBase {
+ @XmlElement(name = "SUNATRetentionSystemCode", namespace = XMLConstants.SAC)
+ private String sunatSystemCode;
+
+ @XmlElement(name = "SUNATRetentionPercent", namespace = XMLConstants.SAC)
+ private BigDecimal sunatPercent;
+
+ @XmlElement(name = "SUNATTotalPaid", namespace = XMLConstants.SAC)
+ private BigDecimal sunatTotal;
+
+ @XmlElement(name = "SUNATRetentionDocumentReference", namespace = XMLConstants.SAC)
+ private XMLRetentionSunatDocumentReference sunatDocumentReference;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetentionSunatDocumentReference.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetentionSunatDocumentReference.java
new file mode 100644
index 00000000..412eddef
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetentionSunatDocumentReference.java
@@ -0,0 +1,73 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "XMLRetentionSunatDocumentReference")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLRetentionSunatDocumentReference extends XMLPercepcionRetencionSunatDocumentReferenceBase {
+
+ @XmlElement(name = "SUNATRetentionInformation", namespace = XMLConstants.SAC)
+ private XMLRetentionInformation sunatInformation;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLRetentionSunatDocumentReference.XMLRetencionInformation")
+ @Data
+ @NoArgsConstructor
+ public static class XMLRetentionInformation {
+ @XmlElement(name = "SUNATRetentionAmount", namespace = XMLConstants.SAC)
+ private BigDecimal sunatAmount;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "SUNATRetentionDate", namespace = XMLConstants.SAC)
+ private LocalDate sunatDate;
+
+ @XmlElement(name = "SUNATNetTotalPaid", namespace = XMLConstants.SAC)
+ private BigDecimal sunatNetTotal;
+
+ @XmlElement(name = "ExchangeRate", namespace = XMLConstants.CAC)
+ private ExchangeRate exchangeRate;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "XMLRetentionSunatDocumentReference.ExchangeRate")
+ @Data
+ @NoArgsConstructor
+ public static class ExchangeRate {
+ @XmlElement(name = "CalculationRate", namespace = XMLConstants.CBC)
+ private BigDecimal calculationRate;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "Date", namespace = XMLConstants.CBC)
+ private LocalDate date;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSalesDocument.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSalesDocument.java
new file mode 100644
index 00000000..67a998a1
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSalesDocument.java
@@ -0,0 +1,360 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalTimeAdapter;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public abstract class XMLSalesDocument {
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String documentId;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "IssueDate", namespace = XMLConstants.CBC)
+ private LocalDate issueDate;
+
+ @XmlJavaTypeAdapter(LocalTimeAdapter.class)
+ @XmlElement(name = "IssueTime", namespace = XMLConstants.CBC)
+ private LocalTime issueTime;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "DueDate", namespace = XMLConstants.CBC)
+ private LocalDate dueDate;
+
+ @XmlElement(name = "InvoiceTypeCode", namespace = XMLConstants.CBC)
+ private InvoiceTypeCode invoiceTypeCode;
+
+ @XmlElement(name = "Note", namespace = XMLConstants.CBC)
+ private List notes;
+
+ @XmlElement(name = "DocumentCurrencyCode", namespace = XMLConstants.CBC)
+ private String documentCurrencyCode;
+
+ @XmlElement(name = "OrderReference", namespace = XMLConstants.CAC)
+ private OrderReference orderReference;
+
+ @XmlElement(name = "DespatchDocumentReference", namespace = XMLConstants.CAC)
+ private List despatchDocumentReferences;
+
+ @XmlElement(name = "AdditionalDocumentReference", namespace = XMLConstants.CAC)
+ private List additionalDocumentReferences;
+
+ @XmlElement(name = "Signature", namespace = XMLConstants.CAC)
+ private XMLSignature signature;
+
+ @XmlElement(name = "AccountingSupplierParty", namespace = XMLConstants.CAC)
+ private AccountingSupplierParty accountingSupplierParty;
+
+ @XmlElement(name = "AccountingCustomerParty", namespace = XMLConstants.CAC)
+ private AccountingCustomerParty accountingCustomerParty;
+
+ @XmlElement(name = "Delivery", namespace = XMLConstants.CAC)
+ private Delivery delivery;
+
+ @XmlElement(name = "PaymentMeans", namespace = XMLConstants.CAC)
+ private PaymentMeans paymentMeans;
+
+ @XmlElement(name = "PaymentTerms", namespace = XMLConstants.CAC)
+ private List paymentTerms;
+
+ @XmlElement(name = "PrepaidPayment", namespace = XMLConstants.CAC)
+ private List prepaidPayments;
+
+ @XmlElement(name = "AllowanceCharge", namespace = XMLConstants.CAC)
+ private List allowanceCharges;
+
+ @XmlElement(name = "TaxTotal", namespace = XMLConstants.CAC)
+ private TaxTotal taxTotal;
+
+ // Note
+ @XmlElement(name = "DiscrepancyResponse", namespace = XMLConstants.CAC)
+ private DiscrepancyResponse discrepancyResponse;
+
+ //
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.InvoiceTypeCode")
+ @Data
+ @NoArgsConstructor
+ public static class InvoiceTypeCode {
+ @XmlValue
+ private String value;
+
+ @XmlAttribute(name = "listID")
+ private String listID;
+ }
+
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.Note")
+ @Data
+ @NoArgsConstructor
+ public static class Note {
+ @XmlValue
+ private String value;
+
+ @XmlAttribute(name = "languageLocaleID")
+ private String languageLocaleId;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.OrderReference")
+ @Data
+ @NoArgsConstructor
+ public static class OrderReference {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.DespatchDocumentReference")
+ @Data
+ @NoArgsConstructor
+ public static class DespatchDocumentReference {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC)
+ private String documentTypeCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.AdditionalDocumentReference")
+ @Data
+ @NoArgsConstructor
+ public static class AdditionalDocumentReference {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC)
+ private String documentTypeCode;
+
+ @XmlElement(name = "DocumentStatusCode", namespace = XMLConstants.CBC)
+ private String documentStatusCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.AccountingSupplierParty")
+ @Data
+ @NoArgsConstructor
+ public static class AccountingSupplierParty {
+ @XmlElement(name = "Party", namespace = XMLConstants.CAC)
+ private XMLSupplier party;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.AccountingCustomerParty")
+ @Data
+ @NoArgsConstructor
+ public static class AccountingCustomerParty {
+ @XmlElement(name = "Party", namespace = XMLConstants.CAC)
+ private XMLCustomer party;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.Delivery")
+ @Data
+ @NoArgsConstructor
+ public static class Delivery {
+ @XmlElement(name = "DeliveryLocation", namespace = XMLConstants.CAC)
+ private DeliveryLocation deliveryLocation;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.DeliveryLocation")
+ @Data
+ @NoArgsConstructor
+ public static class DeliveryLocation {
+ @XmlElement(name = "Address", namespace = XMLConstants.CAC)
+ private XMLAddress address;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.PaymentMeans")
+ @Data
+ @NoArgsConstructor
+ public static class PaymentMeans {
+ @XmlElement(name = "PaymentMeansCode", namespace = XMLConstants.CBC)
+ private String paymentMeansCode;
+
+ @XmlElement(name = "PayeeFinancialAccount", namespace = XMLConstants.CAC)
+ private PayeeFinancialAccount payeeFinancialAccount;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.PayeeFinancialAccount")
+ @Data
+ @NoArgsConstructor
+ public static class PayeeFinancialAccount {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.PaymentTerms")
+ @Data
+ @NoArgsConstructor
+ public static class PaymentTerms {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "PaymentMeansID", namespace = XMLConstants.CBC)
+ private String paymentMeansID;
+
+ @XmlElement(name = "Amount", namespace = XMLConstants.CBC)
+ private BigDecimal amount;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "PaymentDueDate", namespace = XMLConstants.CBC)
+ private LocalDate paymentDueDate;
+
+ @XmlElement(name = "PaymentPercent", namespace = XMLConstants.CBC)
+ private BigDecimal paymentPercent;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.PrepaidPayment")
+ @Data
+ @NoArgsConstructor
+ public static class PrepaidPayment {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "PaidAmount", namespace = XMLConstants.CBC)
+ private BigDecimal paidAmount;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.AllowanceCharge")
+ @Data
+ @NoArgsConstructor
+ public static class AllowanceCharge {
+ @XmlElement(name = "ChargeIndicator", namespace = XMLConstants.CBC)
+ private Boolean chargeIndicator;
+
+ @XmlElement(name = "AllowanceChargeReasonCode", namespace = XMLConstants.CBC)
+ private String allowanceChargeReasonCode;
+
+ @XmlElement(name = "MultiplierFactorNumeric", namespace = XMLConstants.CBC)
+ private BigDecimal multiplierFactorNumeric;
+
+ @XmlElement(name = "Amount", namespace = XMLConstants.CBC)
+ private BigDecimal amount;
+
+ @XmlElement(name = "BaseAmount", namespace = XMLConstants.CBC)
+ private BigDecimal baseAmount;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.TaxTotal")
+ @Data
+ @NoArgsConstructor
+ public static class TaxTotal {
+ @XmlElement(name = "TaxAmount", namespace = XMLConstants.CBC)
+ BigDecimal taxAmount;
+
+ @XmlElement(name = "TaxSubtotal", namespace = XMLConstants.CAC)
+ List taxSubtotals;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.TaxSubtotal")
+ @Data
+ @NoArgsConstructor
+ public static class TaxSubtotal {
+ @XmlElement(name = "TaxableAmount", namespace = XMLConstants.CBC)
+ private BigDecimal taxableAmount;
+
+ @XmlElement(name = "TaxAmount", namespace = XMLConstants.CBC)
+ private BigDecimal taxAmount;
+
+ @XmlElement(name = "TaxCategory", namespace = XMLConstants.CAC)
+ private TaxCategory taxCategory;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.TaxCategory")
+ @Data
+ @NoArgsConstructor
+ public static class TaxCategory {
+ @XmlElement(name = "TaxScheme", namespace = XMLConstants.CAC)
+ private TaxScheme taxScheme;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.TaxScheme")
+ @Data
+ @NoArgsConstructor
+ public static class TaxScheme {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.MonetaryTotal")
+ @Data
+ @NoArgsConstructor
+ public static class MonetaryTotal {
+ @XmlElement(name = "LineExtensionAmount", namespace = XMLConstants.CBC)
+ private BigDecimal lineExtensionAmount;
+
+ @XmlElement(name = "TaxInclusiveAmount", namespace = XMLConstants.CBC)
+ private BigDecimal taxInclusiveAmount;
+
+ @XmlElement(name = "AllowanceTotalAmount", namespace = XMLConstants.CBC)
+ private BigDecimal allowanceTotalAmount;
+
+ @XmlElement(name = "PrepaidAmount", namespace = XMLConstants.CBC)
+ private BigDecimal prepaidAmount;
+
+ @XmlElement(name = "PayableAmount", namespace = XMLConstants.CBC)
+ private BigDecimal payableAmount;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocument.DiscrepancyResponse")
+ @Data
+ @NoArgsConstructor
+ public static class DiscrepancyResponse {
+ @XmlElement(name = "ReferenceID", namespace = XMLConstants.CBC)
+ private String referenceID;
+
+ @XmlElement(name = "ResponseCode", namespace = XMLConstants.CBC)
+ private String responseCode;
+
+ @XmlElement(name = "Description", namespace = XMLConstants.CBC)
+ private String description;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSalesDocumentLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSalesDocumentLine.java
new file mode 100644
index 00000000..a0930875
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSalesDocumentLine.java
@@ -0,0 +1,145 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import java.math.BigDecimal;
+import java.util.List;
+
+@XmlType(name = "SalesDocumentLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public class XMLSalesDocumentLine {
+
+ @XmlElement(name = "LineExtensionAmount", namespace = XMLConstants.CBC)
+ private BigDecimal lineExtensionAmount;
+
+ @XmlElement(name = "PricingReference", namespace = XMLConstants.CAC)
+ private PricingReference pricingReference;
+
+ @XmlElement(name = "TaxTotal", namespace = XMLConstants.CAC)
+ private TaxTotalLine taxTotal;
+
+ @XmlElement(name = "Item", namespace = XMLConstants.CAC)
+ private Item item;
+
+ @XmlElement(name = "Price", namespace = XMLConstants.CAC)
+ private Price price;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.PricingReference")
+ @Data
+ @NoArgsConstructor
+ public static class PricingReference {
+ @XmlElement(name = "AlternativeConditionPrice", namespace = XMLConstants.CAC)
+ private AlternativeConditionPrice alternativeConditionPrice;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.AlternativeConditionPrice")
+ @Data
+ @NoArgsConstructor
+ public static class AlternativeConditionPrice {
+ @XmlElement(name = "PriceAmount", namespace = XMLConstants.CBC)
+ private BigDecimal alternativeConditionPrice;
+
+ @XmlElement(name = "PriceTypeCode", namespace = XMLConstants.CBC)
+ private String priceTypeCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.TaxTotalLine")
+ @Data
+ @NoArgsConstructor
+ public static class TaxTotalLine {
+ @XmlElement(name = "TaxAmount", namespace = XMLConstants.CBC)
+ BigDecimal taxAmount;
+
+ @XmlElement(name = "TaxSubtotal", namespace = XMLConstants.CAC)
+ List taxSubtotals;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.TaxSubtotalLine")
+ @Data
+ @NoArgsConstructor
+ public static class TaxSubtotalLine {
+ @XmlElement(name = "TaxableAmount", namespace = XMLConstants.CBC)
+ private BigDecimal taxableAmount;
+
+ @XmlElement(name = "TaxAmount", namespace = XMLConstants.CBC)
+ private BigDecimal taxAmount;
+
+ @XmlElement(name = "TaxCategory", namespace = XMLConstants.CAC)
+ private TaxCategory taxCategory;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.TaxCategory")
+ @Data
+ @NoArgsConstructor
+ public static class TaxCategory {
+ @XmlElement(name = "Percent", namespace = XMLConstants.CBC)
+ private BigDecimal percent;
+
+ @XmlElement(name = "TierRange", namespace = XMLConstants.CBC)
+ private String tierRange;
+
+ @XmlElement(name = "PerUnitAmount", namespace = XMLConstants.CBC)
+ private BigDecimal perUnitAmount;
+
+ @XmlElement(name = "TaxExemptionReasonCode", namespace = XMLConstants.CBC)
+ private String taxExemptionReasonCode;
+
+ @XmlElement(name = "TaxScheme", namespace = XMLConstants.CAC)
+ private TaxScheme TaxScheme;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.TaxScheme")
+ @Data
+ @NoArgsConstructor
+ public static class TaxScheme {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.Item")
+ @Data
+ @NoArgsConstructor
+ public static class Item {
+ @XmlElement(name = "Description", namespace = XMLConstants.CBC)
+ private String description;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SalesDocumentLine.Price")
+ @Data
+ @NoArgsConstructor
+ public static class Price {
+ @XmlElement(name = "PriceAmount", namespace = XMLConstants.CBC)
+ private BigDecimal priceAmount;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSignature.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSignature.java
new file mode 100644
index 00000000..5535ce09
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSignature.java
@@ -0,0 +1,55 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Signature")
+@Data
+@NoArgsConstructor
+public class XMLSignature {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "SignatoryParty", namespace = XMLConstants.CAC)
+ private SignatoryParty signatoryParty;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "Signature.SignatoryParty")
+ @Data
+ @NoArgsConstructor
+ public static class SignatoryParty {
+ @XmlElement(name = "PartyName", namespace = XMLConstants.CAC)
+ private PartyName partyName;
+ }
+
+ @XmlType(name = "Signature.PartyName")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyName {
+ @XmlElement(name = "Name", namespace = XMLConstants.CBC)
+ private String name;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocuments.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocuments.java
new file mode 100644
index 00000000..8d93f596
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocuments.java
@@ -0,0 +1,39 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "SummaryDocuments", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:SummaryDocuments-1")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLSummaryDocuments extends XMLSunatDocument {
+
+ @XmlElement(name = "SummaryDocumentsLine", namespace = XMLConstants.SAC)
+ private List lines;
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocumentsLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocumentsLine.java
new file mode 100644
index 00000000..f1fca806
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocumentsLine.java
@@ -0,0 +1,180 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import java.math.BigDecimal;
+import java.util.List;
+
+@XmlType(name = "SummaryDocumentsLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public class XMLSummaryDocumentsLine {
+
+ @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC)
+ private String documentTypeCode;
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String documentId;
+
+ @XmlElement(name = "AccountingCustomerParty", namespace = XMLConstants.CAC)
+ private AccountingCustomerParty accountingCustomerParty;
+
+ @XmlElement(name = "BillingReference", namespace = XMLConstants.CAC)
+ private BillingReference billingReference;
+
+ @XmlElement(name = "Status", namespace = XMLConstants.CAC)
+ private Status status;
+
+ @XmlElement(name = "TotalAmount", namespace = XMLConstants.SAC)
+ private TotalAmount totalAmount;
+
+ @XmlElement(name = "BillingPayment", namespace = XMLConstants.SAC)
+ private List billingPayments;
+
+ @XmlElement(name = "AllowanceCharge", namespace = XMLConstants.CAC)
+ private AllowanceCharge allowanceCharge;
+
+ @XmlElement(name = "TaxTotal", namespace = XMLConstants.CAC)
+ private List taxTotals;
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.AccountingCustomerParty")
+ @Data
+ @NoArgsConstructor
+ public static class AccountingCustomerParty {
+ @XmlElement(name = "CustomerAssignedAccountID", namespace = XMLConstants.CBC)
+ private String customerAssignedAccountID;
+
+ @XmlElement(name = "AdditionalAccountID", namespace = XMLConstants.CBC)
+ private String additionalAccountID;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.Status")
+ @Data
+ @NoArgsConstructor
+ public static class Status {
+ @XmlElement(name = "ConditionCode", namespace = XMLConstants.CBC)
+ private String conditionCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.TotalAmount")
+ @Data
+ @NoArgsConstructor
+ public static class TotalAmount {
+ @XmlValue
+ private BigDecimal value;
+
+ @XmlAttribute(name = "currencyID")
+ private String currencyID;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.AllowanceCharge")
+ @Data
+ @NoArgsConstructor
+ public static class AllowanceCharge {
+ @XmlElement(name = "Amount", namespace = XMLConstants.CBC)
+ private BigDecimal value;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.BillingPayment")
+ @Data
+ @NoArgsConstructor
+ public static class BillingPayment {
+ @XmlElement(name = "PaidAmount", namespace = XMLConstants.CBC)
+ BigDecimal paidAmount;
+
+ @XmlElement(name = "InstructionID", namespace = XMLConstants.CBC)
+ String instructionId;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.BillingReference")
+ @Data
+ @NoArgsConstructor
+ public static class BillingReference {
+ @XmlElement(name = "InvoiceDocumentReference", namespace = XMLConstants.CAC)
+ private InvoiceDocumentReference invoiceDocumentReference;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.InvoiceDocumentReference")
+ @Data
+ @NoArgsConstructor
+ public static class InvoiceDocumentReference {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+
+ @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC)
+ private String documentTypeCode;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.TaxTotalSummaryDocuments")
+ @Data
+ @NoArgsConstructor
+ public static class TaxTotal {
+ @XmlElement(name = "TaxAmount", namespace = XMLConstants.CBC)
+ BigDecimal taxAmount;
+
+ @XmlElement(name = "TaxSubtotal", namespace = XMLConstants.CAC)
+ TaxSubtotal taxSubtotals;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.TaxSubtotalTaxTotalSummaryDocuments")
+ @Data
+ @NoArgsConstructor
+ public static class TaxSubtotal {
+ @XmlElement(name = "TaxAmount", namespace = XMLConstants.CBC)
+ private BigDecimal taxAmount;
+
+ @XmlElement(name = "TaxCategory", namespace = XMLConstants.CAC)
+ private TaxCategory taxCategory;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.TaxCategory")
+ @Data
+ @NoArgsConstructor
+ public static class TaxCategory {
+ @XmlElement(name = "TaxScheme", namespace = XMLConstants.CAC)
+ private TaxScheme taxScheme;
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "SummaryDocumentsLine.TaxScheme")
+ @Data
+ @NoArgsConstructor
+ public static class TaxScheme {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSunatDocument.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSunatDocument.java
new file mode 100644
index 00000000..4eec3327
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSunatDocument.java
@@ -0,0 +1,51 @@
+/*
+ * 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.jaxb.models;
+
+import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.time.LocalDate;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public abstract class XMLSunatDocument {
+
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String documentId;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "ReferenceDate", namespace = XMLConstants.CBC)
+ private LocalDate referenceDate;
+
+ @XmlJavaTypeAdapter(LocalDateAdapter.class)
+ @XmlElement(name = "IssueDate", namespace = XMLConstants.CBC)
+ private LocalDate issueDate;
+
+ @XmlElement(name = "Signature", namespace = XMLConstants.CAC)
+ private XMLSignature signature;
+
+ @XmlElement(name = "AccountingSupplierParty", namespace = XMLConstants.CAC)
+ private XMLSupplierSunat accountingSupplierParty;
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSupplier.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSupplier.java
new file mode 100644
index 00000000..a7b7d26c
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSupplier.java
@@ -0,0 +1,74 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Supplier.Party")
+@Data
+@NoArgsConstructor
+public class XMLSupplier {
+
+ @XmlElement(name = "PartyIdentification", namespace = XMLConstants.CAC)
+ private PartyIdentification partyIdentification;
+
+ @XmlElement(name = "PartyName", namespace = XMLConstants.CAC)
+ private PartyName partyName;
+
+ @XmlElement(name = "PartyLegalEntity", namespace = XMLConstants.CAC)
+ private PartyLegalEntity partyLegalEntity;
+
+ @XmlElement(name = "Contact", namespace = XMLConstants.CAC)
+ private XMLContact contact;
+
+ @XmlType(name = "Supplier.PartyIdentification")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyIdentification {
+ @XmlElement(name = "ID", namespace = XMLConstants.CBC)
+ private String id;
+ }
+
+ @XmlType(name = "Supplier.PartyName")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyName {
+ @XmlElement(name = "Name", namespace = XMLConstants.CBC)
+ private String name;
+ }
+
+ @XmlType(name = "Supplier.PartyLegalEntity")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyLegalEntity {
+ @XmlElement(name = "RegistrationName", namespace = XMLConstants.CBC)
+ private String registrationName;
+
+ @XmlElement(name = "RegistrationAddress", namespace = XMLConstants.CAC)
+ private XMLAddress address;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSupplierSunat.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSupplierSunat.java
new file mode 100644
index 00000000..3a811399
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSupplierSunat.java
@@ -0,0 +1,74 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "SupplierSunat")
+@Data
+@NoArgsConstructor
+public class XMLSupplierSunat {
+
+ @XmlElement(name = "CustomerAssignedAccountID", namespace = XMLConstants.CBC)
+ private String customerAssignedAccountID;
+
+ @XmlElement(name = "PartyName", namespace = XMLConstants.CAC)
+ private PartyName partyName;
+
+ @XmlElement(name = "Party", namespace = XMLConstants.CAC)
+ private Party party;
+
+ @XmlElement(name = "Contact", namespace = XMLConstants.CAC)
+ private XMLContact contact;
+
+ @XmlType(name = "SupplierSunat.PartyName")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyName {
+ @XmlElement(name = "Name", namespace = XMLConstants.CBC)
+ private String name;
+ }
+
+ @XmlType(name = "SupplierSunat.Party")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class Party {
+ @XmlElement(name = "PartyLegalEntity", namespace = XMLConstants.CAC)
+ private PartyLegalEntity partyLegalEntity;
+ }
+
+ @XmlType(name = "SupplierSunat.PartyLegalEntity")
+ @XmlAccessorType(XmlAccessType.NONE)
+ @Data
+ @NoArgsConstructor
+ public static class PartyLegalEntity {
+ @XmlElement(name = "RegistrationName", namespace = XMLConstants.CBC)
+ private String registrationName;
+
+ @XmlElement(name = "RegistrationAddress", namespace = XMLConstants.CAC)
+ private XMLAddress address;
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocuments.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocuments.java
new file mode 100644
index 00000000..3bb9b8c1
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocuments.java
@@ -0,0 +1,39 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = "VoidedDocuments", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:VoidedDocuments-1")
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+public class XMLVoidedDocuments extends XMLSunatDocument {
+
+ @XmlElement(name = "VoidedDocumentsLine", namespace = XMLConstants.SAC)
+ private List lines;
+
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocumentsLine.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocumentsLine.java
new file mode 100644
index 00000000..2af33ff5
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocumentsLine.java
@@ -0,0 +1,44 @@
+/*
+ * 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.jaxb.models;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "VoidedDocumentsLine")
+@XmlAccessorType(XmlAccessType.NONE)
+@Data
+@NoArgsConstructor
+public class XMLVoidedDocumentsLine {
+
+ @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC)
+ private String documentTypeCode;
+
+ @XmlElement(name = "DocumentSerialID", namespace = XMLConstants.SAC)
+ private String documentSerialID;
+
+ @XmlElement(name = "DocumentNumberID", namespace = XMLConstants.SAC)
+ private Integer documentNumberID;
+
+ @XmlElement(name = "VoidReasonDescription", namespace = XMLConstants.SAC)
+ private String voidReasonDescription;
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/package-info.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/package-info.java
new file mode 100644
index 00000000..c7e5f8b0
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/package-info.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+@XmlSchema(
+ xmlns = {
+ @XmlNs(prefix = "cbc", namespaceURI = XMLConstants.CBC),
+ @XmlNs(prefix = "cac", namespaceURI = XMLConstants.CAC),
+ @XmlNs(prefix = "sac", namespaceURI = XMLConstants.SAC),
+ @XmlNs(prefix = "ext", namespaceURI = XMLConstants.EXT)
+ },
+ elementFormDefault = XmlNsForm.QUALIFIED
+)
+package io.github.project.openubl.xbuilder.content.jaxb.models;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
\ No newline at end of file
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Document.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Document.java
index d6c5241b..b096c4aa 100644
--- a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Document.java
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Document.java
@@ -49,9 +49,7 @@ public abstract class Document {
/**
* Persona que firma electrónicamente el comprobante. Si es NULL los datos del proveedor son usados.
*/
- @Schema(
- description = "Persona que firma electrónicamente el comprobante. Si NULL los datos del proveedor son usados."
- )
+ @Schema(description = "Persona que firma el comprobante. Si NULL los datos del proveedor son usados.")
private Firmante firmante;
}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoVentaDetalle.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoVentaDetalle.java
index 944af794..c9128614 100644
--- a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoVentaDetalle.java
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoVentaDetalle.java
@@ -63,6 +63,9 @@ public class DocumentoVentaDetalle {
@Schema(description = "Catalogo 07")
private String igvTipo;
+ @Schema(minimum = "0")
+ private BigDecimal tasaIcb;
+
@Schema(minimum = "0")
private BigDecimal icb;
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 50e67b9d..a2c82a66 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
@@ -67,9 +67,6 @@ public class Invoice extends SalesDocument {
@Singular
private List anticipos;
- @Singular
- private List otrosDocumentosTributariosRelacionados;
-
@Singular
private List descuentos;
}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/SunatDocument.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/SunatDocument.java
index c7c65b59..6606dcc3 100644
--- a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/SunatDocument.java
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/SunatDocument.java
@@ -17,8 +17,6 @@
package io.github.project.openubl.xbuilder.content.models.sunat;
import io.github.project.openubl.xbuilder.content.models.common.Document;
-import io.github.project.openubl.xbuilder.content.models.common.Firmante;
-import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -41,17 +39,9 @@ public class SunatDocument extends Document {
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "1", maximum = "99999999")
private Integer numero;
- /**
- * Fecha de emisión del comprobante. Ejemplo 2022-12-25 (YYYY-MM-SS)
- */
- @Schema(description = "Format: \"YYYY-MM-SS\". Ejemplo: 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$")
- private LocalDate fechaEmision;
-
/**
* Fecha de emisión de los comprobantes dados de baja. Ejemplo 2022-12-25 (YYYY-MM-SS)
*/
@Schema(description = "Format: \"YYYY-MM-SS\". Ejemplo: 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$")
private LocalDate fechaEmisionComprobantes;
- private Firmante firmante;
- private Proveedor proveedor;
}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java
index 8909a5e8..ccceb930 100644
--- a/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java
@@ -29,6 +29,9 @@
@AllArgsConstructor
public class Comprobante {
+ @Schema(requiredMode = Schema.RequiredMode.AUTO, description = "Moneda del comprobante declarado")
+ private String moneda;
+
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalogo 01")
private String tipoComprobante;
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 ace33234..1ba1a9f1 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
@@ -34,7 +34,6 @@
import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.HeaderRuleContext;
import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.HeaderRuleUnit;
-import java.time.LocalDate;
import java.util.stream.Stream;
public class ContentEnricher {
@@ -60,6 +59,7 @@ public void enrich(Invoice input) {
// Body
BodyRuleContext ruleContextBody = BodyRuleContext.builder()
+ .moneda(input.getMoneda())
.tasaIgv(input.getTasaIgv())
.tasaIvap(input.getTasaIvap())
.tasaIcb(input.getTasaIcb())
@@ -93,6 +93,7 @@ private void enrichNote(Note input) {
// Body
BodyRuleContext ruleContextBody = BodyRuleContext.builder()
+ .moneda(input.getMoneda())
.tasaIgv(input.getTasaIgv())
.tasaIcb(input.getTasaIcb())
.build();
@@ -114,6 +115,7 @@ public void enrich(VoidedDocuments input) {
// Body
BodyRuleContext ruleContextBody = BodyRuleContext.builder()
+ .moneda(input.getMoneda())
.build();
RuleUnit ruleUnitBody = new BodyRuleUnit(phaseType, defaults, ruleContextBody);
@@ -134,6 +136,7 @@ public void enrich(SummaryDocuments input) {
// Body
BodyRuleContext ruleContextBody = BodyRuleContext.builder()
+ .moneda(input.getMoneda())
.build();
RuleUnit ruleUnitBody = new BodyRuleUnit(phaseType, defaults, ruleContextBody);
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java
index abf22eca..d87e9ea2 100644
--- a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java
@@ -35,10 +35,6 @@ public Rule create(Defaults defaults, RuleContext ruleContext) {
return this;
}
- public Defaults getDefaults() {
- return defaults;
- }
-
public BodyRuleContext getRuleContext() {
return ruleContext;
}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/TasaIcbRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/TasaIcbRule.java
new file mode 100644
index 00000000..62f69bb9
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/TasaIcbRule.java
@@ -0,0 +1,48 @@
+/*
+ * 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.detalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
+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.isSalesDocumentItem;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TasaIcbRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object)
+ .map(documento -> documento.getTasaIcb() == null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ BigDecimal tasaIcb = getRuleContext().getTasaIcb();
+ detalle.setTasaIcb(tasaIcb);
+ };
+ whenSalesDocumentItem.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/summaryDocumentItem/MonedaRule.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/summaryDocumentItem/MonedaRule.java
new file mode 100644
index 00000000..3c543bb4
--- /dev/null
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/summaryDocumentItem/MonedaRule.java
@@ -0,0 +1,49 @@
+/*
+ * 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.summaryDocumentItem;
+
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocumentsItem;
+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.isSummaryDocumentsItem;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSummaryDocumentsItem;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class MonedaRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (isSummaryDocumentsItem.test(object) && whenSummaryDocumentsItem.apply(object)
+ .map(item -> item.getComprobante() != null &&
+ item.getComprobante().getMoneda() == null
+ )
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = item -> {
+ String moneda = getRuleContext().getMoneda();
+ item.getComprobante().setMoneda(moneda);
+ };
+ whenSummaryDocumentsItem.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java
index af875a95..35bba6e7 100644
--- a/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java
+++ b/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java
@@ -26,6 +26,7 @@
@Builder
public class BodyRuleContext implements RuleContext {
+ private String moneda;
private BigDecimal tasaIgv;
private BigDecimal tasaIvap;
private BigDecimal tasaIcb;
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 d9a49edc..4932d66b 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
@@ -44,6 +44,7 @@ io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.Unidad
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.IgvTipoRule
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.IscTipoRule
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.PrecioDeReferenciaTipoRule
+io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.TasaIcbRule
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.TasaIgvRule
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.TasaIscRule
@@ -56,6 +57,13 @@ io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento.Tipo
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento.FactorRule
io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento.MontoBaseRule
+## Enrich - VoidedDocuments
+io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.voidedDocumentItem.TipoComprobanteRule
+
+## Enrich - SummaryDocuments
+io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.summaryDocumentItem.TipoOperacionRule
+io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.summaryDocumentItem.MonedaRule
+
## 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
@@ -66,9 +74,3 @@ io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IgvRu
io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IscBaseImponibleRule
io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IscRule
io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.TotalImpuestosRule
-
-# VoidedDocuments
-io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.voidedDocumentItem.TipoComprobanteRule
-
-# SummaryDocuments
-io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.summaryDocumentItem.TipoOperacionRule
\ No newline at end of file
diff --git a/core/src/main/resources/templates/Renderer/despatchAdvice.xml b/core/src/main/resources/templates/Renderer/despatchAdvice.xml
index 3ec0fc50..3d220ca4 100644
--- a/core/src/main/resources/templates/Renderer/despatchAdvice.xml
+++ b/core/src/main/resources/templates/Renderer/despatchAdvice.xml
@@ -106,8 +106,8 @@
{/if}
- {envio.partida.ubigeo }}
- {envio.partida.direccion }}
+ {envio.partida.ubigeo}
+ {envio.partida.direccion}
{#if envio.codigoDePuerto}
diff --git a/core/src/main/resources/templates/Renderer/invoice.xml b/core/src/main/resources/templates/Renderer/invoice.xml
index 005399f1..fa3ac8d4 100644
--- a/core/src/main/resources/templates/Renderer/invoice.xml
+++ b/core/src/main/resources/templates/Renderer/invoice.xml
@@ -8,9 +8,11 @@
{fechaVencimiento}
{/if}
{tipoComprobante}
+ {#if leyendas}
{#for key in leyendas.keySet}
{/for}
+ {/if}
{#if observaciones}
{/if}
diff --git a/core/src/main/resources/templates/Renderer/summaryDocuments.xml b/core/src/main/resources/templates/Renderer/summaryDocuments.xml
index cb768818..b2eda8cf 100644
--- a/core/src/main/resources/templates/Renderer/summaryDocuments.xml
+++ b/core/src/main/resources/templates/Renderer/summaryDocuments.xml
@@ -41,42 +41,42 @@
{it.tipoOperacion}
- {it.comprobante.valorVenta.importeTotal}
+ {it.comprobante.valorVenta.importeTotal}
{#if it.comprobante.valorVenta.gravado}
- {it.comprobante.valorVenta.gravado}
+ {it.comprobante.valorVenta.gravado}
01
{/if}
{#if it.comprobante.valorVenta.exonerado}
- {it.comprobante.valorVenta.exonerado}
+ {it.comprobante.valorVenta.exonerado}
02
{/if}
{#if it.comprobante.valorVenta.inafecto}
- {it.comprobante.valorVenta.inafecto}
+ {it.comprobante.valorVenta.inafecto}
03
{/if}
{#if it.comprobante.valorVenta.gratuito}
- {it.comprobante.valorVenta.gratuito}
+ {it.comprobante.valorVenta.gratuito}
05
{/if}
{#if it.comprobante.valorVenta.otrosCargos}
true
- {it.comprobante.valorVenta.otrosCargos}
+ {it.comprobante.valorVenta.otrosCargos}
{/if}
{#if it.comprobante.impuestos.igv}
- {it.comprobante.impuestos.igv}
+ {it.comprobante.impuestos.igv}
- {it.comprobante.impuestos.igv}
+ {it.comprobante.impuestos.igv}
1000
@@ -89,9 +89,9 @@
{/if}
{#if it.comprobante.impuestos.icb}
- {it.comprobante.impuestos.icb}
+ {it.comprobante.impuestos.icb}
- {it.comprobante.impuestos.icb}
+ {it.comprobante.impuestos.icb}
7152
diff --git a/core/src/main/resources/templates/ubl/standard/include/document-line.xml b/core/src/main/resources/templates/ubl/standard/include/document-line.xml
index 479e8d4b..762dafc4 100644
--- a/core/src/main/resources/templates/ubl/standard/include/document-line.xml
+++ b/core/src/main/resources/templates/ubl/standard/include/document-line.xml
@@ -45,7 +45,7 @@
{item.icb.scale(2)}
{item.cantidad}
- {tasaIcb.scale(2)}
+ {item.tasaIcb.scale(2)}
7152
ICBPER
diff --git a/core/src/test/java/e2e/AbstractTest.java b/core/src/test/java/e2e/AbstractTest.java
index 743fd2bf..50446d6c 100644
--- a/core/src/test/java/e2e/AbstractTest.java
+++ b/core/src/test/java/e2e/AbstractTest.java
@@ -16,21 +16,67 @@
*/
package e2e;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
+import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import e2e.renderer.XMLAssertUtils;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.CreditNoteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.DebitNoteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.DespatchAdviceMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.InvoiceMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.PerceptionMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.RetentionMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.SummaryDocumentsMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.VoidedDocumentsMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNote;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNote;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocuments;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoice;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcion;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetention;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocuments;
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.Invoice;
+import io.github.project.openubl.xbuilder.content.models.standard.guia.DespatchAdvice;
+import io.github.project.openubl.xbuilder.content.models.sunat.baja.VoidedDocuments;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.Perception;
+import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.Retention;
+import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocuments;
import io.github.project.openubl.xbuilder.enricher.ContentEnricher;
import io.github.project.openubl.xbuilder.enricher.config.DateProvider;
import io.github.project.openubl.xbuilder.enricher.config.Defaults;
import io.github.project.openubl.xbuilder.renderer.TemplateProducer;
import io.quarkus.qute.Template;
+import org.mapstruct.factory.Mappers;
+import org.xml.sax.InputSource;
+import javax.xml.bind.JAXBContext;
+import java.io.IOException;
+import java.io.StringReader;
import java.math.BigDecimal;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.time.LocalDate;
+import java.util.Map;
public class AbstractTest {
+ private static final InvoiceMapper invoiceMapper = Mappers.getMapper(InvoiceMapper.class);
+ private static final CreditNoteMapper creditNoteMapper = Mappers.getMapper(CreditNoteMapper.class);
+ private static final DebitNoteMapper debitNoteMapper = Mappers.getMapper(DebitNoteMapper.class);
+ private static final VoidedDocumentsMapper voidedDocumentsMapper = Mappers.getMapper(VoidedDocumentsMapper.class);
+ private static final SummaryDocumentsMapper summaryDocumentsMapper = Mappers.getMapper(SummaryDocumentsMapper.class);
+ private static final PerceptionMapper perceptionMapper = Mappers.getMapper(PerceptionMapper.class);
+ private static final RetentionMapper retentionMapper = Mappers.getMapper(RetentionMapper.class);
+ private static final DespatchAdviceMapper despatchAdviceMapper = Mappers.getMapper(DespatchAdviceMapper.class);
+
protected static final Defaults defaults = Defaults.builder()
.icbTasa(new BigDecimal("0.2"))
.igvTasa(new BigDecimal("0.18"))
@@ -39,7 +85,32 @@ public class AbstractTest {
protected static final DateProvider dateProvider = () -> LocalDate.of(2019, 12, 24);
- protected void assertInput(Invoice input, String snapshot) throws Exception {
+ public YAMLMapper getYamlMapper() {
+ YAMLMapper mapper = new YAMLMapper(new YAMLFactory());
+ mapper.registerModule(new JavaTimeModule());
+ mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ mapper.configure(YAMLGenerator.Feature.LITERAL_BLOCK_STYLE, true);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper;
+ }
+
+ public void writeYaml(String kind, Object input, String snapshotFilename) throws URISyntaxException, IOException {
+ String rootDir = getClass().getName().replaceAll("\\.", "/");
+
+ String snapshotFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource(rootDir + "/" + snapshotFilename).toURI()));
+
+ Path directoryPath = Paths.get("../quarkus-extension/integration-tests/src/test/resources").resolve(rootDir);
+ Files.createDirectories(directoryPath);
+ Path filePath = directoryPath.resolve(snapshotFilename.replaceAll(".xml", "") + ".yaml");
+
+ getYamlMapper().writeValue(filePath.toFile(), Map.of(
+ "kind", kind,
+ "input", input,
+ "snapshot", snapshotFileContent
+ ));
+ }
+
+ protected void assertInput(Invoice input, String snapshotFilename) throws Exception {
ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
enricher.enrich(input);
@@ -47,12 +118,23 @@ protected void assertInput(Invoice input, String snapshot) throws Exception {
Template template = TemplateProducer.getInstance().getInvoice();
String xml = template.data(input).render();
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLInvoice xmlPojo = (XMLInvoice) JAXBContext.newInstance(XMLInvoice.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ Invoice inputFromXml = invoiceMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
// Then
- XMLAssertUtils.assertSnapshot(xml, getClass(), snapshot);
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+
+ writeYaml("Invoice", input, snapshotFilename);
}
- protected void assertInput(CreditNote input, String snapshot) throws Exception {
+ protected void assertInput(CreditNote input, String snapshotFilename) throws Exception {
ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
enricher.enrich(input);
@@ -60,12 +142,23 @@ protected void assertInput(CreditNote input, String snapshot) throws Exception {
Template template = TemplateProducer.getInstance().getCreditNote();
String xml = template.data(input).render();
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLCreditNote xmlPojo = (XMLCreditNote) JAXBContext.newInstance(XMLCreditNote.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ CreditNote inputFromXml = creditNoteMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
// Then
- XMLAssertUtils.assertSnapshot(xml, getClass(), snapshot);
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.CREDIT_NOTE_XSD);
+
+ writeYaml("CreditNote", input, snapshotFilename);
}
- protected void assertInput(DebitNote input, String snapshot) throws Exception {
+ protected void assertInput(DebitNote input, String snapshotFilename) throws Exception {
ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
enricher.enrich(input);
@@ -73,8 +166,139 @@ protected void assertInput(DebitNote input, String snapshot) throws Exception {
Template template = TemplateProducer.getInstance().getDebitNote();
String xml = template.data(input).render();
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLDebitNote xmlPojo = (XMLDebitNote) JAXBContext.newInstance(XMLDebitNote.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ DebitNote inputFromXml = debitNoteMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
// Then
- XMLAssertUtils.assertSnapshot(xml, getClass(), snapshot);
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.DEBIT_NOTE_XSD);
+
+ writeYaml("DebitNote", input, snapshotFilename);
+ }
+
+ protected void assertInput(VoidedDocuments input, String snapshotFilename) throws Exception {
+ ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
+ enricher.enrich(input);
+
+ // When
+ Template template = TemplateProducer.getInstance().getVoidedDocument();
+ String xml = template.data(input).render();
+
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLVoidedDocuments xmlPojo = (XMLVoidedDocuments) JAXBContext.newInstance(XMLVoidedDocuments.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ VoidedDocuments inputFromXml = voidedDocumentsMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
+ // Then
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
+ XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.VOIDED_DOCUMENTS_XSD);
+
+ writeYaml("VoidedDocuments", input, snapshotFilename);
+ }
+
+ protected void assertInput(SummaryDocuments input, String snapshotFilename) throws Exception {
+ ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
+ enricher.enrich(input);
+
+ // When
+ Template template = TemplateProducer.getInstance().getSummaryDocuments();
+ String xml = template.data(input).render();
+
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLSummaryDocuments xmlPojo = (XMLSummaryDocuments) JAXBContext.newInstance(XMLSummaryDocuments.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ SummaryDocuments inputFromXml = summaryDocumentsMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
+ // Then
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
+ XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.SUMMARY_DOCUMENTS_XSD);
+
+ writeYaml("SummaryDocuments", input, snapshotFilename);
+ }
+
+ protected void assertInput(Perception input, String snapshotFilename) throws Exception {
+ ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
+ enricher.enrich(input);
+
+ // When
+ Template template = TemplateProducer.getInstance().getPerception();
+ String xml = template.data(input).render();
+
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLPercepcion xmlPojo = (XMLPercepcion) JAXBContext.newInstance(XMLPercepcion.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ Perception inputFromXml = perceptionMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
+ // Then
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
+ XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.PERCEPTION_XSD);
+
+ writeYaml("Perception", input, snapshotFilename);
+ }
+
+ protected void assertInput(Retention input, String snapshotFilename) throws Exception {
+ ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
+ enricher.enrich(input);
+
+ // When
+ Template template = TemplateProducer.getInstance().getRetention();
+ String xml = template.data(input).render();
+
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLRetention xmlPojo = (XMLRetention) JAXBContext.newInstance(XMLRetention.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ Retention inputFromXml = retentionMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
+ // Then
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
+ XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.RETENTION_XSD);
+
+ writeYaml("Retention", input, snapshotFilename);
+ }
+
+ protected void assertInput(DespatchAdvice input, String snapshotFilename) throws Exception {
+ ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
+ enricher.enrich(input);
+
+ // When
+ Template template = TemplateProducer.getInstance().getDespatchAdvice();
+ String xml = template.data(input).render();
+
+ String reconstructedXml;
+ try (StringReader reader = new StringReader(xml);) {
+ XMLDespatchAdvice xmlPojo = (XMLDespatchAdvice) JAXBContext.newInstance(XMLDespatchAdvice.class)
+ .createUnmarshaller()
+ .unmarshal(new InputSource(reader));
+ DespatchAdvice inputFromXml = despatchAdviceMapper.map(xmlPojo);
+ reconstructedXml = template.data(inputFromXml).render();
+ }
+
+ // Then
+ XMLAssertUtils.assertSnapshot(xml, reconstructedXml, getClass(), snapshotFilename);
+ XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.DESPATCH_ADVICE_XSD);
+
+ writeYaml("DespatchAdvice", input, snapshotFilename);
}
}
diff --git a/core/src/test/java/e2e/renderer/XMLAssertUtils.java b/core/src/test/java/e2e/renderer/XMLAssertUtils.java
index 2ed9e696..87f771df 100644
--- a/core/src/test/java/e2e/renderer/XMLAssertUtils.java
+++ b/core/src/test/java/e2e/renderer/XMLAssertUtils.java
@@ -98,7 +98,7 @@ public class XMLAssertUtils {
}
}
- public static void assertSnapshot(String expected, Class> clasz, String snapshotFile) throws SAXException {
+ private static void assertSnapshot(String expected, Class> clasz, String snapshotFile) throws SAXException {
String rootDir = clasz.getName().replaceAll("\\.", "/");
// Update snapshots and if updated do not verify since it doesn't make sense anymore
@@ -133,6 +133,11 @@ public static void assertSnapshot(String expected, Class> clasz, String snapsh
assertFalse(myDiff.hasDifferences(), expected + "\n" + myDiff);
}
+ public static void assertSnapshot(String expected, String expectedReverse, Class> clasz, String snapshotFile) throws SAXException {
+ assertSnapshot(expected, clasz, snapshotFile);
+ assertSnapshot(expectedReverse, clasz, snapshotFile);
+ }
+
public static void assertSendSunat(String xmlWithoutSignature, String xsdSchema, String... allowedNotes) throws Exception {
String skipSunat = System.getProperty("skipSunat", "false");
if (skipSunat != null && skipSunat.equals("false")) {
diff --git a/core/src/test/java/e2e/renderer/creditnote/CreditNoteIscTest.java b/core/src/test/java/e2e/renderer/creditnote/CreditNoteIscTest.java
index 6ba5ea9a..54d3713e 100644
--- a/core/src/test/java/e2e/renderer/creditnote/CreditNoteIscTest.java
+++ b/core/src/test/java/e2e/renderer/creditnote/CreditNoteIscTest.java
@@ -17,23 +17,16 @@
package e2e.renderer.creditnote;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog8;
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.CreditNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
-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;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class CreditNoteIscTest extends AbstractTest {
@Test
@@ -71,16 +64,7 @@ public void testIsc_sistemaAlValor() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getCreditNote();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "isc_sistemaAlValor.xml");
- assertSendSunat(xml, XMLAssertUtils.CREDIT_NOTE_XSD);
+ assertInput(input, "isc_sistemaAlValor.xml");
}
@Test
@@ -118,16 +102,7 @@ public void testIsc_aplicacionAlMontoFijo() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getCreditNote();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "isc_aplicacionAlMontoFijo.xml");
- assertSendSunat(xml, XMLAssertUtils.CREDIT_NOTE_XSD);
+ assertInput(input, "isc_aplicacionAlMontoFijo.xml");
}
@Test
@@ -165,15 +140,6 @@ public void testIsc_sistemaDePreciosDeVentalAlPublico() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getCreditNote();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "isc_sistemaDePreciosDeVentalAlPublico.xml");
- assertSendSunat(xml, XMLAssertUtils.CREDIT_NOTE_XSD);
+ assertInput(input, "isc_sistemaDePreciosDeVentalAlPublico.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/creditnote/CreditNoteOrdenDeCompraTest.java b/core/src/test/java/e2e/renderer/creditnote/CreditNoteOrdenDeCompraTest.java
index 21189a28..50c7b3d4 100644
--- a/core/src/test/java/e2e/renderer/creditnote/CreditNoteOrdenDeCompraTest.java
+++ b/core/src/test/java/e2e/renderer/creditnote/CreditNoteOrdenDeCompraTest.java
@@ -17,22 +17,15 @@
package e2e.renderer.creditnote;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.CreditNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
-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;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class CreditNoteOrdenDeCompraTest extends AbstractTest {
@Test
@@ -69,15 +62,6 @@ public void testInvoiceWithCustomUnidadMedida() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getCreditNote();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "ordenDeCompra.xml");
- assertSendSunat(xml, XMLAssertUtils.CREDIT_NOTE_XSD);
+ assertInput(input, "ordenDeCompra.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/creditnote/CreditNoteTest.java b/core/src/test/java/e2e/renderer/creditnote/CreditNoteTest.java
index 36ad4fe4..69f627a4 100644
--- a/core/src/test/java/e2e/renderer/creditnote/CreditNoteTest.java
+++ b/core/src/test/java/e2e/renderer/creditnote/CreditNoteTest.java
@@ -17,22 +17,15 @@
package e2e.renderer.creditnote;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.CreditNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
-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;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class CreditNoteTest extends AbstractTest {
@Test
@@ -68,15 +61,6 @@ public void testInvoiceWithCustomUnidadMedida() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getCreditNote();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "MinData_RUC.xml");
- assertSendSunat(xml, XMLAssertUtils.CREDIT_NOTE_XSD);
+ assertInput(input, "MinData_RUC.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/debitnote/DebitNoteTest.java b/core/src/test/java/e2e/renderer/debitnote/DebitNoteTest.java
index b5bcd326..b4487913 100644
--- a/core/src/test/java/e2e/renderer/debitnote/DebitNoteTest.java
+++ b/core/src/test/java/e2e/renderer/debitnote/DebitNoteTest.java
@@ -17,22 +17,15 @@
package e2e.renderer.debitnote;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.DebitNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
-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;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class DebitNoteTest extends AbstractTest {
@Test
@@ -68,15 +61,6 @@ public void testInvoiceWithCustomUnidadMedida() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getDebitNote();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "MinData_RUC.xml");
- assertSendSunat(xml, XMLAssertUtils.DEBIT_NOTE_XSD);
+ assertInput(input, "MinData_RUC.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/despatchadvice/DespatchAdviceTest.java b/core/src/test/java/e2e/renderer/despatchadvice/DespatchAdviceTest.java
index 083bd92b..97f4f870 100644
--- a/core/src/test/java/e2e/renderer/despatchadvice/DespatchAdviceTest.java
+++ b/core/src/test/java/e2e/renderer/despatchadvice/DespatchAdviceTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.despatchadvice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog18;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog20;
@@ -29,16 +28,10 @@
import io.github.project.openubl.xbuilder.content.models.standard.guia.Envio;
import io.github.project.openubl.xbuilder.content.models.standard.guia.Partida;
import io.github.project.openubl.xbuilder.content.models.standard.guia.Remitente;
-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;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class DespatchAdviceTest extends AbstractTest {
@Test
@@ -86,16 +79,7 @@ public void testBasicMinData() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getDespatchAdvice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "minData.xml");
- assertSendSunat(xml, XMLAssertUtils.DESPATCH_ADVICE_XSD);
+ assertInput(input, "minData.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java
index f1e78a49..d97df134 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java
@@ -17,16 +17,12 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.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;
@@ -65,15 +61,6 @@ public void testFechaVencimiento() throws Exception {
.anticipo(Anticipo.builder().comprobanteSerieNumero("F001-2").monto(new BigDecimal("100")).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(), "minAnticipos.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "minAnticipos.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java
index 3447aa10..ed275aa6 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceDescuentosTest.java
@@ -17,7 +17,6 @@
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;
@@ -25,9 +24,6 @@
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;
@@ -63,16 +59,7 @@ public void descuentoGlobal() throws Exception {
)
.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);
+ assertInput(input, "descuentoGlobal.xml");
}
@Test
@@ -105,16 +92,7 @@ public void descuentoGlobal_tipo02() throws Exception {
)
.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);
+ assertInput(input, "descuentoGlobal_tipo02.xml");
}
@Test
@@ -147,16 +125,7 @@ public void descuentoGlobal_tipo03() throws Exception {
)
.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);
+ assertInput(input, "descuentoGlobal_tipo03.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java
index 09161538..a899cf33 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog59;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.github.project.openubl.xbuilder.content.models.common.Cliente;
@@ -25,9 +24,6 @@
import io.github.project.openubl.xbuilder.content.models.standard.general.Detraccion;
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;
@@ -67,15 +63,6 @@ public void testFechaVencimiento() throws Exception {
)
.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(), "detraccion.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "detraccion.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java
index b9eb513f..a7433c14 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java
@@ -17,16 +17,12 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.Direccion;
import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
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;
@@ -65,16 +61,7 @@ public void testDireccionEntregaMin() throws Exception {
)
.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(), "direccionEntregaMin.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "direccionEntregaMin.xml");
}
@Test
@@ -119,15 +106,6 @@ public void testDireccionEntregaFull() throws Exception {
)
.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(), "direccionEntregaFull.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "direccionEntregaFull.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest.java
index 20e9c247..7fa943b1 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceDocumentoRelacionadoTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog12;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.github.project.openubl.xbuilder.content.models.common.Cliente;
@@ -25,9 +24,6 @@
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoRelacionado;
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;
@@ -71,15 +67,6 @@ public void testDocumentoRelacionado() throws Exception {
)
.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(), "documentoRelacionado.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "documentoRelacionado.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java
index b5680606..2b6bad40 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java
@@ -17,15 +17,11 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.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;
@@ -65,15 +61,6 @@ public void testFechaVencimiento() throws Exception {
)
.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(), "conFechaVencimiento.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "conFechaVencimiento.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java
index 566ea88c..9e08b31e 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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;
@@ -25,9 +24,6 @@
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
import io.github.project.openubl.xbuilder.content.models.standard.general.FormaDePago;
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;
@@ -67,16 +63,7 @@ public void testInvoiceWithFormaPagoContadoPorDefecto() throws Exception {
)
.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(), "sinFormaPago.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "sinFormaPago.xml");
}
@Test
@@ -123,15 +110,6 @@ public void testInvoiceWithFormaPagoCredito() throws Exception {
)
.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(), "conFormaPago.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "conFormaPago.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceGuiasTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceGuiasTest.java
index 48eb0975..97896236 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceGuiasTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceGuiasTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.github.project.openubl.xbuilder.content.models.common.Cliente;
@@ -25,9 +24,6 @@
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
import io.github.project.openubl.xbuilder.content.models.standard.general.Guia;
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;
@@ -68,15 +64,6 @@ public void testGuiaConSerieT() throws Exception {
)
.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(), "guiaSerieT.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "guiaSerieT.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceIscTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceIscTest.java
index 41a9da4f..4d457a5c 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceIscTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceIscTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog8;
@@ -25,9 +24,6 @@
import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
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;
@@ -67,16 +63,7 @@ public void testIsc_sistemaAlValor() throws Exception {
)
.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(), "isc_sistemaAlValor.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "isc_sistemaAlValor.xml");
}
@Test
@@ -112,16 +99,7 @@ public void testIsc_aplicacionAlMontoFijo() throws Exception {
)
.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(), "isc_aplicacionAlMontoFijo.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "isc_aplicacionAlMontoFijo.xml");
}
@Test
@@ -157,16 +135,7 @@ public void testIsc_sistemaDePreciosDeVentalAlPublico() throws Exception {
)
.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(), "isc_sistemaDePreciosDeVentalAlPublico.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "isc_sistemaDePreciosDeVentalAlPublico.xml");
}
@Test
@@ -209,16 +178,7 @@ public void testIsc_precioConImpuestos() throws Exception {
)
.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(), "isc_precioConImpuestos.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "isc_precioConImpuestos.xml");
}
@Test
@@ -291,15 +251,6 @@ public void testIsc_mixedTipoIgv() throws Exception {
)
.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(), "isc_mixedTipoIgv.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "isc_mixedTipoIgv.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java b/core/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java
index 8a3c65ce..4634d684 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java
@@ -17,15 +17,11 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.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;
@@ -53,16 +49,7 @@ public void testInvoice_withPrecioUnitario() throws Exception {
)
.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(), "with-precioUnitario.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "with-precioUnitario.xml");
}
@Test
@@ -87,16 +74,7 @@ public void testInvoice_withPrecioConIgv() throws Exception {
)
.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(), "with-precioUnitarioConImpuestos.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "with-precioUnitarioConImpuestos.xml");
}
@Test
@@ -121,16 +99,7 @@ public void testInvoice_withPrecioUnitario_andICB() throws Exception {
)
.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(), "with-precioUnitario-ICB.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "with-precioUnitario-ICB.xml");
}
@Test
@@ -156,15 +125,6 @@ public void testInvoice_withPrecioConIgv_andICB() throws Exception {
)
.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(), "with-precioUnitario-conImpuestos-ICB.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "with-precioUnitario-conImpuestos-ICB.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceMoneda.java b/core/src/test/java/e2e/renderer/invoice/InvoiceMoneda.java
index 63f6a190..e3b598ec 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceMoneda.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceMoneda.java
@@ -17,17 +17,11 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
-import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
-import io.github.project.openubl.xbuilder.content.catalogs.Catalog8;
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.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;
@@ -60,16 +54,7 @@ public void testCustomMoneda() throws Exception {
)
.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(), "customMoneda.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customMoneda.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceOrdeDeCompraTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceOrdeDeCompraTest.java
index 8b92c641..f4eea57c 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceOrdeDeCompraTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceOrdeDeCompraTest.java
@@ -17,15 +17,11 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.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;
@@ -64,15 +60,6 @@ public void testFechaVencimiento() throws Exception {
)
.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(), "ordenDeCompra.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "ordenDeCompra.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.java b/core/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.java
index 1f6d9af8..3062cfb4 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.java
@@ -17,16 +17,12 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.DocumentoVentaDetalle;
import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
import io.github.project.openubl.xbuilder.content.models.standard.general.Percepcion;
-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;
@@ -59,15 +55,6 @@ public void testFechaVencimiento() throws Exception {
.percepcion(Percepcion.builder().tipo("51").porcentaje(new BigDecimal("0.02")).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(), "percepcion.xml");
- XMLAssertUtils.assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "percepcion.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceTest.java
index 7a46b4d4..925f02b0 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
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.Contacto;
@@ -26,9 +25,6 @@
import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
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;
@@ -36,9 +32,6 @@
import java.time.LocalTime;
import java.time.Month;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class InvoiceTest extends AbstractTest {
@Test
@@ -74,16 +67,7 @@ public void testInvoiceWithCustomUnidadMedida() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "customUnidadMedida.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customUnidadMedida.xml");
}
@Test
@@ -122,16 +106,7 @@ public void testInvoiceWithCustomFechaEmision() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "customFechaEmision.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customFechaEmision.xml");
}
@Test
@@ -177,16 +152,7 @@ public void testInvoiceWithCustomClienteDireccionAndContacto() throws Exception
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "customClienteDireccionAndContacto.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customClienteDireccionAndContacto.xml");
}
@Test
@@ -232,16 +198,7 @@ public void testInvoiceWithCustomProveedorDireccionAndContacto() throws Exceptio
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "customProveedorDireccionAndContacto.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customProveedorDireccionAndContacto.xml");
}
@Test
@@ -280,16 +237,7 @@ public void testInvoiceWithCustomFirmante() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "customFirmante.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customFirmante.xml");
}
@Test
@@ -325,16 +273,7 @@ public void testInvoiceWithICB_precioUnitario() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "icb.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "icb.xml");
}
@Test
@@ -372,16 +311,7 @@ public void testInvoiceWithICB_precioConIgv() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "icb.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "icb.xml");
}
@Test
@@ -416,15 +346,6 @@ public void testInvoiceWithCustomProveedor_direccionNotNullAndCodigoLocalNull()
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "customCodigoLocal.xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "customCodigoLocal.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/invoice/InvoiceTipoIgvTest.java b/core/src/test/java/e2e/renderer/invoice/InvoiceTipoIgvTest.java
index 5f398911..747a9de6 100644
--- a/core/src/test/java/e2e/renderer/invoice/InvoiceTipoIgvTest.java
+++ b/core/src/test/java/e2e/renderer/invoice/InvoiceTipoIgvTest.java
@@ -17,24 +17,17 @@
package e2e.renderer.invoice;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
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.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.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import java.math.BigDecimal;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class InvoiceTipoIgvTest extends AbstractTest {
@ParameterizedTest
@@ -64,16 +57,7 @@ public void testInvoice(Catalog7 tipoIgv) throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "invoice_pu_" + tipoIgv + ".xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "invoice_pu_" + tipoIgv + ".xml");
}
@ParameterizedTest
@@ -104,16 +88,7 @@ public void testInvoiceWithPrecionConImpuestos(Catalog7 tipoIgv) throws Exceptio
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "invoice_pr_" + tipoIgv + ".xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "invoice_pr_" + tipoIgv + ".xml");
}
@ParameterizedTest
@@ -145,16 +120,7 @@ public void testInvoiceWithPrecionConImpuestosAndIcb(Catalog7 tipoIgv) throws Ex
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "invoice_pr_icb_" + tipoIgv + ".xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "invoice_pr_icb_" + tipoIgv + ".xml");
}
@ParameterizedTest
@@ -192,15 +158,6 @@ public void testInvoiceWithPrecionConImpuestosAndIcbAndIsc(Catalog7 tipoIgv) thr
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getInvoice();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "invoice_pr_icb_isc_" + tipoIgv + ".xml");
- assertSendSunat(xml, XMLAssertUtils.INVOICE_XSD);
+ assertInput(input, "invoice_pr_icb_isc_" + tipoIgv + ".xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/perception/PerceptionTest.java b/core/src/test/java/e2e/renderer/perception/PerceptionTest.java
index a80b29e9..bd0917ca 100644
--- a/core/src/test/java/e2e/renderer/perception/PerceptionTest.java
+++ b/core/src/test/java/e2e/renderer/perception/PerceptionTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.perception;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog22;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
@@ -26,17 +25,11 @@
import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.ComprobanteAfectado;
import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.PercepcionRetencionOperacion;
import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.Perception;
-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;
import java.time.LocalDate;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class PerceptionTest extends AbstractTest {
@Test
@@ -77,16 +70,7 @@ public void testSimplePerception() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getPerception();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "perception_simple.xml");
- assertSendSunat(xml, XMLAssertUtils.PERCEPTION_XSD);
+ assertInput(input, "perception_simple.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/retention/RetentionTest.java b/core/src/test/java/e2e/renderer/retention/RetentionTest.java
index 9c9c4338..060bc3ba 100644
--- a/core/src/test/java/e2e/renderer/retention/RetentionTest.java
+++ b/core/src/test/java/e2e/renderer/retention/RetentionTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.retention;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog23;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
@@ -26,17 +25,11 @@
import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.ComprobanteAfectado;
import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.PercepcionRetencionOperacion;
import io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.Retention;
-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;
import java.time.LocalDate;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class RetentionTest extends AbstractTest {
@Test
@@ -77,16 +70,7 @@ public void testSimplePerception() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getRetention();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "retention_simple.xml");
- assertSendSunat(xml, XMLAssertUtils.RETENTION_XSD);
+ assertInput(input, "retention_simple.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/summarydocuments/SummaryDocumentsTest.java b/core/src/test/java/e2e/renderer/summarydocuments/SummaryDocumentsTest.java
index 55dab141..4d0a35fc 100644
--- a/core/src/test/java/e2e/renderer/summarydocuments/SummaryDocumentsTest.java
+++ b/core/src/test/java/e2e/renderer/summarydocuments/SummaryDocumentsTest.java
@@ -17,7 +17,6 @@
package e2e.renderer.summarydocuments;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog19;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1_Invoice;
@@ -30,16 +29,10 @@
import io.github.project.openubl.xbuilder.content.models.sunat.resumen.ComprobanteValorVenta;
import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocuments;
import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocumentsItem;
-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;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class SummaryDocumentsTest extends AbstractTest {
@Test
@@ -109,16 +102,7 @@ public void testMultipleVoidedDocuments() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getSummaryDocuments();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "summaryDocuments.xml");
- assertSendSunat(xml, XMLAssertUtils.SUMMARY_DOCUMENTS_XSD);
+ assertInput(input, "summaryDocuments.xml");
}
}
diff --git a/core/src/test/java/e2e/renderer/voideddocument/VoidedDocumentsTest.java b/core/src/test/java/e2e/renderer/voideddocument/VoidedDocumentsTest.java
index 7f077b66..e5425602 100644
--- a/core/src/test/java/e2e/renderer/voideddocument/VoidedDocumentsTest.java
+++ b/core/src/test/java/e2e/renderer/voideddocument/VoidedDocumentsTest.java
@@ -17,21 +17,14 @@
package e2e.renderer.voideddocument;
import e2e.AbstractTest;
-import e2e.renderer.XMLAssertUtils;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1_Invoice;
import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
import io.github.project.openubl.xbuilder.content.models.sunat.baja.VoidedDocuments;
import io.github.project.openubl.xbuilder.content.models.sunat.baja.VoidedDocumentsItem;
-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.time.LocalDate;
-import static e2e.renderer.XMLAssertUtils.assertSendSunat;
-import static e2e.renderer.XMLAssertUtils.assertSnapshot;
-
public class VoidedDocumentsTest extends AbstractTest {
@Test
@@ -62,16 +55,7 @@ public void testMultipleVoidedDocuments() throws Exception {
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getVoidedDocument();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "voidedDocument.xml");
- assertSendSunat(xml, XMLAssertUtils.VOIDED_DOCUMENTS_XSD);
+ assertInput(input, "voidedDocument.xml");
}
@Test
@@ -101,16 +85,7 @@ public void testMultipleVoidedDocuments_autoGeneratedFechaEmision() throws Excep
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getVoidedDocument();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "voidedDocument_autoGeneratedFechaEmision.xml");
- assertSendSunat(xml, XMLAssertUtils.VOIDED_DOCUMENTS_XSD);
+ assertInput(input, "voidedDocument_autoGeneratedFechaEmision.xml");
}
@Test
@@ -139,15 +114,6 @@ public void testMultipleVoidedDocuments_autoGeneratedTipoComprobante() throws Ex
)
.build();
- ContentEnricher enricher = new ContentEnricher(defaults, dateProvider);
- enricher.enrich(input);
-
- // When
- Template template = TemplateProducer.getInstance().getVoidedDocument();
- String xml = template.data(input).render();
-
- // Then
- assertSnapshot(xml, getClass(), "voidedDocument_autoGeneratedTipoComprobante.xml");
- assertSendSunat(xml, XMLAssertUtils.VOIDED_DOCUMENTS_XSD);
+ assertInput(input, "voidedDocument_autoGeneratedTipoComprobante.xml");
}
}
diff --git a/core/src/test/resources/e2e/renderer/despatchadvice/DespatchAdviceTest/minData.xml b/core/src/test/resources/e2e/renderer/despatchadvice/DespatchAdviceTest/minData.xml
index ed28a68b..5494d7fd 100644
--- a/core/src/test/resources/e2e/renderer/despatchadvice/DespatchAdviceTest/minData.xml
+++ b/core/src/test/resources/e2e/renderer/despatchadvice/DespatchAdviceTest/minData.xml
@@ -72,8 +72,8 @@
- 010101}
- DireccionOrigen}
+ 010101
+ DireccionOrigen
diff --git a/pom.xml b/pom.xml
index 02c275a7..511b7a0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@
${basedir}
1.18.26
+ 1.5.3.Final
2.16.4.Final
2.9.1
4.1.3
@@ -193,6 +194,7 @@
src/test/resources/**
src/main/resources/**
.github/**
+ **/*.yaml
diff --git a/quarkus-extension/deployment/pom.xml b/quarkus-extension/deployment/pom.xml
index 92bd640b..11ee5783 100644
--- a/quarkus-extension/deployment/pom.xml
+++ b/quarkus-extension/deployment/pom.xml
@@ -37,6 +37,10 @@
io.quarkus
quarkus-qute-deployment
+
+ io.quarkus
+ quarkus-jaxb-deployment
+
io.github.project-openubl
quarkus-xbuilder
diff --git a/quarkus-extension/deployment/src/main/java/io/github/project/openubl/quarkus/xbuilder/deployment/QuarkusXbuilderProcessor.java b/quarkus-extension/deployment/src/main/java/io/github/project/openubl/quarkus/xbuilder/deployment/QuarkusXbuilderProcessor.java
index 73b91aef..d3309352 100644
--- a/quarkus-extension/deployment/src/main/java/io/github/project/openubl/quarkus/xbuilder/deployment/QuarkusXbuilderProcessor.java
+++ b/quarkus-extension/deployment/src/main/java/io/github/project/openubl/quarkus/xbuilder/deployment/QuarkusXbuilderProcessor.java
@@ -28,9 +28,12 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.util.ServiceUtil;
+import io.quarkus.jaxb.deployment.JaxbClassesToBeBoundBuildItem;
import java.io.IOException;
import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
class QuarkusXbuilderProcessor {
@@ -106,7 +109,7 @@ void registerServices(BuildProducer services) throws I
}
@BuildStep
- ReflectiveClassBuildItem reflectionLombok() {
+ ReflectiveClassBuildItem reflectionModelsLombok() {
return new ReflectiveClassBuildItem(true, false,
"io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote$CreditNoteBuilderImpl",
"io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote$DebitNoteBuilderImpl",
@@ -121,7 +124,119 @@ ReflectiveClassBuildItem reflectionLombok() {
}
@BuildStep
- ReflectiveClassBuildItem reflection() {
+ ReflectiveClassBuildItem reflectionJaxbLombok() {
+ return new ReflectiveClassBuildItem(true, true,
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLAddress$AddressLine",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLAddress$Country",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNoteLine$Quantity",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLCustomer$PartyIdentification",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLCustomer$PartyIdentification_ID",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLCustomer$PartyLegalEntity",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNoteLine$Quantity",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$AdditionalDocumentReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$AddressLine",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$CarrierParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$Delivery",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$DeliveryAddress",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$DeliveryCustomerParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$DespatchSupplierParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$DriverPerson",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$FirstArrivalPortLocation",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$GrossWeightMeasure",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$ID",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$OrderReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$OriginAddress",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$Party",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$PartyIdentification",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$PartyLegalEntity",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$PartyName",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$RoadTransport",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$SellerSupplierParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$Shipment",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$ShipmentStage",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$TransitPeriod",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$TransportEquipment",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$TransportHandlingUnit",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice$TransportMeans",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdviceLine$CommodityClassification",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdviceLine$DeliveredQuantity",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdviceLine$Item",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdviceLine$SellersItemIdentification",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoiceLine$Quantity",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionRetencionBase$TotalInvoiceAmount",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionRetencionSunatDocumentReferenceBase$ID",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionRetencionSunatDocumentReferenceBase$Payment",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionRetencionSunatDocumentReferenceBase$TotalInvoiceAmount",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionSunatDocumentReference$ExchangeRate",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionSunatDocumentReference$XMLPercepcionInformation",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetentionSunatDocumentReference$ExchangeRate",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetentionSunatDocumentReference$XMLRetentionInformation",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$AccountingCustomerParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$AccountingSupplierParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$AdditionalDocumentReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$AllowanceCharge",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$Delivery",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$DeliveryLocation",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$DespatchDocumentReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$DiscrepancyResponse",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$InvoiceTypeCode",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$MonetaryTotal",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$Note",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$OrderReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$PayeeFinancialAccount",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$PaymentMeans",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$PaymentTerms",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$PrepaidPayment",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$TaxCategory",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$TaxScheme",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$TaxSubtotal",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument$TaxTotal",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$AlternativeConditionPrice",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$Item",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$Price",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$PricingReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$TaxCategory",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$TaxScheme",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$TaxSubtotalLine",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine$TaxTotalLine",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSignature$PartyName",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSignature$SignatoryParty",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$AccountingCustomerParty",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$AllowanceCharge",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$BillingPayment",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$BillingReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$InvoiceDocumentReference",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$Status",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$TaxCategory",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$TaxScheme",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$TaxSubtotal",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$TaxTotal",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine$TotalAmount",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplier$PartyIdentification",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplier$PartyLegalEntity",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplier$PartyName",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplierSunat$Party",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplierSunat$PartyLegalEntity",
+ "io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplierSunat$PartyName"
+ );
+ }
+
+ @BuildStep
+ ReflectiveClassBuildItem reflectionModels() {
return new ReflectiveClassBuildItem(true, false,
io.github.project.openubl.xbuilder.content.models.common.Cliente.class,
io.github.project.openubl.xbuilder.content.models.common.Cliente.ClienteBuilder.class,
@@ -267,4 +382,102 @@ ReflectiveClassBuildItem reflection() {
io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion.PercepcionRetencionOperacion.PercepcionRetencionOperacionBuilder.class
);
}
+
+ @BuildStep
+ ReflectiveClassBuildItem reflectionJaxb() {
+ return new ReflectiveClassBuildItem(true, true,
+ io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter.class,
+ io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalTimeAdapter.class,
+
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ClienteMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ContactoMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.DireccionMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.FirmanteMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.GuiaMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero2Translator.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.Numero3Translator.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ProveedorMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentHelperMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SalesDocumentMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieNumeroTranslator.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.common.SerieTranslator.class,
+
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.utils.MapperUtils.class,
+
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.CreditNoteMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.DebitNoteMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.DespatchAdviceMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.InvoiceMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.PerceptionMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.RetentionMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.SummaryDocumentsMapper.class,
+ io.github.project.openubl.xbuilder.content.jaxb.mappers.VoidedDocumentsMapper.class,
+
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLAddress.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLConstants.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLContact.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNote.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNoteLine.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLCustomer.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNote.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNoteLine.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdviceLine.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoice.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoiceLine.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcion.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionRetencionBase.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionRetencionSunatDocumentReferenceBase.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcionSunatDocumentReference.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetention.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetentionSunatDocumentReference.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocumentLine.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSignature.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocuments.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocumentsLine.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSunatDocument.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplier.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplierSunat.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocuments.class,
+ io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocumentsLine.class
+ );
+ }
+
+ @BuildStep
+ ReflectiveClassBuildItem mapstruct() {
+ return new ReflectiveClassBuildItem(true, false,
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ClienteMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ContactoMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.common.DireccionMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.common.FirmanteMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.common.GuiaMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.common.ProveedorMapperImpl",
+
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.CreditNoteMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.DebitNoteMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.DespatchAdviceMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.InvoiceMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.PerceptionMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.RetentionMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.SummaryDocumentsMapperImpl",
+ "io.github.project.openubl.xbuilder.content.jaxb.mappers.VoidedDocumentsMapperImpl"
+ );
+ }
+
+ @BuildStep
+ void jaxbRegisterClassesToBeBound(BuildProducer classesToBeBoundBuildItemProducer) {
+ List classesToBeBound = new ArrayList<>();
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoice.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNote.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNote.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocuments.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocuments.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcion.class.getName());
+ classesToBeBound.add(io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetention.class.getName());
+
+ classesToBeBoundBuildItemProducer.produce(new JaxbClassesToBeBoundBuildItem(classesToBeBound));
+ }
}
diff --git a/quarkus-extension/integration-tests/pom.xml b/quarkus-extension/integration-tests/pom.xml
index 6a656623..2ae121f5 100644
--- a/quarkus-extension/integration-tests/pom.xml
+++ b/quarkus-extension/integration-tests/pom.xml
@@ -33,6 +33,25 @@
${project.parent.basedir}
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.14.2
+ test
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
+ 2.14.2
+ test
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+ 2.14.2
+ test
+
+
io.quarkus
quarkus-resteasy-qute
diff --git a/quarkus-extension/integration-tests/src/main/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResource.java b/quarkus-extension/integration-tests/src/main/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResource.java
index 3284ee6e..b8a35b22 100644
--- a/quarkus-extension/integration-tests/src/main/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResource.java
+++ b/quarkus-extension/integration-tests/src/main/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResource.java
@@ -17,6 +17,22 @@
package io.github.project.openubl.quarkus.xbuilder.it;
import io.github.project.openubl.quarkus.xbuilder.XBuilder;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.CreditNoteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.DebitNoteMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.DespatchAdviceMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.InvoiceMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.PerceptionMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.RetentionMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.SummaryDocumentsMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.mappers.VoidedDocumentsMapper;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLCreditNote;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDebitNote;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLDespatchAdvice;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLInvoice;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLPercepcion;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLRetention;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSummaryDocuments;
+import io.github.project.openubl.xbuilder.content.jaxb.models.XMLVoidedDocuments;
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.Invoice;
@@ -28,6 +44,8 @@
import io.github.project.openubl.xbuilder.enricher.ContentEnricher;
import io.quarkus.qute.Template;
import io.vertx.core.json.JsonObject;
+import org.mapstruct.factory.Mappers;
+import org.xml.sax.InputSource;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@@ -36,6 +54,12 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.IOException;
+import java.io.StringReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.time.LocalDate;
import static io.github.project.openubl.quarkus.xbuilder.XBuilder.Type.CREDIT_NOTE;
@@ -47,18 +71,30 @@
import static io.github.project.openubl.quarkus.xbuilder.XBuilder.Type.SUMMARY_DOCUMENTS;
import static io.github.project.openubl.quarkus.xbuilder.XBuilder.Type.VOIDED_DOCUMENTS;
-@ApplicationScoped
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
+@ApplicationScoped
@Path("/quarkus-xbuilder")
public class QuarkusXbuilderResource {
@Inject
XBuilder xBuilder;
+ @Inject
+ Unmarshaller unmarshaller;
+
+ private static final InvoiceMapper invoiceMapper = Mappers.getMapper(InvoiceMapper.class);
+ private static final CreditNoteMapper creditNoteMapper = Mappers.getMapper(CreditNoteMapper.class);
+ private static final DebitNoteMapper debitNoteMapper = Mappers.getMapper(DebitNoteMapper.class);
+ private static final VoidedDocumentsMapper voidedDocumentsMapper = Mappers.getMapper(VoidedDocumentsMapper.class);
+ private static final SummaryDocumentsMapper summaryDocumentsMapper = Mappers.getMapper(SummaryDocumentsMapper.class);
+ private static final PerceptionMapper perceptionMapper = Mappers.getMapper(PerceptionMapper.class);
+ private static final RetentionMapper retentionMapper = Mappers.getMapper(RetentionMapper.class);
+ private static final DespatchAdviceMapper despatchAdviceMapper = Mappers.getMapper(DespatchAdviceMapper.class);
+
@POST
- @Path("invoice")
- public String createInvoice(JsonObject json) {
+ @Path("Invoice/from-json")
+ public String createInvoiceXml(JsonObject json) {
Invoice invoice = json.mapTo(Invoice.class);
ContentEnricher enricher = new ContentEnricher(xBuilder.getDefaults(), () -> LocalDate.of(2022, 1, 25));
@@ -69,7 +105,22 @@ public String createInvoice(JsonObject json) {
}
@POST
- @Path("credit-note")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("Invoice/from-xml")
+ public String createInvoiceXml(String xml) throws IOException, JAXBException {
+ Template template = xBuilder.getTemplate(INVOICE);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLInvoice xmlPojo = (XMLInvoice) unmarshaller.unmarshal(new InputSource(reader));
+ Invoice inputFromXml = invoiceMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("CreditNote/from-json")
public String createCreditNote(JsonObject json) {
CreditNote creditNote = json.mapTo(CreditNote.class);
@@ -81,7 +132,22 @@ public String createCreditNote(JsonObject json) {
}
@POST
- @Path("debit-note")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("CreditNote/from-xml")
+ public String createCreditNoteXml(String xml) {
+ Template template = xBuilder.getTemplate(CREDIT_NOTE);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLCreditNote xmlPojo = (XMLCreditNote) unmarshaller.unmarshal(new InputSource(reader));
+ CreditNote inputFromXml = creditNoteMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("DebitNote/from-json")
public String createDebitNote(JsonObject json) {
DebitNote debitNote = json.mapTo(DebitNote.class);
@@ -93,7 +159,22 @@ public String createDebitNote(JsonObject json) {
}
@POST
- @Path("voided-documents")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("DebitNote/from-xml")
+ public String createDebitNoteXml(String xml) {
+ Template template = xBuilder.getTemplate(DEBIT_NOTE);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLDebitNote xmlPojo = (XMLDebitNote) unmarshaller.unmarshal(new InputSource(reader));
+ DebitNote inputFromXml = debitNoteMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("VoidedDocuments/from-json")
public String createVoidedDocuments(JsonObject json) {
VoidedDocuments voidedDocuments = json.mapTo(VoidedDocuments.class);
@@ -105,7 +186,22 @@ public String createVoidedDocuments(JsonObject json) {
}
@POST
- @Path("summary-documents")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("VoidedDocuments/from-xml")
+ public String createVoidedDocumentsXml(String xml) {
+ Template template = xBuilder.getTemplate(VOIDED_DOCUMENTS);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLVoidedDocuments xmlPojo = (XMLVoidedDocuments) unmarshaller.unmarshal(new InputSource(reader));
+ VoidedDocuments inputFromXml = voidedDocumentsMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("SummaryDocuments/from-json")
public String createSummaryDocuments(JsonObject json) {
SummaryDocuments summaryDocuments = json.mapTo(SummaryDocuments.class);
@@ -117,7 +213,22 @@ public String createSummaryDocuments(JsonObject json) {
}
@POST
- @Path("perception")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("SummaryDocuments/from-xml")
+ public String createSummaryDocumentsXml(String xml) {
+ Template template = xBuilder.getTemplate(SUMMARY_DOCUMENTS);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLSummaryDocuments xmlPojo = (XMLSummaryDocuments) unmarshaller.unmarshal(new InputSource(reader));
+ SummaryDocuments inputFromXml = summaryDocumentsMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("Perception/from-json")
public String createPerception(JsonObject json) {
Perception perception = json.mapTo(Perception.class);
@@ -129,7 +240,22 @@ public String createPerception(JsonObject json) {
}
@POST
- @Path("retention")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("Perception/from-xml")
+ public String createPerceptionXml(String xml) {
+ Template template = xBuilder.getTemplate(PERCEPTION);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLPercepcion xmlPojo = (XMLPercepcion) unmarshaller.unmarshal(new InputSource(reader));
+ Perception inputFromXml = perceptionMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("Retention/from-json")
public String createRetention(JsonObject json) {
Retention retention = json.mapTo(Retention.class);
@@ -141,7 +267,22 @@ public String createRetention(JsonObject json) {
}
@POST
- @Path("despatch-advice")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("Retention/from-xml")
+ public String createRetentionXml(String xml) {
+ Template template = xBuilder.getTemplate(RETENTION);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLRetention xmlPojo = (XMLRetention) unmarshaller.unmarshal(new InputSource(reader));
+ Retention inputFromXml = retentionMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @POST
+ @Path("DespatchAdvice/from-json")
public String createDespatchAdvice(JsonObject json) {
DespatchAdvice despatchAdvice = json.mapTo(DespatchAdvice.class);
@@ -149,8 +290,21 @@ public String createDespatchAdvice(JsonObject json) {
enricher.enrich(despatchAdvice);
Template template = xBuilder.getTemplate(DESPATCH_ADVICE);
- String xml = template.data(despatchAdvice).render();
- return xml;
+ return template.data(despatchAdvice).render();
}
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Path("DespatchAdvice/from-xml")
+ public String createDespatchAdviceXml(String xml) {
+ Template template = xBuilder.getTemplate(DESPATCH_ADVICE);
+
+ try (StringReader reader = new StringReader(xml)) {
+ XMLDespatchAdvice xmlPojo = (XMLDespatchAdvice) unmarshaller.unmarshal(new InputSource(reader));
+ DespatchAdvice inputFromXml = despatchAdviceMapper.map(xmlPojo);
+ return template.data(inputFromXml).render();
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/quarkus-extension/integration-tests/src/main/resources/application.properties b/quarkus-extension/integration-tests/src/main/resources/application.properties
index 10dabadf..45a13c31 100644
--- a/quarkus-extension/integration-tests/src/main/resources/application.properties
+++ b/quarkus-extension/integration-tests/src/main/resources/application.properties
@@ -15,7 +15,5 @@
# limitations under the License.
#
-quarkus.xbuilder.moneda=PEN
-quarkus.xbuilder.unidad-medida=NIU
quarkus.xbuilder.igv-tasa=0.2
-quarkus.xbuilder.icb-tasa=0.2
\ No newline at end of file
+quarkus.xbuilder.icb-tasa=0.2
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 123666a1..071226a4 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
@@ -16,6 +16,12 @@
*/
package io.github.project.openubl.quarkus.xbuilder.it;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
+import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog18;
import io.github.project.openubl.xbuilder.content.catalogs.Catalog19;
@@ -52,8 +58,15 @@
import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test;
+import java.io.IOException;
import java.math.BigDecimal;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.time.LocalDate;
+import java.util.Map;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
@@ -61,6 +74,53 @@
@QuarkusTest
public class QuarkusXbuilderResourceTest {
+ public YAMLMapper getYamlMapper() {
+ YAMLMapper mapper = new YAMLMapper(new YAMLFactory());
+ mapper.registerModule(new JavaTimeModule());
+ mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ mapper.configure(YAMLGenerator.Feature.LITERAL_BLOCK_STYLE, true);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ return mapper;
+ }
+
+ @Test
+ public void testAllYamlFilesFromSnapshot() throws URISyntaxException, IOException {
+ YAMLMapper yamlMapper = getYamlMapper();
+
+ URL url = getClass().getClassLoader().getResource("e2e");
+ Path path = Paths.get(url.toURI());
+ Files.walk(path, 5)
+ .filter(p -> !p.toFile().isDirectory())
+ .forEach(p -> {
+ try {
+ Map jsonObject = yamlMapper.readValue(p.toFile(), Map.class);
+ String kind = (String) jsonObject.get("kind");
+ String snapshot = (String) jsonObject.get("snapshot");
+ Map input = (Map) jsonObject.get("input");
+
+ given()
+ .when()
+ .contentType(ContentType.JSON)
+ .body(input)
+ .post("/quarkus-xbuilder/" + kind + "/from-json")
+ .then()
+ .statusCode(200)
+ .body(is(snapshot));
+
+ given()
+ .when()
+ .contentType(ContentType.TEXT)
+ .body(snapshot)
+ .post("/quarkus-xbuilder/" + kind + "/from-xml")
+ .then()
+ .statusCode(200)
+ .body(is(snapshot));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+
@Test
public void testInvoice() {
Invoice invoice = Invoice.builder()
@@ -89,7 +149,7 @@ public void testInvoice() {
.when()
.contentType(ContentType.JSON)
.body(invoice)
- .post("/quarkus-xbuilder/invoice")
+ .post("/quarkus-xbuilder/Invoice/from-json")
.then()
.statusCode(200)
.body(is(
@@ -251,7 +311,7 @@ public void testCreditNote() {
.when()
.contentType(ContentType.JSON)
.body(creditNote)
- .post("/quarkus-xbuilder/credit-note")
+ .post("/quarkus-xbuilder/CreditNote/from-json")
.then()
.statusCode(200)
.body(is(
@@ -417,7 +477,7 @@ public void testDebitNote() {
.when()
.contentType(ContentType.JSON)
.body(debitNote)
- .post("/quarkus-xbuilder/debit-note")
+ .post("/quarkus-xbuilder/DebitNote/from-json")
.then()
.statusCode(200)
.body(is(
@@ -584,7 +644,7 @@ public void testVoidedDocuments() {
.when()
.contentType(ContentType.JSON)
.body(voidedDocuments)
- .post("/quarkus-xbuilder/voided-documents")
+ .post("/quarkus-xbuilder/VoidedDocuments/from-json")
.then()
.statusCode(200)
.body(is("\n" +
@@ -718,7 +778,7 @@ public void testSummaryDocuments() {
.when()
.contentType(ContentType.JSON)
.body(summaryDocuments)
- .post("/quarkus-xbuilder/summary-documents")
+ .post("/quarkus-xbuilder/SummaryDocuments/from-json")
.then()
.statusCode(200)
.body(is("\n" +
@@ -890,7 +950,7 @@ public void testPerception() {
.when()
.contentType(ContentType.JSON)
.body(perception)
- .post("/quarkus-xbuilder/perception")
+ .post("/quarkus-xbuilder/Perception/from-json")
.then()
.statusCode(200)
.body(is("\n" +
@@ -1008,7 +1068,7 @@ public void testRetention() {
.when()
.contentType(ContentType.JSON)
.body(retention)
- .post("/quarkus-xbuilder/retention")
+ .post("/quarkus-xbuilder/Retention/from-json")
.then()
.statusCode(200)
.body(is("\n" +
@@ -1133,7 +1193,7 @@ public void testDespatchAdvice() {
.when()
.contentType(ContentType.JSON)
.body(despatchAdvice)
- .post("/quarkus-xbuilder/despatch-advice")
+ .post("/quarkus-xbuilder/DespatchAdvice/from-json")
.then()
.statusCode(200)
.body(is("\n" +
@@ -1210,8 +1270,8 @@ public void testDespatchAdvice() {
" \n" +
" \n" +
" \n" +
- " 010101}\n" +
- " DireccionOrigen}\n" +
+ " 010101\n" +
+ " DireccionOrigen\n" +
" \n" +
" \n" +
" \n" +
diff --git a/quarkus-extension/integration-tests/src/test/resources/.gitignore b/quarkus-extension/integration-tests/src/test/resources/.gitignore
new file mode 100644
index 00000000..4bc47c90
--- /dev/null
+++ b/quarkus-extension/integration-tests/src/test/resources/.gitignore
@@ -0,0 +1 @@
+/e2e/
diff --git a/quarkus-extension/runtime/pom.xml b/quarkus-extension/runtime/pom.xml
index 544a6905..0775cf68 100644
--- a/quarkus-extension/runtime/pom.xml
+++ b/quarkus-extension/runtime/pom.xml
@@ -37,6 +37,10 @@
io.quarkus
quarkus-qute
+
+ io.quarkus
+ quarkus-jaxb
+
io.github.project-openubl
xbuilder
diff --git a/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/runtime/XBuilderConfig.java b/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/runtime/XBuilderConfig.java
index c5fce9bd..98a764ba 100644
--- a/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/runtime/XBuilderConfig.java
+++ b/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/runtime/XBuilderConfig.java
@@ -26,18 +26,6 @@
@ConfigRoot(name = "xbuilder", phase = ConfigPhase.RUN_TIME)
public class XBuilderConfig {
- /**
- * Default moneda
- */
- @ConfigItem
- public Optional moneda;
-
- /**
- * Default unidadMedida
- */
- @ConfigItem
- public Optional unidadMedida;
-
/**
* Default igvTasa
*/