Skip to content

Commit

Permalink
fix: adiciona valores padrão a campos não obrigatorios
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeferson Menegaldo committed Mar 8, 2024
1 parent 3ffcc8b commit 1e028a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/NFe/Entity/Endereco.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
*/
class Endereco implements Node
{
public const NOME_PAIS_DEFAULT = 'BRASIL';
public const CODIGO_PAIS_DEFAULT = 1058;

private $pais;
private $cep;
private $municipio;
Expand Down Expand Up @@ -323,13 +326,13 @@ public function loadNode($element, $name = null)
Util::loadNode(
$element,
'cPais'
)
) ?? $this::CODIGO_PAIS_DEFAULT
);
$this->getPais()->setNome(
Util::loadNode(
$element,
'xPais'
)
) ?? $this::NOME_PAIS_DEFAULT
);
return $element;
}
Expand Down
4 changes: 2 additions & 2 deletions src/NFe/Entity/Pagamento.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,10 @@ public function loadNode($element, $name = null)
$name = is_null($name) ? 'detPag' : $name;
if ($name == 'vTroco') {
$this->setValor(
'-' . Util::loadNode(
'-' . (Util::loadNode(
$element,
'vTroco'
)
) ?? 0)
);
return $element;
}
Expand Down

0 comments on commit 1e028a5

Please sign in to comment.