Skip to content

Commit

Permalink
fix: summaryDocuments include IGV always (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Jun 11, 2024
1 parent 3b1bff1 commit ad4b631
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ default ComprobanteImpuestos mapLineComprobanteImpuestos(XMLSummaryDocumentsLine
.flatMap(taxScheme -> Optional.ofNullable(taxScheme.getId()))
.flatMap(code -> Catalog.valueOfCode(Catalog5.class, code))
.orElse(null),
XMLSummaryDocumentsLine.TaxTotal::getTaxAmount
taxTotal -> Optional.ofNullable(taxTotal.getTaxAmount()).orElse(BigDecimal.ZERO)
));

return ComprobanteImpuestos.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
<cbc:Amount currencyID="{it.comprobante.moneda}">{it.comprobante.valorVenta.otrosCargos}</cbc:Amount>
</cac:AllowanceCharge>
{/if}
{#if it.comprobante.impuestos.igv}
<cac:TaxTotal>
<cbc:TaxAmount currencyID="{it.comprobante.moneda}">{it.comprobante.impuestos.igv}</cbc:TaxAmount>
<cac:TaxSubtotal>
Expand All @@ -86,7 +85,6 @@
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
{/if}
{#if it.comprobante.impuestos.icb}
<cac:TaxTotal>
<cbc:TaxAmount currencyID="{it.comprobante.moneda}">{it.comprobante.impuestos.icb}</cbc:TaxAmount>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,44 @@ public void testMultipleVoidedDocuments() throws Exception {
assertInput(input, "summaryDocuments.xml");
}

@Test
public void testVoidedDocument_anularBoletaExonerada() throws Exception {
// Given
SummaryDocuments input = SummaryDocuments.builder()
.numero(1)
.fechaEmisionComprobantes(dateProvider.now().minusDays(2))
.proveedor(Proveedor.builder()
.ruc("12345678912")
.razonSocial("Softgreen S.A.C.")
.build()
)
.comprobante(SummaryDocumentsItem.builder()
.tipoOperacion(Catalog19.ANULADO.toString())
.comprobante(Comprobante.builder()
.tipoComprobante(Catalog1_Invoice.BOLETA.getCode())//
.serieNumero("B001-1")
.cliente(Cliente.builder()
.nombre("Carlos Feria")
.numeroDocumentoIdentidad("12345678")
.tipoDocumentoIdentidad(Catalog6.DNI.getCode())
.build()
)
.impuestos(ComprobanteImpuestos.builder()
.igv(new BigDecimal("0"))
.build()
)
.valorVenta(ComprobanteValorVenta.builder()
.importeTotal(new BigDecimal("100"))
.gravado(new BigDecimal("0"))
.exonerado(new BigDecimal("0"))
.build()
)
.build()
)
.build()
)
.build();

assertInput(input, "summaryDocuments_anularBoletaExonerada.xml");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<SummaryDocuments xmlns="urn:sunat:names:specification:ubl:peru:schema:xsd:SummaryDocuments-1"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:ns11="urn:sunat:names:specification:ubl:peru:schema:xsd:Perception-1"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1"
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent />
</ext:UBLExtension>
</ext:UBLExtensions>
<cbc:UBLVersionID>2.0</cbc:UBLVersionID>
<cbc:CustomizationID>1.1</cbc:CustomizationID>
<cbc:ID>RC-20191224-1</cbc:ID>
<cbc:ReferenceDate>2019-12-22</cbc:ReferenceDate>
<cbc:IssueDate>2019-12-24</cbc:IssueDate>
<cac:Signature>
<cbc:ID>12345678912</cbc:ID>
<cac:SignatoryParty>
<cac:PartyIdentification>
<cbc:ID>12345678912</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name><![CDATA[Softgreen S.A.C.]]></cbc:Name>
</cac:PartyName>
</cac:SignatoryParty>
<cac:DigitalSignatureAttachment>
<cac:ExternalReference>
<cbc:URI>#PROJECT-OPENUBL-SIGN</cbc:URI>
</cac:ExternalReference>
</cac:DigitalSignatureAttachment>
</cac:Signature>
<cac:AccountingSupplierParty>
<cbc:CustomerAssignedAccountID>12345678912</cbc:CustomerAssignedAccountID>
<cbc:AdditionalAccountID>6</cbc:AdditionalAccountID>
<cac:Party>
<cac:PartyLegalEntity>
<cbc:RegistrationName><![CDATA[Softgreen S.A.C.]]></cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingSupplierParty>
<sac:SummaryDocumentsLine>
<cbc:LineID>1</cbc:LineID>
<cbc:DocumentTypeCode>03</cbc:DocumentTypeCode>
<cbc:ID>B001-1</cbc:ID>
<cac:AccountingCustomerParty>
<cbc:CustomerAssignedAccountID>12345678</cbc:CustomerAssignedAccountID>
<cbc:AdditionalAccountID>1</cbc:AdditionalAccountID>
</cac:AccountingCustomerParty>
<cac:Status>
<cbc:ConditionCode>3</cbc:ConditionCode>
</cac:Status>
<sac:TotalAmount currencyID="PEN">100</sac:TotalAmount>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="PEN">0</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxAmount currencyID="PEN">0</cbc:TaxAmount>
<cac:TaxCategory>
<cac:TaxScheme>
<cbc:ID>1000</cbc:ID>
<cbc:Name>IGV</cbc:Name>
<cbc:TaxTypeCode>VAT</cbc:TaxTypeCode>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
</sac:SummaryDocumentsLine>
</SummaryDocuments>

0 comments on commit ad4b631

Please sign in to comment.