From d2583df501b6d7b3002a959376394d8dc0758e5a Mon Sep 17 00:00:00 2001 From: Gerson Felipe Schwinn Date: Fri, 31 May 2024 13:51:02 -0300 Subject: [PATCH] Adicionando teste de sefazAtorInteressado --- src/Tools.php | 11 +++-- tests/ToolsTest.php | 18 +++++++ ...emplo_xml_request_sefazAtorInteressado.xml | 48 +++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/xml/exemplo_xml_request_sefazAtorInteressado.xml diff --git a/src/Tools.php b/src/Tools.php index 1851ec59..c5effb1d 100755 --- a/src/Tools.php +++ b/src/Tools.php @@ -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 ' @@ -484,7 +487,9 @@ public function sefazAtorInteressado(\stdClass $std): string $std->chNFe, self::EVT_ATORINTERESSADO, $std->nSeqEvento, - $tagAdic + $tagAdic, + $dhEvento, + $lote ); } diff --git a/tests/ToolsTest.php b/tests/ToolsTest.php index 7f567c9f..ba5f0d11 100755 --- a/tests/ToolsTest.php +++ b/tests/ToolsTest.php @@ -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 diff --git a/tests/fixtures/xml/exemplo_xml_request_sefazAtorInteressado.xml b/tests/fixtures/xml/exemplo_xml_request_sefazAtorInteressado.xml new file mode 100644 index 00000000..fcc4721d --- /dev/null +++ b/tests/fixtures/xml/exemplo_xml_request_sefazAtorInteressado.xml @@ -0,0 +1,48 @@ + + + 202405311345419 + + + 91 + 2 + 93623057000128 + 35220605730928000145550010000048661583302923 + 2024-05-31T13:45:41-03:00 + 110150 + 1 + 1.00 + + Ator interessado na NF-e + 35 + 1 + 2 + + 88880563000162 + + 0 + 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 + + + + + + + + + + + + + dqrwELBmSrvYmmbjv5FoKEKzTr8= + + + pbLJSJcFB3vmPDSLsqQHXjUb1fzfNfwH2Kpax/kVKlKCI9IZtoD2TYHl3UlrIA+uXP2naJ4LK0tX01e7nm8SCHiq9LKlmeMsOe6qDwnLCvLOSOPSqun/6wWGMfZeRD+aY6uaXByRh+7RG+3m8DXs0hXnTa5zYVt0croO1x8uOkVR96frIZgu9VMoClxpIJVpS01JLW7fIlJwWn4p5+aQSeiYzlYrDzCm51jsaFN1zgnR4VeeCk17iOHEHk8EgcPX0mqVY6bKraLOaJ+wD7kzG3HMKYJ/WvxNTqDu6N84yPdUImqiigfGIiPVtJ5Kvn5nSGIKiGE13L8usuGPw+rKfuU1BTb1q9k4I8ln6YZA6jTlCzF9FxWdDRFpY7Rrq9gAUx7a/xzrQ1MlDmZSYy5ara14etVa29vZQwEbMWVRRUZ9K16gfQcbY34//OpmQn/pjtDlpApSa0/V98lZiPSq4gNJIQZTUy0mIFP9gXSdu/wscgsKekAAtlIn9eXGopdCLdoADryTFHd2/DxGuA1KRDdaNO35zjM0LnH7JnCd2ZYA3peMWcIlXzud4jzoMM47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