Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavomews committed Oct 28, 2024
2 parents c94a586 + e5420b6 commit e466d54
Show file tree
Hide file tree
Showing 30 changed files with 1,427 additions and 1,074 deletions.
1,928 changes: 964 additions & 964 deletions examples/nfe_v4.00.xsd.xml

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions fake/fakeSefazCancela.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"tpAmb" => 2,
"razaosocial" => "SUA RAZAO SOCIAL LTDA",
"cnpj" => "99999999999999",
"siglaUF" => "SP",
"siglaUF" => "AM",
"schemes" => "PL_009_V4",
"versao" => '4.00',
"tokenIBPT" => "AAAAAAA",
Expand All @@ -35,17 +35,17 @@

$content = file_get_contents('expired_certificate.pfx');
$tools = new Tools($configJson, Certificate::readPfx($content, 'associacao'));
$tools->model('55');
$tools->model('65');
$tools->setVerAplic('5.1.34');
$tools->loadSoapClass($soap);

$chave = '35345678901234567890123456789012345678901234';
$chave = '13345678901234567890123456789012345678901234';
$justificativa = 'nfe com erros de digitação';
$nProt = '123456789012345';
$response = $tools->sefazCancela($chave, $justificativa, $nProt);

echo FakePretty::prettyPrint($response);

} catch (\Exception $e) {
echo $e->getMessage();
}
}
6 changes: 5 additions & 1 deletion fake/fakeSefazConcilicacao.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"tpAmb" => 2,
"razaosocial" => "SUA RAZAO SOCIAL LTDA",
"cnpj" => "99999999999999",
"siglaUF" => "SP",
"siglaUF" => "MG",
"schemes" => "PL_009_V4",
"versao" => '4.00',
"tokenIBPT" => "AAAAAAA",
Expand Down Expand Up @@ -70,13 +70,17 @@
$std->detPag[0]->dPag = '2024-07-30'; //Obrigatório data do pagamento

//grupo OPCIONAL de informações sobre envolvidos no pagamento

$std->detPag[0]->CNPJPag = '12345678901234'; //opcional, caso seja informado a UFPag também deverá ser informada
// CNPJ transacional do pagamento - Preencher informando o CNPJ do estabelecimento onde o pagamento foi
// processado/transacionado/recebido quando a emissão do documento fiscal ocorrer em estabelecimento distinto

$std->detPag[0]->UFPag = 'SP'; //opcional, caso seja informado a CNPJPag também deverá ser informada
// UF do CNPJ do estabelecimento onde o pagamento foi processado/transacionado/recebido

$std->detPag[0]->CNPJIF = '11111111111111'; //opcinal
//CNPJ da instituição financeira, de pagamento, adquirente ou subadquirente.

$std->detPag[0]->tBand = '20'; //opcional Bandeira da operadora de cartão
//01 Visa
//02 Mastercard
Expand Down
6 changes: 3 additions & 3 deletions fake/fakeSefazDistDfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
$tools->loadSoapClass($soap);

$ultNSU = 0;
$numNSU = null;
$numNSU = 0;

$response = $tools->sefazDistDFe($ultNSU, $numNSU);

echo FakePretty::prettyPrint($response);

} catch (\Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions fake/fakeSefazManifesta.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
$tools->model('55');
$tools->setVerAplic('5.1.34');
$tools->loadSoapClass($soap);

$chave = "35345678901234567890123456789012345678901234";
$justificativa = null;
$justificativa = '';
$tipo = $tools::EVT_CIENCIA;
$response = $tools->sefazManifesta($chave, $tipo, $justificativa);

echo FakePretty::prettyPrint($response);

} catch (\Exception $e) {
echo $e->getMessage();
}
}
Empty file modified schemes/PL_009_V4/consReciNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/consSitNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/consStatServ_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/enviNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/inutNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/leiauteConsSitNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/leiauteConsStatServ_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/leiauteInutNFe_v4.00.xsd
100644 → 100755
Empty file.
191 changes: 137 additions & 54 deletions schemes/PL_009_V4/leiauteNFe_v4.00.xsd
100644 → 100755

Large diffs are not rendered by default.

Empty file modified schemes/PL_009_V4/nfe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/procInutNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/procNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/retConsReciNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/retConsSitNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/retConsStatServ_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/retEnviNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/retInutNFe_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/tiposBasico_v4.00.xsd
100644 → 100755
Empty file.
Empty file modified schemes/PL_009_V4/xmldsig-core-schema_v1.01.xsd
100644 → 100755
Empty file.
11 changes: 8 additions & 3 deletions src/Common/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,14 @@ protected function servico(string $service, string $uf, $tpAmb, bool $ignoreCont
throw new \RuntimeException("Servico [$service] indisponivel UF [$uf] ou modelo [$this->modelo]");
}
}
$this->urlcUF = $this->getcUF($uf); //recuperação do cUF
if ($this->urlcUF > 91) {
$this->urlcUF = $this->getcUF($this->config->siglaUF); //foi solicitado dado de SVCRS ou SVCAN
//NT 2024.002 1.00 Maio/2024, comentário P08 elemento cOrgao
if ($uf === 'SVRS') {
$this->urlcUF = 92;
} else {
$this->urlcUF = $this->getcUF($uf); //recuperação do cUF
if ($this->urlcUF > 91) {
$this->urlcUF = $this->getcUF($this->config->siglaUF); //foi solicitado dado de SVCRS ou SVCAN
}
}
$this->urlVersion = $stdServ->$service->version; //recuperação da versão
$this->urlService = $stdServ->$service->url; //recuperação da url do serviço
Expand Down
23 changes: 17 additions & 6 deletions src/Common/Webservices.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ public function __construct(string $xml)
*/
public function get(string $sigla, $amb, int $modelo): \stdClass
{
$autfile = realpath(__DIR__ . '/../../storage/autorizadores.json');
$autorizadores = json_decode(file_get_contents($autfile), true);
if (!key_exists($sigla, $autorizadores[$modelo])) {
throw new \RuntimeException("Nao existe autorizador [$sigla] para os webservices do modelo [$modelo]");
}
$auto = $autorizadores[$modelo][$sigla];
$auto = self::getAuth($sigla, $modelo);
if (empty($auto) || empty($this->std)) {
throw new \RuntimeException('Falhou autorizador, parece vazio');
}
Expand All @@ -72,6 +67,22 @@ public function get(string $sigla, $amb, int $modelo): \stdClass
return $svw;
}

/**
* Obtem a sigla do autorizador para um estado origem e modelo de documento fiscal
* @param string $sigla
* @param int $modelo
* @return string
*/
public static function getAuth(string $sigla, int $modelo): string
{
$autfile = realpath(__DIR__ . '/../../storage/autorizadores.json');
$autorizadores = json_decode(file_get_contents($autfile), true);
if (!key_exists($sigla, $autorizadores[$modelo])) {
throw new \RuntimeException("Nao existe autorizador [$sigla] para os webservices do modelo [$modelo]");
}
return $autorizadores[$modelo][$sigla];
}

/**
* Return WS parameters in a stdClass
*/
Expand Down
Loading

0 comments on commit e466d54

Please sign in to comment.