├── .devcontainer └── devcontainer.json ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── backport.yml │ ├── ci.yml │ ├── codeql-analysis.yml │ ├── release.yml │ └── sonar.yml ├── .gitignore ├── .vscode └── settings.json ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md ├── examples ├── pom.xml ├── springbot │ ├── README.md │ ├── pom.xml │ ├── screenshot.png │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quickstart │ │ │ └── xbuilder │ │ │ └── springboot │ │ │ ├── Application.java │ │ │ ├── XBuilderController.java │ │ │ └── XSenderController.java │ │ ├── resources │ │ ├── CERTIFICADO CLAVE PRIVADA.key │ │ ├── CERTIFICADO CLAVE PUBLICA SUNAT.cer │ │ └── LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx │ │ └── webapp │ │ ├── css │ │ └── styles.css │ │ └── index.html ├── tomcat │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ ├── quickstart.sh │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quickstart │ │ │ └── xbuilder │ │ │ └── springboot │ │ │ ├── XBuilderServlet.java │ │ │ └── XSenderServlet.java │ │ ├── resources │ │ ├── CERTIFICADO CLAVE PRIVADA.key │ │ ├── CERTIFICADO CLAVE PUBLICA SUNAT.cer │ │ ├── LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx │ │ └── invoice.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── css │ │ └── styles.css │ │ └── index.html ├── wildfly │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quickstart │ │ │ └── xbuilder │ │ │ └── jee │ │ │ ├── UBLResource.java │ │ │ └── UBLService.java │ │ ├── resources │ │ ├── CERTIFICADO CLAVE PRIVADA.key │ │ ├── CERTIFICADO CLAVE PUBLICA SUNAT.cer │ │ └── LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx │ │ └── webapp │ │ ├── WEB-INF │ │ ├── beans.xml │ │ └── web.xml │ │ ├── css │ │ └── styles.css │ │ └── index.html ├── xbuilder │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quickstart │ │ │ └── xbuilder │ │ │ └── Main.java │ │ └── resources │ │ ├── CERTIFICADO CLAVE PRIVADA.key │ │ ├── CERTIFICADO CLAVE PUBLICA SUNAT.cer │ │ └── LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx └── xsender │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── quickstart │ │ └── xsender │ │ └── Main.java │ └── resources │ └── invoice.xml ├── jreleaser.yml ├── pom.xml ├── src └── jreleaser │ └── templates │ └── article │ └── release.md ├── tools └── copyright.txt ├── xbuilder ├── core │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── project │ │ │ │ └── openubl │ │ │ │ └── xbuilder │ │ │ │ ├── content │ │ │ │ ├── catalogs │ │ │ │ │ ├── Catalog.java │ │ │ │ │ ├── Catalog1.java │ │ │ │ │ ├── Catalog10.java │ │ │ │ │ ├── Catalog12.java │ │ │ │ │ ├── Catalog12_Anticipo.java │ │ │ │ │ ├── Catalog12_Doc_Trib_Relacionado_BoletaFactura.java │ │ │ │ │ ├── Catalog12_Doc_Trib_Relacionado_NotaCredito.java │ │ │ │ │ ├── Catalog12_Doc_Trib_Relacionado_NotaDebito.java │ │ │ │ │ ├── Catalog16.java │ │ │ │ │ ├── Catalog18.java │ │ │ │ │ ├── Catalog19.java │ │ │ │ │ ├── Catalog1_Guia.java │ │ │ │ │ ├── Catalog1_Invoice.java │ │ │ │ │ ├── Catalog20.java │ │ │ │ │ ├── Catalog21.java │ │ │ │ │ ├── Catalog22.java │ │ │ │ │ ├── Catalog23.java │ │ │ │ │ ├── Catalog5.java │ │ │ │ │ ├── Catalog51.java │ │ │ │ │ ├── Catalog52.java │ │ │ │ │ ├── Catalog53.java │ │ │ │ │ ├── Catalog53_Anticipo.java │ │ │ │ │ ├── Catalog53_DescuentoGlobal.java │ │ │ │ │ ├── Catalog54.java │ │ │ │ │ ├── Catalog59.java │ │ │ │ │ ├── Catalog6.java │ │ │ │ │ ├── Catalog7.java │ │ │ │ │ ├── Catalog7_1.java │ │ │ │ │ ├── Catalog8.java │ │ │ │ │ ├── Catalog9.java │ │ │ │ │ └── CatalogContadoCredito.java │ │ │ │ ├── jaxb │ │ │ │ │ ├── adapters │ │ │ │ │ │ ├── LocalDateAdapter.java │ │ │ │ │ │ └── LocalTimeAdapter.java │ │ │ │ │ ├── mappers │ │ │ │ │ │ ├── CreditNoteMapper.java │ │ │ │ │ │ ├── DebitNoteMapper.java │ │ │ │ │ │ ├── DespatchAdviceMapper.java │ │ │ │ │ │ ├── InvoiceMapper.java │ │ │ │ │ │ ├── PerceptionMapper.java │ │ │ │ │ │ ├── RetentionMapper.java │ │ │ │ │ │ ├── SummaryDocumentsMapper.java │ │ │ │ │ │ ├── VoidedDocumentsMapper.java │ │ │ │ │ │ ├── common │ │ │ │ │ │ │ ├── ClienteMapper.java │ │ │ │ │ │ │ ├── ContactoMapper.java │ │ │ │ │ │ │ ├── DireccionMapper.java │ │ │ │ │ │ │ ├── FirmanteMapper.java │ │ │ │ │ │ │ ├── GuiaMapper.java │ │ │ │ │ │ │ ├── Numero2Translator.java │ │ │ │ │ │ │ ├── Numero3Translator.java │ │ │ │ │ │ │ ├── ProveedorMapper.java │ │ │ │ │ │ │ ├── SalesDocumentHelperMapper.java │ │ │ │ │ │ │ ├── SalesDocumentMapper.java │ │ │ │ │ │ │ ├── SerieNumeroMapper.java │ │ │ │ │ │ │ ├── SerieNumeroTranslator.java │ │ │ │ │ │ │ └── SerieTranslator.java │ │ │ │ │ │ └── utils │ │ │ │ │ │ │ └── MapperUtils.java │ │ │ │ │ └── models │ │ │ │ │ │ ├── XMLAddress.java │ │ │ │ │ │ ├── XMLConstants.java │ │ │ │ │ │ ├── XMLContact.java │ │ │ │ │ │ ├── XMLCreditNote.java │ │ │ │ │ │ ├── XMLCreditNoteLine.java │ │ │ │ │ │ ├── XMLCustomer.java │ │ │ │ │ │ ├── XMLDebitNote.java │ │ │ │ │ │ ├── XMLDebitNoteLine.java │ │ │ │ │ │ ├── XMLDespatchAdvice.java │ │ │ │ │ │ ├── XMLDespatchAdviceLine.java │ │ │ │ │ │ ├── XMLInvoice.java │ │ │ │ │ │ ├── XMLInvoiceLine.java │ │ │ │ │ │ ├── XMLPercepcion.java │ │ │ │ │ │ ├── XMLPercepcionRetencionBase.java │ │ │ │ │ │ ├── XMLPercepcionRetencionSunatDocumentReferenceBase.java │ │ │ │ │ │ ├── XMLPercepcionSunatDocumentReference.java │ │ │ │ │ │ ├── XMLRetention.java │ │ │ │ │ │ ├── XMLRetentionSunatDocumentReference.java │ │ │ │ │ │ ├── XMLSalesDocument.java │ │ │ │ │ │ ├── XMLSalesDocumentLine.java │ │ │ │ │ │ ├── XMLSignature.java │ │ │ │ │ │ ├── XMLSummaryDocuments.java │ │ │ │ │ │ ├── XMLSummaryDocumentsLine.java │ │ │ │ │ │ ├── XMLSunatDocument.java │ │ │ │ │ │ ├── XMLSupplier.java │ │ │ │ │ │ ├── XMLSupplierSunat.java │ │ │ │ │ │ ├── XMLVoidedDocuments.java │ │ │ │ │ │ ├── XMLVoidedDocumentsLine.java │ │ │ │ │ │ └── package-info.java │ │ │ │ └── models │ │ │ │ │ ├── common │ │ │ │ │ ├── Cliente.java │ │ │ │ │ ├── Contacto.java │ │ │ │ │ ├── Direccion.java │ │ │ │ │ ├── Document.java │ │ │ │ │ ├── Firmante.java │ │ │ │ │ ├── Proveedor.java │ │ │ │ │ └── TipoCambio.java │ │ │ │ │ ├── standard │ │ │ │ │ ├── general │ │ │ │ │ │ ├── Anticipo.java │ │ │ │ │ │ ├── BaseDocumentoTributarioRelacionado.java │ │ │ │ │ │ ├── CargoDescuento.java │ │ │ │ │ │ ├── CreditNote.java │ │ │ │ │ │ ├── CuotaDePago.java │ │ │ │ │ │ ├── DebitNote.java │ │ │ │ │ │ ├── Descuento.java │ │ │ │ │ │ ├── Detraccion.java │ │ │ │ │ │ ├── DocumentoRelacionado.java │ │ │ │ │ │ ├── DocumentoVentaDetalle.java │ │ │ │ │ │ ├── FormaDePago.java │ │ │ │ │ │ ├── Guia.java │ │ │ │ │ │ ├── Invoice.java │ │ │ │ │ │ ├── Note.java │ │ │ │ │ │ ├── Percepcion.java │ │ │ │ │ │ ├── SalesDocument.java │ │ │ │ │ │ ├── TotalImporte.java │ │ │ │ │ │ ├── TotalImporteInvoice.java │ │ │ │ │ │ ├── TotalImporteNote.java │ │ │ │ │ │ └── TotalImpuestos.java │ │ │ │ │ └── guia │ │ │ │ │ │ ├── DespatchAdvice.java │ │ │ │ │ │ ├── DespatchAdviceItem.java │ │ │ │ │ │ ├── Destinatario.java │ │ │ │ │ │ ├── Destino.java │ │ │ │ │ │ ├── DocumentoBaja.java │ │ │ │ │ │ ├── DocumentoRelacionado.java │ │ │ │ │ │ ├── Envio.java │ │ │ │ │ │ ├── Partida.java │ │ │ │ │ │ ├── Proveedor.java │ │ │ │ │ │ ├── Remitente.java │ │ │ │ │ │ └── Transportista.java │ │ │ │ │ ├── sunat │ │ │ │ │ ├── SunatDocument.java │ │ │ │ │ ├── baja │ │ │ │ │ │ ├── VoidedDocuments.java │ │ │ │ │ │ └── VoidedDocumentsItem.java │ │ │ │ │ ├── percepcionretencion │ │ │ │ │ │ ├── BasePercepcionRetencion.java │ │ │ │ │ │ ├── ComprobanteAfectado.java │ │ │ │ │ │ ├── PercepcionRetencionOperacion.java │ │ │ │ │ │ ├── Perception.java │ │ │ │ │ │ └── Retention.java │ │ │ │ │ └── resumen │ │ │ │ │ │ ├── Comprobante.java │ │ │ │ │ │ ├── ComprobanteAfectado.java │ │ │ │ │ │ ├── ComprobanteImpuestos.java │ │ │ │ │ │ ├── ComprobanteValorVenta.java │ │ │ │ │ │ ├── SummaryDocuments.java │ │ │ │ │ │ └── SummaryDocumentsItem.java │ │ │ │ │ └── utils │ │ │ │ │ └── UBLRegex.java │ │ │ │ ├── enricher │ │ │ │ ├── ContentEnricher.java │ │ │ │ ├── config │ │ │ │ │ ├── DateProvider.java │ │ │ │ │ └── Defaults.java │ │ │ │ └── kie │ │ │ │ │ ├── AbstractBodyRule.java │ │ │ │ │ ├── AbstractHeaderRule.java │ │ │ │ │ ├── Rule.java │ │ │ │ │ ├── RuleContext.java │ │ │ │ │ ├── RuleFactory.java │ │ │ │ │ ├── RuleFactoryRegistry.java │ │ │ │ │ ├── RulePhase.java │ │ │ │ │ ├── RuleUnit.java │ │ │ │ │ ├── rules │ │ │ │ │ ├── enrich │ │ │ │ │ │ ├── body │ │ │ │ │ │ │ ├── anticipo │ │ │ │ │ │ │ │ ├── ComprobanteTipoAnticipoRule.java │ │ │ │ │ │ │ │ └── TipoAnticipoRule.java │ │ │ │ │ │ │ ├── descuento │ │ │ │ │ │ │ │ ├── FactorRule.java │ │ │ │ │ │ │ │ ├── MontoBaseRule.java │ │ │ │ │ │ │ │ └── TipoDescuentoRule.java │ │ │ │ │ │ │ ├── detalle │ │ │ │ │ │ │ │ ├── IgvTipoRule.java │ │ │ │ │ │ │ │ ├── IscTipoRule.java │ │ │ │ │ │ │ │ ├── PrecioDeReferenciaTipoRule.java │ │ │ │ │ │ │ │ ├── TasaIcbRule.java │ │ │ │ │ │ │ │ ├── TasaIgvRule.java │ │ │ │ │ │ │ │ ├── TasaIscRule.java │ │ │ │ │ │ │ │ └── UnidadDeMedidaRule.java │ │ │ │ │ │ │ ├── summaryDocumentItem │ │ │ │ │ │ │ │ ├── MonedaRule.java │ │ │ │ │ │ │ │ └── TipoOperacionRule.java │ │ │ │ │ │ │ └── voidedDocumentItem │ │ │ │ │ │ │ │ └── TipoComprobanteRule.java │ │ │ │ │ │ └── header │ │ │ │ │ │ │ ├── FechaEmisionRule.java │ │ │ │ │ │ │ ├── FirmanteRule.java │ │ │ │ │ │ │ ├── MonedaRule.java │ │ │ │ │ │ │ ├── ProveedorDireccionRule.java │ │ │ │ │ │ │ ├── TasaIcbRule.java │ │ │ │ │ │ │ ├── TasaIgvRule.java │ │ │ │ │ │ │ ├── TasaIvapRule.java │ │ │ │ │ │ │ ├── TipoDocumentoIdentidadClienteRule.java │ │ │ │ │ │ │ ├── invoice │ │ │ │ │ │ │ ├── DetraccionRule.java │ │ │ │ │ │ │ ├── DireccionDeEntregaRule.java │ │ │ │ │ │ │ ├── FormaDePagoRule.java │ │ │ │ │ │ │ ├── FormaDePagoTipoRule.java │ │ │ │ │ │ │ ├── FormaDePagoTotalRule.java │ │ │ │ │ │ │ ├── PercepcionRule.java │ │ │ │ │ │ │ ├── TipoComprobanteRule.java │ │ │ │ │ │ │ └── TipoOperacionRule.java │ │ │ │ │ │ │ └── note │ │ │ │ │ │ │ ├── ComprobanteAfectadoTipoRule.java │ │ │ │ │ │ │ ├── creditnote │ │ │ │ │ │ │ └── TipoNotaCreditoRule.java │ │ │ │ │ │ │ └── debitnote │ │ │ │ │ │ │ └── TipoNotaDebitoRule.java │ │ │ │ │ ├── process │ │ │ │ │ │ └── body │ │ │ │ │ │ │ └── detalle │ │ │ │ │ │ │ ├── IcbAplicaRule.java │ │ │ │ │ │ │ ├── IcbRule.java │ │ │ │ │ │ │ ├── IgvBaseImponibleRule.java │ │ │ │ │ │ │ ├── IgvRule.java │ │ │ │ │ │ │ ├── IscBaseImponibleRule.java │ │ │ │ │ │ │ ├── IscRule.java │ │ │ │ │ │ │ ├── PrecioDeReferenciaRule.java │ │ │ │ │ │ │ ├── PrecioRule.java │ │ │ │ │ │ │ └── TotalImpuestosRule.java │ │ │ │ │ ├── summary │ │ │ │ │ │ └── header │ │ │ │ │ │ │ ├── LeyendasRule.java │ │ │ │ │ │ │ ├── invoice │ │ │ │ │ │ │ ├── DetraccionRule.java │ │ │ │ │ │ │ ├── PercepcionRule.java │ │ │ │ │ │ │ ├── TotalImporteRule.java │ │ │ │ │ │ │ └── TotalImpuestosRule.java │ │ │ │ │ │ │ └── note │ │ │ │ │ │ │ ├── TotalImporteRule.java │ │ │ │ │ │ │ └── TotalImpuestosRule.java │ │ │ │ │ └── utils │ │ │ │ │ │ ├── DetalleUtils.java │ │ │ │ │ │ ├── Helpers.java │ │ │ │ │ │ └── Impuesto.java │ │ │ │ │ └── ruleunits │ │ │ │ │ ├── BodyRuleContext.java │ │ │ │ │ ├── BodyRuleUnit.java │ │ │ │ │ ├── HeaderRuleContext.java │ │ │ │ │ └── HeaderRuleUnit.java │ │ │ │ ├── renderer │ │ │ │ ├── EngineProducer.java │ │ │ │ └── TemplateProducer.java │ │ │ │ └── signature │ │ │ │ ├── CertificateDetails.java │ │ │ │ ├── CertificateDetailsFactory.java │ │ │ │ ├── XMLSigner.java │ │ │ │ └── XmlSignatureHelper.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── io.github.project.openubl.xbuilder.enricher.kie.RuleFactory │ │ │ └── templates │ │ │ ├── Renderer │ │ │ ├── creditNote.xml │ │ │ ├── debitNote.xml │ │ │ ├── despatchAdvice.xml │ │ │ ├── invoice.xml │ │ │ ├── perception.xml │ │ │ ├── retention.xml │ │ │ ├── summaryDocuments.xml │ │ │ └── voidedDocuments.xml │ │ │ └── ubl │ │ │ ├── common │ │ │ └── signature.xml │ │ │ ├── standard │ │ │ ├── guia │ │ │ │ └── despatch-advice.ftl │ │ │ └── include │ │ │ │ ├── address.xml │ │ │ │ ├── contact.xml │ │ │ │ ├── customer.xml │ │ │ │ ├── document-line.xml │ │ │ │ ├── documentos-relacionados.xml │ │ │ │ ├── general-data.xml │ │ │ │ ├── guias.xml │ │ │ │ ├── monetary-total.xml │ │ │ │ ├── namespaces.xml │ │ │ │ ├── note │ │ │ │ └── invoice-reference.xml │ │ │ │ ├── payment-terms.xml │ │ │ │ ├── supplier.xml │ │ │ │ ├── tax-total.xml │ │ │ │ └── ubl-extensions.xml │ │ │ └── sunat │ │ │ └── include │ │ │ ├── agent-party.xml │ │ │ ├── receiver-party.xml │ │ │ └── supplier.xml │ │ └── test │ │ ├── java │ │ └── e2e │ │ │ ├── AbstractTest.java │ │ │ ├── enricher │ │ │ ├── enrich │ │ │ │ ├── DetalleTest.java │ │ │ │ ├── GeneralDocumentTest.java │ │ │ │ └── InvoiceTest.java │ │ │ └── process │ │ │ │ └── DetalleTest.java │ │ │ ├── homologacion │ │ │ ├── Group1Test.java │ │ │ ├── Group2ExoneradoTest.java │ │ │ ├── Group2InafectoTest.java │ │ │ ├── Group3Test.java │ │ │ ├── Group4Test.java │ │ │ ├── Group5Test.java │ │ │ ├── Group6Test.java │ │ │ ├── Group7Test.java │ │ │ ├── HomologacionConstants.java │ │ │ └── ManualDeHomologación_Version_3_0.pdf │ │ │ └── renderer │ │ │ ├── XMLAssertUtils.java │ │ │ ├── creditnote │ │ │ ├── CreditNoteIscTest.java │ │ │ ├── CreditNoteOrdenDeCompraTest.java │ │ │ └── CreditNoteTest.java │ │ │ ├── debitnote │ │ │ └── DebitNoteTest.java │ │ │ ├── despatchadvice │ │ │ └── DespatchAdviceTest.java │ │ │ ├── invoice │ │ │ ├── InvoiceAnticiposTest.java │ │ │ ├── InvoiceDescuentosTest.java │ │ │ ├── InvoiceDetraccionTest.java │ │ │ ├── InvoiceDireccionEntregaTest.java │ │ │ ├── InvoiceDocumentoRelacionadoTest.java │ │ │ ├── InvoiceFechaVencimientoTest.java │ │ │ ├── InvoiceFormaPagoTest.java │ │ │ ├── InvoiceGuiasTest.java │ │ │ ├── InvoiceIscTest.java │ │ │ ├── InvoiceIssue30Test.java │ │ │ ├── InvoiceMonedaTest.java │ │ │ ├── InvoiceOrdeDeCompraTest.java │ │ │ ├── InvoicePercepcionTest.java │ │ │ ├── InvoiceTest.java │ │ │ └── InvoiceTipoIgvTest.java │ │ │ ├── perception │ │ │ └── PerceptionTest.java │ │ │ ├── retention │ │ │ └── RetentionTest.java │ │ │ ├── summarydocuments │ │ │ └── SummaryDocumentsTest.java │ │ │ └── voideddocument │ │ │ └── VoidedDocumentsTest.java │ │ └── resources │ │ ├── CERTIFICADO CLAVE PRIVADA.key │ │ ├── CERTIFICADO CLAVE PUBLICA SUNAT.cer │ │ ├── LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx │ │ ├── e2e │ │ ├── homologacion │ │ │ ├── Group1Test │ │ │ │ ├── factura1Con3Items.xml │ │ │ │ ├── factura2Con2Items.xml │ │ │ │ ├── factura3Con1Items.xml │ │ │ │ ├── factura4Con5Items.xml │ │ │ │ ├── factura5Con4Items.xml │ │ │ │ ├── notaDeCreditoDeFactura2.xml │ │ │ │ ├── notaDeCreditoDeFactura3.xml │ │ │ │ ├── notaDeCreditoDeFactura4.xml │ │ │ │ ├── notaDeDebitoDeFactura2.xml │ │ │ │ ├── notaDeDebitoDeFactura3.xml │ │ │ │ └── notaDeDebitoDeFactura4.xml │ │ │ ├── Group2ExoneradoTest │ │ │ │ ├── factura1Con1Items.xml │ │ │ │ ├── factura2Con4Items.xml │ │ │ │ ├── factura3Con7Items.xml │ │ │ │ ├── factura4Con5Items.xml │ │ │ │ ├── factura5Con6Items.xml │ │ │ │ ├── notaDeCreditoDeFactura1.xml │ │ │ │ ├── notaDeCreditoDeFactura3.xml │ │ │ │ ├── notaDeCreditoDeFactura5.xml │ │ │ │ ├── notaDeDebitoDeFactura1.xml │ │ │ │ ├── notaDeDebitoDeFactura3.xml │ │ │ │ └── notaDeDebitoDeFactura5.xml │ │ │ ├── Group2InafectoTest │ │ │ │ ├── factura1Con1Items.xml │ │ │ │ ├── factura2Con4Items.xml │ │ │ │ ├── factura3Con7Items.xml │ │ │ │ ├── factura4Con5Items.xml │ │ │ │ ├── factura5Con6Items.xml │ │ │ │ ├── notaDeCreditoDeFactura1.xml │ │ │ │ ├── notaDeCreditoDeFactura3.xml │ │ │ │ ├── notaDeCreditoDeFactura5.xml │ │ │ │ ├── notaDeDebitoDeFactura1.xml │ │ │ │ ├── notaDeDebitoDeFactura3.xml │ │ │ │ └── notaDeDebitoDeFactura5.xml │ │ │ ├── Group3Test │ │ │ │ ├── factura1Con7Items.xml │ │ │ │ ├── factura2Con2Items.xml │ │ │ │ ├── factura3Con5Items.xml │ │ │ │ ├── factura4Con4Items.xml │ │ │ │ └── factura5Con3Items.xml │ │ │ ├── Group4Test │ │ │ │ ├── factura1Con2Items.xml │ │ │ │ ├── factura2Con2Items.xml │ │ │ │ ├── factura3Con4Items.xml │ │ │ │ ├── factura4Con3Items.xml │ │ │ │ ├── factura5Con5Items.xml │ │ │ │ ├── notaDeCreditoDeFactura2.xml │ │ │ │ ├── notaDeCreditoDeFactura3.xml │ │ │ │ ├── notaDeCreditoDeFactura5.xml │ │ │ │ ├── notaDeDebitoDeFactura2.xml │ │ │ │ ├── notaDeDebitoDeFactura3.xml │ │ │ │ └── notaDeDebitoDeFactura5.xml │ │ │ ├── Group5Test │ │ │ │ ├── factura1Con5Items.xml │ │ │ │ ├── notaDeCreditoDeFactura1.xml │ │ │ │ └── notaDeDebitoDeFactura2.xml │ │ │ ├── Group6Test │ │ │ │ ├── factura1Con5Items.xml │ │ │ │ ├── notaDeCreditoDeFactura1.xml │ │ │ │ └── notaDeDebitoDeFactura1.xml │ │ │ └── Group7Test │ │ │ │ ├── factura1Con5Items.xml │ │ │ │ ├── notaDeCreditoDeFactura1.xml │ │ │ │ └── notaDeDebitoDeFactura2.xml │ │ └── renderer │ │ │ ├── creditnote │ │ │ ├── CreditNoteIscTest │ │ │ │ ├── isc_aplicacionAlMontoFijo.xml │ │ │ │ ├── isc_sistemaAlValor.xml │ │ │ │ └── isc_sistemaDePreciosDeVentalAlPublico.xml │ │ │ ├── CreditNoteOrdenDeCompraTest │ │ │ │ └── ordenDeCompra.xml │ │ │ └── CreditNoteTest │ │ │ │ └── MinData_RUC.xml │ │ │ ├── debitnote │ │ │ └── DebitNoteTest │ │ │ │ └── MinData_RUC.xml │ │ │ ├── despatchadvice │ │ │ └── DespatchAdviceTest │ │ │ │ └── minData.xml │ │ │ ├── invoice │ │ │ ├── InvoiceAnticiposTest │ │ │ │ └── minAnticipos.xml │ │ │ ├── InvoiceDescuentosTest │ │ │ │ ├── descuentoGlobal.xml │ │ │ │ ├── descuentoGlobal_tipo02.xml │ │ │ │ └── descuentoGlobal_tipo03.xml │ │ │ ├── InvoiceDetraccionTest │ │ │ │ └── detraccion.xml │ │ │ ├── InvoiceDireccionEntregaTest │ │ │ │ ├── direccionEntregaFull.xml │ │ │ │ └── direccionEntregaMin.xml │ │ │ ├── InvoiceDocumentoRelacionadoTest │ │ │ │ └── documentoRelacionado.xml │ │ │ ├── InvoiceFechaVencimientoTest │ │ │ │ └── conFechaVencimiento.xml │ │ │ ├── InvoiceFormaPagoTest │ │ │ │ ├── conFormaPago.xml │ │ │ │ └── sinFormaPago.xml │ │ │ ├── InvoiceGuiasTest │ │ │ │ └── guiaSerieT.xml │ │ │ ├── InvoiceIscTest │ │ │ │ ├── isc_aplicacionAlMontoFijo.xml │ │ │ │ ├── isc_mixedTipoIgv.xml │ │ │ │ ├── isc_precioConImpuestos.xml │ │ │ │ ├── isc_sistemaAlValor.xml │ │ │ │ └── isc_sistemaDePreciosDeVentalAlPublico.xml │ │ │ ├── InvoiceIssue30Test │ │ │ │ ├── with-precioUnitario-ICB.xml │ │ │ │ ├── with-precioUnitario-conImpuestos-ICB.xml │ │ │ │ ├── with-precioUnitario.xml │ │ │ │ └── with-precioUnitarioConImpuestos.xml │ │ │ ├── InvoiceMonedaTest │ │ │ │ └── customMoneda.xml │ │ │ ├── InvoiceOrdeDeCompraTest │ │ │ │ └── ordenDeCompra.xml │ │ │ ├── InvoicePercepcionTest │ │ │ │ └── percepcion.xml │ │ │ ├── InvoiceTest │ │ │ │ ├── customClienteDireccionAndContacto.xml │ │ │ │ ├── customCodigoLocal.xml │ │ │ │ ├── customFechaEmision.xml │ │ │ │ ├── customFirmante.xml │ │ │ │ ├── customProveedorDireccionAndContacto.xml │ │ │ │ ├── customUnidadMedida.xml │ │ │ │ └── icb.xml │ │ │ └── InvoiceTipoIgvTest │ │ │ │ ├── invoice_pr_EXONERADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_EXONERADO_TRANSFERENCIA_GRATUITA.xml │ │ │ │ ├── invoice_pr_EXPORTACION.xml │ │ │ │ ├── invoice_pr_GRAVADO_BONIFICACIONES.xml │ │ │ │ ├── invoice_pr_GRAVADO_IVAP.xml │ │ │ │ ├── invoice_pr_GRAVADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_GRAVADO_RETIRO.xml │ │ │ │ ├── invoice_pr_GRAVADO_RETIRO_POR_DONACION.xml │ │ │ │ ├── invoice_pr_GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.xml │ │ │ │ ├── invoice_pr_GRAVADO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pr_GRAVADO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pr_INAFECTO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_INAFECTO_RETIRO.xml │ │ │ │ ├── invoice_pr_INAFECTO_RETIRO_POR_BONIFICACION.xml │ │ │ │ ├── invoice_pr_INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.xml │ │ │ │ ├── invoice_pr_INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.xml │ │ │ │ ├── invoice_pr_INAFECTO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pr_INAFECTO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pr_icb_EXONERADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_icb_EXONERADO_TRANSFERENCIA_GRATUITA.xml │ │ │ │ ├── invoice_pr_icb_EXPORTACION.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_BONIFICACIONES.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_IVAP.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_RETIRO.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_RETIRO_POR_DONACION.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pr_icb_GRAVADO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_RETIRO.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_RETIRO_POR_BONIFICACION.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pr_icb_INAFECTO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pr_icb_isc_EXONERADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_icb_isc_EXONERADO_TRANSFERENCIA_GRATUITA.xml │ │ │ │ ├── invoice_pr_icb_isc_EXPORTACION.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_BONIFICACIONES.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_IVAP.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_RETIRO.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_RETIRO_POR_DONACION.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pr_icb_isc_GRAVADO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_RETIRO.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_RETIRO_POR_BONIFICACION.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pr_icb_isc_INAFECTO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pu_EXONERADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pu_EXONERADO_TRANSFERENCIA_GRATUITA.xml │ │ │ │ ├── invoice_pu_EXPORTACION.xml │ │ │ │ ├── invoice_pu_GRAVADO_BONIFICACIONES.xml │ │ │ │ ├── invoice_pu_GRAVADO_IVAP.xml │ │ │ │ ├── invoice_pu_GRAVADO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pu_GRAVADO_RETIRO.xml │ │ │ │ ├── invoice_pu_GRAVADO_RETIRO_POR_DONACION.xml │ │ │ │ ├── invoice_pu_GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.xml │ │ │ │ ├── invoice_pu_GRAVADO_RETIRO_POR_PREMIO.xml │ │ │ │ ├── invoice_pu_GRAVADO_RETIRO_POR_PUBLICIDAD.xml │ │ │ │ ├── invoice_pu_INAFECTO_OPERACION_ONEROSA.xml │ │ │ │ ├── invoice_pu_INAFECTO_RETIRO.xml │ │ │ │ ├── invoice_pu_INAFECTO_RETIRO_POR_BONIFICACION.xml │ │ │ │ ├── invoice_pu_INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.xml │ │ │ │ ├── invoice_pu_INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.xml │ │ │ │ ├── invoice_pu_INAFECTO_RETIRO_POR_PREMIO.xml │ │ │ │ └── invoice_pu_INAFECTO_RETIRO_POR_PUBLICIDAD.xml │ │ │ ├── perception │ │ │ └── PerceptionTest │ │ │ │ └── perception_simple.xml │ │ │ ├── retention │ │ │ └── RetentionTest │ │ │ │ └── retention_simple.xml │ │ │ ├── summarydocuments │ │ │ └── SummaryDocumentsTest │ │ │ │ ├── summaryDocuments.xml │ │ │ │ └── summaryDocuments_anularBoletaExonerada.xml │ │ │ └── voideddocument │ │ │ └── VoidedDocumentsTest │ │ │ ├── voidedDocument.xml │ │ │ ├── voidedDocument_autoGeneratedFechaEmision.xml │ │ │ └── voidedDocument_autoGeneratedTipoComprobante.xml │ │ └── xsd │ │ ├── 2.0 │ │ ├── common │ │ │ ├── CCTS_CCT_SchemaModule-2.0.xsd │ │ │ ├── CodeList_CurrencyCode_ISO_7_04.xsd │ │ │ ├── CodeList_LanguageCode_ISO_7_04.xsd │ │ │ ├── CodeList_MIMEMediaTypeCode_IANA_7_04.xsd │ │ │ ├── CodeList_UnitCode_UNECE_7_04.xsd │ │ │ ├── UBL-CommonAggregateComponents-2.0.xsd │ │ │ ├── UBL-CommonBasicComponents-2.0.xsd │ │ │ ├── UBL-CommonExtensionComponents-2.0.xsd │ │ │ ├── UBL-CoreComponentParameters-2.0.xsd │ │ │ ├── UBL-ExtensionContentDatatype-2.0.xsd │ │ │ ├── UBL-QualifiedDatatypes-2.0.xsd │ │ │ ├── UBLPE-SunatAggregateComponents-1.0.xsd │ │ │ ├── UBLPE-SunatAggregateComponents-1.1.xsd │ │ │ ├── UnqualifiedDataTypeSchemaModule-2.0.xsd │ │ │ └── xmldsig-core-schema.xsd │ │ ├── maindoc │ │ │ ├── UBLPE-ApplicationResponse-1.0.xsd │ │ │ ├── UBLPE-CreditNote-1.0.xsd │ │ │ ├── UBLPE-DebitNote-1.0.xsd │ │ │ ├── UBLPE-Invoice-1.0.xsd │ │ │ ├── UBLPE-Perception-1.0.xsd │ │ │ ├── UBLPE-Retention-1.0.xsd │ │ │ ├── UBLPE-SummaryDocuments-1.0.xsd │ │ │ └── UBLPE-VoidedDocuments-1.0.xsd │ │ ├── message.xml │ │ ├── message.xsl │ │ ├── validateAdditionalInformationSchema-beta.xsl │ │ └── validateAdditionalInformationSchema.xsl │ │ └── 2.1 │ │ ├── common │ │ ├── CCTS_CCT_SchemaModule-2.1.xsd │ │ ├── UBL-CommonAggregateComponents-2.1.xsd │ │ ├── UBL-CommonBasicComponents-2.1.xsd │ │ ├── UBL-CommonExtensionComponents-2.1.xsd │ │ ├── UBL-CommonSignatureComponents-2.1.xsd │ │ ├── UBL-CoreComponentParameters-2.1.xsd │ │ ├── UBL-ExtensionContentDataType-2.1.xsd │ │ ├── UBL-QualifiedDataTypes-2.1.xsd │ │ ├── UBL-SignatureAggregateComponents-2.1.xsd │ │ ├── UBL-SignatureBasicComponents-2.1.xsd │ │ ├── UBL-UnqualifiedDataTypes-2.1.xsd │ │ ├── UBL-XAdESv132-2.1.xsd │ │ ├── UBL-XAdESv141-2.1.xsd │ │ └── UBL-xmldsig-core-schema-2.1.xsd │ │ └── maindoc │ │ ├── UBL-ApplicationResponse-2.1.xsd │ │ ├── UBL-AttachedDocument-2.1.xsd │ │ ├── UBL-AwardedNotification-2.1.xsd │ │ ├── UBL-BillOfLading-2.1.xsd │ │ ├── UBL-CallForTenders-2.1.xsd │ │ ├── UBL-Catalogue-2.1.xsd │ │ ├── UBL-CatalogueDeletion-2.1.xsd │ │ ├── UBL-CatalogueItemSpecificationUpdate-2.1.xsd │ │ ├── UBL-CataloguePricingUpdate-2.1.xsd │ │ ├── UBL-CatalogueRequest-2.1.xsd │ │ ├── UBL-CertificateOfOrigin-2.1.xsd │ │ ├── UBL-ContractAwardNotice-2.1.xsd │ │ ├── UBL-ContractNotice-2.1.xsd │ │ ├── UBL-CreditNote-2.1.xsd │ │ ├── UBL-DebitNote-2.1.xsd │ │ ├── UBL-DespatchAdvice-2.1.xsd │ │ ├── UBL-DocumentStatus-2.1.xsd │ │ ├── UBL-DocumentStatusRequest-2.1.xsd │ │ ├── UBL-ExceptionCriteria-2.1.xsd │ │ ├── UBL-ExceptionNotification-2.1.xsd │ │ ├── UBL-Forecast-2.1.xsd │ │ ├── UBL-ForecastRevision-2.1.xsd │ │ ├── UBL-ForwardingInstructions-2.1.xsd │ │ ├── UBL-FreightInvoice-2.1.xsd │ │ ├── UBL-FulfilmentCancellation-2.1.xsd │ │ ├── UBL-GoodsItemItinerary-2.1.xsd │ │ ├── UBL-GuaranteeCertificate-2.1.xsd │ │ ├── UBL-InstructionForReturns-2.1.xsd │ │ ├── UBL-InventoryReport-2.1.xsd │ │ ├── UBL-Invoice-2.1.xsd │ │ ├── UBL-ItemInformationRequest-2.1.xsd │ │ ├── UBL-Order-2.1.xsd │ │ ├── UBL-OrderCancellation-2.1.xsd │ │ ├── UBL-OrderChange-2.1.xsd │ │ ├── UBL-OrderResponse-2.1.xsd │ │ ├── UBL-OrderResponseSimple-2.1.xsd │ │ ├── UBL-PackingList-2.1.xsd │ │ ├── UBL-PriorInformationNotice-2.1.xsd │ │ ├── UBL-ProductActivity-2.1.xsd │ │ ├── UBL-Quotation-2.1.xsd │ │ ├── UBL-ReceiptAdvice-2.1.xsd │ │ ├── UBL-Reminder-2.1.xsd │ │ ├── UBL-RemittanceAdvice-2.1.xsd │ │ ├── UBL-RequestForQuotation-2.1.xsd │ │ ├── UBL-RetailEvent-2.1.xsd │ │ ├── UBL-SelfBilledCreditNote-2.1.xsd │ │ ├── UBL-SelfBilledInvoice-2.1.xsd │ │ ├── UBL-Statement-2.1.xsd │ │ ├── UBL-StockAvailabilityReport-2.1.xsd │ │ ├── UBL-Tender-2.1.xsd │ │ ├── UBL-TenderReceipt-2.1.xsd │ │ ├── UBL-TendererQualification-2.1.xsd │ │ ├── UBL-TradeItemLocationProfile-2.1.xsd │ │ ├── UBL-TransportExecutionPlan-2.1.xsd │ │ ├── UBL-TransportExecutionPlanRequest-2.1.xsd │ │ ├── UBL-TransportProgressStatus-2.1.xsd │ │ ├── UBL-TransportProgressStatusRequest-2.1.xsd │ │ ├── UBL-TransportServiceDescription-2.1.xsd │ │ ├── UBL-TransportServiceDescriptionRequest-2.1.xsd │ │ ├── UBL-TransportationStatus-2.1.xsd │ │ ├── UBL-TransportationStatusRequest-2.1.xsd │ │ ├── UBL-UnawardedNotification-2.1.xsd │ │ ├── UBL-UtilityStatement-2.1.xsd │ │ └── UBL-Waybill-2.1.xsd ├── pom.xml └── quarkus-extension │ ├── deployment │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quarkus │ │ │ └── xbuilder │ │ │ └── deployment │ │ │ └── QuarkusXbuilderProcessor.java │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── quarkus │ │ └── xbuilder │ │ └── test │ │ ├── QuarkusXbuilderDevModeTest.java │ │ └── QuarkusXbuilderTest.java │ ├── integration-tests │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── project │ │ │ │ └── openubl │ │ │ │ └── quarkus │ │ │ │ └── xbuilder │ │ │ │ └── it │ │ │ │ └── QuarkusXbuilderResource.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quarkus │ │ │ └── xbuilder │ │ │ └── it │ │ │ ├── QuarkusXbuilderResourceIT.java │ │ │ └── QuarkusXbuilderResourceTest.java │ │ └── resources │ │ └── .gitignore │ ├── pom.xml │ └── runtime │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── quarkus │ │ └── xbuilder │ │ ├── XBuilder.java │ │ └── runtime │ │ ├── CustomTemplateLocator.java │ │ ├── DefaultXBuilder.java │ │ └── XBuilderConfig.java │ └── resources │ └── META-INF │ └── quarkus-extension.yaml └── xsender ├── core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── xsender │ │ │ ├── Constants.java │ │ │ ├── camel │ │ │ ├── StandaloneCamel.java │ │ │ ├── routes │ │ │ │ ├── CxfEndpointConfiguration.java │ │ │ │ ├── RestSunatErrorResponseProcessor.java │ │ │ │ ├── RestSunatResponseProcessor.java │ │ │ │ ├── SoapSunatErrorResponseProcessor.java │ │ │ │ ├── SoapSunatResponseProcessor.java │ │ │ │ ├── SunatRouteBuilder.java │ │ │ │ └── TicketResponseType.java │ │ │ └── utils │ │ │ │ ├── CamelData.java │ │ │ │ └── CamelUtils.java │ │ │ ├── company │ │ │ ├── CompanyCredentials.java │ │ │ └── CompanyURLs.java │ │ │ ├── files │ │ │ ├── BillServiceFileAnalyzer.java │ │ │ ├── BillServiceXMLFileAnalyzer.java │ │ │ ├── ZipFile.java │ │ │ ├── exceptions │ │ │ │ └── UnsupportedXMLFileException.java │ │ │ └── xml │ │ │ │ ├── DocumentType.java │ │ │ │ ├── XmlContent.java │ │ │ │ ├── XmlContentProvider.java │ │ │ │ └── XmlHandler.java │ │ │ ├── models │ │ │ ├── Metadata.java │ │ │ ├── Status.java │ │ │ ├── Sunat.java │ │ │ ├── SunatResponse.java │ │ │ └── rest │ │ │ │ ├── PayloadDocumentDto.java │ │ │ │ ├── ResponseAccessTokenSuccessDto.java │ │ │ │ ├── ResponseDocumentErrorDto.java │ │ │ │ └── ResponseDocumentSuccessDto.java │ │ │ ├── sunat │ │ │ ├── BillConsultServiceDestination.java │ │ │ ├── BillServiceDestination.java │ │ │ ├── BillValidServiceDestination.java │ │ │ └── catalog │ │ │ │ └── Catalog1.java │ │ │ └── utils │ │ │ ├── ByteUtils.java │ │ │ └── CdrReader.java │ └── resources │ │ ├── application.properties │ │ └── wsdl │ │ ├── billConsultService.wsdl │ │ ├── billService.wsdl │ │ └── billValidService.wsdl │ └── test │ ├── java │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── xsender │ │ ├── camel │ │ ├── ApiCredentialsTest.java │ │ └── SendBillTest.java │ │ ├── files │ │ ├── XMLBillServiceFileAnalyzerTest.java │ │ └── xml │ │ │ └── XmlContentProviderTest.java │ │ └── sunat │ │ └── catalog │ │ └── Catalog1Test.java │ └── resources │ ├── ubl │ ├── 12345678912-01-F001-1.xml │ ├── 12345678912-01-F001-1_alterado.xml │ ├── 12345678912-01-F001-1_observado.xml │ ├── 12345678912-01-F001-2.xml │ ├── 12345678912-RA-20200328-1.xml │ ├── 12345678912-RR-20200328-1.xml │ ├── 20000000001-31-VVV1-1.xml │ ├── 20494637074-20-R001-00000001.xml │ ├── 20494637074-T001-00007394.xml │ ├── 20603233591-03-B007-00000049.xml │ └── cdr │ │ ├── R-12345678901-01-F001-00000587.xml │ │ └── R-20220557805-01-F001-22Openubl.XML │ └── xmls │ ├── credit-note.xml │ ├── credit-note_boleta.xml │ ├── credit-note_factura.xml │ ├── debit-note.xml │ ├── debit-note_boleta.xml │ ├── debit-note_factura.xml │ ├── despatch-advice-T.xml │ ├── despatch-advice-V.xml │ ├── invoice.xml │ ├── invoice_boleta.xml │ ├── invoice_factura.xml │ ├── invoice_with_zerosInID.xml │ ├── perception.xml │ ├── retention.xml │ ├── summary-document.xml │ ├── voided-document.xml │ ├── voided-document_boleta.xml │ └── voided-document_factura.xml ├── pom.xml ├── quarkus-extension ├── deployment │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── quarkus │ │ │ └── xsender │ │ │ └── deployment │ │ │ └── QuarkusXsenderProcessor.java │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── quarkus │ │ └── xsender │ │ └── test │ │ ├── QuarkusXsenderDevModeTest.java │ │ └── QuarkusXsenderTest.java ├── integration-tests │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── project │ │ │ │ └── openubl │ │ │ │ └── quarkus │ │ │ │ └── xsender │ │ │ │ └── it │ │ │ │ └── QuarkusXSenderResource.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── xmls │ │ │ ├── 12345678912-01-F001-1.xml │ │ │ ├── 12345678912-RA-20200328-1.xml │ │ │ └── 20000000001-31-VVV1-1.xml │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── quarkus │ │ └── xsender │ │ └── it │ │ ├── QuarkusSenderResourceIT.java │ │ └── QuarkusXSenderResourceTest.java ├── pom.xml └── runtime │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── project │ │ └── openubl │ │ └── quarkus │ │ └── xsender │ │ ├── XSender.java │ │ └── runtime │ │ └── XSenderConfig.java │ └── resources │ └── META-INF │ └── quarkus-extension.yaml └── spring-boot-extension ├── integration-tests ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── project │ │ │ └── openubl │ │ │ └── springboot │ │ │ └── xsender │ │ │ └── it │ │ │ ├── Application.java │ │ │ └── SpringBootXSenderResource.java │ └── resources │ │ ├── application.properties │ │ └── xmls │ │ ├── 12345678912-01-F001-1.xml │ │ ├── 12345678912-RA-20200328-1.xml │ │ └── 20000000001-31-VVV1-1.xml │ └── test │ └── java │ └── io │ └── github │ └── project │ └── openubl │ └── quarkus │ └── xsender │ └── it │ └── SpringBootXSenderResourceTest.java ├── pom.xml └── runtime ├── pom.xml └── src └── main └── java └── io └── github └── project └── openubl └── spring └── xsender └── runtime └── XSenderSpringSetup.java /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xhandler", 3 | "image": "mcr.microsoft.com/devcontainers/java:17-bullseye", 4 | "features": { 5 | "ghcr.io/devcontainers/features/java:1": { 6 | "version": "17", 7 | "installMaven": "true", 8 | "installGradle": "false" 9 | }, 10 | "ghcr.io/devcontainers/features/docker-in-docker:2": {} 11 | }, 12 | "postCreateCommand": "echo \"source /usr/share/bash-completion/completions/git\" >> ~/.bashrc", 13 | "customizations": { 14 | "vscode": { 15 | "settings": { 16 | "java.compile.nullAnalysis.mode": "automatic" 17 | }, 18 | "extensions": [ 19 | "vscjava.vscode-java-pack", 20 | "github.vscode-github-actions", 21 | "github.vscode-pull-request-github" 22 | ] 23 | }, 24 | "codespaces": { 25 | "openFiles": [ 26 | "README.md" 27 | ] 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [carlosthe19916] 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | # Maintain dependencies for GitHub Actions 5 | - package-ecosystem: "github-actions" 6 | directory: "/" 7 | schedule: 8 | interval: "weekly" 9 | commit-message: 10 | prefix: "GitHub Actions" 11 | include: "scope" 12 | # Maintain dependencies for pom.xml 13 | - package-ecosystem: "maven" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | commit-message: 18 | prefix: "Maven pom.xml" 19 | include: "scope" 20 | -------------------------------------------------------------------------------- /.github/workflows/backport.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request_target: 3 | types: [ "labeled", "closed" ] 4 | 5 | jobs: 6 | backport: 7 | name: Backport PR 8 | runs-on: ubuntu-latest 9 | if: | 10 | github.event.pull_request.merged == true 11 | && contains(github.event.pull_request.labels.*.name, 'auto-backport') 12 | && ( 13 | (github.event.action == 'labeled' && github.event.label.name == 'auto-backport') 14 | || (github.event.action == 'closed') 15 | ) 16 | steps: 17 | - name: Backport Action 18 | uses: sqren/backport-github-action@v9.5.1 19 | with: 20 | github_token: ${{ secrets.GITHUB_TOKEN }} 21 | auto_backport_label_prefix: auto-backport-to- 22 | add_original_reviewers: true 23 | 24 | - name: Info log 25 | if: ${{ success() }} 26 | run: cat ~/.backport/backport.info.log 27 | 28 | - name: Debug log 29 | if: ${{ failure() }} 30 | run: cat ~/.backport/backport.debug.log -------------------------------------------------------------------------------- /.github/workflows/sonar.yml: -------------------------------------------------------------------------------- 1 | name: Sonar 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | env: 9 | CI: true 10 | 11 | jobs: 12 | code-scan: 13 | name: Code Scan 14 | if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'project-openubl' }} 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | - uses: actions/setup-java@v4 19 | with: 20 | distribution: "temurin" 21 | java-version: 17 22 | cache: maven 23 | - name: Build with Maven and Coverage/Sonar 24 | run: mvn verify -P coverage,sonar 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.versionsBackup 2 | 3 | # Intellij 4 | ################### 5 | .idea 6 | *.iml 7 | 8 | # Eclipse # 9 | ########### 10 | .project 11 | .settings 12 | .classpath 13 | .factorypath 14 | 15 | # NetBeans # 16 | ############ 17 | nbactions.xml 18 | nb-configuration.xml 19 | catalog.xml 20 | nbproject 21 | 22 | # Compiled source # 23 | ################### 24 | *.com 25 | *.class 26 | *.dll 27 | *.exe 28 | *.o 29 | *.so 30 | 31 | # Packages # 32 | ############ 33 | # it's better to unpack these files and commit the raw source 34 | # git has its own built in compression methods 35 | *.7z 36 | *.dmg 37 | *.gz 38 | *.iso 39 | *.jar 40 | *.rar 41 | *.tar 42 | *.zip 43 | 44 | # Logs and databases # 45 | ###################### 46 | *.log 47 | 48 | # Maven # 49 | ######### 50 | target 51 | 52 | # Maven shade 53 | ############# 54 | *dependency-reduced-pom.xml 55 | 56 | /lsp/ 57 | bin/ -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "interactive" 3 | } -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | As an open source project we do not support any version 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Create an issue or even better a Pull Request fixing the vulnerability 10 | -------------------------------------------------------------------------------- /examples/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | io.github.project-openubl 8 | xhandler-parent 9 | 5.0.3-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | examples-parent 14 | Examples - Parent 15 | Examples parent 16 | pom 17 | 18 | 19 | xbuilder 20 | xsender 21 | wildfly 22 | tomcat 23 | springbot 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.apache.maven.plugins 31 | maven-war-plugin 32 | 3.4.0 33 | 34 | false 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /examples/springbot/README.md: -------------------------------------------------------------------------------- 1 | ## Demo XBuilder and XSender using Spring Boot 2 | 3 | Download this repository and execute 4 | 5 | ```shell 6 | mvn spring-boot:run 7 | ``` 8 | 9 | ### Use the demo 10 | 11 | Open [http://localhost:8080](http://localhost:8080) 12 | 13 | ![Screenshot](./screenshot.png) 14 | -------------------------------------------------------------------------------- /examples/springbot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/examples/springbot/screenshot.png -------------------------------------------------------------------------------- /examples/springbot/src/main/java/io/github/project/openubl/quickstart/xbuilder/springboot/Application.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quickstart.xbuilder.springboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ComponentScan; 6 | 7 | @ComponentScan 8 | @ComponentScan("io.github.project.openubl.spring.xsender.runtime") 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Application.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /examples/springbot/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/examples/springbot/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx -------------------------------------------------------------------------------- /examples/springbot/src/main/webapp/css/styles.css: -------------------------------------------------------------------------------- 1 | .invalid { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /examples/tomcat/.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | bin/ 6 | 7 | # IntelliJ 8 | .idea 9 | *.ipr 10 | *.iml 11 | *.iws 12 | 13 | # NetBeans 14 | nb-configuration.xml 15 | 16 | # Visual Studio Code 17 | .vscode 18 | 19 | # OSX 20 | .DS_Store 21 | 22 | # Vim 23 | *.swp 24 | *.swo 25 | 26 | # patch 27 | *.orig 28 | *.rej 29 | 30 | # Maven 31 | target/ 32 | pom.xml.tag 33 | pom.xml.releaseBackup 34 | pom.xml.versionsBackup 35 | release.properties 36 | 37 | workspace/ -------------------------------------------------------------------------------- /examples/tomcat/README.md: -------------------------------------------------------------------------------- 1 | ## Deploy 2 | 3 | - Compile the application 4 | 5 | ```shell 6 | mvn clean package 7 | ``` 8 | 9 | - Use Cargo to download and deploy it to Tomcat 10 | 11 | ```shell 12 | mvn cargo:run 13 | ``` 14 | 15 | - Open http://localhost:8080/tomcat-xbuilder-xsender/ 16 | 17 | -------------------------------------------------------------------------------- /examples/tomcat/quickstart.sh: -------------------------------------------------------------------------------- 1 | # Generate .war 2 | mvn clean package 3 | 4 | # Download Tomcat 5 | rm -rf workspace/ 6 | #wget https://repo1.maven.org/maven2/org/apache/tomcat/tomcat/9.0.46/tomcat-9.0.46.zip -P workspace/ 7 | wget https://repo1.maven.org/maven2/org/apache/tomcat/tomcat/10.1.8/tomcat-10.1.8.zip -P workspace/ 8 | #unzip workspace/tomcat-9.0.46.zip -d workspace/ 9 | unzip workspace/tomcat-10.1.8.zip -d workspace/ 10 | #chmod +x -R ./workspace/apache-tomcat-9.0.46/bin 11 | chmod +x -R ./workspace/apache-tomcat-10.1.8/bin 12 | 13 | # Copy .war to Tomcat 14 | #cp target/tomcat-xbuilder-xsender-0.0.1-SNAPSHOT.war workspace/apache-tomcat-9.0.46/webapps/demo.war 15 | cp target/tomcat-xbuilder-xsender-0.0.1-SNAPSHOT.war workspace/apache-tomcat-10.1.8/webapps/demo.war 16 | 17 | # Start Tomcat 18 | #./workspace/apache-tomcat-9.0.46/bin/startup.sh 19 | ./workspace/apache-tomcat-10.1.8/bin/startup.sh 20 | 21 | sleep 10s 22 | -------------------------------------------------------------------------------- /examples/tomcat/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/examples/tomcat/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx -------------------------------------------------------------------------------- /examples/tomcat/src/main/webapp/WEB-INF /web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/tomcat/src/main/webapp/css/styles.css: -------------------------------------------------------------------------------- 1 | .invalid { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /examples/wildfly/README.md: -------------------------------------------------------------------------------- 1 | Steps: 2 | 3 | ## Init Wildfly 4 | 5 | ```shell 6 | mvn wildfly:start -f xbuilder-jee-vanilla/ 7 | ``` 8 | 9 | ## Deploy your app 10 | 11 | ```shell 12 | mvn wildfly:deploy -f xbuilder-jee-vanilla/ 13 | ``` 14 | 15 | ## Open browser 16 | 17 | - Open [http://localhost:8080/xbuilder-jee-vanilla](http://localhost:8080/xbuilder-jee-vanilla) 18 | -------------------------------------------------------------------------------- /examples/wildfly/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/examples/wildfly/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx -------------------------------------------------------------------------------- /examples/wildfly/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /examples/wildfly/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | 9 | javax.ws.rs.core.Application 10 | /api/* 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/wildfly/src/main/webapp/css/styles.css: -------------------------------------------------------------------------------- 1 | .invalid { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /examples/xbuilder/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github.project-openubl 8 | examples-parent 9 | 5.0.3-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | xbuilder-example 14 | Examples - XBuilder 15 | 16 | 17 | 18 | io.github.project-openubl 19 | xbuilder 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/xbuilder/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/examples/xbuilder/src/main/resources/LLAMA-PE-CERTIFICADO-DEMO-12345678912.pfx -------------------------------------------------------------------------------- /examples/xsender/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github.project-openubl 8 | examples-parent 9 | 5.0.3-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | xsender-example 14 | Examples - XSender 15 | 16 | 17 | 18 | io.github.project-openubl 19 | xsender 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/jreleaser/templates/article/release.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{projectNameCapitalized}} {{projectEffectiveVersion}} released! 3 | description: {{projectEffectiveVersion}} es el último release. 4 | date: {{#f_now}}YYYY-MM-dd{{/f_now}} 5 | authors: [carlosthe19916] 6 | tags: [xbuilder, release] 7 | --- 8 | 9 | Acabamos de lanzar {{projectNameCapitalized}} {{projectEffectiveVersion}} con un conjunto de nuevas funcionalidades, corrección de errores, y mejor documentación. 10 | 11 | ## Full changelog 12 | 13 | Puedes ver [the full changelog of {{projectEffectiveVersion}} on GitHub]({{releaseNotesUrl}}). 14 | -------------------------------------------------------------------------------- /tools/copyright.txt: -------------------------------------------------------------------------------- 1 | Copyright 2019 Project OpenUBL, Inc. and/or its affiliates 2 | and other contributors as indicated by the @author tags. 3 | 4 | Licensed under the Apache License - 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | import java.util.Optional; 4 | import java.util.function.Supplier; 5 | import java.util.stream.Stream; 6 | 7 | public interface Catalog { 8 | Supplier invalidCatalogValue = (Supplier) () -> 9 | new IllegalStateException("No se pudo convertir el valor del catálogo"); 10 | 11 | /** 12 | * @param Class you want to search for 13 | * @param enumType class you want to search for 14 | * @param code the code or Enum value 15 | * @return an instance of Catalog which is equal to ValueOf or contains the same code 16 | */ 17 | static Optional valueOfCode(Class enumType, String code) { 18 | return Stream 19 | .of(enumType.getEnumConstants()) 20 | .filter(p -> p.toString().equalsIgnoreCase(code) || p.getCode().equals(code)) 21 | .findFirst(); 22 | } 23 | 24 | String getCode(); 25 | } 26 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | import java.util.Optional; 4 | import java.util.stream.Stream; 5 | 6 | public enum Catalog1 implements Catalog { 7 | FACTURA("01"), 8 | BOLETA("03"), 9 | NOTA_CREDITO("07"), 10 | NOTA_DEBITO("08"), 11 | GUIA_REMISION_REMITENTE("09"), 12 | TICKET_MAQUINA_REGISTRADORA("12"), 13 | DOCUMENTOS_FINANCIEROS("13"), 14 | DOCUMENTOS_AFP("18"), 15 | GUIA_REMISION_TRANSPORTISTA("31"), 16 | COMPROBANTE_PAGO_SEAE("56"), 17 | GUIA_REMISION_REMITENTE_COMPLEMENTARIA("71"), 18 | GUIA_REMISION_TRANSPORTISTA_COMPLEMENTARIA("72"), 19 | 20 | RETENCION("20"), 21 | PERCEPCION("40"), 22 | PERCEPCION_VENTA_INTERNA("21"); 23 | 24 | private final String code; 25 | 26 | Catalog1(String code) { 27 | this.code = code; 28 | } 29 | 30 | public static Optional valueOfCode(String code) { 31 | return Stream.of(Catalog1.values()).filter(p -> p.code.equals(code)).findFirst(); 32 | } 33 | 34 | @Override 35 | public String getCode() { 36 | return code; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog10.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog10 implements Catalog { 4 | INTERES_POR_MORA("01"), 5 | AUMENTO_EN_EL_VALOR("02"), 6 | PENALIDAD_OTROS_CONCEPTOS("03"); 7 | 8 | private final String code; 9 | 10 | Catalog10(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog12 implements Catalog { 4 | FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC("01"), 5 | FACTURA_EMITIDA_POR_ANTICIPOS("02"), 6 | BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS("03"), 7 | TICKET_DE_SALIDA("04"), 8 | CODIGO_SCOP("05"), 9 | FACTURA_ELECTRONICA_REMITENTE("06"), 10 | GUIA_DE_REMISION_REMITENTE("07"), 11 | DECLARACION_DE_SALIDA_DEL_DEPOSITO_FRANCO("08"), 12 | DECLARACION_SIMPLIFICADA_DE_IMPORTACION("09"), 13 | LIQUIDACION_DE_COMPRA_EMITIDA_POR_ANTICIPOS("10"), 14 | OTROS("99"); 15 | 16 | private final String code; 17 | 18 | Catalog12(String code) { 19 | this.code = code; 20 | } 21 | 22 | @Override 23 | public String getCode() { 24 | return code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Anticipo.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog12_Anticipo implements Catalog { 4 | FACTURA_EMITIDA_POR_ANTICIPOS("02"), 5 | BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS("03"); 6 | 7 | private final String code; 8 | 9 | Catalog12_Anticipo(String code) { 10 | this.code = code; 11 | } 12 | 13 | @Override 14 | public String getCode() { 15 | return code; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_BoletaFactura.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog12_Doc_Trib_Relacionado_BoletaFactura implements Catalog { 4 | TICKET_DE_SALIDA("04"), 5 | CODIGO_SCOP("05"), 6 | FACTURA_ELECTRONICA_REMITENTE("06"), 7 | GUIA_DE_REMISION_REMITENTE("07"), 8 | DECLARACION_DE_SALIDA_DEL_DEPOSITO_FRANCO("08"), 9 | DECLARACION_SIMPLIFICADA_DE_IMPORTACION("09"), 10 | OTROS("99"); 11 | 12 | private final String code; 13 | 14 | Catalog12_Doc_Trib_Relacionado_BoletaFactura(String code) { 15 | this.code = code; 16 | } 17 | 18 | @Override 19 | public String getCode() { 20 | return code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaCredito.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog12_Doc_Trib_Relacionado_NotaCredito implements Catalog { 4 | FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC("01"), 5 | TICKET_DE_SALIDA("04"), 6 | CODIGO_SCOP("05"), 7 | OTROS("99"); 8 | 9 | private final String code; 10 | 11 | Catalog12_Doc_Trib_Relacionado_NotaCredito(String code) { 12 | this.code = code; 13 | } 14 | 15 | @Override 16 | public String getCode() { 17 | return code; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaDebito.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog12_Doc_Trib_Relacionado_NotaDebito implements Catalog { 4 | TICKET_DE_SALIDA("04"), 5 | CODIGO_SCOP("05"), 6 | OTROS("99"); 7 | 8 | private final String code; 9 | 10 | Catalog12_Doc_Trib_Relacionado_NotaDebito(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog16.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog16 implements Catalog { 4 | PRECIO_UNITARIO_INCLUYE_IGV("01"), 5 | VALOR_REFERENCIAL_UNITARIO_EN_OPERACIONES_NO_ONEROSAS("02"); 6 | 7 | private final String code; 8 | 9 | Catalog16(String code) { 10 | this.code = code; 11 | } 12 | 13 | @Override 14 | public String getCode() { 15 | return code; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog18.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog18 implements Catalog { 4 | TRANSPORTE_PUBLICO("01"), 5 | TRANSPORTE_PRIVADO("02"); 6 | 7 | private final String code; 8 | 9 | Catalog18(String code) { 10 | this.code = code; 11 | } 12 | 13 | @Override 14 | public String getCode() { 15 | return code; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog19.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog19 implements Catalog { 4 | ADICIONAR("1"), 5 | MODIFICAR("2"), 6 | ANULADO("3"); 7 | 8 | private final String code; 9 | 10 | Catalog19(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Guia.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | import java.util.Optional; 4 | import java.util.stream.Stream; 5 | 6 | public enum Catalog1_Guia implements Catalog { 7 | GUIA_REMISION_REMITENTE("09"), 8 | GUIA_REMISION_TRANSPORTISTA("31"); 9 | 10 | private final String code; 11 | 12 | Catalog1_Guia(String code) { 13 | this.code = code; 14 | } 15 | 16 | public static Optional valueOfCode(String code) { 17 | return Stream.of(Catalog1_Guia.values()).filter(p -> p.code.equals(code)).findFirst(); 18 | } 19 | 20 | @Override 21 | public String getCode() { 22 | return code; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Invoice.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog1_Invoice implements Catalog { 4 | FACTURA("01"), 5 | BOLETA("03"); 6 | 7 | private final String code; 8 | 9 | Catalog1_Invoice(String code) { 10 | this.code = code; 11 | } 12 | 13 | @Override 14 | public String getCode() { 15 | return code; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog20.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog20 implements Catalog { 4 | VENTA("01"), 5 | VENTA_SUJETA_A_CONFIRMACION_DEL_COMPRADOR("14"), 6 | COMPRA("02"), 7 | TRASLADO_ENTRE_ESTABLECIMIENTOS_DE_LA_MISMA_EMPRESA("04"), 8 | TRASLADO_EMISOR_ITINERANTE_CP("18"), 9 | IMPORTACION("08"), 10 | EXPORTACION("09"), 11 | TRASLADO_A_ZONA_PRIMARIA("19"), 12 | OTROS("13"); 13 | 14 | private final String code; 15 | 16 | Catalog20(String code) { 17 | this.code = code; 18 | } 19 | 20 | @Override 21 | public String getCode() { 22 | return code; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog21.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog21 implements Catalog { 4 | NUMERACION_DAM("01"), 5 | NUMERO_DE_ORDEN_DE_ENTREGA("02"), 6 | NUMERO_SCOP("03"), 7 | NUMERO_DE_MANIFIESTO_DE_CARGA("04"), 8 | NUMERO_DE_CONSTANCIA_DE_DETRACCION("05"), 9 | OTROS("06"); 10 | 11 | private final String code; 12 | 13 | Catalog21(String code) { 14 | this.code = code; 15 | } 16 | 17 | @Override 18 | public String getCode() { 19 | return code; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog22.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public enum Catalog22 implements Catalog { 6 | VENTA_INTERNA("01", BigDecimal.valueOf(2)), 7 | ADQUISICION_DE_COMBUSTIBLE("02", BigDecimal.valueOf(1)), 8 | AGENTE_DE_PERCEPCION_CON_TASA_ESPECIAL("03", BigDecimal.valueOf(0.5)); 9 | 10 | private final String code; 11 | private final BigDecimal percent; 12 | 13 | Catalog22(String code, BigDecimal percent) { 14 | this.code = code; 15 | this.percent = percent; 16 | } 17 | 18 | @Override 19 | public String getCode() { 20 | return code; 21 | } 22 | 23 | public BigDecimal getPercent() { 24 | return percent; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog23.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public enum Catalog23 implements Catalog { 6 | TASA_TRES("01", BigDecimal.valueOf(3)); 7 | 8 | private final String code; 9 | private final BigDecimal percent; 10 | 11 | Catalog23(String code, BigDecimal percent) { 12 | this.code = code; 13 | this.percent = percent; 14 | } 15 | 16 | @Override 17 | public String getCode() { 18 | return code; 19 | } 20 | 21 | public BigDecimal getPercent() { 22 | return percent; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog5.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog5 implements Catalog { 4 | IGV("1000", "VAT", "S", "IGV"), 5 | IMPUESTO_ARROZ_PILADO("1016", "VAT", "S", "IVAP"), 6 | ISC("2000", "EXC", "S", "ISC"), 7 | EXPORTACION("9995", "FRE", "S", "EXP"), 8 | GRATUITO("9996", "FRE", "S", "GRA"), 9 | EXONERADO("9997", "VAT", "S", "EXO"), 10 | INAFECTO("9998", "FRE", "S", "INA"), 11 | ICBPER("7152", "OTH", "S", "ICBPER"), 12 | OTROS("9999", "OTH", "S", "OTROS"); 13 | 14 | private final String code; 15 | private final String tipo; 16 | private final String categoria; 17 | private final String nombre; 18 | 19 | Catalog5(String code, String tipo, String categoria, String nombre) { 20 | this.code = code; 21 | this.tipo = tipo; 22 | this.categoria = categoria; 23 | this.nombre = nombre; 24 | } 25 | 26 | @Override 27 | public String getCode() { 28 | return code; 29 | } 30 | 31 | public String getTipo() { 32 | return tipo; 33 | } 34 | 35 | public String getCategoria() { 36 | return categoria; 37 | } 38 | 39 | public String getNombre() { 40 | return nombre; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog51.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog51 implements Catalog { 4 | VENTA_INTERNA("0101"), 5 | OPERACION_SUJETA_A_DETRACCION("1001"), 6 | OPERACION_SUJETA_A_PERCEPCION("2001"); 7 | 8 | private final String code; 9 | 10 | Catalog51(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog52.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog52 implements Catalog { 4 | MONTO_EN_LETRAS("1000", "MONTO EN LETRAS"), 5 | COMPROBANTE_DE_PERCEPCION("2000", "COMPROBANTE DE PERCEPCION"), 6 | VENTA_REALIZADA_POR_EMISOR_ITINERANTE("2005", "VENTA REALIZADA POR EMISOR ITINERANTE"), 7 | OPERACION_SUJETA_A_DETRACCION("2006", "OPERACION SUJETA A DETRACCION"); 8 | 9 | private final String code; 10 | private final String label; 11 | 12 | Catalog52(String code, String label) { 13 | this.code = code; 14 | this.label = label; 15 | } 16 | 17 | @Override 18 | public String getCode() { 19 | return code; 20 | } 21 | 22 | public String getLabel() { 23 | return label; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog53 implements Catalog { 4 | DESCUENTO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("00"), 5 | DESCUENTO_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("01"), 6 | DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP("02"), 7 | DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("03"), 8 | DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP("04"), 9 | DESCUENTO_GLOBAL_POR_ANTICIPOS_EXONERADOS("05"), 10 | DESCUENTO_GLOBAL_POR_ANTICIPOS_INAFECTOS("06"), 11 | FACTOR_DE_COMPENSACION("07"), 12 | ANTICIPO_DE_ISC("20"), 13 | FISE("45"), 14 | RECARGO_AL_CONSUMO_Y_O_PROPINAS("46"), 15 | CARGOS_QUE_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("47"), 16 | CARGOS_QUE_NO_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("48"), 17 | CARGOS_GLOBALES_QUE_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("49"), 18 | CARGOS_GLOBALES_QUE_NO_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("50"), 19 | PERCEPCION_VENTA_INTERNA("51"), 20 | PERCEPCION_A_LA_ADQUISICION_DE_COMBUSTIBLE("52"), 21 | PERCEPCION_REALIZADA_AL_AGENTE_DE_PERCEPCION_CON_TASA_ESPECIAL("53"), 22 | FACTOR_DE_APORTACION("54"), 23 | RETENCION_DE_RENTA_POR_ANTICIPOS("61"), 24 | RETENCION_DEL_IGV("62"), 25 | RETENCION_DE_RENTA_DE_SEGUNDA_CATEGORIA("62"); 26 | 27 | private final String code; 28 | 29 | Catalog53(String code) { 30 | this.code = code; 31 | } 32 | 33 | @Override 34 | public String getCode() { 35 | return code; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_Anticipo.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog53_Anticipo implements Catalog { 4 | DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP("04"), 5 | DESCUENTO_GLOBAL_POR_ANTICIPOS_EXONERADOS("05"), 6 | DESCUENTO_GLOBAL_POR_ANTICIPOS_INAFECTOS("06"); 7 | 8 | private final String code; 9 | 10 | Catalog53_Anticipo(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_DescuentoGlobal.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog53_DescuentoGlobal implements Catalog { 4 | DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP("02"), 5 | DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("03"); 6 | 7 | private final String code; 8 | 9 | Catalog53_DescuentoGlobal(String code) { 10 | this.code = code; 11 | } 12 | 13 | @Override 14 | public String getCode() { 15 | return code; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog54.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog54 implements Catalog { 4 | AZUCAR("001"), 5 | ALCOHOL_ETILICO("003"), 6 | RECURSOS_HIDROBIOLOGICOS("004"); 7 | 8 | private final String code; 9 | 10 | Catalog54(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog59.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog59 implements Catalog { 4 | DEPOSITO_EN_CUENTA("001"), 5 | GIRO("002"), 6 | TRANSFERENCIA_DE_FONDOS("003"), 7 | ORDEN_DE_PAGO("004"), 8 | TARJETA_DE_DEBITO("005"), 9 | TARJETA_DE_CREDITO_EMITIDA_EN_EL_PAIS_POR_UNA_EMPRESA_DEL_SISTEMA_FINANCIERO("006"), 10 | CHEQUES_CON_LA_CLAUSULA_DE_NONEGOCIABLE_INTRANSFERIBLE_NOALAORDEN_U_OTRA_EQUIVALENTE("007"), 11 | EFECTIVO_POR_OPERACIONES_EN_LAS_QUE_NO_EXISTE_OBLIGACION_DE_UTILIZAR_MEDIO_DE_PAGO("008"), 12 | EFECTIVO_EN_LOS_DEMAS_CASOS("009"), 13 | MEDIOS_DE_PAGO_USADOS_EN_COMERCIO_EXTERIOR("010"), 14 | DOCUMENTOS_EMITIDOS_POR_LAS_EDPYMES_Y_LAS_COOPERATIVAS("011"), 15 | TARJETA_DE_CREDITO_EMITIDA_EN_EL_PAIS_O_EN_EXTERIOR_EMITIDA_POR_EMPRESA_NO_PERTENECIENTE_AL_SISTEMA_FINANCIERO("012"), 16 | TARJETAS_DE_CREDITO_EMITIDAS_EN_EL_EXTERIOR_POR_EMPRESAS_BANCARIAS_O_FINANCIERAS_NO_DOMICILIADAS("013"), 17 | TRANSFERENCIAS_COMERCIO_EXTERIOR("101"), 18 | CHEQUES_BANCARIOS_COMERCIO_EXTERIOR("102"), 19 | ORDEN_DE_PAGO_SIMPLE_COMERCIO_EXTERIOR("103"), 20 | ORDEN_DE_PAGO_DOCUMENTARIO_COMERCIO_EXTERIOR("104"), 21 | REMESA_SIMPLE_COMERCIO_EXTERIOR("105"), 22 | REMESA_DOCUMENTARIA_COMERCIO_EXTERIOR("106"), 23 | CARTA_DE_CREDITO_SIMPLE_COMERCIO_EXTERIOR("107"), 24 | CARTA_DE_CREDITO_DOCUMENTARIO_COMERCIO_EXTERIOR("108"), 25 | OTROS_MEDIOS_DE_PAGO("999"); 26 | 27 | private final String code; 28 | 29 | Catalog59(String code) { 30 | this.code = code; 31 | } 32 | 33 | @Override 34 | public String getCode() { 35 | return code; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog6.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog6 implements Catalog { 4 | DOC_TRIB_NO_DOM_SIN_RUC("0"), 5 | DNI("1"), 6 | EXTRANJERIA("4"), 7 | RUC("6"), 8 | PASAPORTE("7"), 9 | DEC_DIPLOMATICA("A"), 10 | DOC_IDENT_PAIS_RESIDENCIA_NO_D("B"), 11 | TAX_IDENTIFICATION_NUMBER_TIN_DOC_TRIB_PP_NN("C"), 12 | IDENTIFICATION_NUMBER_IN_DOC_TRIB_PP_JJ("D"), 13 | TAM_TARJETA_ANDINA_DE_MIGRACION("E"), 14 | PERMISO_TEMPORAL_DE_PERMANENCIA_PTP("F"), 15 | SALVOCONDUCTO("G"); 16 | 17 | private final String code; 18 | 19 | Catalog6(String code) { 20 | this.code = code; 21 | } 22 | 23 | @Override 24 | public String getCode() { 25 | return code; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7_1.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog7_1 implements Catalog { 4 | GRAVADO("01"), 5 | EXONERADO("02"), 6 | INAFECTO("03"), 7 | EXPORTACION("04"), 8 | GRATUITA("05"); 9 | 10 | private final String code; 11 | 12 | Catalog7_1(String code) { 13 | this.code = code; 14 | } 15 | 16 | @Override 17 | public String getCode() { 18 | return code; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog8.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog8 implements Catalog { 4 | SISTEMA_AL_VALOR("01"), 5 | APLICACION_AL_MONTO_FIJO("02"), 6 | SISTEMA_DE_PRECIOS_DE_VENTA_AL_PUBLICO("02"); 7 | 8 | private final String code; 9 | 10 | Catalog8(String code) { 11 | this.code = code; 12 | } 13 | 14 | @Override 15 | public String getCode() { 16 | return code; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog9.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum Catalog9 implements Catalog { 4 | ANULACION_DE_LA_OPERACION("01"), 5 | ANULACION_POR_ERROR_EN_EL_RUC("02"), 6 | CORRECCION_POR_ERROR_EN_LA_DESCRIPCION("03"), 7 | DESCUENTO_GLOBAL("04"), 8 | DESCUENTO_POR_ITEM("05"), 9 | DEVOLUCION_TOTAL("06"), 10 | DEVOLUCION_POR_ITEM("07"), 11 | BONIFICACION("08"), 12 | DISMINUCION_EN_EL_VALOR("09"), 13 | OTROS_CONCEPTOS("10"); 14 | 15 | private final String code; 16 | 17 | Catalog9(String code) { 18 | this.code = code; 19 | } 20 | 21 | @Override 22 | public String getCode() { 23 | return code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/CatalogContadoCredito.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.catalogs; 2 | 3 | public enum CatalogContadoCredito implements Catalog { 4 | CONTADO("Contado"), 5 | CREDITO("Credito"); 6 | 7 | private final String code; 8 | 9 | CatalogContadoCredito(String code) { 10 | this.code = code; 11 | } 12 | 13 | @Override 14 | public String getCode() { 15 | return code; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalDateAdapter.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.adapters; 2 | 3 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 4 | import java.time.LocalDate; 5 | 6 | public class LocalDateAdapter extends XmlAdapter { 7 | @Override 8 | public LocalDate unmarshal(String v) throws Exception { 9 | return LocalDate.parse(v); 10 | } 11 | 12 | @Override 13 | public String marshal(LocalDate v) throws Exception { 14 | return v.toString(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/adapters/LocalTimeAdapter.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.adapters; 2 | 3 | import jakarta.xml.bind.annotation.adapters.XmlAdapter; 4 | import java.time.LocalTime; 5 | 6 | public class LocalTimeAdapter extends XmlAdapter { 7 | @Override 8 | public LocalTime unmarshal(String v) throws Exception { 9 | return LocalTime.parse(v); 10 | } 11 | 12 | @Override 13 | public String marshal(LocalTime v) throws Exception { 14 | return v.toString(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ClienteMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLCustomer; 4 | import io.github.project.openubl.xbuilder.content.models.common.Cliente; 5 | import org.mapstruct.Mapper; 6 | import org.mapstruct.Mapping; 7 | 8 | @Mapper(uses = { 9 | ContactoMapper.class, 10 | DireccionMapper.class 11 | }) 12 | public interface ClienteMapper { 13 | 14 | @Mapping(target = "tipoDocumentoIdentidad", source = "partyIdentification.id.schemeID") 15 | @Mapping(target = "numeroDocumentoIdentidad", source = "partyIdentification.id.value") 16 | @Mapping(target = "nombre", source = "partyLegalEntity.registrationName") 17 | @Mapping(target = "direccion", source = "partyLegalEntity.address") 18 | @Mapping(target = "contacto", source = "contact") 19 | Cliente map(XMLCustomer xml); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ContactoMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLContact; 4 | import io.github.project.openubl.xbuilder.content.models.common.Contacto; 5 | import org.mapstruct.Mapper; 6 | import org.mapstruct.Mapping; 7 | 8 | @Mapper 9 | public interface ContactoMapper { 10 | 11 | @Mapping(target = "telefono", source = "telephone") 12 | @Mapping(target = "email", source = "electronicMail") 13 | Contacto map(XMLContact xml); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/DireccionMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLAddress; 4 | import io.github.project.openubl.xbuilder.content.models.common.Direccion; 5 | import org.mapstruct.Mapper; 6 | import org.mapstruct.Mapping; 7 | 8 | @Mapper 9 | public interface DireccionMapper { 10 | 11 | @Mapping(target = "ubigeo", source = "id") 12 | @Mapping(target = "codigoLocal", source = "addressTypeCode") 13 | @Mapping(target = "urbanizacion", source = "citySubdivisionName") 14 | @Mapping(target = "provincia", source = "cityName") 15 | @Mapping(target = "departamento", source = "countrySubEntity") 16 | @Mapping(target = "distrito", source = "district") 17 | @Mapping(target = "codigoPais", source = "country.identificationCode") 18 | @Mapping(target = "direccion", source = "addressLine.line") 19 | Direccion map(XMLAddress xml); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/FirmanteMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSignature; 4 | import io.github.project.openubl.xbuilder.content.models.common.Firmante; 5 | import org.mapstruct.Mapper; 6 | import org.mapstruct.Mapping; 7 | 8 | @Mapper(uses = { 9 | ContactoMapper.class, 10 | DireccionMapper.class 11 | }) 12 | public interface FirmanteMapper { 13 | 14 | @Mapping(target = "ruc", source = "id") 15 | @Mapping(target = "razonSocial", source = "signatoryParty.partyName.name") 16 | Firmante map(XMLSignature xml); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/GuiaMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSalesDocument; 4 | import io.github.project.openubl.xbuilder.content.models.standard.general.Guia; 5 | import org.mapstruct.Mapper; 6 | import org.mapstruct.Mapping; 7 | 8 | @Mapper 9 | public interface GuiaMapper { 10 | 11 | @Mapping(target = "serieNumero", source = "id") 12 | @Mapping(target = "tipoDocumento", source = "documentTypeCode") 13 | Guia mapGuia(XMLSalesDocument.DespatchDocumentReference xml); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero2Translator.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import org.mapstruct.Qualifier; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Qualifier 11 | @Target(ElementType.METHOD) 12 | @Retention(RetentionPolicy.CLASS) 13 | public @interface Numero2Translator { 14 | } 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/Numero3Translator.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import org.mapstruct.Qualifier; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Qualifier 11 | @Target(ElementType.METHOD) 12 | @Retention(RetentionPolicy.CLASS) 13 | public @interface Numero3Translator { 14 | } 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/ProveedorMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplier; 4 | import io.github.project.openubl.xbuilder.content.jaxb.models.XMLSupplierSunat; 5 | import io.github.project.openubl.xbuilder.content.models.common.Proveedor; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.Mapping; 8 | 9 | @Mapper(uses = { 10 | ContactoMapper.class, 11 | DireccionMapper.class 12 | }) 13 | public interface ProveedorMapper { 14 | 15 | @Mapping(target = "ruc", source = "partyIdentification.id") 16 | @Mapping(target = "nombreComercial", source = "partyName.name") 17 | @Mapping(target = "razonSocial", source = "partyLegalEntity.registrationName") 18 | @Mapping(target = "direccion", source = "partyLegalEntity.address") 19 | @Mapping(target = "contacto", source = "contact") 20 | Proveedor map(XMLSupplier xml); 21 | 22 | @Mapping(target = "ruc", source = "customerAssignedAccountID") 23 | @Mapping(target = "nombreComercial", source = "partyName.name") 24 | @Mapping(target = "razonSocial", source = "party.partyLegalEntity.registrationName") 25 | @Mapping(target = "direccion", source = "party.partyLegalEntity.address") 26 | @Mapping(target = "contacto", source = "contact") 27 | Proveedor map(XMLSupplierSunat xml); 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroMapper.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | @SerieNumeroTranslator 4 | public class SerieNumeroMapper { 5 | 6 | @SerieTranslator 7 | public String toSerie(String serieNumero) { 8 | if (serieNumero == null) { 9 | return null; 10 | } 11 | 12 | String[] split = serieNumero.split("-"); 13 | return split.length >= 1 ? split[0] : null; 14 | } 15 | 16 | @Numero2Translator 17 | public Integer toNumero2(String serieNumero) { 18 | if (serieNumero == null) { 19 | return null; 20 | } 21 | 22 | String[] split = serieNumero.split("-"); 23 | return split.length >= 2 ? Integer.parseInt(split[1]) : null; 24 | } 25 | 26 | @Numero3Translator 27 | public Integer toNumero3(String serieNumero) { 28 | if (serieNumero == null) { 29 | return null; 30 | } 31 | 32 | String[] split = serieNumero.split("-"); 33 | return split.length >= 3 ? Integer.parseInt(split[2]) : null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieNumeroTranslator.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import org.mapstruct.Qualifier; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Qualifier 11 | @Target(ElementType.TYPE) 12 | @Retention(RetentionPolicy.CLASS) 13 | public @interface SerieNumeroTranslator { 14 | } 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/common/SerieTranslator.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.common; 2 | 3 | import org.mapstruct.Qualifier; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Qualifier 11 | @Target(ElementType.METHOD) 12 | @Retention(RetentionPolicy.CLASS) 13 | public @interface SerieTranslator { 14 | } 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/mappers/utils/MapperUtils.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.mappers.utils; 2 | 3 | import java.math.BigDecimal; 4 | import java.math.RoundingMode; 5 | import java.util.Optional; 6 | 7 | public class MapperUtils { 8 | 9 | public static BigDecimal mapPorcentaje(BigDecimal number) { 10 | return Optional.ofNullable(number) 11 | .map(bigDecimal -> bigDecimal.divide(new BigDecimal("100"), 10, RoundingMode.HALF_EVEN)) 12 | .orElse(null); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLConstants.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | public class XMLConstants { 4 | public static final String CBC = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"; 5 | public static final String CAC = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"; 6 | public static final String SAC = "urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1"; 7 | public static final String EXT = "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"; 8 | } 9 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLContact.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import jakarta.xml.bind.annotation.XmlAccessType; 7 | import jakarta.xml.bind.annotation.XmlAccessorType; 8 | import jakarta.xml.bind.annotation.XmlElement; 9 | import jakarta.xml.bind.annotation.XmlType; 10 | 11 | @XmlAccessorType(XmlAccessType.NONE) 12 | @XmlType(name = "Contact") 13 | @Data 14 | @NoArgsConstructor 15 | public class XMLContact { 16 | 17 | @XmlElement(name = "Telephone", namespace = XMLConstants.CBC) 18 | private String telephone; 19 | 20 | @XmlElement(name = "ElectronicMail", namespace = XMLConstants.CBC) 21 | private String electronicMail; 22 | } 23 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNote.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.util.List; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "CreditNote", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLCreditNote extends XMLSalesDocument { 19 | @XmlElement(name = "LegalMonetaryTotal", namespace = XMLConstants.CAC) 20 | private MonetaryTotal monetaryTotal; 21 | 22 | @XmlElement(name = "CreditNoteLine", namespace = XMLConstants.CAC) 23 | private List lines; 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLCreditNoteLine.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlAttribute; 10 | import jakarta.xml.bind.annotation.XmlElement; 11 | import jakarta.xml.bind.annotation.XmlType; 12 | import jakarta.xml.bind.annotation.XmlValue; 13 | import java.math.BigDecimal; 14 | 15 | @XmlType(name = "CreditNoteDocumentLine") 16 | @XmlAccessorType(XmlAccessType.NONE) 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @NoArgsConstructor 20 | public class XMLCreditNoteLine extends XMLSalesDocumentLine { 21 | @XmlElement(name = "CreditedQuantity", namespace = XMLConstants.CBC) 22 | private Quantity quantity; 23 | 24 | @XmlAccessorType(XmlAccessType.NONE) 25 | @XmlType(name = "CreditNoteDocumentLine.Quantity") 26 | @Data 27 | @NoArgsConstructor 28 | public static class Quantity { 29 | @XmlValue 30 | private BigDecimal value; 31 | 32 | @XmlAttribute(name = "unitCode") 33 | private String unitCode; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNote.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.util.List; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "DebitNote", namespace = "urn:oasis:names:specification:ubl:schema:xsd:DebitNote-2") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLDebitNote extends XMLSalesDocument { 19 | @XmlElement(name = "RequestedMonetaryTotal", namespace = XMLConstants.CAC) 20 | private MonetaryTotal monetaryTotal; 21 | 22 | @XmlElement(name = "DebitNoteLine", namespace = XMLConstants.CAC) 23 | private List lines; 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLDebitNoteLine.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlAttribute; 10 | import jakarta.xml.bind.annotation.XmlElement; 11 | import jakarta.xml.bind.annotation.XmlType; 12 | import jakarta.xml.bind.annotation.XmlValue; 13 | import java.math.BigDecimal; 14 | 15 | @XmlType(name = "DebitNoteDocumentLine") 16 | @XmlAccessorType(XmlAccessType.NONE) 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @NoArgsConstructor 20 | public class XMLDebitNoteLine extends XMLSalesDocumentLine { 21 | @XmlElement(name = "DebitedQuantity", namespace = XMLConstants.CBC) 22 | private Quantity quantity; 23 | 24 | @XmlAccessorType(XmlAccessType.NONE) 25 | @XmlType(name = "DebitNoteDocumentLine.Quantity") 26 | @Data 27 | @NoArgsConstructor 28 | public static class Quantity { 29 | @XmlValue 30 | private BigDecimal value; 31 | 32 | @XmlAttribute(name = "unitCode") 33 | private String unitCode; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoice.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.util.List; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "Invoice", namespace = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLInvoice extends XMLSalesDocument { 19 | @XmlElement(name = "LegalMonetaryTotal", namespace = XMLConstants.CAC) 20 | private MonetaryTotal monetaryTotal; 21 | 22 | @XmlElement(name = "InvoiceLine", namespace = XMLConstants.CAC) 23 | private List lines; 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLInvoiceLine.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlAttribute; 10 | import jakarta.xml.bind.annotation.XmlElement; 11 | import jakarta.xml.bind.annotation.XmlType; 12 | import jakarta.xml.bind.annotation.XmlValue; 13 | import java.math.BigDecimal; 14 | 15 | @XmlType(name = "InvoiceDocumentLine") 16 | @XmlAccessorType(XmlAccessType.NONE) 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @NoArgsConstructor 20 | public class XMLInvoiceLine extends XMLSalesDocumentLine { 21 | @XmlElement(name = "InvoicedQuantity", namespace = XMLConstants.CBC) 22 | private Quantity quantity; 23 | 24 | @XmlAccessorType(XmlAccessType.NONE) 25 | @XmlType(name = "InvoiceDocumentLine.Quantity") 26 | @Data 27 | @NoArgsConstructor 28 | public static class Quantity { 29 | @XmlValue 30 | private BigDecimal value; 31 | 32 | @XmlAttribute(name = "unitCode") 33 | private String unitCode; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLPercepcion.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.math.BigDecimal; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "Perception", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:Perception-1") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLPercepcion extends XMLPercepcionRetencionBase { 19 | 20 | @XmlElement(name = "SUNATPerceptionSystemCode", namespace = XMLConstants.SAC) 21 | private String sunatSystemCode; 22 | 23 | @XmlElement(name = "SUNATPerceptionPercent", namespace = XMLConstants.SAC) 24 | private BigDecimal sunatPercent; 25 | 26 | @XmlElement(name = "SUNATTotalCashed", namespace = XMLConstants.SAC) 27 | private BigDecimal sunatTotal; 28 | 29 | @XmlElement(name = "SUNATPerceptionDocumentReference", namespace = XMLConstants.SAC) 30 | private XMLPercepcionSunatDocumentReference sunatDocumentReference; 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLRetention.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.math.BigDecimal; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "Retention", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:Retention-1") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLRetention extends XMLPercepcionRetencionBase { 19 | @XmlElement(name = "SUNATRetentionSystemCode", namespace = XMLConstants.SAC) 20 | private String sunatSystemCode; 21 | 22 | @XmlElement(name = "SUNATRetentionPercent", namespace = XMLConstants.SAC) 23 | private BigDecimal sunatPercent; 24 | 25 | @XmlElement(name = "SUNATTotalPaid", namespace = XMLConstants.SAC) 26 | private BigDecimal sunatTotal; 27 | 28 | @XmlElement(name = "SUNATRetentionDocumentReference", namespace = XMLConstants.SAC) 29 | private XMLRetentionSunatDocumentReference sunatDocumentReference; 30 | } 31 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSignature.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import jakarta.xml.bind.annotation.XmlAccessType; 7 | import jakarta.xml.bind.annotation.XmlAccessorType; 8 | import jakarta.xml.bind.annotation.XmlElement; 9 | import jakarta.xml.bind.annotation.XmlType; 10 | 11 | @XmlAccessorType(XmlAccessType.NONE) 12 | @XmlType(name = "Signature") 13 | @Data 14 | @NoArgsConstructor 15 | public class XMLSignature { 16 | @XmlElement(name = "ID", namespace = XMLConstants.CBC) 17 | private String id; 18 | 19 | @XmlElement(name = "SignatoryParty", namespace = XMLConstants.CAC) 20 | private SignatoryParty signatoryParty; 21 | 22 | @XmlAccessorType(XmlAccessType.NONE) 23 | @XmlType(name = "Signature.SignatoryParty") 24 | @Data 25 | @NoArgsConstructor 26 | public static class SignatoryParty { 27 | @XmlElement(name = "PartyName", namespace = XMLConstants.CAC) 28 | private PartyName partyName; 29 | } 30 | 31 | @XmlType(name = "Signature.PartyName") 32 | @XmlAccessorType(XmlAccessType.NONE) 33 | @Data 34 | @NoArgsConstructor 35 | public static class PartyName { 36 | @XmlElement(name = "Name", namespace = XMLConstants.CBC) 37 | private String name; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSummaryDocuments.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.util.List; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "SummaryDocuments", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:SummaryDocuments-1") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLSummaryDocuments extends XMLSunatDocument { 19 | 20 | @XmlElement(name = "SummaryDocumentsLine", namespace = XMLConstants.SAC) 21 | private List lines; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLSunatDocument.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import io.github.project.openubl.xbuilder.content.jaxb.adapters.LocalDateAdapter; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlType; 11 | import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 12 | import java.time.LocalDate; 13 | 14 | @XmlType(name = "SunatDocument") 15 | @XmlAccessorType(XmlAccessType.NONE) 16 | @Data 17 | @NoArgsConstructor 18 | public abstract class XMLSunatDocument { 19 | 20 | @XmlElement(name = "ID", namespace = XMLConstants.CBC) 21 | private String documentId; 22 | 23 | @XmlJavaTypeAdapter(LocalDateAdapter.class) 24 | @XmlElement(name = "ReferenceDate", namespace = XMLConstants.CBC) 25 | private LocalDate referenceDate; 26 | 27 | @XmlJavaTypeAdapter(LocalDateAdapter.class) 28 | @XmlElement(name = "IssueDate", namespace = XMLConstants.CBC) 29 | private LocalDate issueDate; 30 | 31 | @XmlElement(name = "Signature", namespace = XMLConstants.CAC) 32 | private XMLSignature signature; 33 | 34 | @XmlElement(name = "AccountingSupplierParty", namespace = XMLConstants.CAC) 35 | private XMLSupplierSunat accountingSupplierParty; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocuments.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import jakarta.xml.bind.annotation.XmlAccessType; 8 | import jakarta.xml.bind.annotation.XmlAccessorType; 9 | import jakarta.xml.bind.annotation.XmlElement; 10 | import jakarta.xml.bind.annotation.XmlRootElement; 11 | import java.util.List; 12 | 13 | @XmlAccessorType(XmlAccessType.NONE) 14 | @XmlRootElement(name = "VoidedDocuments", namespace = "urn:sunat:names:specification:ubl:peru:schema:xsd:VoidedDocuments-1") 15 | @EqualsAndHashCode(callSuper = true) 16 | @Data 17 | @NoArgsConstructor 18 | public class XMLVoidedDocuments extends XMLSunatDocument { 19 | 20 | @XmlElement(name = "VoidedDocumentsLine", namespace = XMLConstants.SAC) 21 | private List lines; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/XMLVoidedDocumentsLine.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.jaxb.models; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import jakarta.xml.bind.annotation.XmlAccessType; 7 | import jakarta.xml.bind.annotation.XmlAccessorType; 8 | import jakarta.xml.bind.annotation.XmlElement; 9 | import jakarta.xml.bind.annotation.XmlType; 10 | 11 | @XmlType(name = "VoidedDocumentsLine") 12 | @XmlAccessorType(XmlAccessType.NONE) 13 | @Data 14 | @NoArgsConstructor 15 | public class XMLVoidedDocumentsLine { 16 | 17 | @XmlElement(name = "DocumentTypeCode", namespace = XMLConstants.CBC) 18 | private String documentTypeCode; 19 | 20 | @XmlElement(name = "DocumentSerialID", namespace = XMLConstants.SAC) 21 | private String documentSerialID; 22 | 23 | @XmlElement(name = "DocumentNumberID", namespace = XMLConstants.SAC) 24 | private Integer documentNumberID; 25 | 26 | @XmlElement(name = "VoidReasonDescription", namespace = XMLConstants.SAC) 27 | private String voidReasonDescription; 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/jaxb/models/package-info.java: -------------------------------------------------------------------------------- 1 | @XmlSchema( 2 | xmlns = { 3 | @XmlNs(prefix = "cbc", namespaceURI = XMLConstants.CBC), 4 | @XmlNs(prefix = "cac", namespaceURI = XMLConstants.CAC), 5 | @XmlNs(prefix = "sac", namespaceURI = XMLConstants.SAC), 6 | @XmlNs(prefix = "ext", namespaceURI = XMLConstants.EXT) 7 | }, 8 | elementFormDefault = XmlNsForm.QUALIFIED 9 | ) 10 | package io.github.project.openubl.xbuilder.content.jaxb.models; 11 | 12 | import jakarta.xml.bind.annotation.XmlNs; 13 | import jakarta.xml.bind.annotation.XmlNsForm; 14 | import jakarta.xml.bind.annotation.XmlSchema; -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Cliente.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.common; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | /** 11 | * Cliente de la operación. 12 | * 13 | * @author Carlos Feria 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | public class Cliente { 20 | 21 | /** 22 | * Tipo de documento de identidad del cliente. 23 | *

24 | * Catalogo 06. 25 | *

26 | * Valores válidos: {@link Catalog6} 27 | */ 28 | @Schema(description = "Catalogo 06", requiredMode = Schema.RequiredMode.REQUIRED) 29 | private String tipoDocumentoIdentidad; 30 | 31 | /** 32 | * Número de documento de identidad del cliente. 33 | */ 34 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 35 | private String numeroDocumentoIdentidad; 36 | 37 | /** 38 | * Nombre del cliente. Si el cliente es personal natural entonces 39 | * es el nombre y apellidos de la persona; si el cliente es una persona jurídica 40 | * entonces es la razón social de la empresa. 41 | */ 42 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 43 | private String nombre; 44 | 45 | /** 46 | * Dirección del cliente 47 | */ 48 | private Direccion direccion; 49 | 50 | /** 51 | * Datos de contacto del cliente 52 | */ 53 | private Contacto contacto; 54 | } 55 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Contacto.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.common; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * Datos de contacto 11 | * 12 | * @author Carlos Feria 13 | */ 14 | @Data 15 | @Builder 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class Contacto { 19 | 20 | /** 21 | * Número telefónico 22 | */ 23 | @Schema(description = "Número telefónico") 24 | private String telefono; 25 | 26 | /** 27 | * Correo electrónico 28 | */ 29 | @Schema(description = "Correo electrónico") 30 | private String email; 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Document.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.common; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.SuperBuilder; 7 | 8 | import java.time.LocalDate; 9 | 10 | @Data 11 | @SuperBuilder 12 | @NoArgsConstructor 13 | public abstract class Document { 14 | 15 | /** 16 | * Moneda en la que se emite el comprobante 17 | */ 18 | @Schema(minLength = 3, maxLength = 3) 19 | private String moneda; 20 | 21 | /** 22 | * Fecha de emisión del comprobante. Ejemplo 2022-12-25 (YYYY-MM-SS) 23 | */ 24 | @Schema(description = "Format: \"YYYY-MM-SS\". Ejemplo: 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$") 25 | private LocalDate fechaEmision; 26 | 27 | /** 28 | * Proveedor del bien o servicio 29 | */ 30 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 31 | private Proveedor proveedor; 32 | 33 | /** 34 | * Persona que firma electrónicamente el comprobante. Si es NULL los datos del proveedor son usados. 35 | */ 36 | @Schema(description = "Persona que firma el comprobante. Si NULL los datos del proveedor son usados.") 37 | private Firmante firmante; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Firmante.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.common; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * Persona que firma electrónicamente el documento 11 | * 12 | * @author Carlos Feria 13 | */ 14 | @Data 15 | @Builder 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class Firmante { 19 | 20 | /** 21 | * Número de RUC de la persona 22 | */ 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 11, maxLength = 11, pattern = "[0-9]+") 24 | private String ruc; 25 | 26 | /** 27 | * Razón social de la persona 28 | */ 29 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 30 | private String razonSocial; 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Proveedor.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.common; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * Persona que vende o presta un servicio 11 | * 12 | * @author Carlos Feria 13 | */ 14 | @Data 15 | @Builder 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class Proveedor { 19 | 20 | /** 21 | * Número de RUC de la persona jurídica 22 | */ 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 11, maxLength = 11, pattern = "[0-9]+") 24 | private String ruc; 25 | 26 | /** 27 | * Nombre comercial de la persona jurídica 28 | */ 29 | private String nombreComercial; 30 | 31 | /** 32 | * Razón social de la persona jurídica 33 | */ 34 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 35 | private String razonSocial; 36 | 37 | /** 38 | * Dirección de la persona jurídica 39 | */ 40 | private Direccion direccion; 41 | 42 | /** 43 | * Contacto de la persona jurídica 44 | */ 45 | private Contacto contacto; 46 | } 47 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/common/TipoCambio.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.common; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.math.BigDecimal; 9 | import java.time.LocalDate; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class TipoCambio { 16 | 17 | private LocalDate fecha; 18 | private BigDecimal valor; 19 | } 20 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoTributarioRelacionado.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.SuperBuilder; 5 | 6 | @Data 7 | @SuperBuilder 8 | public abstract class BaseDocumentoTributarioRelacionado { 9 | 10 | private String serieNumero; 11 | } 12 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CargoDescuento.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.SuperBuilder; 7 | 8 | import java.math.BigDecimal; 9 | 10 | @Data 11 | @SuperBuilder 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public class CargoDescuento { 15 | 16 | private String serieNumero; 17 | private String tipo; 18 | private BigDecimal monto; 19 | private BigDecimal porcentaje; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CreditNote.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.SuperBuilder; 7 | import lombok.extern.jackson.Jacksonized; 8 | 9 | /** 10 | * Clase base para CreditNote y DebitNote. 11 | * 12 | * @author Carlos Feria 13 | */ 14 | @Jacksonized 15 | @Data 16 | @SuperBuilder 17 | @NoArgsConstructor 18 | @EqualsAndHashCode(callSuper = true) 19 | public class CreditNote extends Note { 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CuotaDePago.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | import java.time.LocalDate; 11 | 12 | /** 13 | * Cuota de pago para Invoice 14 | * 15 | * @author Carlos Feria 16 | */ 17 | @Data 18 | @Builder 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | public class CuotaDePago { 22 | 23 | /** 24 | * Importe de la cuota 25 | */ 26 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", exclusiveMinimum = true) 27 | private BigDecimal importe; 28 | 29 | /** 30 | * Fecha de pago de la cuota 31 | */ 32 | @Schema(description = "Ejemplo 2022-12-25", requiredMode = Schema.RequiredMode.REQUIRED, pattern = "^\\d{4}-\\d{2}-\\d{2}$") 33 | private LocalDate fechaPago; 34 | } 35 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DebitNote.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.SuperBuilder; 7 | import lombok.extern.jackson.Jacksonized; 8 | 9 | @Jacksonized 10 | @Data 11 | @SuperBuilder 12 | @NoArgsConstructor 13 | @EqualsAndHashCode(callSuper = true) 14 | public class DebitNote extends Note { 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Descuento.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class Descuento { 16 | 17 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalogo 53") 18 | private String tipoDescuento; 19 | 20 | @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) 21 | private BigDecimal factor; 22 | 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 24 | private BigDecimal monto; 25 | 26 | @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) 27 | private BigDecimal montoBase; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Detraccion.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | 11 | /** 12 | * Detracción asociada a un Invoice 13 | * 14 | * @author Carlos Feria 15 | */ 16 | @Data 17 | @Builder 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | public class Detraccion { 21 | 22 | /** 23 | * Catalog59 24 | **/ 25 | @Schema(description = "Catalogo 59", requiredMode = Schema.RequiredMode.REQUIRED) 26 | private String medioDePago; 27 | 28 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 29 | private String cuentaBancaria; 30 | 31 | /** 32 | * Catalog54 33 | **/ 34 | @Schema(description = "Catalog 54", requiredMode = Schema.RequiredMode.REQUIRED) 35 | private String tipoBienDetraido; 36 | 37 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", maximum = "1", exclusiveMinimum = true) 38 | private BigDecimal porcentaje; 39 | 40 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", exclusiveMinimum = true) 41 | private BigDecimal monto; 42 | } 43 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoRelacionado.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class DocumentoRelacionado { 14 | 15 | @Schema(description = "Catalog 12", requiredMode = Schema.RequiredMode.REQUIRED) 16 | private String tipoDocumento; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String serieNumero; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/FormaDePago.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Singular; 8 | import lombok.experimental.SuperBuilder; 9 | 10 | import java.math.BigDecimal; 11 | import java.util.List; 12 | 13 | @Data 14 | @SuperBuilder 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | public class FormaDePago { 18 | 19 | @Schema(description = "CREDITO o CONTADO", requiredMode = Schema.RequiredMode.REQUIRED) 20 | private String tipo; 21 | 22 | @Schema(description = "Monto total de pago", requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0") 23 | private BigDecimal total; 24 | 25 | @Schema(description = "Cuotas de pago") 26 | @Singular 27 | private List cuotas; 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Guia.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Guia { 14 | 15 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 16 | private String serieNumero; 17 | 18 | /** 19 | * Tipo de documento Guia. 20 | *

21 | * Catalogo 01. 22 | *

23 | * Valores válidos: "09", "31" 24 | */ 25 | @Schema(description = "Catalogo 01", requiredMode = Schema.RequiredMode.REQUIRED) 26 | private String tipoDocumento; 27 | } 28 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Percepcion.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class Percepcion { 16 | 17 | /** 18 | * Catalog53 19 | */ 20 | @Schema(description = "Catalog 53", requiredMode = Schema.RequiredMode.REQUIRED) 21 | private String tipo; 22 | 23 | private BigDecimal montoBase; // importeSinImpuestos 24 | private BigDecimal porcentaje; // Establecido por el "tipo" 25 | private BigDecimal monto; // montoBase * porcentaje 26 | private BigDecimal montoTotal; // montoBase + monto 27 | } 28 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporte.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.SuperBuilder; 7 | 8 | import java.math.BigDecimal; 9 | 10 | @Data 11 | @SuperBuilder 12 | @NoArgsConstructor 13 | public abstract class TotalImporte { 14 | 15 | @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) 16 | private BigDecimal importe; 17 | 18 | @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) 19 | private BigDecimal importeSinImpuestos; 20 | 21 | @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) 22 | private BigDecimal importeConImpuestos; 23 | } 24 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.ToString; 8 | import lombok.experimental.SuperBuilder; 9 | 10 | import java.math.BigDecimal; 11 | 12 | @Data 13 | @SuperBuilder 14 | @NoArgsConstructor 15 | @EqualsAndHashCode(callSuper = true) 16 | @ToString(callSuper = true) 17 | public class TotalImporteInvoice extends TotalImporte { 18 | 19 | @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) 20 | private BigDecimal anticipos; 21 | 22 | @Schema(minimum = "0", requiredMode = Schema.RequiredMode.REQUIRED) 23 | private BigDecimal descuentos; 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteNote.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.general; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | import lombok.experimental.SuperBuilder; 8 | 9 | @Data 10 | @SuperBuilder 11 | @NoArgsConstructor 12 | @EqualsAndHashCode(callSuper = true) 13 | @ToString(callSuper = true) 14 | public class TotalImporteNote extends TotalImporte { 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/DespatchAdviceItem.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.extern.jackson.Jacksonized; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Jacksonized 12 | @Data 13 | @Builder 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class DespatchAdviceItem { 17 | private String unidadMedida; 18 | private BigDecimal cantidad; 19 | 20 | private String descripcion; 21 | private String codigo; 22 | private String codigoSunat; 23 | } 24 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Destinatario.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Destinatario { 14 | 15 | @Schema(description = "Catalogo 06", requiredMode = Schema.RequiredMode.REQUIRED) 16 | private String tipoDocumentoIdentidad; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String numeroDocumentoIdentidad; 20 | 21 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 22 | private String nombre; 23 | } 24 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Destino.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @Builder 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class Destino { 13 | private String ubigeo; 14 | private String direccion; 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/DocumentoBaja.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class DocumentoBaja { 14 | 15 | @Schema(description = "Catalog 01", requiredMode = Schema.RequiredMode.REQUIRED) 16 | private String tipoDocumento; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String serieNumero; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/DocumentoRelacionado.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class DocumentoRelacionado { 14 | 15 | @Schema(description = "Catalog 21", requiredMode = Schema.RequiredMode.REQUIRED) 16 | private String tipoDocumento; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String serieNumero; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Envio.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | import java.time.LocalDate; 11 | 12 | @Data 13 | @Builder 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class Envio { 17 | 18 | @Schema(description = "Catalog 20", requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String tipoTraslado; 20 | private String motivoTraslado; 21 | 22 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 23 | private BigDecimal pesoTotal; 24 | 25 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 26 | private String pesoTotalUnidadMedida; 27 | 28 | private Integer numeroDeBultos; 29 | private boolean transbordoProgramado; 30 | 31 | @Schema(description = "Catalog 18", requiredMode = Schema.RequiredMode.REQUIRED) 32 | private String tipoModalidadTraslado; 33 | 34 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 35 | private LocalDate fechaTraslado; 36 | 37 | private String numeroDeContenedor; 38 | private String codigoDePuerto; 39 | 40 | @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) 41 | private Transportista transportista; 42 | 43 | @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) 44 | private Partida partida; 45 | 46 | @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) 47 | private Destino destino; 48 | } 49 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Partida.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @Builder 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class Partida { 13 | private String ubigeo; 14 | private String direccion; 15 | } 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Proveedor.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Proveedor { 14 | 15 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 11, maxLength = 11, pattern = "[0-9]+") 16 | private String ruc; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String razonSocial; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Remitente.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Remitente { 14 | 15 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 11, maxLength = 11, pattern = "[0-9]+") 16 | private String ruc; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String razonSocial; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/Transportista.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.standard.guia; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Transportista { 14 | 15 | @Schema(description = "Catalogo 06", requiredMode = Schema.RequiredMode.REQUIRED) 16 | private String tipoDocumentoIdentidad; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private String numeroDocumentoIdentidad; 20 | 21 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 22 | private String nombre; 23 | 24 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 25 | private String placaDelVehiculo; 26 | 27 | @Schema(description = "Catalogo 06", requiredMode = Schema.RequiredMode.REQUIRED) 28 | private String choferTipoDocumentoIdentidad; 29 | 30 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 31 | private String choferNumeroDocumentoIdentidad; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/SunatDocument.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.common.Document; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import lombok.experimental.SuperBuilder; 10 | 11 | import java.time.LocalDate; 12 | 13 | @Data 14 | @SuperBuilder 15 | @NoArgsConstructor 16 | @EqualsAndHashCode(callSuper = true) 17 | @ToString(callSuper = true) 18 | public class SunatDocument extends Document { 19 | 20 | /** 21 | * Numero de comprobante emitido para la fecha de emision dada 22 | */ 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "1", maximum = "99999999") 24 | private Integer numero; 25 | 26 | /** 27 | * Fecha de emisión de los comprobantes dados de baja. Ejemplo 2022-12-25 (YYYY-MM-SS) 28 | */ 29 | @Schema(description = "Format: \"YYYY-MM-SS\". Ejemplo: 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$") 30 | private LocalDate fechaEmisionComprobantes; 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/VoidedDocuments.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.baja; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.sunat.SunatDocument; 4 | import io.swagger.v3.oas.annotations.media.ArraySchema; 5 | import io.swagger.v3.oas.annotations.media.Schema; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | import lombok.Singular; 10 | import lombok.ToString; 11 | import lombok.experimental.SuperBuilder; 12 | import lombok.extern.jackson.Jacksonized; 13 | 14 | import java.util.List; 15 | 16 | @Jacksonized 17 | @Data 18 | @SuperBuilder 19 | @NoArgsConstructor 20 | @EqualsAndHashCode(callSuper = true) 21 | @ToString(callSuper = true) 22 | public class VoidedDocuments extends SunatDocument { 23 | 24 | /** 25 | * Lista de comprobantes a dar de baja 26 | */ 27 | @Singular 28 | @ArraySchema(minItems = 1, schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) 29 | private List comprobantes; 30 | } 31 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/VoidedDocumentsItem.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.baja; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class VoidedDocumentsItem { 14 | /** 15 | * Serie del comprobante 16 | */ 17 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 18 | private String serie; 19 | 20 | /** 21 | * Número del comprobante 22 | */ 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "1", maximum = "99999999") 24 | private Integer numero; 25 | 26 | @Schema(description = "Catalogo 01") 27 | private String tipoComprobante; 28 | 29 | @Schema(description = "Descripción de la razón de baja") 30 | private String descripcionSustento; 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/BasePercepcionRetencion.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.common.Cliente; 4 | import io.github.project.openubl.xbuilder.content.models.common.Document; 5 | import io.swagger.v3.oas.annotations.media.Schema; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | import lombok.experimental.SuperBuilder; 10 | 11 | import java.math.BigDecimal; 12 | 13 | @Data 14 | @SuperBuilder 15 | @NoArgsConstructor 16 | @EqualsAndHashCode(callSuper = true) 17 | public abstract class BasePercepcionRetencion extends Document { 18 | 19 | /** 20 | * Número del comprobante 21 | */ 22 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "1", maximum = "99999999") 23 | private Integer numero; 24 | 25 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", maximum = "100", exclusiveMinimum = true) 26 | private BigDecimal tipoRegimenPorcentaje; 27 | 28 | private String observacion; 29 | 30 | /** 31 | * Cliente 32 | */ 33 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 34 | private Cliente cliente; 35 | 36 | private PercepcionRetencionOperacion operacion; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/ComprobanteAfectado.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | import java.time.LocalDate; 11 | 12 | @Data 13 | @Builder 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class ComprobanteAfectado { 17 | private String moneda; 18 | 19 | @Schema(description = "Catalogo 01") 20 | private String tipoComprobante; 21 | 22 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 23 | private String serieNumero; 24 | 25 | @Schema(description = "Format: \"YYYY-MM-SS\". Ejemplo: 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$") 26 | private LocalDate fechaEmision; 27 | 28 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 29 | private BigDecimal importeTotal; 30 | } 31 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/PercepcionRetencionOperacion.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.common.TipoCambio; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.math.BigDecimal; 11 | import java.time.LocalDate; 12 | 13 | @Data 14 | @Builder 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | public class PercepcionRetencionOperacion { 18 | 19 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Numero de cobro o pago") 20 | private Integer numeroOperacion; 21 | 22 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Fecha en la que se realiza el cobro o pago") 23 | private LocalDate fechaOperacion; 24 | 25 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Importe del cobro o pago") 26 | private BigDecimal importeOperacion; 27 | 28 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 29 | private ComprobanteAfectado comprobante; 30 | 31 | private TipoCambio tipoCambio; 32 | } 33 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Perception.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.ToString; 8 | import lombok.experimental.SuperBuilder; 9 | import lombok.extern.jackson.Jacksonized; 10 | 11 | import java.math.BigDecimal; 12 | 13 | @Jacksonized 14 | @Data 15 | @SuperBuilder 16 | @NoArgsConstructor 17 | @EqualsAndHashCode(callSuper = true) 18 | @ToString(callSuper = true) 19 | public class Perception extends BasePercepcionRetencion { 20 | /** 21 | * Serie del comprobante 22 | */ 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 4, pattern = "^[P|p].*$") 24 | private String serie; 25 | 26 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalog 22") 27 | private String tipoRegimen; 28 | 29 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0") 30 | private BigDecimal importeTotalPercibido; 31 | 32 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0") 33 | private BigDecimal importeTotalCobrado; 34 | } 35 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Retention.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.ToString; 8 | import lombok.experimental.SuperBuilder; 9 | import lombok.extern.jackson.Jacksonized; 10 | 11 | import java.math.BigDecimal; 12 | 13 | @Jacksonized 14 | @Data 15 | @SuperBuilder 16 | @NoArgsConstructor 17 | @EqualsAndHashCode(callSuper = true) 18 | @ToString(callSuper = true) 19 | public class Retention extends BasePercepcionRetencion { 20 | /** 21 | * Serie del comprobante 22 | */ 23 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 4, pattern = "^[R|r].*$") 24 | private String serie; 25 | 26 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalog 23") 27 | private String tipoRegimen; 28 | 29 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0") 30 | private BigDecimal importeTotalRetenido; 31 | 32 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0") 33 | private BigDecimal importeTotalPagado; 34 | } 35 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.resumen; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.common.Cliente; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Data 11 | @Builder 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public class Comprobante { 15 | 16 | @Schema(requiredMode = Schema.RequiredMode.AUTO, description = "Moneda del comprobante declarado") 17 | private String moneda; 18 | 19 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalogo 01") 20 | private String tipoComprobante; 21 | 22 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 23 | private String serieNumero; 24 | 25 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 26 | private Cliente cliente; 27 | 28 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 29 | private ComprobanteValorVenta valorVenta; 30 | 31 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 32 | private ComprobanteImpuestos impuestos; 33 | 34 | private ComprobanteAfectado comprobanteAfectado; 35 | } 36 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteAfectado.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.resumen; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class ComprobanteAfectado { 14 | 15 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalogo 01") 16 | private String tipoComprobante; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Comprobante afectado") 19 | private String serieNumero; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteImpuestos.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.resumen; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class ComprobanteImpuestos { 16 | 17 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "IGV del comprobante") 18 | private BigDecimal igv; 19 | 20 | @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "ICB del comprobante") 21 | private BigDecimal icb; 22 | } 23 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteValorVenta.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.resumen; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class ComprobanteValorVenta { 16 | 17 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 18 | private BigDecimal importeTotal; 19 | private BigDecimal otrosCargos; 20 | private BigDecimal gravado; 21 | private BigDecimal exonerado; 22 | private BigDecimal inafecto; 23 | private BigDecimal gratuito; 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/SummaryDocuments.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.resumen; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.sunat.SunatDocument; 4 | import io.swagger.v3.oas.annotations.media.ArraySchema; 5 | import io.swagger.v3.oas.annotations.media.Schema; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.NoArgsConstructor; 9 | import lombok.Singular; 10 | import lombok.ToString; 11 | import lombok.experimental.SuperBuilder; 12 | import lombok.extern.jackson.Jacksonized; 13 | 14 | import java.util.List; 15 | 16 | @Jacksonized 17 | @Data 18 | @SuperBuilder 19 | @NoArgsConstructor 20 | @EqualsAndHashCode(callSuper = true) 21 | @ToString(callSuper = true) 22 | public class SummaryDocuments extends SunatDocument { 23 | 24 | /** 25 | * Lista de comprobantes 26 | */ 27 | @Singular 28 | @ArraySchema(minItems = 1, schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) 29 | private List comprobantes; 30 | } 31 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/SummaryDocumentsItem.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.sunat.resumen; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class SummaryDocumentsItem { 14 | 15 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Catalogo Catalog19") 16 | private String tipoOperacion; 17 | 18 | @Schema(requiredMode = Schema.RequiredMode.REQUIRED) 19 | private Comprobante comprobante; 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/content/models/utils/UBLRegex.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.content.models.utils; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.regex.Pattern; 6 | 7 | @Data 8 | public class UBLRegex { 9 | 10 | public static final Pattern FACTURA_SERIE_REGEX = Pattern.compile("^[F|f].*$"); 11 | public static final Pattern BOLETA_SERIE_REGEX = Pattern.compile("^[B|b].*$"); 12 | 13 | private UBLRegex() { 14 | // Just static methods 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/config/DateProvider.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.config; 2 | 3 | import java.time.LocalDate; 4 | 5 | public interface DateProvider { 6 | LocalDate now(); 7 | } 8 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/config/Defaults.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.config; 2 | 3 | import lombok.Builder; 4 | import lombok.Getter; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Getter 9 | @Builder 10 | public class Defaults { 11 | private BigDecimal icbTasa = new BigDecimal("0.5"); 12 | private BigDecimal igvTasa = new BigDecimal("0.18"); 13 | private BigDecimal ivapTasa = new BigDecimal("0.04"); 14 | } 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 4 | import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.BodyRuleContext; 5 | 6 | public abstract class AbstractBodyRule implements RuleFactory, Rule { 7 | 8 | private Defaults defaults; 9 | private BodyRuleContext ruleContext; 10 | 11 | @Override 12 | public Rule create(Defaults defaults, RuleContext ruleContext) { 13 | this.defaults = defaults; 14 | if (ruleContext instanceof BodyRuleContext) { 15 | this.ruleContext = (BodyRuleContext) ruleContext; 16 | } else { 17 | throw new IllegalStateException("HeaderRule requires HeaderContext"); 18 | } 19 | return this; 20 | } 21 | 22 | public BodyRuleContext getRuleContext() { 23 | return ruleContext; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractHeaderRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 4 | import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.HeaderRuleContext; 5 | 6 | public abstract class AbstractHeaderRule implements RuleFactory, Rule { 7 | 8 | private Defaults defaults; 9 | private HeaderRuleContext ruleContext; 10 | 11 | @Override 12 | public Rule create(Defaults defaults, RuleContext ruleContext) { 13 | this.defaults = defaults; 14 | if (ruleContext instanceof HeaderRuleContext) { 15 | this.ruleContext = (HeaderRuleContext) ruleContext; 16 | } else { 17 | throw new IllegalStateException("HeaderRule requires HeaderContext"); 18 | } 19 | return this; 20 | } 21 | 22 | public Defaults getDefaults() { 23 | return defaults; 24 | } 25 | 26 | public HeaderRuleContext getRuleContext() { 27 | return ruleContext; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/Rule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | public interface Rule { 4 | void modify(Object object); 5 | } 6 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleContext.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | public interface RuleContext { 4 | } 5 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactory.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 4 | 5 | public interface RuleFactory { 6 | boolean test(Object object); 7 | 8 | Rule create(Defaults defaults, RuleContext ruleContext); 9 | } 10 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactoryRegistry.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | import java.util.ServiceLoader; 6 | import java.util.stream.Collectors; 7 | 8 | public class RuleFactoryRegistry { 9 | 10 | public static List getRuleFactories(RulePhase.PhaseType phaseType) { 11 | return ServiceLoader 12 | .load(RuleFactory.class) 13 | .stream() 14 | .map(ruleProvider -> { 15 | RulePhase rulePhase = ruleProvider.type().getAnnotation(RulePhase.class); 16 | return Map.entry(ruleProvider, rulePhase); 17 | }) 18 | .filter(ruleProviderPhaseEntry -> { 19 | RulePhase rulePhase = ruleProviderPhaseEntry.getValue(); 20 | return rulePhase.type().equals(phaseType); 21 | }) 22 | .sorted((o1, o2) -> o2.getValue().priority() - o1.getValue().priority()) 23 | .map(ruleProviderPhaseEntry -> ruleProviderPhaseEntry.getKey().get()) 24 | .collect(Collectors.toList()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RulePhase.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.TYPE) 10 | public @interface RulePhase { 11 | PhaseType type(); 12 | 13 | int priority() default 0; 14 | 15 | enum PhaseType { 16 | ENRICH, 17 | PROCESS, 18 | SUMMARY, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleUnit.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie; 2 | 3 | public interface RuleUnit { 4 | void modify(Object object); 5 | } 6 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/FactorRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDescuento; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDescuento; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 14 | public class FactorRule extends AbstractBodyRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return isDescuento.test(object) && whenDescuento.apply(object) 19 | .map(descuento -> descuento.getFactor() == null) 20 | .orElse(false); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | Consumer consumer = descuento -> { 26 | descuento.setFactor(BigDecimal.ONE); 27 | }; 28 | whenDescuento.apply(object).ifPresent(consumer); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/descuento/MontoBaseRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.descuento; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.Descuento; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDescuento; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDescuento; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class MontoBaseRule extends AbstractBodyRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return isDescuento.test(object) && whenDescuento.apply(object) 18 | .map(descuento -> descuento.getMontoBase() == null && descuento.getMonto() != null) 19 | .orElse(false); 20 | } 21 | 22 | @Override 23 | public void modify(Object object) { 24 | Consumer consumer = descuento -> { 25 | descuento.setMontoBase(descuento.getMonto()); 26 | }; 27 | whenDescuento.apply(object).ifPresent(consumer); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/IgvTipoRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog; 4 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog7; 5 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 6 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 7 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 8 | 9 | import java.util.function.Consumer; 10 | 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 12 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 13 | 14 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 15 | public class IgvTipoRule extends AbstractBodyRule { 16 | 17 | @Override 18 | public boolean test(Object object) { 19 | return isSalesDocumentItem.test(object); 20 | } 21 | 22 | @Override 23 | public void modify(Object object) { 24 | Consumer consumer = detalle -> { 25 | Catalog7 catalog7; 26 | if (detalle.getIgvTipo() == null) { 27 | catalog7 = Catalog7.GRAVADO_OPERACION_ONEROSA; 28 | } else { 29 | catalog7 = Catalog.valueOfCode(Catalog7.class, detalle.getIgvTipo()).orElseThrow(Catalog.invalidCatalogValue); 30 | } 31 | 32 | detalle.setIgvTipo(catalog7.getCode()); 33 | }; 34 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/IscTipoRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog; 4 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog8; 5 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 6 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 7 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 8 | 9 | import java.util.function.Consumer; 10 | 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 12 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 13 | 14 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 15 | public class IscTipoRule extends AbstractBodyRule { 16 | 17 | @Override 18 | public boolean test(Object object) { 19 | return isSalesDocumentItem.test(object); 20 | } 21 | 22 | @Override 23 | public void modify(Object object) { 24 | Consumer consumer = detalle -> { 25 | Catalog8 catalog8; 26 | if (detalle.getIscTipo() == null) { 27 | catalog8 = Catalog8.SISTEMA_AL_VALOR; 28 | } else { 29 | catalog8 = Catalog.valueOfCode(Catalog8.class, detalle.getIscTipo()).orElseThrow(Catalog.invalidCatalogValue); 30 | } 31 | 32 | detalle.setIscTipo(catalog8.getCode()); 33 | }; 34 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/TasaIcbRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 14 | public class TasaIcbRule extends AbstractBodyRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object) 19 | .map(documento -> documento.getTasaIcb() == null) 20 | .orElse(false) 21 | ); 22 | } 23 | 24 | @Override 25 | public void modify(Object object) { 26 | Consumer consumer = detalle -> { 27 | BigDecimal tasaIcb = getRuleContext().getTasaIcb(); 28 | detalle.setTasaIcb(tasaIcb); 29 | }; 30 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/UnidadDeMedidaRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class UnidadDeMedidaRule extends AbstractBodyRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object) 18 | .map(documento -> documento.getUnidadMedida() == null) 19 | .orElse(false) 20 | ); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | Consumer consumer = detalle -> detalle.setUnidadMedida("NIU"); 26 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/summaryDocumentItem/MonedaRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.summaryDocumentItem; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocumentsItem; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSummaryDocumentsItem; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSummaryDocumentsItem; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class MonedaRule extends AbstractBodyRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return (isSummaryDocumentsItem.test(object) && whenSummaryDocumentsItem.apply(object) 18 | .map(item -> item.getComprobante() != null && 19 | item.getComprobante().getMoneda() == null 20 | ) 21 | .orElse(false) 22 | ); 23 | } 24 | 25 | @Override 26 | public void modify(Object object) { 27 | Consumer consumer = item -> { 28 | String moneda = getRuleContext().getMoneda(); 29 | item.getComprobante().setMoneda(moneda); 30 | }; 31 | whenSummaryDocumentsItem.apply(object).ifPresent(consumer); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/summaryDocumentItem/TipoOperacionRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.summaryDocumentItem; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog; 4 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog19; 5 | import io.github.project.openubl.xbuilder.content.models.sunat.resumen.SummaryDocumentsItem; 6 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 7 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 8 | 9 | import java.util.function.Consumer; 10 | 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSummaryDocumentsItem; 12 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSummaryDocumentsItem; 13 | 14 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 15 | public class TipoOperacionRule extends AbstractBodyRule { 16 | 17 | @Override 18 | public boolean test(Object object) { 19 | return ( 20 | isSummaryDocumentsItem.test(object) && 21 | whenSummaryDocumentsItem.apply(object).map(item -> item.getTipoOperacion() != null).orElse(false) 22 | ); 23 | } 24 | 25 | @Override 26 | public void modify(Object object) { 27 | Consumer consumer = item -> { 28 | Catalog.valueOfCode(Catalog19.class, item.getTipoOperacion()) 29 | .ifPresent(catalog -> item.setTipoOperacion(catalog.getCode())); 30 | }; 31 | whenSummaryDocumentsItem.apply(object).ifPresent(consumer); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/MonedaRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.common.Document; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDocument; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDocument; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class MonedaRule extends AbstractHeaderRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return ( 18 | isDocument.test(object) && 19 | whenDocument.apply(object).map(documento -> documento.getMoneda() == null).orElse(false) 20 | ); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | Consumer consumer = document -> document.setMoneda("PEN"); 26 | whenDocument.apply(object).ifPresent(consumer); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIcbRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.SalesDocument; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocument; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocument; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class TasaIcbRule extends AbstractHeaderRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return ( 18 | isSalesDocument.test(object) && 19 | whenSalesDocument.apply(object).map(documento -> documento.getTasaIcb() == null).orElse(false) 20 | ); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | Consumer consumer = document -> document.setTasaIcb(getDefaults().getIcbTasa()); 26 | whenSalesDocument.apply(object).ifPresent(consumer); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIgvRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.SalesDocument; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocument; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocument; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class TasaIgvRule extends AbstractHeaderRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return (isSalesDocument.test(object) && whenSalesDocument.apply(object) 18 | .map(documento -> documento.getTasaIgv() == null) 19 | .orElse(false) 20 | ); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | Consumer consumer = document -> document.setTasaIgv(getDefaults().getIgvTasa()); 26 | whenSalesDocument.apply(object).ifPresent(consumer); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIvapRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.SalesDocument; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.util.function.Consumer; 8 | 9 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocument; 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocument; 11 | 12 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 13 | public class TasaIvapRule extends AbstractHeaderRule { 14 | 15 | @Override 16 | public boolean test(Object object) { 17 | return (isSalesDocument.test(object) && whenSalesDocument.apply(object) 18 | .map(documento -> documento.getTasaIvap() == null) 19 | .orElse(false) 20 | ); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | Consumer consumer = document -> document.setTasaIvap(getDefaults().getIvapTasa()); 26 | whenSalesDocument.apply(object).ifPresent(consumer); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DetraccionRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog52; 4 | import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; 5 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 6 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.function.Consumer; 11 | 12 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice; 13 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice; 14 | 15 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 16 | public class DetraccionRule extends AbstractHeaderRule { 17 | 18 | @Override 19 | public boolean test(Object object) { 20 | return ( 21 | isInvoice.test(object) && 22 | whenInvoice.apply(object).map(documento -> documento.getDetraccion() != null).orElse(false) 23 | ); 24 | } 25 | 26 | @Override 27 | public void modify(Object object) { 28 | Consumer consumer = document -> { 29 | Catalog52 leyenda = Catalog52.OPERACION_SUJETA_A_DETRACCION; 30 | 31 | Map leyendas = new HashMap<>(document.getLeyendas()); 32 | leyendas.put(leyenda.getCode(), leyenda.getLabel()); 33 | 34 | document.setLeyendas(leyendas); 35 | }; 36 | whenInvoice.apply(object).ifPresent(consumer); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.FormaDePago; 4 | import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; 5 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 6 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 7 | 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 14 | public class FormaDePagoRule extends AbstractHeaderRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return ( 19 | isInvoice.test(object) && 20 | whenInvoice.apply(object).map(documento -> documento.getFormaDePago() == null).orElse(false) 21 | ); 22 | } 23 | 24 | @Override 25 | public void modify(Object object) { 26 | Consumer consumer = document -> { 27 | document.setFormaDePago(FormaDePago.builder().build()); 28 | }; 29 | whenInvoice.apply(object).ifPresent(consumer); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTipoRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.CatalogContadoCredito; 4 | import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; 5 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 6 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 7 | 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 14 | public class FormaDePagoTipoRule extends AbstractHeaderRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return isInvoice.test(object); 19 | } 20 | 21 | @Override 22 | public void modify(Object object) { 23 | Consumer consumer = document -> { 24 | CatalogContadoCredito formaDePagoTipo = document.getFormaDePago().getCuotas() == null || 25 | document.getFormaDePago().getCuotas().isEmpty() 26 | ? CatalogContadoCredito.CONTADO 27 | : CatalogContadoCredito.CREDITO; 28 | 29 | document.getFormaDePago().setTipo(formaDePagoTipo.getCode()); 30 | }; 31 | whenInvoice.apply(object).ifPresent(consumer); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/PercepcionRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog52; 4 | import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; 5 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule; 6 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.function.Consumer; 11 | 12 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice; 13 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice; 14 | 15 | @RulePhase(type = RulePhase.PhaseType.ENRICH) 16 | public class PercepcionRule extends AbstractHeaderRule { 17 | 18 | @Override 19 | public boolean test(Object object) { 20 | return ( 21 | isInvoice.test(object) && 22 | whenInvoice.apply(object).map(documento -> documento.getPercepcion() != null).orElse(false) 23 | ); 24 | } 25 | 26 | @Override 27 | public void modify(Object object) { 28 | Consumer consumer = document -> { 29 | Catalog52 leyenda = Catalog52.COMPROBANTE_DE_PERCEPCION; 30 | 31 | Map leyendas = new HashMap<>(document.getLeyendas()); 32 | leyendas.put(leyenda.getCode(), leyenda.getLabel()); 33 | 34 | document.setLeyendas(leyendas); 35 | }; 36 | whenInvoice.apply(object).ifPresent(consumer); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbAplicaRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.PROCESS) 14 | public class IcbAplicaRule extends AbstractBodyRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object) 19 | .map(documento -> !documento.isIcbAplica() && 20 | documento.getIcb() != null && 21 | documento.getIcb().compareTo(BigDecimal.ZERO) > 0 22 | ) 23 | .orElse(false) 24 | ); 25 | } 26 | 27 | @Override 28 | public void modify(Object object) { 29 | Consumer consumer = detalle -> { 30 | detalle.setIcbAplica(true); 31 | }; 32 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.PROCESS) 14 | public class IcbRule extends AbstractBodyRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object) 19 | .map(documento -> documento.getIcb() == null) 20 | .orElse(false) 21 | ); 22 | } 23 | 24 | @Override 25 | public void modify(Object object) { 26 | Consumer consumer = detalle -> { 27 | BigDecimal icb = detalle.isIcbAplica() 28 | ? detalle.getCantidad().multiply(getRuleContext().getTasaIcb()) 29 | : BigDecimal.ZERO; 30 | detalle.setIcb(icb); 31 | }; 32 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.PROCESS) 14 | public class IgvRule extends AbstractBodyRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object) 19 | .map(documento -> documento.getIgv() == null && 20 | documento.getIgvBaseImponible() != null && 21 | documento.getTasaIgv() != null 22 | ) 23 | .orElse(false) 24 | ); 25 | } 26 | 27 | @Override 28 | public void modify(Object object) { 29 | Consumer consumer = detalle -> { 30 | BigDecimal igv = detalle.getIgvBaseImponible().multiply(detalle.getTasaIgv()); 31 | detalle.setIgv(igv); 32 | }; 33 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IscRule.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle; 2 | 3 | import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; 4 | import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.function.Consumer; 9 | 10 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isSalesDocumentItem; 11 | import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenSalesDocumentItem; 12 | 13 | @RulePhase(type = RulePhase.PhaseType.PROCESS) 14 | public class IscRule extends AbstractBodyRule { 15 | 16 | @Override 17 | public boolean test(Object object) { 18 | return (isSalesDocumentItem.test(object) && whenSalesDocumentItem.apply(object) 19 | .map(documento -> documento.getIsc() == null && 20 | documento.getIscBaseImponible() != null && 21 | documento.getTasaIsc() != null 22 | ) 23 | .orElse(false) 24 | ); 25 | } 26 | 27 | @Override 28 | public void modify(Object object) { 29 | Consumer consumer = detalle -> { 30 | BigDecimal isc = detalle.getIscBaseImponible().multiply(detalle.getTasaIsc()); 31 | detalle.setIsc(isc); 32 | }; 33 | whenSalesDocumentItem.apply(object).ifPresent(consumer); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Impuesto.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.rules.utils; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Data 9 | @Builder 10 | public class Impuesto { 11 | private BigDecimal baseImponible; 12 | 13 | private BigDecimal importe; 14 | private BigDecimal importeIgv; 15 | private BigDecimal importeIsc; 16 | private BigDecimal importeIcb; 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.ruleunits; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.kie.RuleContext; 4 | import lombok.Builder; 5 | import lombok.Getter; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Getter 10 | @Builder 11 | public class BodyRuleContext implements RuleContext { 12 | 13 | private String moneda; 14 | private BigDecimal tasaIgv; 15 | private BigDecimal tasaIvap; 16 | private BigDecimal tasaIcb; 17 | } 18 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleUnit.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.ruleunits; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 4 | import io.github.project.openubl.xbuilder.enricher.kie.RuleFactory; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RuleFactoryRegistry; 6 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 7 | import io.github.project.openubl.xbuilder.enricher.kie.RuleUnit; 8 | 9 | import java.util.List; 10 | 11 | public class BodyRuleUnit implements RuleUnit { 12 | 13 | private final Defaults defaults; 14 | private final BodyRuleContext context; 15 | private final List rules; 16 | 17 | public BodyRuleUnit(RulePhase.PhaseType phaseType, Defaults defaults, BodyRuleContext context) { 18 | this.defaults = defaults; 19 | this.context = context; 20 | this.rules = RuleFactoryRegistry.getRuleFactories(phaseType); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | int prevHashCode; 26 | int currentHashCode; 27 | 28 | do { 29 | prevHashCode = object.hashCode(); 30 | rules 31 | .stream() 32 | .filter(factory -> factory.test(object)) 33 | .map(factory -> factory.create(defaults, context)) 34 | .forEach(rule -> rule.modify(object)); 35 | currentHashCode = object.hashCode(); 36 | } while (prevHashCode != currentHashCode); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleContext.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.ruleunits; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.kie.RuleContext; 4 | import lombok.Builder; 5 | import lombok.Getter; 6 | 7 | import java.time.LocalDate; 8 | 9 | @Getter 10 | @Builder 11 | public class HeaderRuleContext implements RuleContext { 12 | 13 | private LocalDate localDate; 14 | } 15 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleUnit.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.enricher.kie.ruleunits; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 4 | import io.github.project.openubl.xbuilder.enricher.kie.RuleFactory; 5 | import io.github.project.openubl.xbuilder.enricher.kie.RuleFactoryRegistry; 6 | import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; 7 | import io.github.project.openubl.xbuilder.enricher.kie.RuleUnit; 8 | 9 | import java.util.List; 10 | 11 | public class HeaderRuleUnit implements RuleUnit { 12 | 13 | private final Defaults defaults; 14 | private final HeaderRuleContext context; 15 | private final List rules; 16 | 17 | public HeaderRuleUnit(RulePhase.PhaseType phaseType, Defaults defaults, HeaderRuleContext context) { 18 | this.defaults = defaults; 19 | this.context = context; 20 | this.rules = RuleFactoryRegistry.getRuleFactories(phaseType); 21 | } 22 | 23 | @Override 24 | public void modify(Object object) { 25 | int prevHashCode; 26 | int currentHashCode; 27 | 28 | do { 29 | prevHashCode = object.hashCode(); 30 | rules 31 | .stream() 32 | .filter(factory -> factory.test(object)) 33 | .map(factory -> factory.create(defaults, context)) 34 | .forEach(rule -> rule.modify(object)); 35 | currentHashCode = object.hashCode(); 36 | } while (prevHashCode != currentHashCode); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetails.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xbuilder.signature; 2 | 3 | import java.security.PrivateKey; 4 | import java.security.cert.X509Certificate; 5 | 6 | public class CertificateDetails { 7 | 8 | private PrivateKey privateKey; 9 | 10 | private X509Certificate x509Certificate; 11 | 12 | public PrivateKey getPrivateKey() { 13 | return privateKey; 14 | } 15 | 16 | public void setPrivateKey(PrivateKey privateKey) { 17 | this.privateKey = privateKey; 18 | } 19 | 20 | public X509Certificate getX509Certificate() { 21 | return x509Certificate; 22 | } 23 | 24 | public void setX509Certificate(X509Certificate x509Certificate) { 25 | this.x509Certificate = x509Certificate; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/common/signature.xml: -------------------------------------------------------------------------------- 1 | 2 | {firmante.ruc} 3 | 4 | 5 | {firmante.ruc} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | #PROJECT-OPENUBL-SIGN 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/address.xml: -------------------------------------------------------------------------------- 1 | {#if direccion.ubigeo} 2 | {direccion.ubigeo} 3 | {/if} 4 | {#if direccion.codigoLocal} 5 | {direccion.codigoLocal} 6 | {/if} 7 | {#if direccion.urbanizacion} 8 | {direccion.urbanizacion} 9 | {/if} 10 | {#if direccion.provincia} 11 | {direccion.provincia} 12 | {/if} 13 | {#if direccion.departamento} 14 | {direccion.departamento} 15 | {/if} 16 | {#if direccion.distrito} 17 | {direccion.distrito} 18 | {/if} 19 | {#if direccion.direccion} 20 | 21 | 22 | 23 | {/if} 24 | {#if direccion.codigoPais} 25 | 26 | {direccion.codigoPais} 27 | 28 | {/if} 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/contact.xml: -------------------------------------------------------------------------------- 1 | 2 | {#if contacto.telefono} 3 | {contacto.telefono} 4 | {/if} 5 | {#if contacto.email} 6 | {contacto.email} 7 | {/if} 8 | 9 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/customer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {cliente.numeroDocumentoIdentidad} 5 | 6 | 7 | 8 | {#if cliente.direccion} 9 | 10 | {#include ubl/standard/include/address.xml direccion=cliente.direccion /} 11 | 12 | {/if} 13 | 14 | {#if cliente.contacto} 15 | {#include ubl/standard/include/contact.xml contacto=cliente.contacto /} 16 | {/if} 17 | 18 | 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/documentos-relacionados.xml: -------------------------------------------------------------------------------- 1 | {#each item.documentosRelacionados.orEmpty} 2 | 3 | {it.serieNumero} 4 | {it.tipoDocumento} 5 | 6 | {/each} -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/general-data.xml: -------------------------------------------------------------------------------- 1 | 2.1 2 | 2.0 3 | {item.serie}-{item.numero} 4 | {item.fechaEmision} 5 | {#if item.horaEmision} 6 | {item.horaEmision.format('HH:mm:ss')} 7 | {/if} 8 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/guias.xml: -------------------------------------------------------------------------------- 1 | {#each item.guias.orEmpty} 2 | 3 | {it.serieNumero} 4 | {it.tipoDocumento} 5 | 6 | {/each} -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/monetary-total.xml: -------------------------------------------------------------------------------- 1 | {totalImporte.importeSinImpuestos.scale(2)} 2 | {totalImporte.importe.scale(2)} 3 | {totalImporte.importe.scale(2)} 4 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/namespaces.xml: -------------------------------------------------------------------------------- 1 | xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" 2 | xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" 3 | xmlns:ccts="urn:un:unece:uncefact:documentation:2" 4 | xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" 5 | xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 6 | xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" 7 | xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" 8 | xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" 9 | xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" 10 | xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 11 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/note/invoice-reference.xml: -------------------------------------------------------------------------------- 1 | 2 | {item.comprobanteAfectadoSerieNumero} 3 | {item.comprobanteAfectadoTipo} 4 | 5 | 6 | {#if item.ordenDeCompra} 7 | 8 | {item.ordenDeCompra} 9 | 10 | {/if} 11 | 12 | 13 | {item.comprobanteAfectadoSerieNumero} 14 | {item.comprobanteAfectadoTipo} 15 | 16 | 17 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/payment-terms.xml: -------------------------------------------------------------------------------- 1 | 2 | FormaPago 3 | {item.tipo} 4 | {#if item.tipo == 'Credito'} 5 | {item.total.scale(2)} 6 | {/if} 7 | 8 | {#each item.cuotas.orEmpty} 9 | 10 | FormaPago 11 | Cuota{it_index.add(1).format('%03d')} 12 | {it.importe.scale(2)} 13 | {it.fechaPago} 14 | 15 | {/each} 16 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/supplier.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {proveedor.ruc} 5 | 6 | {#if proveedor.nombreComercial} 7 | 8 | {proveedor.nombreComercial} 9 | 10 | {/if} 11 | 12 | 13 | {#if proveedor.direccion} 14 | 15 | {#include ubl/standard/include/address.xml direccion=proveedor.direccion /} 16 | 17 | {/if} 18 | 19 | {#if proveedor.contacto} 20 | {#include ubl/standard/include/contact.xml contacto=proveedor.contacto /} 21 | {/if} 22 | 23 | 24 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/standard/include/ubl-extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/sunat/include/agent-party.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {proveedor.ruc} 4 | 5 | {#if proveedor.nombreComercial} 6 | 7 | 8 | 9 | {/if} 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/sunat/include/receiver-party.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {cliente.numeroDocumentoIdentidad} 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /xbuilder/core/src/main/resources/templates/ubl/sunat/include/supplier.xml: -------------------------------------------------------------------------------- 1 | 2 | {proveedor.ruc} 3 | 6 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /xbuilder/core/src/test/java/e2e/enricher/enrich/InvoiceTest.java: -------------------------------------------------------------------------------- 1 | package e2e.enricher.enrich; 2 | 3 | import e2e.AbstractTest; 4 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog1_Invoice; 5 | import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; 6 | import io.github.project.openubl.xbuilder.enricher.ContentEnricher; 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | 11 | public class InvoiceTest extends AbstractTest { 12 | 13 | @Test 14 | public void testEnrichTipoComprobante() { 15 | // Given 16 | Invoice input = Invoice.builder() 17 | .serie("F001-1") 18 | .tipoComprobante(Catalog1_Invoice.BOLETA.getCode()) // This should be overwritten 19 | .build(); 20 | 21 | // When 22 | ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); 23 | enricher.enrich(input); 24 | 25 | // Then 26 | assertEquals(Catalog1_Invoice.FACTURA.getCode(), input.getTipoComprobante()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xbuilder/core/src/test/java/e2e/homologacion/HomologacionConstants.java: -------------------------------------------------------------------------------- 1 | package e2e.homologacion; 2 | 3 | import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; 4 | import io.github.project.openubl.xbuilder.content.models.common.Cliente; 5 | import io.github.project.openubl.xbuilder.content.models.common.Proveedor; 6 | 7 | public class HomologacionConstants { 8 | 9 | public static final Proveedor proveedor = Proveedor.builder() 10 | .ruc("12345678912") 11 | .razonSocial("Softgreen S.A.C.") 12 | .build(); 13 | public static final Cliente cliente = Cliente.builder() 14 | .nombre("Carlos Feria") 15 | .numeroDocumentoIdentidad("12121212121") 16 | .tipoDocumentoIdentidad(Catalog6.RUC.toString()) 17 | .build(); 18 | } 19 | -------------------------------------------------------------------------------- /xbuilder/core/src/test/java/e2e/homologacion/ManualDeHomologación_Version_3_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/xbuilder/core/src/test/java/e2e/homologacion/ManualDeHomologación_Version_3_0.pdf -------------------------------------------------------------------------------- /xbuilder/core/src/test/resources/LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-openubl/xhandler-java/9dea32a3e38d85899e2c0cb045ec4e4f9b87fb42/xbuilder/core/src/test/resources/LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx -------------------------------------------------------------------------------- /xbuilder/core/src/test/resources/xsd/2.0/message.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /xbuilder/core/src/test/resources/xsd/2.0/message.xsl: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /xbuilder/core/src/test/resources/xsd/2.1/common/UBL-XAdESv141-2.1.xsd: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /xbuilder/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | io.github.project-openubl 8 | xhandler-parent 9 | 5.0.3-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | xbuilder-parent 14 | XBuilder - Parent 15 | XBuilder parent 16 | pom 17 | 18 | 19 | core 20 | quarkus-extension 21 | 22 | 23 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/deployment/src/test/java/io/github/project/openubl/quarkus/xbuilder/test/QuarkusXbuilderDevModeTest.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xbuilder.test; 2 | 3 | import io.quarkus.test.QuarkusDevModeTest; 4 | import org.jboss.shrinkwrap.api.ShrinkWrap; 5 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 6 | import org.junit.jupiter.api.Assertions; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.RegisterExtension; 9 | 10 | public class QuarkusXbuilderDevModeTest { 11 | 12 | // Start hot reload (DevMode) test with your extension loaded 13 | @RegisterExtension 14 | static final QuarkusDevModeTest devModeTest = new QuarkusDevModeTest() 15 | .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); 16 | 17 | @Test 18 | public void writeYourOwnDevModeTest() { 19 | // Write your dev mode tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-hot-reload for more information 20 | Assertions.assertTrue(true, "Add dev mode assertions to " + getClass().getName()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/deployment/src/test/java/io/github/project/openubl/quarkus/xbuilder/test/QuarkusXbuilderTest.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xbuilder.test; 2 | 3 | import io.quarkus.test.QuarkusUnitTest; 4 | import org.jboss.shrinkwrap.api.ShrinkWrap; 5 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 6 | import org.junit.jupiter.api.Assertions; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.RegisterExtension; 9 | 10 | public class QuarkusXbuilderTest { 11 | 12 | // Start unit test with your extension loaded 13 | @RegisterExtension 14 | static final QuarkusUnitTest unitTest = new QuarkusUnitTest() 15 | .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); 16 | 17 | @Test 18 | public void writeYourOwnUnitTest() { 19 | // Write your unit tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-extensions for more information 20 | Assertions.assertTrue(true, "Add some assertions to " + getClass().getName()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/integration-tests/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.xbuilder.igv-tasa=0.2 2 | quarkus.xbuilder.icb-tasa=0.2 3 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/integration-tests/src/test/java/io/github/project/openubl/quarkus/xbuilder/it/QuarkusXbuilderResourceIT.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xbuilder.it; 2 | 3 | import io.quarkus.test.junit.QuarkusIntegrationTest; 4 | 5 | @QuarkusIntegrationTest 6 | public class QuarkusXbuilderResourceIT extends QuarkusXbuilderResourceTest { 7 | } 8 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/integration-tests/src/test/resources/.gitignore: -------------------------------------------------------------------------------- 1 | /e2e/ 2 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/XBuilder.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xbuilder; 2 | 3 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 4 | import io.quarkus.qute.Template; 5 | 6 | public interface XBuilder { 7 | Template getTemplate(Type type); 8 | 9 | Defaults getDefaults(); 10 | 11 | enum Type { 12 | INVOICE("invoice.xml"), 13 | CREDIT_NOTE("creditNote.xml"), 14 | DEBIT_NOTE("debitNote.xml"), 15 | VOIDED_DOCUMENTS("voidedDocuments.xml"), 16 | SUMMARY_DOCUMENTS("summaryDocuments.xml"), 17 | PERCEPTION("perception.xml"), 18 | RETENTION("retention.xml"), 19 | DESPATCH_ADVICE("despatchAdvice.xml"); 20 | 21 | private final String templatePath; 22 | 23 | Type(String templatePath) { 24 | this.templatePath = templatePath; 25 | } 26 | 27 | public String getTemplatePath() { 28 | return templatePath; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/runtime/DefaultXBuilder.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xbuilder.runtime; 2 | 3 | import io.github.project.openubl.quarkus.xbuilder.XBuilder; 4 | import io.github.project.openubl.xbuilder.enricher.config.Defaults; 5 | import io.github.project.openubl.xbuilder.renderer.EngineProducer; 6 | import io.quarkus.qute.Engine; 7 | import io.quarkus.qute.EngineBuilder; 8 | import io.quarkus.qute.HtmlEscaper; 9 | import io.quarkus.qute.Template; 10 | 11 | import jakarta.enterprise.event.Observes; 12 | import jakarta.inject.Inject; 13 | import jakarta.inject.Singleton; 14 | import java.math.BigDecimal; 15 | import java.util.List; 16 | 17 | @Singleton 18 | public class DefaultXBuilder implements XBuilder { 19 | 20 | @Inject 21 | Engine engine; 22 | 23 | @Inject 24 | XBuilderConfig config; 25 | 26 | void configureEngine(@Observes EngineBuilder builder) { 27 | builder.addResultMapper( 28 | new HtmlEscaper(List.of("text/html", "text/xml", "application/xml", "application/xhtml+xml")) 29 | ); 30 | 31 | EngineProducer.getInstance().getEngine().getValueResolvers().forEach(builder::addValueResolver); 32 | } 33 | 34 | @Override 35 | public Template getTemplate(Type type) { 36 | return engine.getTemplate(CustomTemplateLocator.PREFIX + type.getTemplatePath()); 37 | } 38 | 39 | @Override 40 | public Defaults getDefaults() { 41 | return Defaults.builder() 42 | .igvTasa(config.igvTasa.orElse(new BigDecimal("0.18"))) 43 | .icbTasa(config.icbTasa.orElse(new BigDecimal("0.2"))) 44 | .build(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xbuilder/runtime/XBuilderConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xbuilder.runtime; 2 | 3 | import io.quarkus.runtime.annotations.ConfigItem; 4 | import io.quarkus.runtime.annotations.ConfigPhase; 5 | import io.quarkus.runtime.annotations.ConfigRoot; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.Optional; 9 | 10 | @ConfigRoot(name = "xbuilder", phase = ConfigPhase.RUN_TIME) 11 | public class XBuilderConfig { 12 | 13 | /** 14 | * Default igvTasa 15 | */ 16 | @ConfigItem 17 | public Optional igvTasa; 18 | 19 | /** 20 | * Default icbTasa 21 | */ 22 | @ConfigItem 23 | public Optional icbTasa; 24 | } 25 | -------------------------------------------------------------------------------- /xbuilder/quarkus-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml: -------------------------------------------------------------------------------- 1 | name: "Quarkus XBuilder" 2 | description: "XBuilder support." 3 | metadata: 4 | keywords: 5 | - quarkus-xbuilder 6 | - openubl 7 | # guide: ... 8 | categories: 9 | - "miscellaneous" 10 | status: "preview" 11 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/Constants.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender; 2 | 3 | public class Constants { 4 | 5 | public static final String XSENDER_BILL_SERVICE_URI = "direct:xsender-billService"; 6 | public static final String XSENDER_BILL_CONSULT_SERVICE_URI = "direct:xsender-billConsultService"; 7 | public static final String XSENDER_BILL_VALID_SERVICE_URI = "direct:xsender-billValidService"; 8 | 9 | public static final String XSENDER_CREDENTIALS_API_URI = "direct:xsender-credentialsApi"; 10 | } 11 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/camel/StandaloneCamel.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.camel; 2 | 3 | import lombok.Synchronized; 4 | import org.apache.camel.main.Main; 5 | 6 | public final class StandaloneCamel { 7 | 8 | private static StandaloneCamel instance; 9 | private final Main mainCamel; 10 | 11 | private StandaloneCamel() throws Exception { 12 | mainCamel = new Main(StandaloneCamel.class); 13 | mainCamel.start(); 14 | } 15 | 16 | @Synchronized 17 | public static StandaloneCamel getInstance() { 18 | if (instance == null) { 19 | try { 20 | instance = new StandaloneCamel(); 21 | } catch (Exception e) { 22 | throw new RuntimeException(e); 23 | } 24 | } 25 | return instance; 26 | } 27 | 28 | public Main getMainCamel() { 29 | return mainCamel; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/camel/routes/TicketResponseType.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.camel.routes; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | import java.util.Arrays; 7 | import java.util.Optional; 8 | 9 | @Getter 10 | @AllArgsConstructor 11 | public enum TicketResponseType { 12 | PROCESO_CORRECTAMENTE(0, "Procesó correctamente"), 13 | EN_PROCESO(98, "En proceso"), 14 | PROCESO_CON_ERRORES(99, "Procesó con errores"); 15 | 16 | private final int code; 17 | private final String description; 18 | 19 | public static Optional getFromCode(int code) { 20 | return Arrays.stream(TicketResponseType.values()).filter(f -> f.getCode() == code).findFirst(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/camel/utils/CamelData.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.camel.utils; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.util.Map; 8 | 9 | @Data 10 | @Builder 11 | @AllArgsConstructor 12 | public class CamelData { 13 | private Object body; 14 | private Map headers; 15 | } 16 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/company/CompanyCredentials.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.company; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | @Data 8 | @Builder 9 | @AllArgsConstructor 10 | public class CompanyCredentials { 11 | 12 | private final String username; 13 | private final String password; 14 | private final String clientId; 15 | private final String clientSecret; 16 | private final String token; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/company/CompanyURLs.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.company; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | @Data 8 | @Builder 9 | @AllArgsConstructor 10 | public class CompanyURLs { 11 | 12 | private final String invoice; 13 | private final String perceptionRetention; 14 | private final String despatch; 15 | } 16 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/files/BillServiceFileAnalyzer.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.files; 2 | 3 | import io.github.project.openubl.xsender.files.xml.XmlContent; 4 | import io.github.project.openubl.xsender.sunat.BillServiceDestination; 5 | 6 | public interface BillServiceFileAnalyzer { 7 | ZipFile getZipFile(); 8 | 9 | BillServiceDestination getSendFileDestination(); 10 | 11 | BillServiceDestination getVerifyTicketDestination(); 12 | 13 | XmlContent getXmlContent(); 14 | } 15 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/files/ZipFile.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.files; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | @Data 8 | @Builder 9 | @AllArgsConstructor 10 | public class ZipFile { 11 | private final byte[] file; 12 | private final String filename; 13 | } 14 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/files/exceptions/UnsupportedXMLFileException.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.files.exceptions; 2 | 3 | public class UnsupportedXMLFileException extends Exception { 4 | 5 | public UnsupportedXMLFileException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/files/xml/DocumentType.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.files.xml; 2 | 3 | public class DocumentType { 4 | 5 | public static final String INVOICE = "Invoice"; 6 | public static final String CREDIT_NOTE = "CreditNote"; 7 | public static final String DEBIT_NOTE = "DebitNote"; 8 | public static final String VOIDED_DOCUMENT = "VoidedDocuments"; 9 | public static final String SUMMARY_DOCUMENT = "SummaryDocuments"; 10 | public static final String PERCEPTION = "Perception"; 11 | public static final String RETENTION = "Retention"; 12 | public static final String DESPATCH_ADVICE = "DespatchAdvice"; 13 | } 14 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/files/xml/XmlContent.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.files.xml; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @Builder 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class XmlContent { 13 | 14 | private String documentType; 15 | private String documentID; 16 | private String ruc; 17 | private String voidedLineDocumentTypeCode; 18 | } 19 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/files/xml/XmlContentProvider.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.files.xml; 2 | 3 | import org.xml.sax.SAXException; 4 | 5 | import javax.xml.parsers.ParserConfigurationException; 6 | import javax.xml.parsers.SAXParser; 7 | import javax.xml.parsers.SAXParserFactory; 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | 11 | public class XmlContentProvider { 12 | 13 | private XmlContentProvider() { 14 | // Only static methods 15 | } 16 | 17 | public static XmlContent getSunatDocument(InputStream is) throws ParserConfigurationException, SAXException, IOException { 18 | XmlHandler handler = new XmlHandler(); 19 | 20 | SAXParserFactory factory = SAXParserFactory.newDefaultInstance(); 21 | factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); 22 | factory.setFeature("http://xml.org/sax/features/external-general-entities", false); 23 | factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); 24 | factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); 25 | factory.setNamespaceAware(true); 26 | 27 | SAXParser parser = factory.newSAXParser(); 28 | parser.parse(is, handler); 29 | 30 | return handler.getModel(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/Metadata.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | @AllArgsConstructor 12 | public class Metadata { 13 | private final Integer responseCode; 14 | private final String description; 15 | private final List notes; 16 | } 17 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/Status.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models; 2 | 3 | public enum Status { 4 | ACEPTADO, 5 | RECHAZADO, 6 | BAJA, 7 | EXCEPCION, 8 | EN_PROCESO, 9 | UNKNOWN; 10 | 11 | public static Status fromCode(int code) { 12 | if (code == 0) { 13 | return Status.ACEPTADO; 14 | } else if (code == 98) { 15 | return Status.EN_PROCESO; 16 | } else if (code == 99) { 17 | return Status.EXCEPCION; 18 | } else if (code >= 100 && code < 2_000) { 19 | return Status.EXCEPCION; 20 | } else if (code >= 2000 && code < 4000) { 21 | return Status.RECHAZADO; 22 | } else if (code >= 4000) { 23 | return Status.ACEPTADO; 24 | } else { 25 | return Status.UNKNOWN; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/Sunat.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | @Data 7 | @Builder 8 | public class Sunat { 9 | private String ticket; 10 | private byte[] cdr; 11 | } 12 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/SunatResponse.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | @Data 7 | @Builder 8 | public class SunatResponse { 9 | private Status status; 10 | private Metadata metadata; 11 | private Sunat sunat; 12 | 13 | public boolean isTicket() { 14 | return sunat != null && sunat.getTicket() != null; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/rest/ResponseAccessTokenSuccessDto.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models.rest; 2 | 3 | 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.time.ZonedDateTime; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class ResponseAccessTokenSuccessDto { 16 | 17 | private String access_token; 18 | private int expires_in; 19 | private ZonedDateTime created_in; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/rest/ResponseDocumentErrorDto.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models.rest; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Singular; 8 | 9 | import java.util.List; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class ResponseDocumentErrorDto { 16 | private String cod; 17 | private String msg; 18 | private String exc; 19 | 20 | private String status; 21 | private String message; 22 | 23 | @Singular 24 | private List errors; 25 | 26 | @Data 27 | @Builder 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | public static class Error { 31 | private String cod; 32 | private String msg; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/models/rest/ResponseDocumentSuccessDto.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.models.rest; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.time.ZonedDateTime; 9 | 10 | @Data 11 | @Builder 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public class ResponseDocumentSuccessDto { 15 | private String numTicket; 16 | private ZonedDateTime fecRecepcion; 17 | 18 | private String codRespuesta; 19 | private String arcCdr; 20 | private String indCdrGenerado; 21 | private Error error; 22 | 23 | @Data 24 | @Builder 25 | @NoArgsConstructor 26 | @AllArgsConstructor 27 | public static class Error { 28 | private String numError; 29 | private String desError; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/sunat/BillConsultServiceDestination.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.sunat; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.Getter; 7 | 8 | @Data 9 | @Builder 10 | @AllArgsConstructor 11 | public class BillConsultServiceDestination { 12 | private final String url; 13 | private final Operation operation; 14 | 15 | @Getter 16 | @AllArgsConstructor 17 | public enum Operation { 18 | GET_STATUS("getStatus"), 19 | GET_STATUS_CDR("getStatusCdr"); 20 | 21 | private final String webMethod; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/sunat/BillServiceDestination.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.sunat; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.Getter; 7 | import org.apache.camel.component.http.HttpMethods; 8 | 9 | @Data 10 | @Builder 11 | @AllArgsConstructor 12 | public class BillServiceDestination { 13 | private final String url; 14 | private final SoapOperation soapOperation; 15 | private final RestOperation restOperation; 16 | 17 | @Getter 18 | @AllArgsConstructor 19 | public enum SoapOperation { 20 | SEND_BILL("sendBill"), 21 | SEND_SUMMARY("sendSummary"), 22 | SEND_PACK("sendPack"), 23 | GET_STATUS("getStatus"); 24 | 25 | private final String webMethod; 26 | } 27 | 28 | @Getter 29 | @AllArgsConstructor 30 | public enum RestOperation { 31 | SEND_DOCUMENT(HttpMethods.POST, "/comprobantes"), 32 | VERIFY_TICKET(HttpMethods.GET, "/comprobantes/envios"); 33 | 34 | private final HttpMethods method; 35 | private final String path; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/sunat/BillValidServiceDestination.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.sunat; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | @Data 8 | @Builder 9 | @AllArgsConstructor 10 | public class BillValidServiceDestination { 11 | private final String url; 12 | } 13 | -------------------------------------------------------------------------------- /xsender/core/src/main/java/io/github/project/openubl/xsender/sunat/catalog/Catalog1.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.sunat.catalog; 2 | 3 | import java.util.Optional; 4 | import java.util.stream.Stream; 5 | 6 | public enum Catalog1 { 7 | FACTURA("01"), 8 | BOLETA("03"), 9 | NOTA_CREDITO("07"), 10 | NOTA_DEBITO("08"), 11 | GUIA_REMISION_REMITENTE("09"), 12 | TICKET_MAQUINA_REGISTRADORA("12"), 13 | DOCUMENTOS_FINANCIEROS("13"), 14 | DOCUMENTOS_AFP("18"), 15 | GUIA_REMISION_TRANSPORTISTA("31"), 16 | COMPROBANTE_PAGO_SEAE("56"), 17 | GUIA_REMISION_REMITENTE_COMPLEMENTARIA("71"), 18 | GUIA_REMISION_TRANSPORTISTA_COMPLEMENTARIA("72"), 19 | 20 | RETENCION("20"), 21 | PERCEPCION("40"), 22 | PERCEPCION_VENTA_INTERNA("21"); 23 | 24 | private final String code; 25 | 26 | Catalog1(String code) { 27 | this.code = code; 28 | } 29 | 30 | public String getCode() { 31 | return code; 32 | } 33 | 34 | public static Optional valueOfCode(String code) { 35 | return Stream.of(Catalog1.values()).filter(p -> p.getCode().equals(code)).findFirst(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /xsender/core/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # to configure camel main 2 | # https://camel.apache.org/components/next/others/main.html 3 | camel.main.name=XSenderCamel 4 | enableLoggingFeature=false -------------------------------------------------------------------------------- /xsender/core/src/test/java/io/github/project/openubl/xsender/sunat/catalog/Catalog1Test.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.xsender.sunat.catalog; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import java.util.Optional; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.junit.jupiter.api.Assertions.assertFalse; 9 | import static org.junit.jupiter.api.Assertions.assertTrue; 10 | 11 | public class Catalog1Test { 12 | 13 | @Test 14 | public void givenValidCodeShouldReturnEnumValue() { 15 | Optional result = Catalog1.valueOfCode("01"); 16 | 17 | assertTrue(result.isPresent()); 18 | assertEquals(Catalog1.FACTURA, result.get()); 19 | } 20 | 21 | @Test 22 | public void givenInvalidCodeShouldReturnEmptyValue() { 23 | Optional result = Catalog1.valueOfCode("010"); 24 | 25 | assertFalse(result.isPresent()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /xsender/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | io.github.project-openubl 8 | xhandler-parent 9 | 5.0.3-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | xsender-parent 14 | XSender - Parent 15 | Java library for sending XML files to SUNAT 16 | pom 17 | 18 | 19 | core 20 | quarkus-extension 21 | spring-boot-extension 22 | 23 | 24 | -------------------------------------------------------------------------------- /xsender/quarkus-extension/deployment/src/test/java/io/github/project/openubl/quarkus/xsender/test/QuarkusXsenderDevModeTest.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xsender.test; 2 | 3 | import io.quarkus.test.QuarkusDevModeTest; 4 | import org.jboss.shrinkwrap.api.ShrinkWrap; 5 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 6 | import org.junit.jupiter.api.Assertions; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.RegisterExtension; 9 | 10 | public class QuarkusXsenderDevModeTest { 11 | 12 | // Start hot reload (DevMode) test with your extension loaded 13 | @RegisterExtension 14 | static final QuarkusDevModeTest devModeTest = new QuarkusDevModeTest() 15 | .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); 16 | 17 | @Test 18 | public void writeYourOwnDevModeTest() { 19 | // Write your dev mode tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-hot-reload for more information 20 | Assertions.assertTrue(true, "Add dev mode assertions to " + getClass().getName()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /xsender/quarkus-extension/deployment/src/test/java/io/github/project/openubl/quarkus/xsender/test/QuarkusXsenderTest.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xsender.test; 2 | 3 | import io.quarkus.test.QuarkusUnitTest; 4 | import org.jboss.shrinkwrap.api.ShrinkWrap; 5 | import org.jboss.shrinkwrap.api.spec.JavaArchive; 6 | import org.junit.jupiter.api.Assertions; 7 | import org.junit.jupiter.api.Test; 8 | import org.junit.jupiter.api.extension.RegisterExtension; 9 | 10 | public class QuarkusXsenderTest { 11 | 12 | // Start unit test with your extension loaded 13 | @RegisterExtension 14 | static final QuarkusUnitTest unitTest = new QuarkusUnitTest() 15 | .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); 16 | 17 | @Test 18 | public void writeYourOwnUnitTest() { 19 | // Write your unit tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-extensions for more information 20 | Assertions.assertTrue(true, "Add some assertions to " + getClass().getName()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /xsender/quarkus-extension/integration-tests/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.cxf.path=/soapservice 2 | quarkus.native.resources.includes=xmls/*.xml 3 | quarkus.xsender.enable-logging-feature=true -------------------------------------------------------------------------------- /xsender/quarkus-extension/integration-tests/src/test/java/io/github/project/openubl/quarkus/xsender/it/QuarkusSenderResourceIT.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xsender.it; 2 | 3 | import io.quarkus.test.junit.QuarkusIntegrationTest; 4 | 5 | @QuarkusIntegrationTest 6 | public class QuarkusSenderResourceIT extends QuarkusXSenderResourceTest { 7 | } 8 | -------------------------------------------------------------------------------- /xsender/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xsender/XSender.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xsender; 2 | 3 | import io.github.project.openubl.quarkus.xsender.runtime.XSenderConfig; 4 | import io.github.project.openubl.xsender.camel.routes.CxfEndpointConfiguration; 5 | import org.apache.camel.component.cxf.jaxws.CxfEndpoint; 6 | 7 | import jakarta.enterprise.context.ApplicationScoped; 8 | import jakarta.enterprise.inject.Produces; 9 | import jakarta.inject.Inject; 10 | import jakarta.inject.Named; 11 | 12 | public class XSender { 13 | 14 | @Inject 15 | XSenderConfig config; 16 | 17 | @Produces 18 | @ApplicationScoped 19 | @Named("cxfBillServiceEndpoint") 20 | CxfEndpoint produceCxfBillServiceEndpoint() { 21 | return new CxfEndpointConfiguration().cxfBillServiceEndpoint(config.enableLoggingFeature); 22 | } 23 | 24 | @Produces 25 | @ApplicationScoped 26 | @Named("cxfBillConsultServiceEndpoint") 27 | CxfEndpoint produceCxfBillConsultServiceEndpoint() { 28 | return new CxfEndpointConfiguration().cxfBillConsultServiceEndpoint(config.enableLoggingFeature); 29 | } 30 | 31 | @Produces 32 | @ApplicationScoped 33 | @Named("cxfBillValidServiceEndpoint") 34 | CxfEndpoint produceCxfBillValidServiceEndpoint() { 35 | return new CxfEndpointConfiguration().cxfBillValidServiceEndpoint(config.enableLoggingFeature); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /xsender/quarkus-extension/runtime/src/main/java/io/github/project/openubl/quarkus/xsender/runtime/XSenderConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.quarkus.xsender.runtime; 2 | 3 | import io.quarkus.runtime.annotations.ConfigItem; 4 | import io.quarkus.runtime.annotations.ConfigPhase; 5 | import io.quarkus.runtime.annotations.ConfigRoot; 6 | 7 | @ConfigRoot(name = "xsender", phase = ConfigPhase.RUN_TIME) 8 | public class XSenderConfig { 9 | 10 | /** 11 | * Enable logging feature 12 | */ 13 | @ConfigItem 14 | public boolean enableLoggingFeature; 15 | } 16 | -------------------------------------------------------------------------------- /xsender/quarkus-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml: -------------------------------------------------------------------------------- 1 | name: "Quarkus XSender" 2 | description: "XSender support." 3 | metadata: 4 | keywords: 5 | - quarkus-xsender 6 | - openubl 7 | # guide: ... 8 | categories: 9 | - "miscellaneous" 10 | status: "preview" 11 | -------------------------------------------------------------------------------- /xsender/spring-boot-extension/integration-tests/src/main/java/io/github/project/openubl/springboot/xsender/it/Application.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.springboot.xsender.it; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ComponentScan; 6 | 7 | @ComponentScan 8 | @ComponentScan("io.github.project.openubl.spring.xsender.runtime") 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Application.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /xsender/spring-boot-extension/integration-tests/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.xsender.enable-logging-feature=true 2 | -------------------------------------------------------------------------------- /xsender/spring-boot-extension/runtime/src/main/java/io/github/project/openubl/spring/xsender/runtime/XSenderSpringSetup.java: -------------------------------------------------------------------------------- 1 | package io.github.project.openubl.spring.xsender.runtime; 2 | 3 | import io.github.project.openubl.xsender.camel.routes.CxfEndpointConfiguration; 4 | import io.github.project.openubl.xsender.camel.routes.SunatRouteBuilder; 5 | import org.apache.camel.component.cxf.jaxws.CxfEndpoint; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | public class XSenderSpringSetup { 12 | 13 | @Value("${spring.xsender.enable-logging-feature:false}") 14 | private boolean enableLoggingFeature; 15 | 16 | @Bean 17 | public SunatRouteBuilder produceSunatRouteBuilder() { 18 | return new SunatRouteBuilder(); 19 | } 20 | 21 | @Bean(name = "cxfBillServiceEndpoint") 22 | CxfEndpoint produceCxfBillServiceEndpoint() { 23 | return new CxfEndpointConfiguration().cxfBillServiceEndpoint(enableLoggingFeature); 24 | } 25 | 26 | @Bean(name = "cxfBillConsultServiceEndpoint") 27 | CxfEndpoint produceCxfBillConsultServiceEndpoint() { 28 | return new CxfEndpointConfiguration().cxfBillConsultServiceEndpoint(enableLoggingFeature); 29 | } 30 | 31 | @Bean(name = "cxfBillValidServiceEndpoint") 32 | CxfEndpoint produceCxfBillValidServiceEndpoint() { 33 | return new CxfEndpointConfiguration().cxfBillValidServiceEndpoint(enableLoggingFeature); 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------