timbradocfdi 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc7bb1cee842e2824dc247138a47f82b44ebb632
4
+ data.tar.gz: 1e39127a751811f5c153cc17be225e6135de9306
5
+ SHA512:
6
+ metadata.gz: 7309ddd34ce2083b8ee81c280070820ac0b25b900f0cbaae1a5b72ead16cbc52e1fe69b2cffa48712e876b6fd29ffbe5a2e4100ac1f4a27b8f78e84c0588f249
7
+ data.tar.gz: 2439350e3740dbec81b690d052dcb5b3068c562247244abf8947037ec608f3bb974fa8df4e1474522046ad15aca581e335e42d2c940b32aeb17fe2721ad9e1e0
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in timbradocfdi.gemspec
4
+ gemspec
5
+
6
+
7
+ gem 'savon'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Angel Botto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # Timbradocfdi
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Instalación
6
+
7
+ Agrega esta linea a tu gemfile
8
+
9
+ gem 'timbradocfdi'
10
+
11
+ y Ejecuta
12
+
13
+ $ bundle
14
+
15
+ o instala la gema en tu sistema
16
+
17
+ $ gem install timbradocfdi
18
+
19
+ ## Forma de uso
20
+
21
+ Se tienen 4 operaciones las cuales son ``` registra_emisor, timbra_cfdi, obtiene_cfdi y cancela_cfdi ```
22
+
23
+ para el uso adecuado de las operaciones lo primero que debemos es instanciar nuestra clase con nuestra respectiva llave unica y privada de usuario
24
+
25
+ ``` ruby
26
+ @timbrado = Timbradocfdi::Generator.new("aca nuestra llave de usuario")
27
+ ```
28
+
29
+ asi ya tenemos nuestro cliente instanciado en la variable **@timbrado** con la cual podemos generar las 4 operaciones
30
+
31
+
32
+ ### Registra_emisor
33
+
34
+ para registrar un emisor se requiere **rfcemisor, llave .cer, llave .key y contraseña**
35
+
36
+ **Ejemplo de uso**
37
+
38
+ ``` ruby
39
+ rfcemisor = "12345"
40
+ contrasena = "contraseña"
41
+ base64Cer = "ruta de nuestra llave cer"
42
+ base64Key = "ruta de nuestra llave key"
43
+ @timbrado.registroEmisor(rfcEmisor, base64Cer, base64Key, contrasena)
44
+ ```
45
+
46
+ se obtiene un objeto con un codigo y un mensaje indicandonos el estado de la peticion ejemplo
47
+
48
+
49
+ ``` ruby
50
+ {
51
+ :code => "0",
52
+ :message => "El certificado fue guardado y registrado correctamente"
53
+ }
54
+ ```
55
+
56
+ ### Timbra_cfdi
57
+
58
+ Para timbrar un CFDI se require **Comprobante en xml, y el id de nuestro comprobante**
59
+
60
+ **Ejmplo de uso**
61
+
62
+ ``` ruby
63
+ comprobante = "ruta de nuestro comprobante en xml"
64
+ idcomprobante = 1 #Ejemplo
65
+
66
+ @timbrado.timbraCFDI(comprobante, idcomprobante)
67
+ ```
68
+
69
+ se obtiene un objeto con un codigo, un xml, una imagen qr y unos detalles de la peticion en caso de ser exitosa, de lo contrario mostrar el codigo y un mensaje de error
70
+
71
+ ``` ruby
72
+ {
73
+ :code => "0",
74
+ :xml => "ACA RETORNA EL CONTENIDO DE UN XML",
75
+ :qr => "ACA RETORNA EL CONTENIDO DE UNA IMAGEN QR EN BYTES"
76
+ :details => "Detalles como el uid, fecha de la transaccion, etc"
77
+ }
78
+ ```
79
+
80
+ ### Obtiene_cfdi
81
+
82
+ Para obtener un CFDI se requiere unicamente del **UID del folio** y retorna al igual que al timbrar su respectivo **xml, imagen qr y detalles**
83
+
84
+ **Ejemplo de uso**
85
+
86
+ ``` ruby
87
+ folioUUID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX" #Prueba
88
+ @timbrado.obtieneCFDI(@rfcEmisor, folioUUID)
89
+ ```
90
+
91
+ Se obtiene como se indica anteriormente, **xml, imagen qr, detalles** de la peticion
92
+
93
+ ``` ruby
94
+ {
95
+ :code => "0",
96
+ :xml => "ACA RETORNA EL CONTENIDO DE UN XML",
97
+ :qr => "ACA RETORNA EL CONTENIDO DE UNA IMAGEN QR EN BYTES"
98
+ :details => "Detalles como el uid, fecha de la transaccion, etc"
99
+ }
100
+ ```
101
+
102
+
103
+ ### Cancela_cfdi
104
+
105
+ Para cancelar un CFDI se requiere unicamente del **UID del folio**
106
+
107
+ **Ejemplo de uso**
108
+
109
+ ``` ruby
110
+ folioUUID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX" #Prueba
111
+ @timbrado.cancelaCFDI(@rfcEmisor, folioUUID)
112
+ ```
113
+
114
+ Se obtiene un codigo del estado con su respectivo mensaje
115
+
116
+ ``` ruby
117
+ {
118
+ :code => "202",
119
+ :message => "UUID Previamente cancelado"
120
+ }
121
+ ```
122
+
123
+
124
+ ## Errores
125
+
126
+ Aca se describe codigos y mensajes que puede responder la gema
127
+
128
+ | Codigo | Mensaje |
129
+ |---------|-------------------------------------------------------------------|
130
+ | 0 | Resultado exitoso |
131
+ | 1 | El usuario Integrador no existe |
132
+ | 2 | Timbres agotados, favor de contactar al proveedor (Integrador) |
133
+ | 3 | El emisor no ha sido registrado o se encuentra inactivo (Bloqueado) |
134
+ | 4 | El certificado del emisor no es vigente y el comprobante no puede ser sellado |
135
+ | 5 | Ocurrió un error al sellar el comprobante |
136
+ | 6 | Timbres agotados, favor de contactar al proveedor (Emisor) |
137
+ | 7 | El archivo .cer es inválido |
138
+ | 8 | El archivo .key es inválido |
139
+ | 9 | El certificado no es de sello, verifica que los archivos no sean de la FIEL |
140
+ | 10 | La vigencia del certificado ya expiró |
141
+ | 11 | El certificado no pertenece al RFC del Emisor |
142
+ | 12 | La contraseña del sello es inválida |
143
+ | 13 | El certificado no pertenece a la llave privada |
144
+ | 14 | El certificado aún no se encuentra registrado en el SAT, favor de intentarlo más tarde |
145
+ | 15 | Ocurrió un error al guardar el certificado, por favor contactar al proveedor |
146
+ | 16 | Emisor no registrado |
147
+ | 17 | Error al obtener cfdi |
148
+ | 18 | Error de cancelación |
149
+
150
+
151
+ ## Contributing
152
+
153
+ 1. Fork it ( https://github.com/kreattiewe/timbradocfdi/fork )
154
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
155
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
156
+ 4. Push to the branch (`git push origin my-new-feature`)
157
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ module Timbradocfdi
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,41 @@
1
+ require 'savon'
2
+ require "timbradocfdi/version"
3
+ require "timbradocfdi/registroemisor"
4
+ require "timbradocfdi/timbracfdi"
5
+ require "timbradocfdi/obtienecfdi"
6
+ require "timbradocfdi/cancelacfdi"
7
+ require "timbradocfdi/results"
8
+
9
+ module Timbradocfdi
10
+ class Generator
11
+
12
+ BASE_URI = "http://201.175.12.89/serviciointegracionpruebas/Timbrado.asmx?wsdl"
13
+
14
+ ##
15
+ # Attributo accesible (lectura y escritura)
16
+ attr_accessor :user, :client
17
+
18
+ ##
19
+ # Se inicializa la clase con un usuario y su respectivo cliente con el soap
20
+ def initialize(user)
21
+ @client = Savon.client(wsdl: BASE_URI)
22
+ @user = user
23
+ end
24
+
25
+
26
+ ##
27
+ # Read certificate and encode to base64
28
+ def file_reader(path)
29
+ raw = File.read(path)
30
+ Base64.encode64(raw)
31
+ end
32
+
33
+ ##
34
+ # Method for generate HTTP Request post
35
+ def request(function, options = {})
36
+ operation = function.intern
37
+ @client.call(operation, message: options)
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'timbradocfdi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "timbradocfdi"
8
+ spec.version = Timbradocfdi::VERSION
9
+ spec.authors = ["Angel Botto"]
10
+ spec.email = ["angelbotto@gmail.com"]
11
+ spec.summary = "Timbrado CFDI y recibos de nómina por webservice"
12
+ spec.description = "Timbra tus recibos de nómina y comprobantes fiscales por webservice desde tu sistema o ERP sin complicaciones ¡Sin costo de conexión!. Descarga nuestro kit de integración con ejemplos en diferentes lenguajes y un ambiente para que hagas pruebas sin costo ¡ahora!"
13
+ spec.homepage = "http://kreattiewe.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake",'~> 0'
23
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: timbradocfdi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Angel Botto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Timbra tus recibos de nómina y comprobantes fiscales por webservice desde
42
+ tu sistema o ERP sin complicaciones ¡Sin costo de conexión!. Descarga nuestro kit
43
+ de integración con ejemplos en diferentes lenguajes y un ambiente para que hagas
44
+ pruebas sin costo ¡ahora!
45
+ email:
46
+ - angelbotto@gmail.com
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - .gitignore
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - lib/timbradocfdi.rb
57
+ - lib/timbradocfdi/version.rb
58
+ - timbradocfdi.gemspec
59
+ homepage: http://kreattiewe.com
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Timbrado CFDI y recibos de nómina por webservice
83
+ test_files: []