enotas_nfe 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a53fbf29ac1b3cb257a1af2ae054735db71f5616
4
- data.tar.gz: 455d90bee4405169603adf370ed5ae5978ff9e5b
3
+ metadata.gz: d707afc41c1f1e7ba03b71389c6cfbd5ebfdf6cf
4
+ data.tar.gz: 5660a4b3be11113fab6f3519b7d44e0699cabbe8
5
5
  SHA512:
6
- metadata.gz: 6087ae57439296c4fe54b683d99800c9794cd0d79de14b13cb0caa80479857d19765bcdf8e5d9cd41b579c801609c00123555282aa5686ec2937ddf0c426abee
7
- data.tar.gz: '09b4159f1ef1ee5ff37fc900fc0cf41090648012ec60531cedf8b77a163666c65875c34ea453695a85c2cb71c3a9b79268d7274386d5f2eb8c871fcb4cdcdaaf'
6
+ metadata.gz: 124816e933fb8421c513d45512a6fc5e14fb369230c713e0a84bfd0f9e10b9b3132cb7c69c85a5261e62d6cc7b0f2219b7656867e080d223f48b1b102f72a5ca
7
+ data.tar.gz: b60ed5cefce480088f524edb144630a22e680fc3650bb829ade51a927b660f9a960a83eaba6284c1dcb5d566d4dfab86b0c1daa2880653ecb3f32af1f9c69fa1
data/README.md CHANGED
@@ -31,6 +31,147 @@ Ou instale manualmente:
31
31
 
32
32
  $ gem install enotas_nfe
33
33
 
