Skip to content

Commit

Permalink
Merge pull request #1056 from nfephp-org/teste-sefazAtorInteressado
Browse files Browse the repository at this point in the history
Teste sefaz ator interessado
  • Loading branch information
gersonfs authored Jun 3, 2024
2 parents 00046f7 + 28fba3d commit 1108719
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,11 @@ public function sefazCCe(
* @param \stdClass $std
* @return string
*/
public function sefazAtorInteressado(\stdClass $std): string
{
public function sefazAtorInteressado(
\stdClass $std,
?\DateTimeInterface $dhEvento = null,
?string $lote = null
): string {
$xCondUso = 'O emitente ou destinatário da NF-e, declara que permite o '
. 'transportador declarado no campo CNPJ/CPF deste evento a '
. 'autorizar os transportadores subcontratados ou redespachados a '
Expand All @@ -484,7 +487,9 @@ public function sefazAtorInteressado(\stdClass $std): string
$std->chNFe,
self::EVT_ATORINTERESSADO,
$std->nSeqEvento,
$tagAdic
$tagAdic,
$dhEvento,
$lote
);
}

Expand Down
18 changes: 18 additions & 0 deletions tests/ToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,24 @@ public function test_sefazCCe(): void
$this->assertSame($esperado, $request);
}

public function test_sefazAtorInteressado(): void
{
$std = new \stdClass();
$std->tpAutor = 1;
$std->verAplic = 2;
$std->CNPJ = '88880563000162';
$std->tpAutorizacao = 0;
$std->chNFe = '35220605730928000145550010000048661583302923';
$std->nSeqEvento = 1;
$dhEvento = new \DateTime('2024-05-31T13:45:41-03:00');
$lote = '202405311345419';
$retorno = $this->tools->sefazAtorInteressado($std, $dhEvento, $lote);
//@todo Testar o $retorno
$request = $this->tools->getRequest();
$esperado = $this->getCleanXml(__DIR__ . '/fixtures/xml/exemplo_xml_request_sefazAtorInteressado.xml');
$this->assertSame($esperado, $request);
}

/**
* @param string $xml
* @param int|string $idLote
Expand Down
48 changes: 48 additions & 0 deletions tests/fixtures/xml/exemplo_xml_request_sefazAtorInteressado.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<nfeDadosMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NFeRecepcaoEvento4">
<envEvento xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.00">
<idLote>202405311345419</idLote>
<evento xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.00">
<infEvento Id="ID1101503522060573092800014555001000004866158330292301">
<cOrgao>91</cOrgao>
<tpAmb>2</tpAmb>
<CNPJ>93623057000128</CNPJ>
<chNFe>35220605730928000145550010000048661583302923</chNFe>
<dhEvento>2024-05-31T13:45:41-03:00</dhEvento>
<tpEvento>110150</tpEvento>
<nSeqEvento>1</nSeqEvento>
<verEvento>1.00</verEvento>
<detEvento versao="1.00">
<descEvento>Ator interessado na NF-e</descEvento>
<cOrgaoAutor>35</cOrgaoAutor>
<tpAutor>1</tpAutor>
<verAplic>2</verAplic>
<autXML>
<CNPJ>88880563000162</CNPJ>
</autXML>
<tpAutorizacao>0</tpAutorizacao>
<xCondUso>O emitente ou destinatário da NF-e, declara que permite o transportador declarado no campo CNPJ/CPF deste evento a autorizar os transportadores subcontratados ou redespachados a terem acesso ao download da NF-e</xCondUso>
</detEvento>
</infEvento>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#ID1101503522060573092800014555001000004866158330292301">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>dqrwELBmSrvYmmbjv5FoKEKzTr8=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>pbLJSJcFB3vmPDSLsqQHXjUb1f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8YbFr2xorOfKzCKUIIjzHX8WrpT7N6LEGNN17SKrQB2xULQ0aAvnuk8snnJNav/fQr21DUm0T17zgsBUKMB4JtRx3ux+S8VhKd8gwXme3wuDI+5aE1jAg5w5viFDo8nHbW/rDLHoRkt7NoE+tgbJN6Dq/+DbJV/eyA6sNYmpA/bp+mCnTsjLjfS5Vj3UZP8s+OcLirjW1QYjND4gIvOtv2W4aTcjxHdH63F6FlpgzU8vJvYIUQ2y5SqjIywoDTIxn8GDzyyhbgRYkhAk3PvHlgixiq8Ip/hGs27wbO19j/y2IRxu6m1Ag/8v1KB/5WHdvVdyEhQfeYfMH/aiq41lsFGERbBwpugFfOy0it97sUDbZ8z5elrJ+bLE3V7/1kBAfSLPn8lBuPrSQpucS+DgghYlN4JzCytRAJs+qAmF5gwtvIJNRvGpY</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</evento>
</envEvento>
</nfeDadosMsg>

0 comments on commit 1108719

Please sign in to comment.