nRec empty when receiving return from SEFAZ

2

Using the NFePHP project API, through the function:

$retorno = $nfe->sefazEnviaLote($aXml, $tpAmb, $idLote, $aResposta, $indSinc, $flagZip);

I get the array $aResposta .

However this array is returning the nRec empty tag. Below is the XML and array return.

XML of the temporárias folder:

<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  <env:Header/>
  <env:Body>
    <nfeAutorizacaoLoteResult xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeAutorizacao">
      <retEnviNFe versao="3.10" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ns0="http://www.w3.org/2000/09/xmldsig#">
        <tpAmb>2</tpAmb>
        <verAplic>GO3.0</verAplic>
        <cStat>104</cStat>
        <xMotivo>Lote processado</xMotivo>
        <cUF>52</cUF>
        <dhRecbto>2017-01-12T11:45:40-02:00</dhRecbto>
        <protNFe versao="3.10">
          <infProt>
            <tpAmb>2</tpAmb>
            <verAplic>GO3.0</verAplic>
            <chNFe>52170119811185000142550010000000361385289826</chNFe>
            <dhRecbto>2017-01-12T11:45:40-02:00</dhRecbto>
            <nProt>152170016903387</nProt>
            <digVal>N3MSuIoDpO8EIi032j56zhQ+hTU=</digVal>
            <cStat>100</cStat>
            <xMotivo>Autorizado o uso da NF-e</xMotivo>
          </infProt>
        </protNFe>
      </retEnviNFe>
    </nfeAutorizacaoLoteResult>
  </env:Body>
</env:Envelope>

Return from array $aResposta :

 Array ( 
    [bStat] => 1 
    [versao] => 3.10 
    [tpAmb] => 2 
    [verAplic] => GO3.0 
    [cStat] => 104 
    [xMotivo] => Lote processado 
    [cUF] => 52 
    [dhRecbto] => 2017-01-12T11:45:40-02:00 
    [tMed] => 
    [nRec] => 
    [prot] => 
        Array ( 
            [0] => Array ( 
                [chNFe] => 52170119811185000142550010000000361385289826 
                [dhRecbto] => 2017-01-12T11:45:40-02:00 
                [nProt] => 152170016903387 
                [digVal] => N3MSuIoDpO8EIi032j56zhQ+hTU= 
                [cStat] => 100 
                [xMotivo] => Autorizado o uso da NF-e 
            ) 
    )
)

That is, I can not see the receipt number using the function:

$nfe->sefazConsultaRecibo($recibo, $tpAmb, $aResposta);

However, I can print DANF-e normally ...

    
asked by anonymous 12.01.2017 / 15:30

2 answers

4

Good morning, you do not have the receipt number because you must be using the $indSinc parameter equal to 1 (synchronous mode), so the NF-e authorization is instantaneous, no NF-e lot is generated number of receipt, so nRec is empty.

If you change the parameter $indSinc to 0 (asynchronous mode) then the webservice of SEFAZ will generate a Batch of NF-e and return only the number of the receipt, after a few seconds you consult the Batch, by the receipt number.

    
13.01.2017 / 13:21
2

The variable $indSinc was set to value '1', ie SYNCHRONOUS SERVICE, simply change it to '0'.

a) Synchronous services - processing of the service request is completed on the same connection, with the return of a message with the result of processing the requested service;

b) Asynchronous services - service request processing is not completed on the same connection, with returning a reply message with a receipt that only acknowledges receipt of the service request. The taxpayer application must make a new connection to query the result of processing the previously requested service.

Note:SYNCHRONprocessingdependsheavilyontheprocessinginfrastructureoftheStateTreasuryDepartments.

AsynchronousprocessinghasalongerresponsetimebecauseoftheXMLsendcycle,whichcanevenbepassedbyanotherWebService.

Reference:

ElectronicInvoiceProject.IntegrationManual-ContributorTechnicalStandardsofCommunication. link

Google Groups: NFePHP. nRec empty upon return link

Google Groups: NFePHP. Authorize (synchronous vs. asynchronous) . link

XProcess. Testing between Synchronous and Asynchronous Method in NFC-e link

    
13.01.2017 / 13:34