34
+ ## Cadastro de empresa (emissor)
35
+
36
+ * Instancie o cliente passando a sua API key:
37
+
38
+ ```ruby
39
+ client = EnotasNfe::Client.new('sua-api-key-do-e-notas', 'nfse')
40
+ ```
41
+
42
+ * Carregue uma instância de Empresa com os dados:
43
+
44
+ ```ruby
45
+ empresa = EnotasNfe::Model::Empresa.new
46
+ empresa.id = 1 # Usado para quando se deseja atualizar o cadastro
47
+ empresa.cnpj = '000000000000000'
48
+ empresa.nomeFantasia = 'Nome Fantasia'
49
+ empresa.razaoSocial = 'Razão Social'
50
+ empresa.inscricaoMunicipal = '00000000'
51
+ empresa.inscricaoEstadual = '00000000'
52
+ empresa.telefoneComercial = '00000000'
53
+ empresa.email = 'email@mail.com'
54
+ empresa.enviarEmailCliente = false
55
+ empresa.regimeEspecialTributacao = '01'
56
+ empresa.aedf = '00000'
57
+ empresa.descricaoServico = '00'
58
+ empresa.codigoServicoMunicipal = '00'
59
+ empresa.cnae = '000000'
60
+ empresa.aliquotaIss = '0.00'
61
+ empresa.optanteSimplesNacional = true
62
+ empresa.incentivadorCultural = false
63
+ empresa.itemListaServicoLC116 = '0.00'
64
+ empresa.endereco = {
65
+ logradouro: 'Logradouro',
66
+ complemento: 'Complemento',
67
+ numero: '1000',
68
+ bairro: 'Centro',
69
+ cidade: 'Cidade',
70
+ codigoIbgeCidade: 666999,
71
+ uf: SC,
72
+ cep: 00000000
73
+ }
74
+ empresa.configuracoesNFSeProducao = {
75
+ serieNFe = 'NFe',
76
+ sequencialNFe = 1,
77
+ sequencialLoteNFe = 1,
78
+
79
+ # Esses dados variam de acordo com a prefeitura, verifique a necessidade no endpoint de cidades suportadas
80
+ usuarioAcessoProvedor = 'user',
81
+ senhaAcessoProvedor = 'pass',
82
+ tokenAcessoProvedor = 'super-token'
83
+ }
84
+ empresa.configuracoesNFSeHomologacao = {
85
+ serieNFe = 'NFe',
86
+ sequencialNFe = 1,
87
+ sequencialLoteNFe = 1,
88
+
89
+ # Esses dados variam de acordo com a prefeitura, verifique a necessidade no endpoint de cidades suportadas
90
+ usuarioAcessoProvedor = 'user',
91
+ senhaAcessoProvedor = 'pass',
92
+ tokenAcessoProvedor = 'super-token'
93
+ }
94
+ ```
95
+
96
+ Como saber quais dados são obrigatórios em um prefeitura, ou se a prefeitura é suportada pelo Enotas?
97
+
98
+ ```ruby
99
+ response = client.get_caracteristicas_prefeitura('codigo-ibge-cidade')
100
+ ```
101
+
102
+ Caso a prefeitura não seja suportada, o response vai ter uma mensagem de erro, informando. Quando é suportada,
103
+ retorna dados relevantes sobre a prefeitura, que devem ser usados para auxiliar a formação do objeto empresa:
104
+
105
+ ```ruby
106
+ prefeitura = EnotasNfe::Model::CaracteristicaPrefeitura.new(response)
107
+
108
+ # 0: Nenhuma
109
+ # 1: Certificado
110
+ # 2: Usuário e Senha
111
+ # 3: Token
112
+ prefeitura.tipoAutenticacao
113
+
114
+ # 0: Não utiliza
115
+ # 1: Opcional
116
+ # 2: Obrigatória
117
+ prefeitura.assinaturaDigital
118
+
119
+ prefeitura.usaCNAE
120
+ prefeitura.usaItemListaServico
121
+ prefeitura.campoLoginProvedor
122
+ prefeitura.suportaCancelamento
123
+ prefeitura.usaAEDF
124
+ prefeitura.usaRegimeEspecialTributacao
125
+ prefeitura.usaCodigoServicoMunicipal
126
+ prefeitura.usaDescricaoServico
127
+ prefeitura.usaCNAE
128
+ prefeitura.usaItemListaServico
129
+ prefeitura.helpTipoAutenticacao
130
+ prefeitura.helpInscricaoMunicipal
131
+ prefeitura.helpRegimeEspecialTributacao
132
+ prefeitura.helpCodigoServicoMunicipal
133
+ prefeitura.helpDescricaoServico
134
+ prefeitura.helpCNAE
135
+ prefeitura.helpItemListaServico
136
+ prefeitura.suportaEmissaoNFeSemCliente
137
+ prefeitura.suportaEmissaoNFeClienteSemCpf
138
+ prefeitura.suportaEmissaoNFeClienteSemEndereco
139
+ prefeitura.suportaCancelamentoNFeSemCliente
140
+ prefeitura.suportaCancelamentoNFeClienteSemCpf
141
+
142
+ # Retorna uma lista com os regimes de tributação suportados pela prefeitura
143
+ prefeitura.regimesEspecialTributacao
144
+ ```
145
+
146
+ * Salve:
147
+
148
+ ```ruby
149
+ client.create_update_empresa(empresa)
150
+ ```
151
+
152
+ No caso de sucesso dessa operação, será retornado o campo `empresaId`, que deve ser informado, quando deseja ser atualizado um cadastro, ou nos endpoints de Upload.
153
+
154
+ ## Upload do certificado
155
+
156
+ ```ruby
157
+ certificate = {
158
+ arquivo: 'arquivo-de-upload',
159
+ senha: 'pass'
160
+ }
161
+
162
+ client.set_certificado_digital('empresaId', certificate)
163
+ ```
164
+
165
+ ## Upload da logo
166
+
167
+ ```ruby
168
+ logo = {
169
+ arquivo: 'arquivo-de-upload'
170
+ }
171
+
172
+ client.set_logo('empresaId', logo)
173
+ ```
174
+
34
175
  ## Uso básico para NFSE
35
176
 
36
177
  * Instancie o cliente passando sua API key:
@@ -418,7 +559,6 @@ Issues e comentários são sempre bem-vindos no repoistório oficial: https://gi
418
559
  Quer contribuir e não sabe por onde começar? Veja nosso ROADMAP:
419
560
 
420
561
  * Escrever testes;
421
- * Finalizar chamada para troca de logotipo da empresa
422
562
 
