albarros
Forum Replies Created
-
Forum: Plugins
In reply to: [Claudio Sanches - Correios for WooCommerce] Duvidas sobre nova API@gwsnet Pelo que o correio falou no email que enviaram é isso mesmo. Apenas quem tem contrato, via CNPJ, vai conseguir utilizar a nova API.
Claudio,
Ent?o, como citei acima, achei que o problema fosse com os contratos antigos. N?o é!
Pra fechar o tópico como resolvido, eis o problema:
Quando solicitei o cart?o de postagem ao cliente, ele me enviou um print da tela de um sistema que ele utiliza com os correios, e tinha 3 zeros à esquerda seguido de um número de 8 dígitos. Coloquei do jeito que ele mandou e deu errado, depois removi os zeros e continuou dando erro. Ent?o perguntei se ele tinha o pdf do cart?o de postagem (o correio envia esse pdf quando é feito um contrato). Ele me enviou e s?o apenas 2 zeros no cart?o, e n?o 3 como apareceu na tela do sistema. Aí o plugin carregou os servi?os. Testei ent?o com os dados do contrato da minha empresa, colocando o número do cart?o exatamente como está impresso no PDF do cart?o, deu certo também!
Acabei de atualizar a loja de outro cliente com contrato antigo dos correios e também deu certinho.
Ent?o, se alguém mais passar por esse problema, coloque o número do cart?o exatamente igual está no PDF do cart?o.Acho que descobri o problema. Os clientes que tem contrato antigo, bastava colocar os dados corporativos de acesso no plugin antigo e os descontos corporativos apareciam. Já para os clientes com contrato mais recente, isso n?o funcionava. Fiz uma loja há uns 3 meses e tentamos de toda forma mas n?o apareciam os descontos. Ela conversou com os correios e falaram pra ela que teria que utilizar a API nova. Como n?o haviam plugins pra isso disponíveis na época, ela comprou o plugin da loja 5 e assim conseguimos ativar o cálculo de frete com os descontos do contrato.
Ent?o, resolvi testar as credenciais dela aqui onde estou tendo esse problema e funcionou na primeira tentativa!
Resolvi ent?o testar as minhas credenciais (minha empresa tem contrato há uns 4 anos com os correios). N?o funciona, dá o mesmo problema de n?o conseguir carregar a lista de servi?os.
Ent?o minha conclus?o é que os contratos antigos ainda n?o est?o funcionando com essa nova API.tudo bem Claudio?
ativei o log..
tem muita informa??o, isso é o que aparece. De cara fala que n?o consegue gerar o token… bom, isso está totalmente fora da minha área de conhecimento. Será que vendo aí vc consegue identificar o problema?
Muito obrigado por checar!09-14-2023 @ 17:17:31 - Getting available services list from Correios API... 09-14-2023 @ 17:17:31 - Generating new CWS token... 09-14-2023 @ 17:17:32 - Failed to generated token: Array ( [headers] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object ( [data:protected] => Array ( [date] => Thu, 14 Sep 2023 17:17:32 GMT [content-length] => 0 [vary] => Array ( [0] => Origin [1] => Access-Control-Request-Method [2] => Access-Control-Request-Headers ) [x-ratelimit-remaining] => 39 [x-ratelimit-requested-tokens] => 1 [x-ratelimit-burst-capacity] => 40 [x-ratelimit-replenish-rate] => 40 [expires] => 0 [cache-control] => no-cache, no-store, max-age=0, must-revalidate [x-xss-protection] => 1; mode=block [pragma] => no-cache [x-frame-options] => DENY [www-authenticate] => Basic realm="Realm" [x-content-type-options] => nosniff [strict-transport-security] => max-age=15724800; includeSubDomains [x-gtw-cluster] => prod1-bsb [x-gtw-user] => proteica [x-gtw-uri-template] => /v1/autentica/cartaopostagem [x-gtw-service-id] => token [x-gtw-api-time] => 10 [set-cookie] => LBprdExt1=684195850.47873.0000; path=/; Httponly; Secure ) ) [body] => [response] => Array ( [code] => 401 [message] => Unauthorized ) [cookies] => Array ( [0] => WP_Http_Cookie Object ( [name] => LBprdExt1 [value] => 684195850.47873.0000 [expires] => [path] => / [domain] => api.correios.com.br [port] => [host_only] => 1 ) ) [filename] => [http_response] => WP_HTTP_Requests_Response Object ( [response:protected] => WpOrg\Requests\Response Object ( [body] => [raw] => HTTP/1.1 401 Unauthorized Date: Thu, 14 Sep 2023 17:17:32 GMT Content-Length: 0 Connection: close Vary: Origin Vary: Access-Control-Request-Method Vary: Access-Control-Request-Headers X-RateLimit-Remaining: 39 X-RateLimit-Requested-Tokens: 1 X-RateLimit-Burst-Capacity: 40 X-RateLimit-Replenish-Rate: 40 Expires: 0 Cache-Control: no-cache, no-store, max-age=0, must-revalidate X-XSS-Protection: 1; mode=block Pragma: no-cache X-Frame-Options: DENY WWW-Authenticate: Basic realm="Realm" X-Content-Type-Options: nosniff Strict-Transport-Security: max-age=15724800; includeSubDomains x-gtw-cluster: prod1-bsb x-gtw-user: proteica x-gtw-uri-template: /v1/autentica/cartaopostagem x-gtw-service-id: token x-gtw-api-time: 10 Set-Cookie: LBprdExt1=684195850.47873.0000; path=/; Httponly; Secure [headers] => WpOrg\Requests\Response\Headers Object ( [data:protected] => Array ( [date] => Array ( [0] => Thu, 14 Sep 2023 17:17:32 GMT ) [content-length] => Array ( [0] => 0 ) [vary] => Array ( [0] => Origin [1] => Access-Control-Request-Method [2] => Access-Control-Request-Headers ) [x-ratelimit-remaining] => Array ( [0] => 39 ) [x-ratelimit-requested-tokens] => Array ( [0] => 1 ) [x-ratelimit-burst-capacity] => Array ( [0] => 40 ) [x-ratelimit-replenish-rate] => Array ( [0] => 40 ) [expires] => Array ( [0] => 0 ) [cache-control] => Array ( [0] => no-cache, no-store, max-age=0, must-revalidate ) [x-xss-protection] => Array ( [0] => 1; mode=block ) [pragma] => Array ( [0] => no-cache ) [x-frame-options] => Array ( [0] => DENY ) [www-authenticate] => Array ( [0] => Basic realm="Realm" ) [x-content-type-options] => Array ( [0] => nosniff ) [strict-transport-security] => Array ( [0] => max-age=15724800; includeSubDomains ) [x-gtw-cluster] => Array ( [0] => prod1-bsb ) [x-gtw-user] => Array ( [0] => proteica ) [x-gtw-uri-template] => Array ( [0] => /v1/autentica/cartaopostagem ) [x-gtw-service-id] => Array ( [0] => token ) [x-gtw-api-time] => Array ( [0] => 10 ) [set-cookie] => Array ( [0] => LBprdExt1=684195850.47873.0000; path=/; Httponly; Secure ) ) ) [status_code] => 401 [protocol_version] => 1.1 [success] => [redirects] => 0 [url] => https://api.correios.com.br/token/v1/autentica/cartaopostagem [history] => Array ( ) [cookies] => WpOrg\Requests\Cookie\Jar Object ( [cookies:protected] => Array ( [LBprdExt1] => WpOrg\Requests\Cookie Object ( [name] => LBprdExt1 [value] => 684195850.47873.0000 [attributes] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object ( [data:protected] => Array ( [path] => / [httponly] => 1 [secure] => 1 [domain] => api.correios.com.br ) ) [flags] => Array ( [creation] => 1694711852 [last-access] => 1694711852 [persistent] => [host-only] => 1 ) [reference_time] => 1694711852 ) ) ) ) [filename:protected] => [data] => [headers] => [status] => ) ) 09-14-2023 @ 17:17:32 - Missing Token! Aborting... 09-14-2023 @ 17:17:33 - Failed to get services list: Array ( [headers] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object ( [data:protected] => Array ( [date] => Thu, 14 Sep 2023 17:17:33 GMT [content-type] => application/json [content-length] => 225 [vary] => Array ( [0] => Origin [1] => Access-Control-Request-Method [2] => Access-Control-Request-Headers ) [x-ratelimit-remaining] => 164 [x-ratelimit-requested-tokens] => 1 [x-ratelimit-burst-capacity] => 165 [x-ratelimit-replenish-rate] => 150 [x-gtw-cluster] => prod2-bsb [x-gtw-user] => user-unknown [x-gtw-uri-template] => /** [x-gtw-service-id] => meucontrato [x-gtw-api-time] => 4 [strict-transport-security] => max-age=15724800; includeSubDomains [set-cookie] => LBprdExt1=684195850.47873.0000; path=/; Httponly; Secure ) ) [body] => {"msgs":["GTW-010: Acesso n?o autorizado. Verifique o token de acesso informado. Utilize 'Authorization: Bearer'."],"date":"2023-09-14T14:17:33","method":"GET","path":"/meucontrato/v1/empresas//contratos//cartoes//servicos"} [response] => Array ( [code] => 403 [message] => Forbidden ) [cookies] => Array ( [0] => WP_Http_Cookie Object ( [name] => LBprdExt1 [value] => 684195850.47873.0000 [expires] => [path] => / [domain] => api.correios.com.br [port] => [host_only] => 1 ) ) [filename] => [http_response] => WP_HTTP_Requests_Response Object ( [response:protected] => WpOrg\Requests\Response Object ( [body] => {"msgs":["GTW-010: Acesso n?o autorizado. Verifique o token de acesso informado. Utilize 'Authorization: Bearer'."],"date":"2023-09-14T14:17:33","method":"GET","path":"/meucontrato/v1/empresas//contratos//cartoes//servicos"} [raw] => HTTP/1.1 403 Forbidden Date: Thu, 14 Sep 2023 17:17:33 GMT Content-Type: application/json Content-Length: 225 Connection: close Vary: Origin Vary: Access-Control-Request-Method Vary: Access-Control-Request-Headers X-RateLimit-Remaining: 164 X-RateLimit-Requested-Tokens: 1 X-RateLimit-Burst-Capacity: 165 X-RateLimit-Replenish-Rate: 150 x-gtw-cluster: prod2-bsb x-gtw-user: user-unknown x-gtw-uri-template: /** x-gtw-service-id: meucontrato x-gtw-api-time: 4 Strict-Transport-Security: max-age=15724800; includeSubDomains Set-Cookie: LBprdExt1=684195850.47873.0000; path=/; Httponly; Secure {"msgs":["GTW-010: Acesso n?o autorizado. Verifique o token de acesso informado. Utilize 'Authorization: Bearer'."],"date":"2023-09-14T14:17:33","method":"GET","path":"/meucontrato/v1/empresas//contratos//cartoes//servicos"} [headers] => WpOrg\Requests\Response\Headers Object ( [data:protected] => Array ( [date] => Array ( [0] => Thu, 14 Sep 2023 17:17:33 GMT ) [content-type] => Array ( [0] => application/json ) [content-length] => Array ( [0] => 225 ) [vary] => Array ( [0] => Origin [1] => Access-Control-Request-Method [2] => Access-Control-Request-Headers ) [x-ratelimit-remaining] => Array ( [0] => 164 ) [x-ratelimit-requested-tokens] => Array ( [0] => 1 ) [x-ratelimit-burst-capacity] => Array ( [0] => 165 ) [x-ratelimit-replenish-rate] => Array ( [0] => 150 ) [x-gtw-cluster] => Array ( [0] => prod2-bsb ) [x-gtw-user] => Array ( [0] => user-unknown ) [x-gtw-uri-template] => Array ( [0] => /** ) [x-gtw-service-id] => Array ( [0] => meucontrato ) [x-gtw-api-time] => Array ( [0] => 4 ) [strict-transport-security] => Array ( [0] => max-age=15724800; includeSubDomains ) [set-cookie] => Array ( [0] => LBprdExt1=684195850.47873.0000; path=/; Httponly; Secure ) ) ) [status_code] => 403 [protocol_version] => 1.1 [success] => [redirects] => 0 [url] => https://api.correios.com.br/meucontrato/v1/empresas//contratos//cartoes//servicos?page=0&size=500 [history] => Array ( ) [cookies] => WpOrg\Requests\Cookie\Jar Object ( [cookies:protected] => Array ( [LBprdExt1] => WpOrg\Requests\Cookie Object ( [name] => LBprdExt1 [value] => 684195850.47873.0000 [attributes] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object ( [data:protected] => Array ( [path] => / [httponly] => 1 [secure] => 1 [domain] => api.correios.com.br ) ) [flags] => Array ( [creation] => 1694711853 [last-access] => 1694711853 [persistent] => [host-only] => 1 ) [reference_time] => 1694711853 ) ) ) ) [filename:protected] => [data] => [headers] => [status] => ) )