sefazDownload() public method

sefazDownload Solicita o download de NFe já manifestada
public sefazDownload ( string $chNFe = '', string $tpAmb = '', string $cnpj = '', array &$aRetorno = [] ) : string
$chNFe string
$tpAmb string
$cnpj string
$aRetorno array
return string
Example #1
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'On');
require_once '../../bootstrap.php';
use NFePHP\NFe\ToolsNFe;
$nfe = new ToolsNFe('../../config/config.json');
$nfe->setModelo('55');
$chNFe = '35150458716523000119550010000000131000000139';
$tpAmb = '2';
$cnpj = '58716523000119';
$aResposta = array();
$resp = $nfe->sefazDownload($chNFe, $tpAmb, $cnpj, $aResposta);
echo '<br><br><PRE>';
echo htmlspecialchars($nfe->soapDebug);
echo '</PRE><BR>';
print_r($aResposta);
echo "<br>";
Example #2
0
 /**
  * Metodo que recupera do SEFAZ e disponibiliza para download os arquivos
  *
  * @name 	downloadXml
  * @access	public
  * @author	Roberson Faria
  * @param 	Numeric $customer_id
  * @param 	Numeric $chNFe
  */
 public function downloadXml($customer_id, $chNFe)
 {
     try {
         $customer = Customer::find($customer_id)->toArray();
         $nfe = new ToolsNFe($this->setConfig($customer));
         // 			echo "chNfe = ".$chNFe."<br>";
         // 			echo "tpAmb = ".$this->dadosConfig["tpAmb"]."<br>";
         // 			echo "customer_cnpj = ".$customer['customer_cnpj']."<br>";
         $resp = $nfe->sefazDownload($chNFe, $this->dadosConfig["tpAmb"], '0' . $customer['customer_cnpj'], $aResposta);
         return $aResposta;
     } catch (Exception $e) {
         Log::warning("Erro LibNfe Exception: " . $e->getMessage());
         exit;
     }
 }