facturapi_ruby 1.3.0 → 2.1.0

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: b58fed997b3fb3da051f518146bc46b1aa982b874f771e0890870b8578dabb61
4
- data.tar.gz: a6ad129cffa87123e86e36e7b38a53c99e9e30ba3a5b024d77c530e21847ec7f
3
+ metadata.gz: b1a19d9ac7e271ccb1b75a84cd9817e1477801aa795761635eee9ce5042110ff
4
+ data.tar.gz: d1c4f38cc9f7a44c67a9e5ec9cda816673ef1e57b82a83b411570d2127240faf
5
5
  SHA512:
6
- metadata.gz: f7f2b0e62be8433c3cd944fa693829fe0ff495901cc38a8ef73dd8e0d27689f4f8d7b022ae71877a15972dd4d2f628f96655e90e68ec69cb0b6f31440cb65989
7
- data.tar.gz: b7d7e814f06a68fbc3a3b779e9dda13d5869183570ce1c72e3a011a281473300d9f86178b6389a4719bbbdf9e5e3108885754d896fa2104009107d41752a3348
6
+ metadata.gz: cfe8eda4fd596304e928d1be7f23e74ab7b2608497143c39f9161b353bc8f4336d2c696bfc0fcfd99fdf9d2a61f8a6135384c417a56abc13b7b0ab1aa65a27f8
7
+ data.tar.gz: ee2ed706e1242d366e2abd08457b09013fcb4984c3b9bcd8d579af14a172a0e253e19f5c2cc808c23c97a36fc9caf79fbc18d8e85038654b77277a5cfee6a0cc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- facturapi_ruby (1.1.0)
4
+ facturapi_ruby (2.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  rspec (~> 3.0)
33
33
 
34
34
  BUNDLED WITH
35
- 1.16.1
35
+ 1.17.3
@@ -1,4 +1,4 @@
1
- module FacturapiRuby
1
+ module FacturapiRuby
2
2
  class Configuration
3
3
  attr_accessor :api_key, :debug_output
4
4
 
@@ -101,4 +101,42 @@ module FacturapiRuby
101
101
  ENAJENACION_DE_ACCIONES_EN_BOLSA_DE_VALORES: "630",
102
102
  REGIMEN_DE_LOS_INGRESOS_POR_OBTENCION_DE_PREMIOS: "615"
103
103
  }
104
+
105
+ REGIMEN_FISCAL = {
106
+ '603': 'Personas Morales con Fines no Lucrativos',
107
+ '605': 'Sueldos y Salarios e Ingresos Asimilados a Salarios',
108
+ '606': 'Arrendamiento',
109
+ '608': 'Demás ingresos',
110
+ '609': 'Consolidación',
111
+ '610': 'Residentes en el Extranjero sin Establecimiento Permanente en México',
112
+ '611': 'Ingresos por Dividendos (socios y accionistas)',
113
+ '612': 'Personas Físicas con Actividades Empresariales y Profesionales',
114
+ '614': 'Ingresos por intereses',
115
+ '616': 'Sin obligaciones fiscales',
116
+ '620': 'Sociedades Cooperativas de Producción que optan por diferir sus ingresos',
117
+ '621': 'Incorporación Fiscal',
118
+ '622': 'Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras',
119
+ '623': 'Opcional para Grupos de Sociedades',
120
+ '624': 'Coordinados',
121
+ '628': 'Hidrocarburos',
122
+ '607': 'Régimen de Enajenación o Adquisición de Bienes',
123
+ '629': 'De los Regímenes Fiscales Preferentes y de las Empresas Multinacionales',
124
+ '630': 'Enajenación de acciones en bolsa de valores',
125
+ '615': 'Régimen de los ingresos por obtención de premios',
126
+ '625': 'Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas',
127
+ '626': 'Régimen Simplificado de Confianza',
128
+ }.freeze
129
+
130
+ CANCELACION_FISCAL = {
131
+ '01': 'Comprobante emitido con errores con relación',
132
+ '02': 'Comprobante emitido con errores sin relación',
133
+ '03': 'No se llevó a cabo la operación',
134
+ '04': 'Operación nominativa relacionada en la factura global',
135
+ }.freeze
136
+
137
+ TAXABILITY = {
138
+ '01': 'No objeto de impuesto',
139
+ '02': 'Sí objeto de impuesto',
140
+ '03': 'Sí objeto de impuesto, pero no obligado a desglose',
141
+ }.freeze
104
142
  end
