Skip to content

Commit d1317e0

Browse files
authored
Merge pull request #41 from weberdepaulai12/master
Sugestão de melhoria
2 parents 79e176e + 9d8d071 commit d1317e0

3 files changed

Lines changed: 38 additions & 5 deletions

File tree

.vscode/settings.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#088cfd",
4+
"activityBar.background": "#088cfd",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#fec0e2",
8+
"activityBarBadge.foreground": "#001a9c",
9+
"commandCenter.border": "#e7e7e799",
10+
"sash.hoverBorder": "#088cfd",
11+
"statusBar.background": "#0271d0",
12+
"statusBar.foreground": "#e7e7e7",
13+
"statusBarItem.hoverBackground": "#088cfd",
14+
"statusBarItem.remoteBackground": "#0271d0",
15+
"statusBarItem.remoteForeground": "#e7e7e7",
16+
"titleBar.activeBackground": "#0271d0",
17+
"titleBar.activeForeground": "#e7e7e7",
18+
"titleBar.inactiveBackground": "#0271d099",
19+
"titleBar.inactiveForeground": "#e7e7e799"
20+
}
21+
}

src/Common/Consulta.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,27 @@ protected function extractResponse(string $content): object
6161
$cstat = $node->getElementsByTagName('cStat')->item(0)->nodeValue;
6262
if ($cstat == '9490') {
6363
$resp = [
64+
// retorno do código do sefaz
65+
'cstat' => $cstat,
6466
'sucesso' => true,
6567
'motivo' => "Dados encontrados.",
6668
'xProd' => $node->getElementsByTagName('xProd')->item(0)->nodeValue ?? null,
6769
'NCM' => $node->getElementsByTagName('NCM')->item(0)->nodeValue ?? null,
6870
'CEST' => $node->getElementsByTagName('CEST')->item(0)->nodeValue ?? null,
6971
];
70-
} elseif ($cstat == '9496') {
71-
$resp = [
72-
'sucesso' => true,
73-
'motivo' => "Dados encontrados, mas não disponíveis."
74-
];
72+
73+
// somente o cstat == 9490 tem informação de ncm
74+
// } elseif ($cstat == '9496') {
75+
// $resp = [
76+
// 'sucesso' => true,
77+
// 'motivo' => "Dados encontrados, mas não disponíveis."
78+
// ];
79+
7580
} else {
7681
//ocorreu algum erro
7782
$resp = [
83+
// retorno do código do sefaz
84+
'cstat' => $cstat,
7885
'sucesso' => false,
7986
'motivo' => $node->getElementsByTagName('xMotivo')->item(0)->nodeValue ?? null
8087
];

src/Gtin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818

1919
final class Gtin
2020
{
21+
/**
22+
* Código de retorno SEFAZ
23+
*/
24+
public string $cstat;
2125
/**
2226
* Prefix of GTIN
2327
*/
@@ -81,6 +85,7 @@ public function __construct(?string $gtin = null, ?Certificate $certificate = nu
8185
$this->region = 'GS1 Brasil';
8286
$this->checkDigit = 0;
8387
$this->type = 0;
88+
$this->cstat = null;
8489
$this->semgtin = true;
8590
$this->validPrefix = true;
8691
return;

0 commit comments

Comments
 (0)