Skip to content

Change readme #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 120
strategy:
matrix:
java-version: [8, 11, 13]
java-version: [8, 11, 15]

runs-on: ubuntu-latest

Expand Down
94 changes: 15 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,27 @@
![Maven Central](https://img.shields.io/maven-central/v/io.github.project-openubl/xbuilder)
[![License](https://img.shields.io/badge/License-EPL%202.0-green.svg)](https://opensource.org/licenses/EPL-2.0)
![CI](https://github.com/project-openubl/xbuilder/workflows/CI/badge.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=project-openubl_xbuilder&metric=alert_status)](https://sonarcloud.io/dashboard?id=project-openubl_xbuilder)

# XBuilder

Java library for creating and signing XML files based on UBL standards.

XBuilder can be found in [Maven Central](https://mvnrepository.com/artifact/io.github.project-openubl/xbuilder)

## Installation
### Maven
[![Project Chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg?style=for-the-badge&logo=zulip)](https://projectopenubl.zulipchat.com/)
[![Supported JVM Versions](https://img.shields.io/badge/JVM-8--11--15-brightgreen.svg?style=for-the-badge&logo=Java)](https://github.com/quarkusio/quarkus/actions/runs/113853915/)

Open your `pom.xml` file and add:

```xml
<dependency>
<groupId>io.github.project-openubl</groupId>
<artifactId>xbuilder</artifactId>
<version>1.1.0.Final</version>
</dependency>
```

### Gradle
# XBuilder

Open your `build.gradle` file and add:
Librería Java para crear XMLs basados en UBL y los estándares de la SUNAT respecto a la facturación electrónica.

```java
compile group: 'io.github.project-openubl', name: 'xbuilder', version: '1.1.0.Final'
```
XBuilder esta diseñado para que puedas crear XMLs fácilmente.

## Supported countries
- Crea XMLs sin que necesites conocer nada sobre manejo de archivos XMLs.
- Hace cálculos internos por ti.
- Requiere solamente datos mínimos.

- Perú
## ¿Qué puedes hacer con XBuilder?

> If you want support for your country please create an issue.
- Crear XMLs
- Firmar XMLs

## Getting started

XML files can be created from Input Models; for instance:

```java
InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel()
.withSerie("F001")
.withNumero(1)
.withProveedor(ProveedorInputModel.Builder.aProveedorInputModel()
.withRuc("12345678912")
.withRazonSocial("Softgreen S.A.C.")
.build()
)
.withCliente(ClienteInputModel.Builder.aClienteInputModel()
.withNombre("Carlos Feria")
.withNumeroDocumentoIdentidad("12121212121")
.withTipoDocumentoIdentidad(Catalog6.RUC.toString())
.build()
)
.withDetalle(Arrays.asList(
DocumentLineInputModel.Builder.aDocumentLineInputModel()
.withDescripcion("Item1")
.withCantidad(new BigDecimal(10))
.withPrecioUnitario(new BigDecimal(100))
.withUnidadMedida("KGM")
.build(),
DocumentLineInputModel.Builder.aDocumentLineInputModel()
.withDescripcion("Item2")
.withCantidad(new BigDecimal(10))
.withPrecioUnitario(new BigDecimal(100))
.withUnidadMedida("KGM")
.build())
)
.build();

// Process Input and get XML
DocumentWrapper<InvoiceOutputModel> result = DocumentFacade.createXML(input, config, systemClock);
InvoiceOutputModel output = result.getOutput();
String xml = result.getXml();
```

## Sign XMLs

After you created the `xml` file you can now sign it:

```java
String xml;
String signID = "mySignID";

// Get your certificate using the method of your preference
X509Certificate certificate;
PrivateKey privateKey;

Document signedXML = XMLSigner.signXML(xml, signID, certificate, privateKey);
```
- [Documentación](https://project-openubl.github.io/docs/xsender)
- [Discusiones](https://github.com/project-openubl/xsender/discussions)
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<groupId>io.github.project-openubl</groupId>
<artifactId>xbuilder</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.1.3-SNAPSHOT</version>

<name>XML Builder :: Lib</name>
<description>XML Builder Library</description>
Expand Down