Skip to content

Commit a796790

Browse files
Otros documentos tributarios relacionados (#40)
* Add otros documentos tributarios relacionados * Fix license
1 parent 4ef916b commit a796790

File tree

46 files changed

+4114
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4114
-24
lines changed

src/main/java/io/github/project/openubl/xmlbuilderlib/factory/InvoiceAndNoteOutputModelFactory.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel;
3838

3939
import java.math.BigDecimal;
40-
import java.util.*;
40+
import java.util.Collections;
41+
import java.util.List;
42+
import java.util.Objects;
43+
import java.util.TimeZone;
4144
import java.util.stream.Collectors;
4245
import java.util.stream.Stream;
4346

@@ -142,6 +145,19 @@ private static void enrichDocument(DocumentInputModel input, DocumentOutputModel
142145
: Collections.emptyList()
143146
);
144147

148+
// Otros documentos tributarios relacionados
149+
builder.withOtrosDocumentosTributariosRelacionados(input.getOtrosDocumentosTributariosRelacionados() != null ?
150+
input.getOtrosDocumentosTributariosRelacionados().stream()
151+
.map(docInput -> {
152+
DocumentoTributarioRelacionadoOutputModel docOutput = new DocumentoTributarioRelacionadoOutputModel();
153+
docOutput.setSerieNumero(docInput.getSerieNumero());
154+
docOutput.setTipoDocumento(Catalog.valueOfCode(Catalog12.class, docInput.getTipoDocumento()).orElseThrow(Catalog.invalidCatalogValue));
155+
return docOutput;
156+
})
157+
.collect(Collectors.toList())
158+
: Collections.emptyList()
159+
);
160+
145161
// Detalle
146162
List<DocumentLineOutputModel> lineOutput = input.getDetalle().stream()
147163
.map(f -> DocumentLineOutputModelFactory.getDocumentLineOutput(f, config, systemClock))

src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public enum Catalog12 implements Catalog {
2222
BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS("03"),
2323
TICKET_DE_SALIDA("04"),
2424
CODIGO_SCOP("05"),
25+
FACTURA_ELECTRONICA_REMITENTE("06"),
26+
GUIA_DE_REMISION_REMITENTE("07"),
27+
DECLARACION_DE_SALIDA_DEL_DEPOSITO_FRANCO("08"),
28+
DECLARACION_SIMPLIFICADA_DE_IMPORTACION("09"),
29+
LIQUIDACION_DE_COMPRA_EMITIDA_POR_ANTICIPOS("10"),
2530
OTROS("99");
2631

2732
private final String code;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
3+
* and other contributors as indicated by the @author tags.
4+
*
5+
* Licensed under the Eclipse Public License - v 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.eclipse.org/legal/epl-2.0/
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package io.github.project.openubl.xmlbuilderlib.models.catalogs;
18+
19+
public enum Catalog12_Doc_Trib_Relacionado_CreditNote implements Catalog {
20+
FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC("01"),
21+
TICKET_DE_SALIDA("04"),
22+
CODIGO_SCOP("05"),
23+
OTROS("99");
24+
25+
private final String code;
26+
27+
Catalog12_Doc_Trib_Relacionado_CreditNote(String code) {
28+
this.code = code;
29+
}
30+
31+
@Override
32+
public String getCode() {
33+
return code;
34+
}
35+
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
3+
* and other contributors as indicated by the @author tags.
4+
*
5+
* Licensed under the Eclipse Public License - v 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.eclipse.org/legal/epl-2.0/
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package io.github.project.openubl.xmlbuilderlib.models.catalogs;
18+
19+
public enum Catalog12_Doc_Trib_Relacionado_DebitNote implements Catalog {
20+
TICKET_DE_SALIDA("04"),
21+
CODIGO_SCOP("05"),
22+
OTROS("99");
23+
24+
private final String code;
25+
26+
Catalog12_Doc_Trib_Relacionado_DebitNote(String code) {
27+
this.code = code;
28+
}
29+
30+
@Override
31+
public String getCode() {
32+
return code;
33+
}
34+
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
3+
* and other contributors as indicated by the @author tags.
4+
*
5+
* Licensed under the Eclipse Public License - v 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.eclipse.org/legal/epl-2.0/
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package io.github.project.openubl.xmlbuilderlib.models.catalogs;
18+
19+
public enum Catalog12_Doc_Trib_Relacionado_Invoice implements Catalog {
20+
TICKET_DE_SALIDA("04"),
21+
CODIGO_SCOP("05"),
22+
FACTURA_ELECTRONICA_REMITENTE("06"),
23+
GUIA_DE_REMISION_REMITENTE("07"),
24+
DECLARACION_DE_SALIDA_DEL_DEPOSITO_FRANCO("08"),
25+
DECLARACION_SIMPLIFICADA_DE_IMPORTACION("09"),
26+
OTROS("99");
27+
28+
private final String code;
29+
30+
Catalog12_Doc_Trib_Relacionado_Invoice(String code) {
31+
this.code = code;
32+
}
33+
34+
@Override
35+
public String getCode() {
36+
return code;
37+
}
38+
39+
}

src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/CuotaDePagoInputModel.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation;
2121

2222
import javax.validation.constraints.Max;
23-
import javax.validation.constraints.Min;
2423
import javax.validation.constraints.NotNull;
2524
import javax.validation.constraints.Positive;
2625
import java.math.BigDecimal;
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
import javax.validation.constraints.NotBlank;
2323

24-
public class DocumentoTributarioRelacionadoInputModel {
24+
public abstract class DocTribRelacionadoInputModel {
2525

2626
@NotBlank
27-
private String serieNumero;
27+
protected String serieNumero;
2828

2929
@CatalogConstraint(value = Catalog12.class)
30-
private String tipoDocumento;
30+
protected String tipoDocumento;
3131

3232
public String getSerieNumero() {
3333
return serieNumero;
@@ -44,4 +44,5 @@ public String getTipoDocumento() {
4444
public void setTipoDocumento(String tipoDocumento) {
4545
this.tipoDocumento = tipoDocumento;
4646
}
47+
4748
}

src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentInputModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public abstract class DocumentInputModel {
6161
@Valid
6262
private List<GuiaRemisionRelacionadaInputModel> guiasRemisionRelacionadas;
6363

64+
public abstract List<? extends DocTribRelacionadoInputModel> getOtrosDocumentosTributariosRelacionados();
65+
6466
public String getSerie() {
6567
return serie;
6668
}

src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/AnticipoInputModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
*/
1717
package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice;
1818

19-
import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentoTributarioRelacionadoInputModel;
19+
import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel;
2020

2121
import javax.validation.constraints.NotBlank;
2222

23-
public class AnticipoInputModel extends DocumentoTributarioRelacionadoInputModel {
23+
public class AnticipoInputModel extends DocTribRelacionadoInputModel {
2424

2525
@NotBlank
2626
private String ruc;

src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/CargoDescuentoInputModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog53;
2020
import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint;
21-
import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentoTributarioRelacionadoInputModel;
21+
import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel;
2222

2323
import java.math.BigDecimal;
2424

25-
public class CargoDescuentoInputModel extends DocumentoTributarioRelacionadoInputModel {
25+
public class CargoDescuentoInputModel extends DocTribRelacionadoInputModel {
2626

2727
@CatalogConstraint(value = Catalog53.class)
2828
private String tipo;

0 commit comments

Comments
 (0)