facturacr 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7af737bcb8df23e83b649ef0fe9fe32ea909849d0a1d4d641d2e8021b5ddffbe
4
- data.tar.gz: a400d6f8ce9b90cb7420459c4c97fb8c00e15ca9e8caa36273eac3a78cc38c88
3
+ metadata.gz: c9aeb14b8129ea60a444a304c8277c98b2ef8e608315b9880faa10d9ffd08d65
4
+ data.tar.gz: c108f41030c6b08b7d8d3fb269e4f18ebeead42a705b6aa70ecd3b9b10d13d6a
5
5
  SHA512:
6
- metadata.gz: a5a187a184dd3e518c2bc3cbf281c0df8c019ebd2e15574cd6ea5b4409707dd70410e573d46fc2dc1695a573cbe0a8c00f0bcef1ed7ffb39fb18dec77183b101
7
- data.tar.gz: 001af779aa886491d419f03f092512be873fec52197d214c1f3ad7b4bc4a09e8619ea00846b4cb5078d975ed470c9d068ebdcae9f0feea7aff4ba4ef6b88fc1d
6
+ metadata.gz: 2269bd6d6cd3b85d1edb215cf65e6d16a3cbbc9b6f38d5270a2e1153e941da29f52ce1a5021a5544c5f0031f1c4715e04d276f00ba0fc8ea38161018aab7817c
7
+ data.tar.gz: b362d9bfe97d17224d585db49c4d3b061f037408492205f16759f0ae09b6e5a3c99a8c6cc94be4f20e6cf38d9707b70ab8f1628c72e9df0d0a4392bac405e23a
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  *.gem
2
2
  /.bundle/
3
3
  /.yardoc
4
- /Gemfile.lock
5
4
  /_yardoc/
6
5
  /coverage/
7
6
  /doc/
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ facturacr (1.1.3)
5
+ activemodel (>= 3.2)
6
+ awesome_print (~> 1.8)
7
+ colorize (~> 0.8)
8
+ nokogiri (~> 1.8)
9
+ rest-client (~> 2.0)
10
+ thor (~> 1.2.1)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activemodel (7.0.7.2)
16
+ activesupport (= 7.0.7.2)
17
+ activesupport (7.0.7.2)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 1.6, < 2)
20
+ minitest (>= 5.1)
21
+ tzinfo (~> 2.0)
22
+ awesome_print (1.9.2)
23
+ colorize (0.8.1)
24
+ concurrent-ruby (1.2.2)
25
+ domain_name (0.5.20190701)
26
+ unf (>= 0.0.5, < 1.0.0)
27
+ http-accept (1.7.0)
28
+ http-cookie (1.0.5)
29
+ domain_name (~> 0.5)
30
+ i18n (1.14.1)
31
+ concurrent-ruby (~> 1.0)
32
+ mime-types (3.5.1)
33
+ mime-types-data (~> 3.2015)
34
+ mime-types-data (3.2023.0808)
35
+ mini_portile2 (2.8.4)
36
+ minitest (5.11.3)
37
+ minitest-colorize (0.0.5)
38
+ minitest (>= 2.0)
39
+ netrc (0.11.0)
40
+ nokogiri (1.15.4)
41
+ mini_portile2 (~> 2.8.2)
42
+ racc (~> 1.4)
43
+ racc (1.7.1)
44
+ rake (13.0.1)
45
+ rest-client (2.1.0)
46
+ http-accept (>= 1.7.0, < 2.0)
47
+ http-cookie (>= 1.0.2, < 2.0)
48
+ mime-types (>= 1.16, < 4.0)
49
+ netrc (~> 0.8)
50
+ thor (1.2.2)
51
+ tzinfo (2.0.6)
52
+ concurrent-ruby (~> 1.0)
53
+ unf (0.1.4)
54
+ unf_ext
55
+ unf_ext (0.0.8.2)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ bundler
62
+ facturacr!
63
+ minitest (~> 5.11)
64
+ minitest-colorize (~> 0.0)
65
+ rake (>= 12.3.3)
66
+
67
+ BUNDLED WITH
68
+ 1.17.3
data/config/config.yml CHANGED
@@ -6,5 +6,5 @@ development:
6
6
 
7
7
  # api hacienda: valores default
8
8
  api_client_id: 'api-stag'
9
- documents_endpoint: "https://api.comprobanteselectronicos.go.cr/recepcion-sandbox/v1"
9
+ documents_endpoint: "https://api-sandbox.comprobanteselectronicos.go.cr/recepcion/v1"
10
10
  authentication_endpoint: "https://idp.comprobanteselectronicos.go.cr/auth/realms/rut-stag/protocol/openid-connect/token"
data/facturacr.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.10"
20
+ spec.add_development_dependency "bundler"
21
21
  spec.add_development_dependency "rake", ">= 12.3.3"
22
22
  spec.add_development_dependency "minitest", '~> 5.11'
23
23
  spec.add_development_dependency "minitest-colorize", '~> 0.0'
@@ -24,7 +24,7 @@ module FE
24
24
  @key_path = "resources/test.p12"
25
25
  @key_password = "test123"
