nfse-carioca 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Berksfile +6 -0
- data/Berksfile.lock +28 -0
- data/README.md +1 -0
- data/Rakefile +3 -7
- data/Vagrantfile +58 -0
- data/lib/nfse_carioca.rb +5 -12
- data/lib/nfse_carioca/cancelar_nfse.rb +28 -22
- data/lib/nfse_carioca/client.rb +31 -0
- data/lib/nfse_carioca/configuration.rb +49 -7
- data/lib/nfse_carioca/gerar_nfse.rb +14 -23
- data/lib/nfse_carioca/gerar_nfse_xml.rb +49 -103
- data/lib/nfse_carioca/response.rb +27 -0
- data/lib/nfse_carioca/version.rb +2 -2
- data/nfse_carioca.gemspec +4 -4
- data/spec/fixtures/vcr_cassettes/NFSeCarioca_CancelarNFSe/_execute_/when_NFSeCarioca_rps_number_does_not_exist/returns_error_message.yml +253 -0
- data/spec/fixtures/vcr_cassettes/NFSeCarioca_CancelarNFSe/_execute_/when_NFSeCarioca_rps_number_does_not_exist/returns_false.yml +253 -0
- data/spec/fixtures/vcr_cassettes/NFSeCarioca_CancelarNFSe/_execute_/when_NFSeCarioca_rps_number_exist/returns_false.yml +238 -0
- data/spec/fixtures/vcr_cassettes/NFSeCarioca_GerarNFSe/_call/when_NFSeCarioca_rps_number_already_exist/responds_with_error.yml +296 -0
- data/spec/fixtures/vcr_cassettes/NFSeCarioca_GerarNFSe/_call/when_NFSeCarioca_rps_number_already_exist/responds_with_message_error_E10_.yml +296 -0
- data/spec/fixtures/vcr_cassettes/NFSeCarioca_GerarNFSe/_call/when_NFSeCarioca_rps_number_does_not_exist_yet/generates_NFSeCarioca.yml +340 -0
- data/spec/lib/nfse_carioca/cancelar_nfse_spec.rb +13 -21
- data/spec/lib/nfse_carioca/configuration_spec.rb +26 -26
- data/spec/lib/nfse_carioca/gerar_nfse_spec.rb +31 -34
- data/spec/spec_helper.rb +7 -0
- metadata +40 -38
- data/CHANGELOG.md +0 -7
- data/CONTRIBUTING.md +0 -35
- data/lib/nfse_carioca/cancelar_nfse_xml.rb +0 -31
- data/lib/nfse_carioca/models/address.rb +0 -13
- data/lib/nfse_carioca/models/customer.rb +0 -15
- data/lib/nfse_carioca/models/invoice.rb +0 -14
- data/lib/nfse_carioca/models/provider.rb +0 -9
- data/lib/nfse_carioca/nota_carioca_client.rb +0 -31
- data/lib/nfse_carioca/nota_carioca_response.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 188d9a3bce745db419598495e1a2025bd8107349
|
4
|
+
data.tar.gz: 7743636c121b697b78bd5347c7ca07305e199fe5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5417a886e8a3613b83328b1ae305fa79881fedce1f4333cc0a99b70dab7284b8a27f962c5f5a0a469bbd256d8b0071f25b74bb71ed8b059e7aac168e0f25f06e
|
7
|
+
data.tar.gz: 912114d537b3da636af6a96fd7233232c64074ecfa696a277e6c5706fd3dbd9087a240c2ebb265176971f4400857dc98b2aa499a67d5423737662d6c04132aa2
|
data/.gitignore
CHANGED
data/Berksfile
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
source "https://api.berkshelf.com"
|
2
|
+
|
3
|
+
cookbook "apt"
|
4
|
+
cookbook "brightbox", git: "git://github.com/bubble-cookbooks/brightbox.git"
|
5
|
+
cookbook "timezone", git: "git://github.com/winhamwr/chef-timezone.git"
|
6
|
+
cookbook "oh_my_zsh", git: "git://github.com/tdtadeu/oh-my-zsh-chef.git"
|
data/Berksfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
DEPENDENCIES
|
2
|
+
apt
|
3
|
+
brightbox
|
4
|
+
git: git://github.com/bubble-cookbooks/brightbox.git
|
5
|
+
revision: 85d6edf7962db148921f6ddad620709ea22aa85b
|
6
|
+
git
|
7
|
+
git: git://github.com/tdtadeu/git.git
|
8
|
+
revision: 4d9c09a9863a72fe745e1aa7eda9a61b18f8e237
|
9
|
+
oh_my_zsh
|
10
|
+
git: git://github.com/tdtadeu/oh-my-zsh-chef.git
|
11
|
+
revision: e46eb56951ca92a2dd4e5a10c6a19cbad5a2ee8f
|
12
|
+
timezone
|
13
|
+
git: git://github.com/winhamwr/chef-timezone.git
|
14
|
+
revision: 2e8e32dfcc8c70964d7d77de0eb503510c2f6c24
|
15
|
+
|
16
|
+
GRAPH
|
17
|
+
apt (2.6.1)
|
18
|
+
brightbox (0.1.2)
|
19
|
+
apt (>= 0.0.0)
|
20
|
+
build-essential (>= 0.0.0)
|
21
|
+
build-essential (2.1.3)
|
22
|
+
git (0.2.3)
|
23
|
+
apt (>= 0.0.0)
|
24
|
+
oh_my_zsh (0.0.7)
|
25
|
+
git (>= 0.0.0)
|
26
|
+
zsh (>= 0.0.0)
|
27
|
+
timezone (0.0.1)
|
28
|
+
zsh (1.0.1)
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
|
4
|
-
require 'rspec/core/rake_task'
|
3
|
+
require 'rspec/core/rake_task'
|
5
4
|
|
6
|
-
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
6
|
|
8
|
-
|
9
|
-
rescue LoadError
|
10
|
-
# no rspec available
|
11
|
-
end
|
7
|
+
task :default => :spec
|
data/Vagrantfile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
VAGRANTFILE_API_VERSION = "2"
|
5
|
+
|
6
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
7
|
+
config.vm.box = "ubuntu/trusty64"
|
8
|
+
config.vm.network :private_network, ip: "10.20.30.40"
|
9
|
+
config.ssh.forward_agent = true
|
10
|
+
config.vm.synced_folder ".", "/vagrant", nfs: true
|
11
|
+
config.vm.boot_timeout = 120
|
12
|
+
|
13
|
+
config.omnibus.chef_version = :latest
|
14
|
+
config.berkshelf.enabled = true
|
15
|
+
|
16
|
+
config.vm.provider "virtualbox" do |v|
|
17
|
+
host = RbConfig::CONFIG['host_os']
|
18
|
+
if host =~ /darwin/
|
19
|
+
cpus = `sysctl -n hw.ncpu`.to_i
|
20
|
+
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 2
|
21
|
+
else
|
22
|
+
cpus = `nproc`.to_i
|
23
|
+
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 2
|
24
|
+
end
|
25
|
+
|
26
|
+
v.customize ["modifyvm", :id, "--memory", mem]
|
27
|
+
v.customize ["modifyvm", :id, "--cpus", cpus]
|
28
|
+
end
|
29
|
+
|
30
|
+
config.vm.provision :chef_solo do |chef|
|
31
|
+
chef.add_recipe "apt"
|
32
|
+
chef.add_recipe "timezone"
|
33
|
+
|
34
|
+
chef.add_recipe "brightbox"
|
35
|
+
chef.add_recipe "brightbox::xml"
|
36
|
+
chef.add_recipe "oh_my_zsh"
|
37
|
+
|
38
|
+
chef.json = {
|
39
|
+
'timezone' => {
|
40
|
+
'zone' => 'America/Sao_Paulo'
|
41
|
+
},
|
42
|
+
|
43
|
+
'brightbox' => {
|
44
|
+
'version' => 'ruby2.2'
|
45
|
+
},
|
46
|
+
|
47
|
+
'oh_my_zsh' => {
|
48
|
+
'users' => ['vagrant'],
|
49
|
+
'theme' => 'clean',
|
50
|
+
'platform' => 'ubuntu'
|
51
|
+
},
|
52
|
+
|
53
|
+
'bundle' => {
|
54
|
+
'users' => ['vagrant']
|
55
|
+
}
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
data/lib/nfse_carioca.rb
CHANGED
@@ -1,28 +1,21 @@
|
|
1
1
|
require "ostruct"
|
2
|
-
require "virtus"
|
3
|
-
require 'active_support/core_ext/hash'
|
4
2
|
require "nfse_carioca/version"
|
5
3
|
require "nfse_carioca/configuration"
|
6
|
-
require "nfse_carioca/
|
7
|
-
require "nfse_carioca/
|
4
|
+
require "nfse_carioca/client"
|
5
|
+
require "nfse_carioca/response"
|
8
6
|
require "nfse_carioca/gerar_nfse"
|
9
7
|
require "nfse_carioca/cancelar_nfse"
|
10
8
|
|
11
|
-
module
|
12
|
-
|
9
|
+
module NfseCarioca
|
13
10
|
def self.configure(&block)
|
14
11
|
yield configuration
|
15
12
|
end
|
16
13
|
|
17
14
|
def self.configuration
|
18
|
-
@configuration ||=
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.method_missing(method, *args)
|
22
|
-
configuration.send("#{method}")
|
15
|
+
@configuration ||= NfseCarioca::Configuration.new
|
23
16
|
end
|
24
17
|
|
25
|
-
def self.reset
|
18
|
+
def self.reset!
|
26
19
|
@configuration = nil
|
27
20
|
end
|
28
21
|
end
|
@@ -1,36 +1,42 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module NfseCarioca
|
2
|
+
class CancelarNfse
|
3
|
+
attr_reader :invoice_number
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(params={})
|
8
|
-
@params = params
|
5
|
+
def initialize(invoice_number)
|
6
|
+
@invoice_number = invoice_number
|
9
7
|
end
|
10
8
|
|
11
9
|
def execute!
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def nfse_xml
|
18
|
-
CancelarNFSeXML.new(@params).to_xml
|
10
|
+
client.call(:cancelar_nfse, self)
|
19
11
|
end
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
def to_xml
|
14
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
15
|
+
xml.instruct!
|
16
|
+
xml.CancelarNfseEnvio(xmlns: "http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd") do |cancelar_nfse_envio|
|
17
|
+
cancelar_nfse_envio.Pedido(xmlns: "http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd") do |pedido|
|
18
|
+
pedido.InfPedidoCancelamento(Id: "Cancelamento_NF#{invoice_number}") do |inf_pedido_cancelamento|
|
19
|
+
inf_pedido_cancelamento.IdentificacaoNfse do |identificacao_nfse|
|
20
|
+
identificacao_nfse.Numero invoice_number
|
21
|
+
identificacao_nfse.Cnpj NfseCarioca.configuration.cnpj
|
22
|
+
identificacao_nfse.InscricaoMunicipal NfseCarioca.configuration.inscricao_municipal
|
23
|
+
identificacao_nfse.CodigoMunicipio NfseCarioca.configuration.codigo_municipio
|
24
|
+
end
|
25
|
+
inf_pedido_cancelamento.CodigoCancelamento "0"
|
26
|
+
end
|
27
|
+
end
|
24
28
|
end
|
29
|
+
end
|
25
30
|
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
private
|
32
|
+
def client
|
33
|
+
NfseCarioca::Client.new
|
34
|
+
end
|
29
35
|
|
36
|
+
class Response < NfseCarioca::Response
|
30
37
|
def error_message
|
31
|
-
|
38
|
+
content["ListaMensagemRetorno"]["MensagemRetorno"]["Correcao"] if error?
|
32
39
|
end
|
33
|
-
|
34
40
|
end
|
35
41
|
end
|
36
42
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "savon"
|
2
|
+
|
3
|
+
module NfseCarioca
|
4
|
+
class Client
|
5
|
+
def call(method, object)
|
6
|
+
payload = client.call(method, message: { inputXML: object.to_xml })
|
7
|
+
object.class::Response.new payload
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def client
|
13
|
+
Savon.client({
|
14
|
+
wsdl: NfseCarioca.configuration.wsdl,
|
15
|
+
env_namespace: :soap,
|
16
|
+
namespace_identifier: nil,
|
17
|
+
element_form_default: :unqualified,
|
18
|
+
ssl_verify_mode: :none,
|
19
|
+
ssl_version: :SSLv3,
|
20
|
+
ssl_cert_file: NfseCarioca.configuration.cert_path,
|
21
|
+
ssl_cert_key_file: NfseCarioca.configuration.cert_key_path,
|
22
|
+
ssl_ca_cert_file: NfseCarioca.configuration.ca_cert_path,
|
23
|
+
ssl_cert_key_password: NfseCarioca.configuration.cert_key_password,
|
24
|
+
log_level: NfseCarioca.configuration.log_level,
|
25
|
+
log: true,
|
26
|
+
open_timeout: 120,
|
27
|
+
read_timeout: 120
|
28
|
+
})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,14 +1,56 @@
|
|
1
|
-
module
|
1
|
+
module NfseCarioca
|
2
2
|
class Configuration
|
3
|
-
include Singleton
|
4
3
|
|
5
4
|
attr_accessor :test_mode,
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
5
|
+
:log_level,
|
6
|
+
:ca_cert_path,
|
7
|
+
:cert_key_path,
|
8
|
+
:cert_path,
|
9
|
+
:cert_key_password,
|
10
|
+
:cnpj,
|
11
|
+
:inscricao_municipal,
|
12
|
+
:codigo_municipio,
|
13
|
+
:rps_serie,
|
14
|
+
:rps_tipo,
|
15
|
+
:rps_natureza_operacao,
|
16
|
+
:rps_optante_simples_nacional,
|
17
|
+
:rps_incentivador_cultural,
|
18
|
+
:iss_retido,
|
19
|
+
:valor_aliquota,
|
20
|
+
:valor_pis,
|
21
|
+
:valor_cofins,
|
22
|
+
:valor_inss,
|
23
|
+
:valor_ir,
|
24
|
+
:valor_csll,
|
25
|
+
:valor_iss,
|
26
|
+
:item_lista_servico,
|
27
|
+
:codigo_tributacao_municipio
|
10
28
|
|
11
|
-
def
|
29
|
+
def initialize
|
30
|
+
@test_mode = false
|
31
|
+
@log_level = :error
|
32
|
+
|
33
|
+
@codigo_municipio = "3304557"
|
34
|
+
@rps_serie = "A"
|
35
|
+
@rps_tipo = 1
|
36
|
+
@rps_natureza_operacao = 1
|
37
|
+
@rps_optante_simples_nacional = 1
|
38
|
+
@rps_incentivador_cultural = 2
|
39
|
+
|
40
|
+
@iss_retido = 2
|
41
|
+
@valor_aliquota = 0
|
42
|
+
@valor_pis = 0
|
43
|
+
@valor_cofins = 0
|
44
|
+
@valor_inss = 0
|
45
|
+
@valor_ir = 0
|
46
|
+
@valor_csll = 0
|
47
|
+
@valor_iss = 0
|
48
|
+
|
49
|
+
@item_lista_servico = "0105"
|
50
|
+
@codigo_tributacao_municipio = "010501"
|
51
|
+
end
|
52
|
+
|
53
|
+
def wsdl
|
12
54
|
if test_mode
|
13
55
|
"https://homologacao.notacarioca.rio.gov.br/WSNacional/nfse.asmx?wsdl"
|
14
56
|
else
|
@@ -1,48 +1,39 @@
|
|
1
|
-
require "nfse_carioca/nota_carioca_response"
|
2
1
|
require "nfse_carioca/gerar_nfse_xml"
|
3
2
|
|
4
|
-
module
|
5
|
-
class
|
6
|
-
|
3
|
+
module NfseCarioca
|
4
|
+
class GerarNfse
|
7
5
|
def initialize(invoice)
|
8
6
|
@invoice = invoice
|
9
7
|
end
|
10
8
|
|
11
9
|
def execute!
|
12
|
-
|
10
|
+
client.call(:gerar_nfse, self)
|
13
11
|
end
|
14
12
|
|
15
|
-
def
|
16
|
-
|
13
|
+
def to_xml
|
14
|
+
GerarNfseXML.new(@invoice).to_xml
|
17
15
|
end
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
private
|
18
|
+
def client
|
19
|
+
NfseCarioca::Client.new
|
20
|
+
end
|
23
21
|
|
22
|
+
class Response < NfseCarioca::Response
|
24
23
|
def number
|
25
|
-
|
24
|
+
content["CompNfse"]["Nfse"]["InfNfse"]["Numero"] if success?
|
26
25
|
end
|
27
26
|
|
28
27
|
def verification_code
|
29
|
-
|
28
|
+
content["CompNfse"]["Nfse"]["InfNfse"]["CodigoVerificacao"] if success?
|
30
29
|
end
|
31
30
|
|
32
31
|
def issued_at
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def error?
|
37
|
-
!nota_carioca_xml["GerarNfseResposta"]["ListaMensagemRetorno"].nil?
|
32
|
+
content["CompNfse"]["Nfse"]["InfNfse"]["DataEmissao"] if success?
|
38
33
|
end
|
39
34
|
|
40
35
|
def error_message
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def success?
|
45
|
-
!error?
|
36
|
+
content["ListaMensagemRetorno"]["MensagemRetorno"]["Mensagem"] if error?
|
46
37
|
end
|
47
38
|
end
|
48
39
|
end
|
@@ -1,122 +1,68 @@
|
|
1
|
-
module
|
2
|
-
class
|
3
|
-
|
4
|
-
|
5
|
-
}
|
6
|
-
|
7
|
-
RPS_SERIE = "A"
|
8
|
-
|
9
|
-
RPS_TIPO = {
|
10
|
-
RPS: 1
|
11
|
-
}
|
12
|
-
|
13
|
-
RPS_NATUREZA_OPERACAO = {
|
14
|
-
TRIBUTACAO_NO_MUNICIPIO: 1
|
15
|
-
}
|
16
|
-
|
17
|
-
RPS_OPTANTE_SIMPLES_NACIONAL = {
|
18
|
-
SIM: 1
|
19
|
-
}
|
20
|
-
|
21
|
-
RPS_INCENTIVADOR_CULTURAL = {
|
22
|
-
NAO: 2
|
23
|
-
}
|
24
|
-
|
25
|
-
RPS_STATUS = {
|
26
|
-
NORMAL: 1,
|
27
|
-
CANCELADO: 2
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
PROCON_DETAILS = <<-DESCRIPTION
|
32
|
-
Procon:
|
33
|
-
Telefone: 151
|
34
|
-
Endereço 1: Rua da Ajuda nº 5 subsolo - Centro
|
35
|
-
Endereço 2: Praça Cristiano Ottoni s/nº subsolo Ed. D. Pedro II Central do Brasil
|
36
|
-
Rio de janeiro RJ cep: 20221-250
|
37
|
-
Comissão de defesa do consumidor da Alerj
|
38
|
-
Telefone: 08002827060
|
39
|
-
Endereço: Rua da Alfandega nº 08 Térreo, Centro
|
40
|
-
Rio de janeiro - RJ Cep 20070-000
|
41
|
-
DESCRIPTION
|
42
|
-
|
43
|
-
VALOR_ISS_RETIDO = {
|
44
|
-
NAO: 2
|
45
|
-
}
|
46
|
-
|
47
|
-
VALOR_ALIQUOTA = "0.05"
|
48
|
-
VALOR_PIS = 0
|
49
|
-
VALOR_COFINS = 0
|
50
|
-
VALOR_INSS = 0
|
51
|
-
VALOR_IR = 0
|
52
|
-
VALOR_CSLL = 0
|
53
|
-
VALOR_ISS = 0
|
54
|
-
|
55
|
-
def initialize(invoice)
|
56
|
-
@invoice = invoice
|
1
|
+
module NfseCarioca
|
2
|
+
class GerarNfseXML
|
3
|
+
def initialize(invoice_info)
|
4
|
+
@invoice = invoice_info
|
57
5
|
end
|
58
6
|
|
59
7
|
def to_xml
|
60
8
|
xml = Builder::XmlMarkup.new(indent: 2)
|
61
9
|
xml.instruct!
|
62
|
-
xml.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
10
|
+
xml.GerarNfseEnvio(xmlns: "http://notacarioca.rio.gov.br/WSNacional/XSD/1/nfse_pcrj_v01.xsd") do |gerar_nfse_envio|
|
11
|
+
gerar_nfse_envio.Rps do |rps|
|
12
|
+
rps.InfRps(xmlns: "http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd", Id: @invoice[:identification_number]) do |inf_rps|
|
13
|
+
inf_rps.IdentificacaoRps do |identificacao_rps|
|
14
|
+
identificacao_rps.Numero @invoice[:identification_number]
|
15
|
+
identificacao_rps.Serie NfseCarioca.configuration.rps_serie
|
16
|
+
identificacao_rps.Tipo NfseCarioca.configuration.rps_tipo
|
69
17
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
18
|
+
|
19
|
+
inf_rps.DataEmissao Time.now.strftime("%Y-%m-%dT%H:%M:%S")
|
20
|
+
inf_rps.NaturezaOperacao NfseCarioca.configuration.rps_natureza_operacao
|
21
|
+
inf_rps.OptanteSimplesNacional NfseCarioca.configuration.rps_optante_simples_nacional
|
22
|
+
inf_rps.IncentivadorCultural NfseCarioca.configuration.rps_incentivador_cultural
|
23
|
+
inf_rps.Status 1
|
24
|
+
inf_rps.Servico do |servico|
|
25
|
+
servico.Valores do |valores|
|
26
|
+
valores.ValorServicos @invoice[:total]
|
27
|
+
valores.ValorPis NfseCarioca.configuration.valor_pis
|
28
|
+
valores.ValorCoffss NfseCarioca.configuration.valor_cofins
|
29
|
+
valores.ValorInss NfseCarioca.configuration.valor_inss
|
30
|
+
valores.ValorIr NfseCarioca.configuration.valor_ir
|
31
|
+
valores.ValorCsll NfseCarioca.configuration.valor_csll
|
32
|
+
valores.IssRetido NfseCarioca.configuration.iss_retido
|
33
|
+
valores.ValorIss NfseCarioca.configuration.valor_iss
|
34
|
+
valores.Aliquota NfseCarioca.configuration.valor_aliquota
|
86
35
|
end
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
36
|
+
servico.ItemListaServico NfseCarioca.configuration.item_lista_servico
|
37
|
+
servico.CodigoTributacaoMunicipio NfseCarioca.configuration.codigo_tributacao_municipio
|
38
|
+
servico.Discriminacao @invoice[:description]
|
39
|
+
servico.CodigoMunicipio NfseCarioca.configuration.codigo_municipio
|
91
40
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
41
|
+
inf_rps.Prestador do |prestador|
|
42
|
+
prestador.Cnpj NfseCarioca.configuration.cnpj
|
43
|
+
prestador.InscricaoMunicipal NfseCarioca.configuration.inscricao_municipal
|
95
44
|
end
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
45
|
+
|
46
|
+
inf_rps.Tomador do |tomador|
|
47
|
+
tomador.IdentificacaoTomador do |identificacao_tomador|
|
48
|
+
identificacao_tomador.CpfCnpj do |cpf_cnpj|
|
49
|
+
cpf_cnpj.tag!(@invoice[:customer][:document_type], @invoice[:customer][:document_number])
|
100
50
|
end
|
101
51
|
end
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
52
|
+
tomador.RazaoSocial @invoice[:customer][:name]
|
53
|
+
tomador.Endereco do |endereco|
|
54
|
+
endereco.Endereco @invoice[:customer][:address][:street]
|
55
|
+
endereco.Numero @invoice[:customer][:address][:number]
|
56
|
+
endereco.Complemento @invoice[:customer][:address][:complement]
|
57
|
+
endereco.Bairro @invoice[:customer][:address][:neighborhood]
|
58
|
+
endereco.CodigoMunicipio @invoice[:customer][:address][:city_ibge_code]
|
59
|
+
endereco.Uf @invoice[:customer][:address][:state_code]
|
60
|
+
endereco.Cep @invoice[:customer][:address][:zipcode]
|
111
61
|
end
|
112
62
|
end
|
113
63
|
end
|
114
64
|
end
|
115
65
|
end
|
116
66
|
end
|
117
|
-
|
118
|
-
def issued_at
|
119
|
-
Time.now.strftime("%Y-%m-%dT%H:%M:%S")
|
120
|
-
end
|
121
67
|
end
|
122
68
|
end
|