Empty nRec upon receiving return from SEFAZ

Asked

Viewed 736 times

2

Using the Nfephp project API, through the function:

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

get the array $aResposta.

However this array is returning the tag nRec empty. Follows below XML and the return of the array.

XML folder temporárias:

<?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>

Array return $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 
            ) 
    )
)

I mean, I can’t get the receipt number using the function:

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

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

  • The receipt number is in this array? what did you put? You already receive this array and you are ok? 7

  • The receipt number is empty. @Miguel

  • Ha I understand, but should come from this xml? Is that in xml there is also

  • Yes, you should. Can we go to chat? http://chat.stackexchange.com/rooms/51669/nrec-vazia-ao-receberretorno-da-sefaz

2 answers

4


Good morning, you don’t have the receipt number because you must be using the parameter $indSinc 1 (synchronous mode), so the NF-e authorization is instantaneous, not NF-e Batch or receipt number is generated, so the nRec empty.

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

2

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

a) Synchronous services - the 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 return of a reply message with a receipt which merely confirms receipt of the service request. The taxpayer’s application must make a new connection to consult the result of the processing of the previously requested service.

inserir a descrição da imagem aqui

Obs.: the SYNCHRONOUS processing relies heavily on the processing infrastructure of the State Treasury Departments.

ASYNCHRONOUS processing has a longer response time due to the XML sending cycle, which until its authorization can go through one more Webservice.

Reference:

Project Electronic Fiscal Note. Integration Manual - Contributor Technical Standards of Communication. https://www.fazenda.sp.gov.br/nfe/downloads/Manual_de_Integracao_Contribuinte_versao_111-2006-05-30.pdf

Google Groups: Nfephp. Empty nRec upon receiving return https://groups.google.com/forum/#! topic/nfephp/6yEs8WDJWvE

Google Groups: Nfephp. Authorisation (synchronous x asynchronous). https://groups.google.com/forum/#! topic/nfephp/qkqOd6Lqt1U

Xprocess. Synchronous and Asynchronous Method Testing in NFC-e http://www.xprocess.com.br/new/? p=5306

Browser other questions tagged

You are not signed in. Login or sign up in order to post.