Skip to content

Commit a07a41d

Browse files
Add docs - Anticipo (#59)
* Add docs - anticipo * Add docs - anticipo
1 parent 9c3aacb commit a07a41d

File tree

16 files changed

+65
-26
lines changed

16 files changed

+65
-26
lines changed

src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Anticipo.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,38 @@
2020
import lombok.Builder;
2121
import lombok.Data;
2222

23+
/**
24+
* Anticipo realizado.
25+
* <p>
26+
* Un anticipo se realiza cuando el cliente a entregado al proveedor un pago por anticipado a la prestación del servicio o la entrega.
27+
*
28+
* @author <a href="mailto:carlosthe19916@gmail.com">Carlos Feria</a>
29+
*/
2330
@Data
2431
@Builder
2532
public class Anticipo {
2633

34+
/**
35+
* Tipo de anticipo realizado.
36+
* <p>
37+
* Catalogo 53.
38+
* <p>
39+
* Valores válidos: "04", "05", "06"
40+
*/
2741
private String tipo;
28-
private String comprobanteTipo;
42+
43+
/**
44+
* Serie y número de comprobante del anticipo, por ejemplo "F123-4"
45+
*/
2946
private String comprobanteSerieNumero;
47+
48+
/**
49+
* Código de tipo de documento del {@link #comprobanteSerieNumero}.
50+
*/
51+
private String comprobanteTipo;
52+
53+
/**
54+
* Monto prepagado o anticipado
55+
*/
3056
private BigDecimal monto;
3157
}

src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoNota.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@Data
2424
@SuperBuilder
2525
@EqualsAndHashCode(callSuper = true)
26-
public abstract class BaseDocumentoNota extends BaseDocumento {
26+
public abstract class BaseDocumentoNota extends Document {
2727

2828
private String tipoNota;
2929

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
@Data
3232
@SuperBuilder
33-
public abstract class BaseDocumento {
33+
public abstract class Document {
3434

3535
@Singular
3636
private Map<String, String> leyendas;

src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@SuperBuilder
3030
@EqualsAndHashCode(callSuper = true)
3131
@ToString(callSuper = true)
32-
public class Invoice extends BaseDocumento {
32+
public class Invoice extends Document {
3333

3434
private LocalDate fechaVencimiento;
3535
private String tipoComprobante;
@@ -45,6 +45,9 @@ public class Invoice extends BaseDocumento {
4545
private Detraccion detraccion;
4646
private Percepcion percepcion;
4747

48+
/**
49+
* Anticipos asociados al comprobante
50+
*/
4851
@Singular
4952
private List<Anticipo> anticipos;
5053

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
2828
import java.util.function.Consumer;
2929

30+
/**
31+
* Rule for: {@link Anticipo#comprobanteTipo}
32+
*
33+
* @author <a href="mailto:carlosthe19916@gmail.com">Carlos Feria</a>
34+
*/
3035
@RulePhase(type = RulePhase.PhaseType.ENRICH)
31-
public class ComprobanteTipoRule extends AbstractBodyRule {
36+
public class ComprobanteTipoAnticipoRule extends AbstractBodyRule {
3237

3338
@Override
3439
public boolean test(Object object) {

src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/TipoAnticipoRule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
2727
import java.util.function.Consumer;
2828

29+
/**
30+
* Rule for: {@link Anticipo#tipo}
31+
*
32+
* @author <a href="mailto:carlosthe19916@gmail.com">Carlos Feria</a>
33+
*/
2934
@RulePhase(type = RulePhase.PhaseType.ENRICH)
3035
public class TipoAnticipoRule extends AbstractBodyRule {
3136

src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ClienteTipoDocumentoRule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
2323
import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
24-
import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
24+
import io.github.project.openubl.xbuilder.content.models.standard.general.Document;
2525
import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
2626
import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
2727
import java.util.function.Consumer;
@@ -44,7 +44,7 @@ public boolean test(Object object) {
4444

4545
@Override
4646
public void modify(Object object) {
47-
Consumer<BaseDocumento> consumer = document -> {
47+
Consumer<Document> consumer = document -> {
4848
Catalog6 catalog6 = Catalog
4949
.valueOfCode(Catalog6.class, document.getCliente().getTipoDocumentoIdentidad())
5050
.orElseThrow(Catalog.invalidCatalogValue);

src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FechaEmisionRule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
2020
import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
2121

22-
import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
22+
import io.github.project.openubl.xbuilder.content.models.standard.general.Document;
2323
import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
2424
import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
2525
import java.util.function.Consumer;
@@ -37,7 +37,7 @@ public boolean test(Object object) {
3737

3838
@Override
3939
public void modify(Object object) {
40-
Consumer<BaseDocumento> consumer = document -> document.setFechaEmision(getRuleContext().getLocalDate());
40+
Consumer<Document> consumer = document -> document.setFechaEmision(getRuleContext().getLocalDate());
4141
whenBaseDocumento.apply(object).ifPresent(consumer);
4242
}
4343
}

src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FirmanteRule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
2121

2222
import io.github.project.openubl.xbuilder.content.models.common.Firmante;
23-
import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
23+
import io.github.project.openubl.xbuilder.content.models.standard.general.Document;
2424
import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
2525
import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
2626
import java.util.function.Consumer;
@@ -38,7 +38,7 @@ public boolean test(Object object) {
3838

3939
@Override
4040
public void modify(Object object) {
41-
Consumer<BaseDocumento> consumer = document -> {
41+
Consumer<Document> consumer = document -> {
4242
if (document.getFirmante() == null) {
4343
document.setFirmante(Firmante.builder().build());
4444
}

src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/MonedaRule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
2020
import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
2121

22-
import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
22+
import io.github.project.openubl.xbuilder.content.models.standard.general.Document;
2323
import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
2424
import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
2525
import java.util.function.Consumer;
@@ -37,7 +37,7 @@ public boolean test(Object object) {
3737

3838
@Override
3939
public void modify(Object object) {
40-
Consumer<BaseDocumento> consumer = document -> document.setMoneda(getDefaults().getMoneda());
40+
Consumer<Document> consumer = document -> document.setMoneda(getDefaults().getMoneda());
4141
whenBaseDocumento.apply(object).ifPresent(consumer);
4242
}
4343
}

0 commit comments

Comments
 (0)