26
26
  @api_client_id = 'api-stag'
27
- @documents_endpoint = "https://api.comprobanteselectronicos.go.cr/recepcion-sandbox/v1"
27
+ @documents_endpoint = "https://api-sandbox.comprobanteselectronicos.go.cr/recepcion/v1"
28
28
  @authentication_endpoint = "https://idp.comprobanteselectronicos.go.cr/auth/realms/rut-stag/protocol/openid-connect"
29
29
  end
30
30
 
@@ -28,6 +28,8 @@ module FE
28
28
  "11"=> "Sustituye factura rechazada por el Receptor del comprobante",
29
29
  "12"=> "Sustituye Factura de exportación",
30
30
  "13"=> "Facturación mes vencido",
31
+ "14"=> "Comprobante aportado por contribuyente del Régimen de Tributación Simplificado",
32
+ "15"=> "Sustituye una Factura electrónica de Compra ",
31
33
  "99"=> "Otros"
32
34
  }.freeze
33
35
 
@@ -23,7 +23,8 @@ module FE
23
23
  "05"=>"Transitorio 0%",
24
24
  "06"=>"Transitorio 4% ",
25
25
  "07"=>"Transitorio 8% ",
26
- "08"=>"Tarifa general 13%"
26
+ "08"=>"Tarifa general 13%",
27
+ "09"=>"Tarifa reducida 0.5%"
27
28
  }.freeze
28
29
  attr_accessor :code, :rate_code ,:rate, :iva_factor, :total, :exoneration, :total_exportation
29
30
 
@@ -23,6 +23,7 @@ module FE
23
23
  @security_code = args[:security_code]
24
24
  @document_situation = args[:document_situation]
25
25
  @other_charges = args[:other_charges]
26
+ @references = args[:references] || []
26
27
  @namespaces = {
27
28
  "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
28
29
  "xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
@@ -1,3 +1,3 @@
1
1
  module FE
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
@@ -117,6 +117,7 @@ module FE
117
117
  item.discount = line.css("MontoDescuento").text.to_f unless line.css("MontoDescuento").empty?
118
118
  item.discount_reason = line.css("NaturalezaDescuento").text unless line.css("NaturalezaDescuento").empty?
119
119
  item.subtotal = line.css("SubTotal").text.to_f
120
+ item.net_tax = line.css("ImpuestoNeto").text.to_f
120
121
  item.net_total = line.css("MontoTotalLinea").text.to_f
121
122
  item.taxes = []
122
123
  line.css("Impuesto").each do |tax|
@@ -128,8 +129,8 @@ module FE
128
129
  exo.document_number = line.css("Exoneracion NumeroDocumento").text
129
130
  exo.institution = line.css("Exoneracion NombreInstitucion").text
130
131
  exo.date = DateTime.parse(line.css("Exoneracion FechaEmision").text)
131
- exo.total_tax = line.css("Exoneracion MontoImpuesto").text.to_f
132
- exo.percentage = line.css("Exoneracion PorcentajeCompra").text.to_i
132
+ exo.total_tax = line.css("Exoneracion MontoExoneracion").text.to_f
133
+ exo.percentage = line.css("Exoneracion PorcentajeExoneracion").text.to_i
133
134
  t_args[:exoneration] = exo
134
135
  end
135
136
 
@@ -159,7 +160,20 @@ module FE
159
160
  @summary.gross_total = sum.css("TotalVentaNeta").text.to_f
160
161
  @summary.tax_total = sum.css("TotalImpuesto").text.to_f
161
162
  @summary.net_total = sum.css("TotalComprobante").text.to_f
162
-
163
+
164
+
165
+ @others = []
166
+ begin
167
+ @doc.css("#{root_tag} Otros OtroTexto").each do |o|
168
+ key = o.attributes.keys.first
169
+ value = o.attributes[key].try(:value)
170
+ other = FE::Document::OtherText.new(xml_attributes: [[key,value]].to_h, content: o.text)
171
+ @others << other
172
+ end
173
+ rescue => e
174
+ puts "Others parse error: #{e.message}"
175
+ end
176
+
163
177
  refs = @doc.css("#{root_tag} InformacionReferencia")
164
178
  @references = []
165
179
  unless refs.empty?
@@ -179,11 +193,13 @@ module FE
179
193
  @regulation.number = reg.css("NumeroResolucion").text
180
194
  @regulation.date = reg.css("FechaResolucion").text
181
195
 
182
-
196
+
197
+
183
198
  @document.issuer = @issuer
184
199
  @document.receiver = @receiver
185
200
  @document.items = @items
186
201
  @document.summary = @summary
202
+ @document.others = @others
187
203
  @document.references = @references
188
204
  @document.regulation = @regulation
189
205
  elsif @document.present?
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facturacr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Sauter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-30 00:00:00.000000000 Z
11
+ date: 2023-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -161,6 +161,7 @@ files:
161
161
  - ".gitignore"
162
162
  - ".travis.yml"
163
163
  - Gemfile
164
+ - Gemfile.lock
164
165
  - LICENSE.txt
165
166
  - README.md
166
167
  - Rakefile