Skip to content

Commit

Permalink
unit test retention with creditnote
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed Feb 2, 2018
1 parent 4dbb8a5 commit 76caee5
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
88 changes: 88 additions & 0 deletions tests/Resources/retention/with-creditNote.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<Retention xmlns="urn:sunat:names:specification:ubl:peru:schema:xsd:Retention-1" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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.0</cbc:CustomizationID>
<cac:Signature>
<cbc:ID>IdFactesol</cbc:ID>
<cac:SignatoryParty>
<cac:PartyIdentification>
<cbc:ID>20101991319</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name><![CDATA[WORTEC S.A.]]></cbc:Name>
</cac:PartyName>
</cac:SignatoryParty>
<cac:DigitalSignatureAttachment>
<cac:ExternalReference>
<cbc:URI>#SignatureSP</cbc:URI>
</cac:ExternalReference>
</cac:DigitalSignatureAttachment>
</cac:Signature>
<cbc:ID>R001-00000006</cbc:ID>
<cbc:IssueDate>2018-02-01</cbc:IssueDate>
<cac:AgentParty>
<cac:PartyIdentification>
<cbc:ID schemeID="6">20101991319</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name><![CDATA[WORTEC S.A.]]></cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:ID>150140</cbc:ID>
<cbc:StreetName><![CDATA[AV. DEL PINAR NRO. 124 INT. 302]]></cbc:StreetName>
<cbc:CitySubdivisionName><![CDATA[CHACARILLA DEL ESTANQUE]]></cbc:CitySubdivisionName>
<cbc:CityName><![CDATA[LIMA]]></cbc:CityName>
<cbc:CountrySubentity>LIMA</cbc:CountrySubentity>
<cbc:District>SANTIAGO DE SURCO</cbc:District>
<cac:Country>
<cbc:IdentificationCode>PE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyLegalEntity>
<cbc:RegistrationName><![CDATA[WORTEC SOCIEDAD ANONIMA]]></cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:AgentParty>
<cac:ReceiverParty>
<cac:PartyIdentification>
<cbc:ID schemeID="6">20467463684</cbc:ID>
</cac:PartyIdentification>
<cac:PartyLegalEntity>
<cbc:RegistrationName><![CDATA[HEAP LEACHING CONSULTING S.A.C]]></cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:ReceiverParty>
<sac:SUNATRetentionSystemCode>01</sac:SUNATRetentionSystemCode>
<sac:SUNATRetentionPercent>3.00</sac:SUNATRetentionPercent>
<cbc:TotalInvoiceAmount currencyID="PEN">21.00</cbc:TotalInvoiceAmount>
<sac:SUNATTotalPaid currencyID="PEN">679.00</sac:SUNATTotalPaid>
<sac:SUNATRetentionDocumentReference>
<cbc:ID schemeID="01">F003-00000001</cbc:ID>
<cbc:IssueDate>2018-02-01</cbc:IssueDate>
<cbc:TotalInvoiceAmount currencyID="PEN">1000.00</cbc:TotalInvoiceAmount>
<cac:Payment>
<cbc:ID>1</cbc:ID>
<cbc:PaidAmount currencyID="PEN">500.00</cbc:PaidAmount>
<cbc:PaidDate>2018-02-01</cbc:PaidDate>
</cac:Payment>
<sac:SUNATRetentionInformation>
<sac:SUNATRetentionAmount currencyID="PEN">15.00</sac:SUNATRetentionAmount>
<sac:SUNATRetentionDate>2018-02-01</sac:SUNATRetentionDate>
<sac:SUNATNetTotalPaid currencyID="PEN">485.00</sac:SUNATNetTotalPaid>
<cac:ExchangeRate>
<cbc:SourceCurrencyCode>PEN</cbc:SourceCurrencyCode>
<cbc:TargetCurrencyCode>PEN</cbc:TargetCurrencyCode>
<cbc:CalculationRate>1.00</cbc:CalculationRate>
<cbc:Date>2018-02-01</cbc:Date>
</cac:ExchangeRate>
</sac:SUNATRetentionInformation>
</sac:SUNATRetentionDocumentReference>
<sac:SUNATRetentionDocumentReference>
<cbc:ID schemeID="07">F003-00000001</cbc:ID>
<cbc:IssueDate>2018-02-01</cbc:IssueDate>
<cbc:TotalInvoiceAmount currencyID="PEN">500.00</cbc:TotalInvoiceAmount>
</sac:SUNATRetentionDocumentReference>
</Retention>
2 changes: 1 addition & 1 deletion tests/Xml/Parser/RetentionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testParseDoc($filename)
$this->assertNotEmpty($detail->getTipoDoc());
$this->assertNotEmpty($detail->getNumDoc());
$this->assertNotNull($detail->getFechaEmision());
$this->assertGreaterThan(0, count($detail->getPagos()));
$this->assertTrue(is_array($detail->getPagos()));
$this->assertTrue(is_float($detail->getImpTotal()));
$this->assertTrue(is_float($detail->getImpRetenido()));
$this->assertTrue(is_float($detail->getImpPagar()));
Expand Down

0 comments on commit 76caee5

Please sign in to comment.