|
| 1 | + |
| 2 | +[](https://opensource.org/licenses/EPL-2.0) |
1 | 3 |  |
2 | 4 | [](https://sonarcloud.io/dashboard?id=project-openubl_xbuilder) |
3 | 5 |
|
4 | | -# XBuilder |
5 | | - |
6 | | -Java library for creating and signing XML files based on UBL standards. |
7 | | - |
8 | | -XBuilder can be found in [Maven Central](https://mvnrepository.com/artifact/io.github.project-openubl/xbuilder) |
9 | | - |
10 | | -## Installation |
11 | | -### Maven |
| 6 | +[](https://projectopenubl.zulipchat.com/) |
| 7 | +[](https://github.com/quarkusio/quarkus/actions/runs/113853915/) |
12 | 8 |
|
13 | | -Open your `pom.xml` file and add: |
14 | | - |
15 | | -```xml |
16 | | -<dependency> |
17 | | - <groupId>io.github.project-openubl</groupId> |
18 | | - <artifactId>xbuilder</artifactId> |
19 | | - <version>1.1.0.Final</version> |
20 | | -</dependency> |
21 | | -``` |
22 | | - |
23 | | -### Gradle |
| 9 | +# XBuilder |
24 | 10 |
|
25 | | -Open your `build.gradle` file and add: |
| 11 | +Librería Java para crear XMLs basados en UBL y los estándares de la SUNAT respecto a la facturación electrónica. |
26 | 12 |
|
27 | | -```java |
28 | | -compile group: 'io.github.project-openubl', name: 'xbuilder', version: '1.1.0.Final' |
29 | | -``` |
| 13 | +XBuilder esta diseñado para que puedas crear XMLs fácilmente. |
30 | 14 |
|
31 | | -## Supported countries |
| 15 | +- Crea XMLs sin que necesites conocer nada sobre manejo de archivos XMLs. |
| 16 | +- Hace cálculos internos por ti. |
| 17 | +- Requiere solamente datos mínimos. |
32 | 18 |
|
33 | | -- Perú |
| 19 | +## ¿Qué puedes hacer con XBuilder? |
34 | 20 |
|
35 | | -> If you want support for your country please create an issue. |
| 21 | +- Crear XMLs |
| 22 | +- Firmar XMLs |
36 | 23 |
|
37 | 24 | ## Getting started |
38 | 25 |
|
39 | | -XML files can be created from Input Models; for instance: |
40 | | - |
41 | | -```java |
42 | | -InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() |
43 | | - .withSerie("F001") |
44 | | - .withNumero(1) |
45 | | - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() |
46 | | - .withRuc("12345678912") |
47 | | - .withRazonSocial("Softgreen S.A.C.") |
48 | | - .build() |
49 | | - ) |
50 | | - .withCliente(ClienteInputModel.Builder.aClienteInputModel() |
51 | | - .withNombre("Carlos Feria") |
52 | | - .withNumeroDocumentoIdentidad("12121212121") |
53 | | - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) |
54 | | - .build() |
55 | | - ) |
56 | | - .withDetalle(Arrays.asList( |
57 | | - DocumentLineInputModel.Builder.aDocumentLineInputModel() |
58 | | - .withDescripcion("Item1") |
59 | | - .withCantidad(new BigDecimal(10)) |
60 | | - .withPrecioUnitario(new BigDecimal(100)) |
61 | | - .withUnidadMedida("KGM") |
62 | | - .build(), |
63 | | - DocumentLineInputModel.Builder.aDocumentLineInputModel() |
64 | | - .withDescripcion("Item2") |
65 | | - .withCantidad(new BigDecimal(10)) |
66 | | - .withPrecioUnitario(new BigDecimal(100)) |
67 | | - .withUnidadMedida("KGM") |
68 | | - .build()) |
69 | | - ) |
70 | | - .build(); |
71 | | - |
72 | | -// Process Input and get XML |
73 | | -DocumentWrapper<InvoiceOutputModel> result = DocumentFacade.createXML(input, config, systemClock); |
74 | | -InvoiceOutputModel output = result.getOutput(); |
75 | | -String xml = result.getXml(); |
76 | | -``` |
77 | | - |
78 | | -## Sign XMLs |
79 | | - |
80 | | -After you created the `xml` file you can now sign it: |
81 | | - |
82 | | -```java |
83 | | -String xml; |
84 | | -String signID = "mySignID"; |
85 | | - |
86 | | -// Get your certificate using the method of your preference |
87 | | -X509Certificate certificate; |
88 | | -PrivateKey privateKey; |
89 | | - |
90 | | -Document signedXML = XMLSigner.signXML(xml, signID, certificate, privateKey); |
91 | | -``` |
| 26 | +- [Documentación](https://project-openubl.github.io/docs/xsender) |
| 27 | +- [Discusiones](https://github.com/project-openubl/xsender/discussions) |
0 commit comments