@@ -5,14 +5,14 @@ module FacturapiRuby
5
5
  class << self
6
6
  def create(options)
7
7
  HttpClient.post(
8
- endpoint: '/customers',
8
+ endpoint: '/v1/customers',
9
9
  api_options: options
10
10
  )
11
11
  end
12
12
 
13
13
  def update(customer_id, options)
14
14
  HttpClient.put(
15
- endpoint: "/customers/#{customer_id}",
15
+ endpoint: "/v1/customers/#{customer_id}",
16
16
  api_options: options
17
17
  )
18
18
  end
@@ -5,14 +5,14 @@ module FacturapiRuby
5
5
  class << self
6
6
  def pdf(options)
7
7
  HttpClient.get_file(
8
- endpoint: "/invoices/#{options[:invoice_id]}/pdf",
8
+ endpoint: "/v1/invoices/#{options[:invoice_id]}/pdf",
9
9
  file_ext: '.pdf'
10
10
  )
11
11
  end
12
12
 
13
13
  def xml(options)
14
14
  HttpClient.get_file(
15
- endpoint: "/invoices/#{options[:invoice_id]}/xml",
15
+ endpoint: "/v1/invoices/#{options[:invoice_id]}/xml",
16
16
  file_ext: '.xml'
17
17
  )
18
18
  end
@@ -14,7 +14,7 @@ module FacturapiRuby
14
14
  module HttpClient
15
15
 
16
16
  class << self
17
- BASE_URL = 'https://www.facturapi.io/v1'
17
+ BASE_URL = 'https://www.facturapi.io'
18
18
 
19
19
  def get_file(options)
20
20
  response = request(Net::HTTP::Get, options)
@@ -5,21 +5,21 @@ module FacturapiRuby
5
5
  class << self
6
6
  def create(options)
7
7
  HttpClient.post(
8
- endpoint: '/invoices',
8
+ endpoint: '/v1/invoices',
9
9
  api_options: options
10
10
  )
11
11
  end
12
12
 
13
13
  def cancel(invoice_id, options={})
14
14
  HttpClient.delete(
15
- endpoint: "/invoices/#{invoice_id}",
15
+ endpoint: "/v1/invoices/#{invoice_id}",
16
16
  api_options: options
17
17
  )
18
18
  end
19
19
 
20
20
  def get(invoice_id, options={})
21
21
  HttpClient.get(
22
- endpoint: "/invoices/#{invoice_id}",
22
+ endpoint: "/v1/invoices/#{invoice_id}",
23
23
  api_options: options
24
24
  )
25
25
  end
