|
| 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 Apache License - 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.apache.org/licenses/LICENSE-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 e2e.homologacion; |
| 18 | + |
| 19 | +import e2e.AbstractTest; |
| 20 | +import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote; |
| 21 | +import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote; |
| 22 | +import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle; |
| 23 | +import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice; |
| 24 | +import org.junit.jupiter.api.Order; |
| 25 | +import org.junit.jupiter.api.Test; |
| 26 | + |
| 27 | +import java.math.BigDecimal; |
| 28 | + |
| 29 | +public class Group5Test extends AbstractTest { |
| 30 | + |
| 31 | + @Order(1) |
| 32 | + @Test |
| 33 | + public void factura1Con5Items() throws Exception { |
| 34 | + Invoice input = Invoice.builder() |
| 35 | + .serie("FF30") |
| 36 | + .numero(1) |
| 37 | + .proveedor(HomologacionConstants.proveedor) |
| 38 | + .cliente(HomologacionConstants.cliente) |
| 39 | + .detalle(DocumentoVentaDetalle.builder() |
| 40 | + .descripcion("Item1") |
| 41 | + .cantidad(new BigDecimal("1")) |
| 42 | + .precio(new BigDecimal("100")) |
| 43 | + .tasaIsc(new BigDecimal("0.1")) |
| 44 | + .build() |
| 45 | + ) |
| 46 | + .detalle(DocumentoVentaDetalle.builder() |
| 47 | + .descripcion("Item2") |
| 48 | + .cantidad(new BigDecimal("2")) |
| 49 | + .precio(new BigDecimal("200")) |
| 50 | + .tasaIsc(new BigDecimal("0.1")) |
| 51 | + .build() |
| 52 | + ) |
| 53 | + .detalle(DocumentoVentaDetalle.builder() |
| 54 | + .descripcion("Item3") |
| 55 | + .cantidad(new BigDecimal("3")) |
| 56 | + .precio(new BigDecimal("300")) |
| 57 | + .tasaIsc(new BigDecimal("0.1")) |
| 58 | + .build() |
| 59 | + ) |
| 60 | + .detalle(DocumentoVentaDetalle.builder() |
| 61 | + .descripcion("Item4") |
| 62 | + .cantidad(new BigDecimal("4")) |
| 63 | + .precio(new BigDecimal("400")) |
| 64 | + .tasaIsc(new BigDecimal("0.1")) |
| 65 | + .build() |
| 66 | + ) |
| 67 | + .detalle(DocumentoVentaDetalle.builder() |
| 68 | + .descripcion("Item5") |
| 69 | + .cantidad(new BigDecimal("5")) |
| 70 | + .precio(new BigDecimal("500")) |
| 71 | + .tasaIsc(new BigDecimal("0.1")) |
| 72 | + .build() |
| 73 | + ) |
| 74 | + .build(); |
| 75 | + |
| 76 | + assertInput(input, "factura1Con5Items.xml"); |
| 77 | + } |
| 78 | + |
| 79 | + // |
| 80 | + |
| 81 | + @Order(2) |
| 82 | + @Test |
| 83 | + public void notaDeCreditoDeFactura1() throws Exception { |
| 84 | + CreditNote input = CreditNote.builder() |
| 85 | + .serie("FF30") |
| 86 | + .numero(1) |
| 87 | + .comprobanteAfectadoSerieNumero("FF30-1") |
| 88 | + .sustentoDescripcion("Homologacion") |
| 89 | + .proveedor(HomologacionConstants.proveedor) |
| 90 | + .cliente(HomologacionConstants.cliente) |
| 91 | + .detalle(DocumentoVentaDetalle.builder() |
| 92 | + .descripcion("Item1") |
| 93 | + .cantidad(new BigDecimal("1")) |
| 94 | + .precio(new BigDecimal("100")) |
| 95 | + .tasaIsc(new BigDecimal("0.1")) |
| 96 | + .build() |
| 97 | + ) |
| 98 | + .detalle(DocumentoVentaDetalle.builder() |
| 99 | + .descripcion("Item2") |
| 100 | + .cantidad(new BigDecimal("2")) |
| 101 | + .precio(new BigDecimal("200")) |
| 102 | + .tasaIsc(new BigDecimal("0.1")) |
| 103 | + .build() |
| 104 | + ) |
| 105 | + .detalle(DocumentoVentaDetalle.builder() |
| 106 | + .descripcion("Item3") |
| 107 | + .cantidad(new BigDecimal("3")) |
| 108 | + .precio(new BigDecimal("300")) |
| 109 | + .tasaIsc(new BigDecimal("0.1")) |
| 110 | + .build() |
| 111 | + ) |
| 112 | + .detalle(DocumentoVentaDetalle.builder() |
| 113 | + .descripcion("Item4") |
| 114 | + .cantidad(new BigDecimal("4")) |
| 115 | + .precio(new BigDecimal("400")) |
| 116 | + .tasaIsc(new BigDecimal("0.1")) |
| 117 | + .build() |
| 118 | + ) |
| 119 | + .detalle(DocumentoVentaDetalle.builder() |
| 120 | + .descripcion("Item5") |
| 121 | + .cantidad(new BigDecimal("5")) |
| 122 | + .precio(new BigDecimal("500")) |
| 123 | + .tasaIsc(new BigDecimal("0.1")) |
| 124 | + .build() |
| 125 | + ) |
| 126 | + .build(); |
| 127 | + |
| 128 | + assertInput(input, "notaDeCreditoDeFactura1.xml"); |
| 129 | + } |
| 130 | + |
| 131 | + @Order(3) |
| 132 | + @Test |
| 133 | + public void notaDeDebitoDeFactura1() throws Exception { |
| 134 | + DebitNote input = DebitNote.builder() |
| 135 | + .serie("FF30") |
| 136 | + .numero(1) |
| 137 | + .comprobanteAfectadoSerieNumero("FF30-1") |
| 138 | + .sustentoDescripcion("Homologacion") |
| 139 | + .proveedor(HomologacionConstants.proveedor) |
| 140 | + .cliente(HomologacionConstants.cliente) |
| 141 | + .detalle(DocumentoVentaDetalle.builder() |
| 142 | + .descripcion("Item1") |
| 143 | + .cantidad(new BigDecimal("1")) |
| 144 | + .precio(new BigDecimal("100")) |
| 145 | + .tasaIsc(new BigDecimal("0.1")) |
| 146 | + .build() |
| 147 | + ) |
| 148 | + .detalle(DocumentoVentaDetalle.builder() |
| 149 | + .descripcion("Item2") |
| 150 | + .cantidad(new BigDecimal("2")) |
| 151 | + .precio(new BigDecimal("200")) |
| 152 | + .tasaIsc(new BigDecimal("0.1")) |
| 153 | + .build() |
| 154 | + ) |
| 155 | + .detalle(DocumentoVentaDetalle.builder() |
| 156 | + .descripcion("Item3") |
| 157 | + .cantidad(new BigDecimal("3")) |
| 158 | + .precio(new BigDecimal("300")) |
| 159 | + .tasaIsc(new BigDecimal("0.1")) |
| 160 | + .build() |
| 161 | + ) |
| 162 | + .detalle(DocumentoVentaDetalle.builder() |
| 163 | + .descripcion("Item4") |
| 164 | + .cantidad(new BigDecimal("4")) |
| 165 | + .precio(new BigDecimal("400")) |
| 166 | + .tasaIsc(new BigDecimal("0.1")) |
| 167 | + .build() |
| 168 | + ) |
| 169 | + .detalle(DocumentoVentaDetalle.builder() |
| 170 | + .descripcion("Item5") |
| 171 | + .cantidad(new BigDecimal("5")) |
| 172 | + .precio(new BigDecimal("500")) |
| 173 | + .tasaIsc(new BigDecimal("0.1")) |
| 174 | + .build() |
| 175 | + ) |
| 176 | + .build(); |
| 177 | + |
| 178 | + assertInput(input, "notaDeDebitoDeFactura2.xml"); |
| 179 | + } |
| 180 | + |
| 181 | +} |
0 commit comments