Permalink
Browse files

v 1.0

  • Loading branch information...
webmaniabr committed Nov 3, 2017
0 parents commit 8d491e0d3bc7da3612b16c52d1d91e9100ec9685
Showing with 277 additions and 0 deletions.
  1. +30 −0 cancelarNotaFiscal.rb
  2. +30 −0 cartaCorrecao.rb
  3. +19 −0 consultaNotaFiscal.rb
  4. +32 −0 devolucaoNotaFiscal.rb
  5. +96 −0 emissaoNotaFiscal.rb
  6. +32 −0 inutilizarNumeracao.rb
  7. +19 −0 statusSefaz.rb
  8. +19 −0 validadeCertificadoA1.rb
@@ -0,0 +1,30 @@
=begin
JSON request:
{
"chave":"45150819652219000198550990000000011442380343",
"motivo":"Cancelamento por motivos administrativos.",
"ambiente":"1"
}
=end
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/cancelar/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
request.body = "{\"chave\":\"45150819652219000198550990000000011442380343\",\"motivo\":\"Cancelamento por motivos administrativos.\",\"ambiente\":\"1\"}"
response = http.request(request)
puts response.read_body
@@ -0,0 +1,30 @@
=begin
JSON request:
{
"chave":"45150819652219000198550990000000011442380343",
"correcao":"O CFOP correto é 5.102 referente a revenda tributada no mesmo estado.",
"ambiente":1
}
=end
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/cartacorrecao/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
request.body = "{\"chave\": \"45150819652219000198550990000000011442380343\",\"correcao\": \"O CFOP correto é 5.102 referente a revenda tributada no mesmo estado.\",\"ambiente\": \"1\"}"
response = http.request(request)
puts response.read_body
@@ -0,0 +1,19 @@
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/consulta/?chave=45150819652219000198550990000000011442380343&ambiente=1")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
response = http.request(request)
puts response.read_body
@@ -0,0 +1,32 @@
=begin
JSON request:
{
"chave": "45150819652219000198550990000000011442380343",
"natureza_operacao": "Devolução de venda de produção do estabelecimento",
"codigo_cfop": "1.202",
"produtos": [ 2, 3 ],
"ambiente": "1"
}
=end
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/devolucao/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
request.body = "{\"chave\":\"45150819652219000198550990000000011442380343\",\"natureza_operacao\":\"Devolução de venda de produção do estabelecimento\",\"codigo_cfop\":\"1.202\",\"produtos\": [ 2, 3 ],\"ambiente\":\"1\"}"
response = http.request(request)
puts response.read_body
@@ -0,0 +1,96 @@
=begin
JSON request:
{
"ID": 1137,
"url_notificacao": "https://webmaniabr.com/retorno.php",
"operacao": 1,
"natureza_operacao": "Venda de produção do estabelecimento",
"modelo": 1,
"finalidade": 1,
"ambiente": 1,
"cliente": {
"cpf": "980.453.164-03",
"nome_completo": "Miguel Pereira da Silva",
"endereco": "Av. Anita Garibaldi",
"complemento": "Sala 809 Royal",
"numero": 850,
"bairro": "Ahú",
"cidade": "Curitiba",
"uf": "PR",
"cep": "80540-180",
"telefone": "(41) 4063-9102",
"email": "suporte@webmaniabr.com"
},
"produtos": [
{
"nome": "Camisetas Night Run",
"sku": "camiseta-night-run",
"ean": "0789602015376",
"ncm": "6109.10.00",
"cest": "28.038.00",
"cnpj_produtor": "11.290.027/0001-82",
"quantidade": 3,
"unidade": "UN",
"peso": "0.800",
"origem": 0,
"subtotal": "44.90",
"total": "134.70",
"classe_imposto": "REF1637"
},
{
"nome": "Camisetas 10 Milhas",
"sku": "camisetas-10-milhas",
"ean": "0789602015376",
"ncm": "6109.10.00",
"cest": "28.038.00",
"cnpj_produtor": "11.290.027/0001-82",
"quantidade": "1",
"unidade": "UN",
"peso": "0.200",
"origem": 0,
"subtotal": "29.90",
"total": "29.90",
"classe_imposto": "REF1637"
}
],
"pedido": {
"pagamento": 0,
"presenca": 2,
"modalidade_frete": 0,
"frete": "12.56",
"desconto": "10.00",
"total": "174.60"
},
"transporte": {
"cnpj": "11.290.027/0001-82",
"razao_social": "Transportes LTDA",
"ie": "123.456.789.123",
"endereco": "Av. Anita Garibaldi",
"uf": "PR",
"cidade": "Curitiba",
"cep": "80540-180"
}
}
=end
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/emissao/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
request.body = "{\"ID\": 1137,\"url_notificacao\": \"https://webmaniabr.com/retorno.php\",\"operacao\": 1,\"natureza_operacao\": \"Venda de produção do estabelecimento\",\"modelo\": 1,\"finalidade\": 1,\"ambiente\": 1,\"cliente\": {\"cpf\": \"980.453.164-03\",\"nome_completo\": \"Miguel Pereira da Silva\",\"endereco\": \"Av. Anita Garibaldi\",\"complemento\": \"Sala 809 Royal\",\"numero\": 850,\"bairro\": \"Ahú\",\"cidade\": \"Curitiba\",\"uf\": \"PR\",\"cep\": \"80540-180\",\"telefone\": \"(41) 4063-9102\",\"email\": \"suporte@webmaniabr.com\"},\"produtos\": [{\"nome\": \"Camisetas Night Run\",\"sku\": \"camiseta-night-run\",\"ean\": \"0789602015376\",\"ncm\": \"6109.10.00\",\"cest\": \"28.038.00\",\"cnpj_produtor\": \"11.290.027/0001-82\",\"quantidade\": 3,\"unidade\": \"UN\",\"peso\": \"0.800\",\"origem\": 0,\"subtotal\": \"44.90\",\"total\": \"134.70\",\"classe_imposto\": \"REF1637\"},{\"nome\": \"Camisetas 10 Milhas\",\"sku\": \"camisetas-10-milhas\",\"ean\": \"0789602015376\",\"ncm\": \"6109.10.00\",\"cest\": \"28.038.00\",\"cnpj_produtor\": \"11.290.027/0001-82\",\"quantidade\": \"1\",\"unidade\": \"UN\",\"peso\": \"0.200\",\"origem\": 0,\"subtotal\": \"29.90\",\"total\": \"29.90\",\"classe_imposto\": \"REF1637\"}],\"pedido\": {\"pagamento\": 0,\"presenca\": 2,\"modalidade_frete\": 0,\"frete\": \"12.56\",\"desconto\": \"10.00\",\"total\": \"174.60\"},\"transporte\": {\"cnpj\": \"11.290.027/0001-82\",\"razao_social\": \"Transportes LTDA\",\"ie\": \"123.456.789.123\",\"endereco\": \"Av. Anita Garibaldi\",\"uf\": \"PR\",\"cidade\": \"Curitiba\",\"cep\": \"80540-180\"}}"
response = http.request(request)
puts response.read_body
@@ -0,0 +1,32 @@
=begin
JSON request:
{
"sequencia": "101-109",
"motivo": "Inutilização por problemas técnicos.",
"ambiente": "1",
"serie": "99",
"modelo": "1"
}
=end
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/inutilizar/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Put.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
request.body = "{\"sequencia\":\"101-109\",\"motivo\":\"Inutilização por problemas técnicos.\",\"ambiente\":\"1\",\"serie\":\"99\",\"modelo\":\"1\"}"
response = http.request(request)
puts response.read_body
@@ -0,0 +1,19 @@
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/sefaz/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
response = http.request(request)
puts response.read_body
@@ -0,0 +1,19 @@
require 'uri'
require 'net/http'
url = URI("https://webmaniabr.com/api/1/nfe/certificado/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["cache-control"] = 'no-cache'
request["content-type"] = 'application/json'
request["x-consumer-key"] = 'SEU_CONSUMER_KEY'
request["x-consumer-secret"] = 'SEU_CONSUMER_SECRET'
request["x-access-token"] = 'SEU_ACCESS_TOKEN'
request["x-access-token-secret"] = 'SEU_ACCESS_TOKEN_SECRET'
response = http.request(request)
puts response.read_body

0 comments on commit 8d491e0

Please sign in to comment.