Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sugestão de melhoria #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#088cfd",
"activityBar.background": "#088cfd",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#fec0e2",
"activityBarBadge.foreground": "#001a9c",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#088cfd",
"statusBar.background": "#0271d0",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#088cfd",
"statusBarItem.remoteBackground": "#0271d0",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#0271d0",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#0271d099",
"titleBar.inactiveForeground": "#e7e7e799"
}
}
17 changes: 12 additions & 5 deletions src/Common/Consulta.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,27 @@ protected function extractResponse(string $content): object
$cstat = $node->getElementsByTagName('cStat')->item(0)->nodeValue;
if ($cstat == '9490') {
$resp = [
// retorno do código do sefaz
'cstat' => $cstat,
'sucesso' => true,
'motivo' => "Dados encontrados.",
'xProd' => $node->getElementsByTagName('xProd')->item(0)->nodeValue ?? null,
'NCM' => $node->getElementsByTagName('NCM')->item(0)->nodeValue ?? null,
'CEST' => $node->getElementsByTagName('CEST')->item(0)->nodeValue ?? null,
];
} elseif ($cstat == '9496') {
$resp = [
'sucesso' => true,
'motivo' => "Dados encontrados, mas não disponíveis."
];

// somente o cstat == 9490 tem informação de ncm
// } elseif ($cstat == '9496') {
// $resp = [
// 'sucesso' => true,
// 'motivo' => "Dados encontrados, mas não disponíveis."
// ];

} else {
//ocorreu algum erro
$resp = [
// retorno do código do sefaz
'cstat' => $cstat,
'sucesso' => false,
'motivo' => $node->getElementsByTagName('xMotivo')->item(0)->nodeValue ?? null
];
Expand Down
5 changes: 5 additions & 0 deletions src/Gtin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

final class Gtin
{
/**
* Código de retorno SEFAZ
*/
public string $cstat;
/**
* Prefix of GTIN
*/
Expand Down Expand Up @@ -80,6 +84,7 @@ public function __construct(string $gtin = null, Certificate $certificate = null
$this->region = 'GS1 Brasil';
$this->checkDigit = 0;
$this->type = 0;
$this->cstat = null;
$this->semgtin = true;
$this->validPrefix = true;
return;
Expand Down