423
563
  ## License
424
564
 
@@ -18,7 +18,11 @@ require "enotas_nfe/model/configuracoes_nfse_homologacao"
18
18
  require "enotas_nfe/model/configuracoes_nfse_producao"
19
19
  require "enotas_nfe/model/csc"
20
20
  require "enotas_nfe/model/emissao_nfe_consumidor"
21
+ require "enotas_nfe/model/certificado_digital"
21
22
  require "enotas_nfe/model/empresa"
23
+ require "enotas_nfe/model/help_tipo_autenticacao"
24
+ require "enotas_nfe/model/regimes_especial_tributacao"
25
+ require "enotas_nfe/model/caracteristica_prefeitura"
22
26
  require "enotas_nfe/model/pagamento"
23
27
  require "enotas_nfe/model/credenciadora_cartao"
24
28
  require "enotas_nfe/model/forma_pagamento"
@@ -23,6 +23,10 @@ module EnotasNfe
23
23
  multipart_post("empresas/#{firm_id}/certificadoDigital", body)
24
24
  end
25
25
 
26
+ def get_caracteristicas_prefeitura(codigo_ibge_cidade)
27
+ get("estados/cidades/#{codigo_ibge_cidade}/provedor")
28
+ end
29
+
26
30
  ## rota para carta de correcao
27
31
  def cc_create(firm_id, body)
28
32
  post("empresas/#{firm_id}/nf-e/cartaCorrecao", body)
@@ -0,0 +1,31 @@
1
+ module EnotasNfe
2
+ module Model
3
+ class CaracteristicaPrefeitura
4
+ include Virtus.model
5
+
6
+ attribute :tipoAutenticacao, Integer
7
+ attribute :assinaturaDigital, Integer
8
+ attribute :helpTipoAutenticacao, HelpTipoAutenticacao
9
+ attribute :campoLoginProvedor, Integer
10
+ attribute :suportaCancelamento, Boolean
11
+ attribute :usaAEDF, Boolean
12
+ attribute :usaRegimeEspecialTributacao, Boolean
13
+ attribute :usaCodigoServicoMunicipal, Boolean
14
+ attribute :usaDescricaoServico, Boolean
15
+ attribute :usaCNAE, Boolean
16
+ attribute :usaItemListaServico, Boolean
17
+ attribute :helpInscricaoMunicipal, String
18
+ attribute :helpRegimeEspecialTributacao, String
19
+ attribute :helpCodigoServicoMunicipal, String
20
+ attribute :helpDescricaoServico, String
21
+ attribute :helpCNAE, String
22
+ attribute :helpItemListaServico, String
23
+ attribute :suportaEmissaoNFeSemCliente, Boolean
24
+ attribute :suportaEmissaoNFeClienteSemCpf, Boolean
25
+ attribute :suportaEmissaoNFeClienteSemEndereco, Boolean
26
+ attribute :suportaCancelamentoNFeSemCliente, Boolean
27
+ attribute :suportaCancelamentoNFeClienteSemCpf, Boolean
28
+ attribute :regimesEspecialTributacao, Array
29
+ end
30
+ end
31
+ end
@@ -8,6 +8,7 @@ module EnotasNfe
8
8
  attribute :serieNFe, String
9
9
  attribute :sequencialLoteNFe, Integer
10
10
  attribute :usuarioAcessoProvedor, String
11
+ attribute :senhaAcessoProvedor, String
11
12
  attribute :tokenAcessoProvedor, String
12
13
 
13
14
  end
@@ -8,6 +8,7 @@ module EnotasNfe
8
8
  attribute :serieNFe, String
9
9
  attribute :sequencialLoteNFe, Integer
10
10
  attribute :usuarioAcessoProvedor, String
11
+ attribute :senhaAcessoProvedor, String
11
12
  attribute :tokenAcessoProvedor, String
12
13
 
13
14
  end
@@ -24,6 +24,8 @@ module EnotasNfe
24
24
  attribute :endereco, Endereco
25
25
  attribute :inscricaoMunicipal, String
26
26
  attribute :inscricaoEstadual, String
