Пример #1
0
$nfe->transp->transporta->IE = 'ISENTO';
$nfe->transp->transporta->xEnder = 'RUA TESTE, 278, 278 - BAIRRO TESTE';
$nfe->transp->transporta->xMun = 'GOVERNADOR CELSO RAMOS';
$nfe->transp->transporta->UF = 'SC';
$nfe->transp->vol->qVol = '1';
$nfe->transp->vol->esp = 'UNIDADE';
$nfe->transp->vol->marca = '-';
$nfe->transp->vol->nVol = '000003';
$nfe->transp->vol->pesoL = 1.0;
$nfe->transp->vol->pesoB = 1.0;
// Cobr
$nfe->cobr->fat->nFat = '000003';
$nfe->cobr->fat->vOrig = 133.2;
$nfe->cobr->fat->vLiq = 133.2;
$nfe->cobr->dup->add($item = new \PhpNFe\NFe\Builder\Cobr\DupNfe());
$item->nDup = '000003A';
$item->dVenc = '2016-10-09';
$item->vDup = 133.2;
// infAdic
$nfe->infAdic->infCpl = 'xxxx';
$nfe = $nfe->getXML();
$cert = new \PhpNFe\Tools\Certificado\Certificado();
$cert->carregarPfx(__DIR__ . '/SeuCertificado.pfx', 'suaSenha');
$xml = $cert->assinarXML($nfe, 'infNFe');
$autorizar = new \PhpNFe\NFe\NFe($cert);
$val = $autorizar->validar($xml, '3.10');
$ret = $autorizar->autorizar($xml);
$ehErro = $ret->isError();
$message = $ret->getMessage();
$codigo = $ret->getCode();
echo 'Foi!';
Пример #2
0
<?php

include __DIR__ . '/../vendor/autoload.php';
$cert = new \PhpNFe\Tools\Certificado\Certificado();
$cert->carregarPfx(__DIR__ . '/seuCertificado.pfx', 'suaSenha');
$nfe = new \PhpNFe\NFe\NFe($cert);
$xml = file_get_contents(__DIR__ . '/../tests/utils/xmlAutorizadoTeste.xml');
$ret = $nfe->cancela($xml, 'Justificativa Teste', '1');
$ehErro = $ret->isError();
$message = $ret->getMessage();
$code = $ret->getCode();
echo 'Foi!';
Пример #3
0
<?php

include __DIR__ . '/../vendor/autoload.php';
$path = __DIR__ . '/../tests/utils/xmlTeste.xml';
$cert = new \PhpNFe\Tools\Certificado\Certificado();
$cert->carregarPfx(__DIR__ . 'seu_certificado.pfx', 'suaSenha');
$xml = file_get_contents($path);
$xml = $cert->assinarXML($xml, 'infNFe');
$nfe = new \PhpNFe\NFe\NFe($cert);
$b = $cert->ehValido();
$v = $nfe->validar($xml, '3.10');
$ret = $nfe->autorizar($xml);
$code = $ret->getCode();
$chave = $ret->getChNFe();
$retXml = $ret->getXML();
$message = $ret->getMessage();
echo 'foi';
Пример #4
0
<?php

include __DIR__ . '/../vendor/autoload.php';
$cert = new \PhpNFe\Tools\Certificado\Certificado();
$cert->carregarPfx(__DIR__ . '/seuCertificado.pfx', 'suaSenha');
$nfe = new \PhpNFe\NFe\NFe($cert);
$ret = $nfe->consulta('42160818227795000130550010000002031678156759', '2', '42');
$xml = $ret->getMensagem();
$motivo = $ret->getMotivo();
$dataReceb = $ret->getDataReceb();
$code = $ret->getCode();
$protocolo = $ret->getProt();
echo 'Foi!';