@@ -0,0 +1,27 @@
1
+ require 'facturapi_ruby/http_client'
2
+
3
+ module FacturapiRuby
4
+ module Receipts
5
+ class << self
6
+ def get(receipt_id)
7
+ HttpClient.post(
8
+ endpoint: "/v1/receipts/#{receipt_id}"
9
+ )
10
+ end
11
+
12
+ def create(options)
13
+ HttpClient.post(
14
+ endpoint: '/v1/receipts',
15
+ api_options: options
16
+ )
17
+ end
18
+
19
+ def invoice(receipt_id, options={})
20
+ HttpClient.post(
21
+ endpoint: "/v1/receipts/#{receipt_id}/invoice",
22
+ api_options: options
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'facturapi_ruby/http_client'
4
+
5
+ module FacturapiRuby
6
+ module V2
7
+ module Customers
8
+ class << self
9
+ def create(options)
10
+ HttpClient.post(
11
+ endpoint: '/v2/customers',
12
+ api_options: options
13
+ )
14
+ end
15
+
16
+ def update(customer_id, options)
17
+ HttpClient.put(
18
+ endpoint: "/v2/customers/#{customer_id}",
19
+ api_options: options
20
+ )
21
+ end
22
+
23
+ def validate(customer_id)
24
+ HttpClient.get(
25
+ endpoint: '/v2/customers/{customer_id}/tax-info-validation'
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'facturapi_ruby/http_client'
4
+
5
+ module FacturapiRuby
6
+ module V2
7
+ module Files
8
+ class << self
9
+ def pdf(options)
10
+ HttpClient.get_file(
11
+ endpoint: "/v2/invoices/#{options[:invoice_id]}/pdf",
12
+ file_ext: '.pdf'
13
+ )
14
+ end
15
+
16
+ def xml(options)
17
+ HttpClient.get_file(
18
+ endpoint: "/v2/invoices/#{options[:invoice_id]}/xml",
19
+ file_ext: '.xml'
20
+ )
21
+ end
22
+
23
+ def zip(options)
24
+ HttpClient.get_file(
25
+ endpoint: "/v2/invoices/#{options[:invoice_id]}/zip",
26
+ file_ext: '.zip'
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'facturapi_ruby/http_client'
4
+
5
+ module FacturapiRuby
6
+ module V2
7
+ module Invoices
8
+ class << self
9
+ def create(options)
10
+ HttpClient.post(
11
+ endpoint: '/v2/invoices',
12
+ api_options: options
13
+ )
14
+ end
15
+
16
+ def cancel(invoice_id, motive, substitution=nil, options={})
17
+ path = "/v2/invoices/#{invoice_id}?motive=#{motive}"
18
+ path += "&substitution=#{substitution}" if substitution
19
+ HttpClient.delete(
20
+ endpoint: path,
21
+ api_options: options
22
+ )
23
+ end
24
+
25
+ def get(invoice_id, options={})
26
+ HttpClient.get(
27
+ endpoint: "/v2/invoices/#{invoice_id}",
28
+ api_options: options
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ require 'facturapi_ruby/http_client'
2
+
3
+ module FacturapiRuby
4
+ module V2
5
+ module Receipts
6
+ class << self
7
+
8
+ def get(receipt_id)
9
+ HttpClient.post(
10
+ endpoint: "/v2/receipts/#{receipt_id}"
11
+ )
12
+ end
13
+
14
+ def create(options)
15
+ HttpClient.post(
16
+ endpoint: '/v2/receipts',
17
+ api_options: options
18
+ )
19
+ end
20
+
21
+ def invoice(receipt_id, options={})
22
+ HttpClient.post(
23
+ endpoint: "/v2/receipts/#{receipt_id}/invoice",
24
+ api_options: options
25
+ )
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FacturapiRuby
2
- VERSION = "1.3.0"
4
+ VERSION = "2.1.0"
3
5
  end
@@ -4,6 +4,12 @@ require 'facturapi_ruby/customers'
4
4
  require 'facturapi_ruby/files'
5
5
  require 'facturapi_ruby/invoices'
6
6
  require 'facturapi_ruby/version'
7
+ require 'facturapi_ruby/receipts'
8
+ require 'facturapi_ruby/v2/customers'
9
+ require 'facturapi_ruby/v2/files'
10
+ require 'facturapi_ruby/v2/invoices'
11
+ require 'facturapi_ruby/v2/receipts'
12
+
7
13
 
8
14
  module FacturapiRuby
9
15
  class << self
@@ -13,5 +19,5 @@ module FacturapiRuby
13
19
  self.configuration ||= Configuration.new
14
20
  yield(configuration)
15
21
  end
16
- end
22
+ end
17
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facturapi_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Llamas Velasco
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-06 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,12 +78,17 @@ files:
78
78
  - lib/facturapi_ruby/files.rb
79
79
  - lib/facturapi_ruby/http_client.rb
80
80
  - lib/facturapi_ruby/invoices.rb
81
+ - lib/facturapi_ruby/receipts.rb
82
+ - lib/facturapi_ruby/v2/customers.rb
83
+ - lib/facturapi_ruby/v2/files.rb
84
+ - lib/facturapi_ruby/v2/invoices.rb
85
+ - lib/facturapi_ruby/v2/receipts.rb
81
86
  - lib/facturapi_ruby/version.rb
82
87
  homepage: https://github.com/diegollams/facturapi_ruby
83
88
  licenses:
84
89
  - MIT
85
90
  metadata: {}
86
- post_install_message:
91
+ post_install_message:
87
92
  rdoc_options: []
88
93
  require_paths:
89
94
  - lib
@@ -98,9 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
103
  - !ruby/object:Gem::Version
99
104
  version: '0'
100
105
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.7.5
103
- signing_key:
106
+ rubygems_version: 3.0.9
107
+ signing_key:
104
108
  specification_version: 4
105
109
  summary: Crea Facturas Electrónicas válidas lo más fácil posible (CFDI) https://facturapi.io
106
110
  test_files: []