27
+ attribute :prazo, Integer
28
+ attribute :status, String
27
29
  attribute :regimeEspecialTributacao, String
28
30
  attribute :descricaoServico, String
29
31
  attribute :codigoServicoMunicipal, String
@@ -6,7 +6,9 @@ module EnotasNfe
6
6
 
7
7
  attribute :pais, String
8
8
  attribute :uf, String
9
+ attribute :codigoIbgeUf, Integer
9
10
  attribute :cidade, String
11
+ attribute :codigoIbgeCidade, Integer
10
12
  attribute :logradouro, String
11
13
  attribute :numero, String
12
14
  attribute :complemento, String
@@ -0,0 +1,13 @@
1
+ module EnotasNfe
2
+ module Model
3
+ class HelpTipoAutenticacao
4
+ include Virtus.model
5
+
6
+ attribute :certificadoDigital, String
7
+ attribute :usuario, String
8
+ attribute :senha, String
9
+ attribute :token, String
10
+ attribute :fraseSecreta, String
11
+ end
12
+ end
13
+ end
@@ -10,6 +10,7 @@ module EnotasNfe
10
10
  attribute :codigo, String
11
11
  attribute :descricao, String
12
12
  attribute :ncm, String
13
+ attribute :cest, String
13
14
  attribute :quantidade, Float
14
15
  attribute :unidadeMedida, String
15
16
  attribute :valorUnitario, Float
@@ -0,0 +1,10 @@
1
+ module EnotasNfe
2
+ module Model
3
+ class RegimesEspecialTributacao
4
+ include Virtus.model
5
+
6
+ attribute :codigo, String
7
+ attribute :nome, String
8
+ end
9
+ end
10
+ end
@@ -13,11 +13,11 @@ module EnotasNfe
13
13
  attribute :itemListaServicoLC116, String
14
14
  attribute :ufPrestacaoServico, String
15
15
  attribute :municipioPrestacaoServico, String
16
- attribute :valorCofins, Decimal
17
- attribute :valorInss, Decimal
18
- attribute :valorIr, Decimal
19
- attribute :valorPis, Decimal
20
- attribute :valorCsll, Decimal
16
+ attribute :valorCofins, Float
17
+ attribute :valorInss, Float
18
+ attribute :valorIr, Float
19
+ attribute :valorPis, Float
20
+ attribute :valorCsll, Float
21
21
 
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module EnotasNfe
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enotas_nfe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Fernando Pimenta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-24 00:00:00.000000000 Z
11
+ date: 2018-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,6 +132,7 @@ files:
132
132
  - lib/enotas_nfe/middleware.rb
133
133
  - lib/enotas_nfe/model/ambiente_homologacao.rb
134
134
  - lib/enotas_nfe/model/ambiente_producao.rb
135
+ - lib/enotas_nfe/model/caracteristica_prefeitura.rb
135
136
  - lib/enotas_nfe/model/carta_correcao.rb
136
137
  - lib/enotas_nfe/model/certificado_digital.rb
137
138
  - lib/enotas_nfe/model/cliente.rb
@@ -146,6 +147,7 @@ files:
146
147
  - lib/enotas_nfe/model/endereco_entrega.rb
147
148
  - lib/enotas_nfe/model/forma_pagamento.rb
148
149
  - lib/enotas_nfe/model/frete.rb
150
+ - lib/enotas_nfe/model/help_tipo_autenticacao.rb
149
151
  - lib/enotas_nfe/model/icms.rb
150
152
  - lib/enotas_nfe/model/impostos.rb
151
153
  - lib/enotas_nfe/model/issqn.rb
@@ -155,6 +157,7 @@ files:
155
157
  - lib/enotas_nfe/model/pedido.rb
156
158
  - lib/enotas_nfe/model/pis.rb
157
159
  - lib/enotas_nfe/model/produto.rb
160
+ - lib/enotas_nfe/model/regimes_especial_tributacao.rb
158
161
  - lib/enotas_nfe/model/servico.rb
159
162
  - lib/enotas_nfe/model/transportadora.rb
160
163
  - lib/enotas_nfe/model/transporte.rb