diff --git a/src/Greenter/Parser/InvoiceParser.php b/src/Greenter/Parser/InvoiceParser.php
index 772901a..84978f7 100644
--- a/src/Greenter/Parser/InvoiceParser.php
+++ b/src/Greenter/Parser/InvoiceParser.php
@@ -66,7 +66,7 @@ private function getXpath($value)
$doc = $value;
} else {
$doc = new \DOMDocument();
- $doc->loadXML($value);
+ @$doc->loadXML($value);
}
$rootNamespace = $doc->documentElement->namespaceURI;
$xpt = new \DOMXPath($doc);
diff --git a/src/Greenter/XmlReader.php b/src/Greenter/XmlReader.php
index 02e9f07..50fb98e 100644
--- a/src/Greenter/XmlReader.php
+++ b/src/Greenter/XmlReader.php
@@ -25,7 +25,7 @@ class XmlReader
public function loadXml($xml)
{
$doc = new \DOMDocument();
- $doc->loadXML($xml);
+ @$doc->loadXML($xml);
$this->loadDom($doc);
}
diff --git a/tests/Resources/20480072872-01-FB99-70000.xml b/tests/Resources/20480072872-01-FB99-70000.xml
new file mode 100644
index 0000000..a87f932
--- /dev/null
+++ b/tests/Resources/20480072872-01-FB99-70000.xml
@@ -0,0 +1,406 @@
+
+
+
+
+
+
+ 1001
+ 28151.72
+
+
+
+ 04
+
+
+ 1000
+ MONTO EN LETRAS
+
+
+
+
+
+
+
+ 0
+
+ 2017-03-16 00:00:00
+
+
+ D43
+ 0.00
+
+
+
+
+
+
+
+ EST
+
+
+
+
+
+
+ Conservas Frescomar
+ OVL 086 Comercial 2015
+ 005-20373
+
+
+
+
+
+
+ 1451938
+
+
+
+
+
+
+ 0
+
+
+
+
+ 2.0
+ 1.0
+ FB99-70000
+ 2017-10-02
+ 01
+ Conservas Frescomar - OVL 086 Comercial 2015 - 005-20369
+ PEN
+
+ IDSignKG
+
+
+ 20480072872
+
+
+
+
+
+
+
+ signatureKG
+
+
+
+
+ 20480072872
+ 6
+
+
+
+
+
+ 150131
+ CAL. AMADOR MERINO REYNA NRO. 307 (EDIFICIO NACIONAL PISO 12 Y 13)
+ SAN ISIDRO
+ LIMA
+ LIMA
+ SAN ISIDRO
+
+ PE
+
+
+
+
+
+
+
+
+
+ 20384203133
+ 6
+
+
+ AV. SANTA ELVIRA MZA. E LOTE. 1 (VILLA SOL) - LOS OLIVOS LIMA LIMA PERU
+
+
+
+
+
+
+ facturas@zvdistribuidores.com
+
+
+
+ PEN
+ PEN
+ 3.059
+
+
+ 5067.31
+
+ 5067.31
+
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+ 0.00
+ 0.00
+ 33219.03
+
+
+ 1
+ 60.00
+ 4677.97
+
+
+ 92.00
+ 01
+
+
+
+ 842.03
+
+ 842.03
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 77.9661
+
+
+
+ 2
+ 100.00
+ 10313.56
+
+
+ 121.70
+ 01
+
+
+
+ 1856.44
+
+ 1856.44
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 103.1356
+
+
+
+ 3
+ 15.00
+ 1894.07
+
+
+ 149.00
+ 01
+
+
+
+ 340.93
+
+ 340.93
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 126.2712
+
+
+
+ 4
+ 5.00
+ 602.54
+
+
+ 142.20
+ 01
+
+
+
+ 108.46
+
+ 108.46
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 120.5085
+
+
+
+ 5
+ 15.00
+ 1830.51
+
+
+ 144.00
+ 01
+
+
+
+ 329.49
+
+ 329.49
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 122.0339
+
+
+
+ 6
+ 60.00
+ 7983.05
+
+
+ 156.9999
+ 01
+
+
+
+ 1436.95
+
+ 1436.95
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 133.0508
+
+
+
+ 7
+ 8.00
+ 542.37
+
+
+ 80.00
+ 01
+
+
+
+ 97.63
+
+ 97.63
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 67.7966
+
+
+
+ 8
+ 3.00
+ 307.65
+
+
+ 121.0097
+ 01
+
+
+
+ 55.38
+
+ 55.38
+
+ 10
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 102.5506
+
+
+
\ No newline at end of file
diff --git a/tests/Resources/20480072872-07-FB99-00001.xml b/tests/Resources/20480072872-07-FB99-00001.xml
new file mode 100644
index 0000000..985ce11
--- /dev/null
+++ b/tests/Resources/20480072872-07-FB99-00001.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+ 1001
+ 0.00
+
+
+ 1002
+ 1.00
+
+
+ 1003
+ 0.00
+
+
+
+
+
+ 2.0
+ 1.0
+ FB99-00001
+ 2017-10-02
+ PEN
+
+ FA99-00002
+ 09
+
+
+
+
+ FA99-00002
+ 01
+
+
+
+ IDSignKG
+
+
+ 20480072872
+
+
+
+
+
+
+
+ signatureKG
+
+
+
+
+ 20480072872
+ 6
+
+
+
+
+
+ 150131
+ MIGUEL SEMINARIO 320 - 5to Piso
+ SAN ISIDRO
+ LIMA
+ LIMA
+ SAN ISIDRO
+
+ PE
+
+
+
+
+
+
+
+
+ 20384203133
+ 6
+
+
+
+
+
+
+ jronceros@tci.net.pe
+
+
+
+ 0.00
+
+ 0.00
+
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+ 0.00
+ 0.00
+ 1.00
+
+
+ 1
+ 1.00
+ 1.00
+
+
+ 1.00
+ 01
+
+
+
+ 0.00
+
+ 0.00
+
+ 40
+
+ 1000
+ IGV
+ VAT
+
+
+
+
+
+
+
+
+ 1.00
+
+
+
\ No newline at end of file
diff --git a/tests/Xml/Parser/InvoiceParserTest.php b/tests/Xml/Parser/InvoiceParserTest.php
index 99b6baf..ef1bbd4 100644
--- a/tests/Xml/Parser/InvoiceParserTest.php
+++ b/tests/Xml/Parser/InvoiceParserTest.php
@@ -89,6 +89,7 @@ public function filenameProvider()
[$dir.'factura-guia.xml'],
[$dir.'gravada.xml'],
[$dir.'plazavea-bol.xml'],
+ [$dir.'20480072872-01-FB99-70000.xml']
];
}
diff --git a/tests/Xml/Parser/NoteParserTest.php b/tests/Xml/Parser/NoteParserTest.php
index 694f414..25302c6 100644
--- a/tests/Xml/Parser/NoteParserTest.php
+++ b/tests/Xml/Parser/NoteParserTest.php
@@ -17,7 +17,7 @@
*/
class NoteParserTest extends \PHPUnit_Framework_TestCase
{
- public function testCreditNoteTest()
+ public function testCreditNote()
{
$parser = new NoteParser();
$xml = file_get_contents(__DIR__.'/../../Resources/notacr-fac.xml');
@@ -33,6 +33,22 @@ public function testCreditNoteTest()
$this->assertGreaterThan(0, count($obj->getDetails()));
}
+ public function testCreditNoteSfs()
+ {
+ $parser = new NoteParser();
+ $xml = file_get_contents(__DIR__.'/../../Resources/20480072872-07-FB99-00001.xml');
+ /**@var $obj Note */
+ $obj = $parser->parse($xml);
+
+ $this->assertEquals('07', $obj->getTipoDoc());
+ $this->assertEquals('FB99', $obj->getSerie());
+ $this->assertLessThanOrEqual(8, strlen($obj->getCorrelativo()));
+ $this->assertNotEmpty($obj->getTipDocAfectado());
+ $this->assertNotEmpty($obj->getNumDocfectado());
+ $this->assertNotEmpty($obj->getCodMotivo());
+ $this->assertGreaterThan(0, count($obj->getDetails()));
+ }
+
public function testDebitNoteTest()
{
$parser = new NoteParser();
@@ -50,7 +66,7 @@ public function testDebitNoteTest()
$this->assertGreaterThan(0, count($obj->getDetails()));
}
- public function testCreditNoteSunatSolTest()
+ public function testCreditNoteSunatSol()
{
$parser = new NoteParser();
$xml = file_get_contents(__DIR__.'/../../Resources/NOTA_CREDITOE001-27.XML');