Skip to content

[ISSUE-32] Start verifying CDR notes to pass tests #33

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 7 commits into from
Apr 10, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public abstract class AbstractUBLTest {
protected TimeZone timeZone;
protected SystemClock systemClock;

protected String PROVIDER_WITHOUT_ADDRESS_NOTE = "3030 - El XML no contiene el tag o no existe información del código de local anexo del emisor";
protected String DOCUMENT_WITHOUT_2007_LEGEND = "4264 - El XML no contiene el codigo de leyenda 2007 para el tipo de operación IVAP";

public AbstractUBLTest() throws Exception {
xPath = XPathFactory.newInstance().newXPath();
Expand Down Expand Up @@ -151,8 +151,7 @@ private void sendFileToSunat(Document document, String xmlWithoutSignature, Stri
List<String> notesToCheck = billServiceModel.getNotes().stream().filter(f -> allowedNotesList.stream().noneMatch(f::startsWith)).collect(Collectors.toList());
notesToCheck.forEach(f -> System.out.println("WARNING:" + f));

// TODO Fix all warning messages and then apply this validation
// assertTrue(notesToCheck.isEmpty(), "Notes fom SUNAT:\n" + String.join("\n", notesToCheck));
assertTrue(notesToCheck.isEmpty(), "Notes fom SUNAT:\n" + String.join("\n", notesToCheck));
}

// Check ticket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ void testVoidedDocument_Factura_MinData() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice_specialCharacters.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testCreditNoteSinFormaPago_afectaFactura() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/formapago/sinFormaPago_afectaFactura.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -122,7 +122,7 @@ public void testCreditNoteSinFormaPago_afectaBoleta() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/formapago/sinFormaPago_afectaBoleta.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -189,7 +189,7 @@ public void testCreditNoteConFormaPago_afectaFactura() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/formapago/conFormaPago_afectaFactura.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -256,6 +256,6 @@ public void testCreditNoteConFormaPago_afectaBoleta() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/formapago/conFormaPago_afectaBoleta.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testCreditNoteWithMinDataSent_customerWithRuc() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_RUC.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -120,7 +120,7 @@ void testCreditNoteWithMinDataSent_customerWithDni() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_DNI.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -164,7 +164,7 @@ void testCreditNoteWithMinDataSent_customerWithDocTribNoDomSinRuc() throws Excep
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_DocTribNoDomSinRuc.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -208,7 +208,7 @@ void testCreditNoteWithMinDataSent_customerWithExtranjeria() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_Extranjeria.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -252,7 +252,7 @@ void testCreditNoteWithMinDataSent_customerWithPasaporte() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_Pasaporte.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -296,7 +296,7 @@ void testCreditNoteWithMinDataSent_customerWithDecDiplomatica() throws Exception
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_DecDiplomatica.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -340,7 +340,7 @@ void testCreditNoteWithMinDataSent_usePrecioUnitario() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -384,7 +384,7 @@ void testCreditNoteWithMinDataSent_usePrecioConIgv() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -428,7 +428,7 @@ void testCreditNoteWithMinDataSent_usePrecioUnitarioAndCantidadThreeDecimals() t
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -472,6 +472,6 @@ void testCreditNoteWithMinDataSent_usePrecioConIgvAndCantidadThreeDecimals() thr
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void testCreditNoteTipoNota_GravadoOnerosa_precioUnitario() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/creditnote/tiponota/descuentoPorItem.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void testDebitNoteWithMinDataSent_customerWithRuc() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_RUC.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -122,7 +122,7 @@ void testDebitNoteWithMinDataSent_customerWithDni() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_DNI.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -166,7 +166,7 @@ void testDebitNoteWithMinDataSent_customerWithDocTribNoDomSinRuc() throws Except
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_DocTribNoDomSinRuc.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -212,7 +212,7 @@ void testDebitNoteWithMinDataSent_customerWithExtranjeria() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_Extranjeria.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -258,7 +258,7 @@ void testDebitNoteWithMinDataSent_customerWithPasaporte() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_Pasaporte.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -302,7 +302,7 @@ void testDebitNoteWithMinDataSent_customerWithDecDiplomatica() throws Exception
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_DecDiplomatica.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -346,7 +346,7 @@ void testDebitNoteWithMinDataSent_usePrecioUnitario() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -390,7 +390,7 @@ void testDebitNoteWithMinDataSent_usePrecioConIgv() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -434,7 +434,7 @@ void testDebitNoteWithMinDataSent_usePrecioUnitarioAndCantidadThreeDecimals() th
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -480,7 +480,7 @@ void testDebitNoteWithMinDataSent_usePrecioConIgvAndCantidadThreeDecimals() thro
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void testDebitNoteTipoNota_GravadoOnerosa_precioUnitario() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/debitnote/tiponota/descuentoPorItem.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void testInvoiceWithCustomUnidadMedida() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/customUnidadMedida.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -123,7 +123,7 @@ void testInvoiceWithCustomFechaEmision() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/customFechaEmision.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -179,7 +179,7 @@ void testInvoiceWithCustomClienteDireccionAndContacto() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/customClienteDireccionAndContacto.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -284,7 +284,7 @@ void testInvoiceWithCustomFirmante() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/customFirmante.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -333,7 +333,7 @@ void testInvoiceWithICB_precioUnitario() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/icb.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -382,7 +382,7 @@ void testInvoiceWithICB_precioConIgv() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/icb.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -435,6 +435,6 @@ void testInvoiceWithCustomProveedor_direccionNotNullAndCodigoLocalNull() throws
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/customCodigoLocal.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void testInvoice_withPrecioUnitario() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioUnitario.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -130,7 +130,7 @@ void testInvoice_withPrecioConIgv() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioConIgv.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -177,7 +177,7 @@ void testInvoice_withPrecioUnitario_andICB() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioUnitario_andICB.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down Expand Up @@ -224,6 +224,6 @@ void testInvoice_withPrecioConIgv_andICB() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioConIgv_andICB.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void testInvoiceWithMinDataSent_customerWithDecDiplomatica() throws Exception {
// Then
assertOutputHasNoConstraintViolations(validator, output);
assertSnapshot(xml, "xml/invoice/mindata/MinData_DecDiplomatica.xml");
assertSendSunat(xml, PROVIDER_WITHOUT_ADDRESS_NOTE);
assertSendSunat(xml);
}

@Test
Expand Down
Loading