snoopy_afip 2.0.0 → 2.1.0
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.
- data/lib/snoopy_afip/auth_data.rb +4 -4
- data/lib/snoopy_afip/bill.rb +13 -0
- data/lib/snoopy_afip/version.rb +1 -1
- data/snoopy_afip.gemspec +1 -1
- metadata +4 -4
@@ -11,9 +11,9 @@ module Snoopy
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.generate_auth_file invoicing_firm
|
14
|
-
raise "Debe definir el cuit del emisor"
|
15
|
-
raise "Archivo
|
16
|
-
raise "Archivo
|
14
|
+
raise "Debe definir el cuit del emisor" unless invoicing_firm[:cuit]
|
15
|
+
raise "Archivo certificado no encontrado en #{invoicing_firm[:cert]}" unless File.exists?(invoicing_firm[:cert])
|
16
|
+
raise "Archivo de llave privada no encontrado en #{invoicing_firm[:pkey]}" unless File.exists?(invoicing_firm[:pkey])
|
17
17
|
|
18
18
|
todays_datafile = "/tmp/snoopy_afip_#{invoicing_firm[:cuit]}_#{Time.new.strftime('%d_%m_%Y')}.yml"
|
19
19
|
opts = "-u #{Snoopy.auth_url} -k #{invoicing_firm[:pkey]} -c #{invoicing_firm[:cert]} -i #{invoicing_firm[:cuit]}"
|
@@ -35,7 +35,7 @@ module Snoopy
|
|
35
35
|
# subj_cuit: Cuit registado en AFIP.
|
36
36
|
# out_path: donde se almacenara el certificado generado.
|
37
37
|
# Snoopy::AuthData.generate_certificate_request(generate_pkey, subj_o, subj_cn, subj_cuit, tmp_cert_req_path)
|
38
|
-
def generate_certificate_request(pkey, subj_o, subj_cn, subj_cuit, out_path)
|
38
|
+
def self.generate_certificate_request(pkey, subj_o, subj_cn, subj_cuit, out_path)
|
39
39
|
begin
|
40
40
|
%x(openssl req -new -key #{pkey} -subj "/C=AR/O=#{subj_o}/CN=#{subj_cn}/serialNumber=CUIT #{subj_cuit}" -out #{out_path})
|
41
41
|
rescue => e
|
data/lib/snoopy_afip/bill.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
module Snoopy
|
2
3
|
class Bill
|
3
4
|
include AuthData
|
@@ -148,6 +149,18 @@ module Snoopy
|
|
148
149
|
def parcial?; @resultado == "P"; end
|
149
150
|
def rechazada?; @resultado == "R"; end
|
150
151
|
|
152
|
+
# Para probar que la conexion con afip es correcta, si este metodo devuelve true, es posible realizar cualquier consulta al ws de la AFIP.
|
153
|
+
def connection_valid?
|
154
|
+
begin
|
155
|
+
result = client.call(:fe_dummy).body[:fe_dummy_response][:fe_dummy_result]
|
156
|
+
@observaciones << "app_server: #{result[:app_server]}, db_server: #{result[:db_server]}, auth_server: #{result[:auth_server]}"
|
157
|
+
result[:app_server] == "OK" and result[:db_server] == "OK" and result[:auth_server] == "OK"
|
158
|
+
rescue => e
|
159
|
+
@errors << e.message
|
160
|
+
false
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
151
164
|
def parse_observations(fecae_observations)
|
152
165
|
begin
|
153
166
|
fecae_observations.each_value do |obs|
|
data/lib/snoopy_afip/version.rb
CHANGED
data/snoopy_afip.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = ["gab.edera@gmail.com"]
|
15
15
|
s.extra_rdoc_files = ["LICENSE.txt", "README.textile"]
|
16
16
|
s.files = [".document", "CHANGELOG", "Gemfile", "Gemfile.lock", "LICENSE.txt", "README.textile", "Rakefile", "VERSION", "autotest/discover.rb", "snoopy_afip.gemspec", "lib/snoopy_afip.rb", "lib/snoopy_afip/auth_data.rb", "lib/snoopy_afip/authorizer.rb", "lib/snoopy_afip/bill.rb", "lib/snoopy_afip/constants.rb", "lib/snoopy_afip/core_ext/float.rb", "lib/snoopy_afip/core_ext/hash.rb", "lib/snoopy_afip/core_ext/string.rb", "lib/snoopy_afip/version.rb", "spec/snoopy_afip/auth_data_spec.rb", "spec/snoopy_afip/authorizer_spec.rb", "spec/snoopy_afip/bill_spec.rb", "spec/spec_helper.rb", "wsaa-client.sh"]
|
17
|
-
s.homepage = "https://github.com/
|
17
|
+
s.homepage = "https://github.com/gedera/snoopy_afip"
|
18
18
|
s.licenses = ["MIT"]
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
s.rubygems_version = "1.8.25"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snoopy_afip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- g.edera, eserdio
|
@@ -132,7 +132,7 @@ files:
|
|
132
132
|
- spec/spec_helper.rb
|
133
133
|
- wsaa-client.sh
|
134
134
|
has_rdoc: true
|
135
|
-
homepage: https://github.com/
|
135
|
+
homepage: https://github.com/gedera/snoopy_afip
|
136
136
|
licenses:
|
137
137
|
- MIT
|
138
138
|
post_install_message:
|