Skip to content

Add VoidedDocuments support #150

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
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
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
[![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-11--17-brightgreen.svg?style=for-the-badge&logo=Java)](https://github.com/project-openubl/xbuilder/actions/runs/472762588/)

#### XBuilder
[![Maven Central](https://img.shields.io/maven-central/v/io.github.project-openubl/xbuilder)](https://search.maven.org/artifact/io.github.project-openubl/xbuilder/)

#### Quarkus XBuilder
[![Maven Central](https://img.shields.io/maven-central/v/io.github.project-openubl/quarkus-xbuilder)](https://search.maven.org/artifact/io.github.project-openubl/quarkus-xbuilder/)
| Artifact | Version |
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| XBuilder | [![Maven Central](https://img.shields.io/maven-central/v/io.github.project-openubl/xbuilder)](https://search.maven.org/artifact/io.github.project-openubl/xbuilder/) |
| XBuilder Quarkus extension | [![Maven Central](https://img.shields.io/maven-central/v/io.github.project-openubl/quarkus-xbuilder)](https://search.maven.org/artifact/io.github.project-openubl/quarkus-xbuilder/) |

# XBuilder

Expand All @@ -29,12 +28,16 @@ XBuilder esta diseñado para que puedas crear XMLs fácilmente.
## Getting started

- [Documentación](https://project-openubl.github.io)
- [Discusiones](https://github.com/project-openubl/xsender/discussions)
- [Discusiones](https://github.com/project-openubl/xbuilder/discussions)

## Developers

### Update snapshots

```shell
mvn clean test -Dxbuilder.snapshot.update
```
```

## License

- [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ public class Cliente {
* <p>
* Valores válidos: {@link Catalog6}
*/
@Schema(description = "Catalogo 06", required = true)
@Schema(description = "Catalogo 06", requiredMode = Schema.RequiredMode.REQUIRED)
private String tipoDocumentoIdentidad;

/**
* Número de documento de identidad del cliente.
*/
@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String numeroDocumentoIdentidad;

/**
* Nombre del cliente. Si el cliente es personal natural entonces
* es el nombre y apellidos de la persona; si el cliente es una persona jurídica
* entonces es la razón social de la empresa.
*/
@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String nombre;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.project.openubl.xbuilder.content.models.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.time.LocalDate;

@Data
@SuperBuilder
@NoArgsConstructor
public abstract class Document {

/**
* Fecha de emisión del comprobante. Ejemplo 2022-12-25 (YYYY-MM-SS)
*/
@Schema(description = "Format: \"YYYY-MM-SS\". Ejemplo: 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$")
private LocalDate fechaEmision;

/**
* Proveedor del bien o servicio
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private Proveedor proveedor;

/**
* Persona que firma electrónicamente el comprobante. Si es NULL los datos del proveedor son usados.
*/
@Schema(
description = "Persona que firma electrónicamente el comprobante. Si NULL los datos del proveedor son usados."
)
private Firmante firmante;

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public class Firmante {
/**
* Número de RUC de la persona
*/
@Schema(required = true, minLength = 11, maxLength = 11, pattern = "[0-9]+")
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 11, maxLength = 11, pattern = "[0-9]+")
private String ruc;

/**
* Razón social de la persona
*/
@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String razonSocial;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Proveedor {
/**
* Número de RUC de la persona jurídica
*/
@Schema(required = true, minLength = 11, maxLength = 11, pattern = "[0-9]+")
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minLength = 11, maxLength = 11, pattern = "[0-9]+")
private String ruc;

/**
Expand All @@ -47,7 +47,7 @@ public class Proveedor {
/**
* Razón social de la persona jurídica
*/
@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String razonSocial;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public class Anticipo {
* <p>
* Valores válidos: "04", "05", "06"
*/
@Schema(example = "04", description = "Catalog 53", required = true, allowableValues = {"04", "05", "06"})
@Schema(example = "04", description = "Catalog 53", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"04", "05", "06"})
private String tipo;

/**
* Serie y número de comprobante del anticipo, por ejemplo "F123-4"
*/
@Schema(example = "F123-4", required = true)
@Schema(example = "F123-4", requiredMode = Schema.RequiredMode.REQUIRED)
private String comprobanteSerieNumero;

/**
Expand All @@ -63,6 +63,6 @@ public class Anticipo {
/**
* Monto prepagado o anticipado
*/
@Schema(example = "10", required = true, minimum = "0", exclusiveMinimum = true)
@Schema(example = "10", requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", exclusiveMinimum = true)
private BigDecimal monto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class CuotaDePago {
/**
* Importe de la cuota
*/
@Schema(required = true, minimum = "0", exclusiveMinimum = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", exclusiveMinimum = true)
private BigDecimal importe;

/**
* Fecha de pago de la cuota
*/
@Schema(description = "Ejemplo 2022-12-25", required = true, pattern = "^\\d{4}-\\d{2}-\\d{2}$")
@Schema(description = "Ejemplo 2022-12-25", requiredMode = Schema.RequiredMode.REQUIRED, pattern = "^\\d{4}-\\d{2}-\\d{2}$")
private LocalDate fechaPago;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ public class Detraccion {
/**
* Catalog59
**/
@Schema(description = "Catalogo 59", required = true)
@Schema(description = "Catalogo 59", requiredMode = Schema.RequiredMode.REQUIRED)
private String medioDePago;

@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String cuentaBancaria;

/**
* Catalog54
**/
@Schema(description = "Catalog 54", required = true)
@Schema(description = "Catalog 54", requiredMode = Schema.RequiredMode.REQUIRED)
private String tipoBienDetraido;

@Schema(required = true, minimum = "0", maximum = "1", exclusiveMinimum = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", maximum = "1", exclusiveMinimum = true)
private BigDecimal porcentaje;

@Schema(required = true, minimum = "0", exclusiveMinimum = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", exclusiveMinimum = true)
private BigDecimal monto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
@AllArgsConstructor
public class DocumentoRelacionado {

@Schema(description = "Catalog 12", required = true)
@Schema(description = "Catalog 12", requiredMode = Schema.RequiredMode.REQUIRED)
private String tipoDocumento;

@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String serieNumero;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DocumentoDetalle {
public class DocumentoVentaDetalle {

@Schema(description = "Descripcion del bien o servicio", required = true)
@Schema(description = "Descripcion del bien o servicio", requiredMode = Schema.RequiredMode.REQUIRED)
private String descripcion;

private String unidadMedida;

@Schema(required = true, minimum = "0", exclusiveMinimum = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0", exclusiveMinimum = true)
private BigDecimal cantidad;

@Schema(description = "Precio sin incluir impuestos", minimum = "0")
Expand All @@ -51,7 +51,7 @@ public class DocumentoDetalle {
private String precioReferenciaTipo;

// Impuestos
@Schema(description = "Ejemplo 0.18", minimum = "0", maximum = "1")
@Schema(description = "Monto total de IGV", minimum = "0")
private BigDecimal igv;

@Schema(minimum = "0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
@AllArgsConstructor
public class FormaDePago {

@Schema(description = "CREDITO o CONTADO", required = true)
@Schema(description = "CREDITO o CONTADO", requiredMode = Schema.RequiredMode.REQUIRED)
private String tipo;

@Schema(description = "Monto total de pago", required = true, minimum = "0")
@Schema(description = "Monto total de pago", requiredMode = Schema.RequiredMode.REQUIRED, minimum = "0")
private BigDecimal total;

@Schema(description = "Cuotas de pago")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@AllArgsConstructor
public class Guia {

@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String serieNumero;

/**
Expand All @@ -38,6 +38,6 @@ public class Guia {
* <p>
* Valores válidos: "09", "31"
*/
@Schema(description = "Catalogo 01", required = true)
@Schema(description = "Catalogo 01", requiredMode = Schema.RequiredMode.REQUIRED)
private String tipoDocumento;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class Invoice extends Document {
public class Invoice extends SalesDocument {

@Schema(description = "Ejemplo 2022-12-25", pattern = "^\\d{4}-\\d{2}-\\d{2}$")
private LocalDate fechaVencimiento;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@SuperBuilder
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public abstract class Note extends Document {
public abstract class Note extends SalesDocument {

/**
* Tipo de nota.
Expand All @@ -47,7 +47,7 @@ public abstract class Note extends Document {
* Serie y número del comprobante al que le aplica la nota de crédito/débito.
* Ejemplo: F001-1
*/
@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String comprobanteAfectadoSerieNumero;

/**
Expand All @@ -61,7 +61,7 @@ public abstract class Note extends Document {
/**
* Texto sustentatorio para la emision de la nota
*/
@Schema(required = true)
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private String sustentoDescripcion;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Percepcion {
/**
* Catalog53
*/
@Schema(description = "Catalog 53", required = true)
@Schema(description = "Catalog 53", requiredMode = Schema.RequiredMode.REQUIRED)
private String tipo;

private BigDecimal montoBase; // importeSinImpuestos
Expand Down
Loading