facturama-ipz 0.0.3
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 +7 -0
- data/lib/facturama/facturama_api_multi.rb +29 -0
- data/lib/facturama/facturama_api_web.rb +47 -0
- data/lib/facturama/models/address.rb +17 -0
- data/lib/facturama/models/branch_office.rb +16 -0
- data/lib/facturama/models/cfdi.rb +77 -0
- data/lib/facturama/models/cfdi_relation.rb +11 -0
- data/lib/facturama/models/cfdi_relations.rb +13 -0
- data/lib/facturama/models/client.rb +19 -0
- data/lib/facturama/models/complement.rb +9 -0
- data/lib/facturama/models/connection_info.rb +21 -0
- data/lib/facturama/models/csd.rb +14 -0
- data/lib/facturama/models/exception/facturama_exception.rb +13 -0
- data/lib/facturama/models/exception/model_exception.rb +8 -0
- data/lib/facturama/models/globalInformation.rb +15 -0
- data/lib/facturama/models/image.rb +12 -0
- data/lib/facturama/models/item.rb +29 -0
- data/lib/facturama/models/model.rb +68 -0
- data/lib/facturama/models/product.rb +25 -0
- data/lib/facturama/models/product_tax.rb +14 -0
- data/lib/facturama/models/receiver.rb +18 -0
- data/lib/facturama/models/serie.rb +15 -0
- data/lib/facturama/models/tax.rb +15 -0
- data/lib/facturama/models/tax_entity.rb +22 -0
- data/lib/facturama/models/tax_stamp.rb +13 -0
- data/lib/facturama/models/thirdPartyAccount.rb +14 -0
- data/lib/facturama/services/branch_office_service.rb +13 -0
- data/lib/facturama/services/catalog_service.rb +39 -0
- data/lib/facturama/services/cfdi_multi_service.rb +130 -0
- data/lib/facturama/services/cfdi_service.rb +137 -0
- data/lib/facturama/services/client_service.rb +13 -0
- data/lib/facturama/services/crud_service.rb +33 -0
- data/lib/facturama/services/csd_service.rb +13 -0
- data/lib/facturama/services/http_service.rb +115 -0
- data/lib/facturama/services/product_service.rb +13 -0
- data/lib/facturama/version.rb +5 -0
- data/lib/facturama-ipz.rb +42 -0
- data/lib/samples/sample_api.rb +11 -0
- data/lib/samples/sample_api_multi.rb +367 -0
- data/lib/samples/sample_api_web.rb +458 -0
- metadata +95 -0
@@ -0,0 +1,458 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../facturama'
|
4
|
+
require_relative 'sample_api'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module Facturama
|
8
|
+
module Samples
|
9
|
+
class SampleApiWeb < SampleApi
|
10
|
+
def initialize; end
|
11
|
+
|
12
|
+
def run
|
13
|
+
puts '============================================================'
|
14
|
+
puts " FACTURAMA WEB SDK #{Facturama::VERSION}"
|
15
|
+
puts '============================================================'
|
16
|
+
|
17
|
+
# Creación de una instacia de la API Facturama, configurado con los datos del usuario de pruebas
|
18
|
+
facturama = create_api_instance
|
19
|
+
|
20
|
+
# Invocaciones a los ejemplos de uso de los servicios de Facturama API
|
21
|
+
begin
|
22
|
+
# sample_clients(facturama) # Servicio de cliente
|
23
|
+
|
24
|
+
# sample_products(facturama) # Servicio de productos
|
25
|
+
|
26
|
+
sample_cfdis(facturama) # Servicio de CFDI
|
27
|
+
rescue FacturamaException => e
|
28
|
+
puts '----------- EXCEPCIONES -----------'
|
29
|
+
puts " * #{e.message}"
|
30
|
+
|
31
|
+
e.details&.each do |item|
|
32
|
+
puts "#{item[0]}: " + item[1].join(',')
|
33
|
+
end
|
34
|
+
rescue Exception => e
|
35
|
+
puts '----------- EXCEPCIONES -----------'
|
36
|
+
puts " * #{e}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# ---------------------------------------------------------------------------------------------------------------------
|
41
|
+
# CONFIGURACION DEL ENTORNO DE LA API
|
42
|
+
def create_api_instance
|
43
|
+
facturama_user = 'prueba'
|
44
|
+
facturama_password = 'pruebas2011'
|
45
|
+
is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)
|
46
|
+
|
47
|
+
# Creacion de una instancia de FacturamaApi
|
48
|
+
Facturama::FacturamaApiWeb.new(facturama_user, facturama_password, is_development)
|
49
|
+
end
|
50
|
+
|
51
|
+
# ---------------------------------------------------------------------------------------------------------------------
|
52
|
+
# EJEMPLO DEL SERVICIO DE CLIENTES
|
53
|
+
# - Listado de clientes
|
54
|
+
# - Agregar cliente
|
55
|
+
# - Obtener cliente específico y editarlo
|
56
|
+
def sample_clients(facturama)
|
57
|
+
sample_clients_list(facturama) # Listar todos los clientes
|
58
|
+
|
59
|
+
new_client = sample_clients_create(facturama) # Agregar cliente
|
60
|
+
client_id = new_client['Id'] # Id del cliente recientemente agregado
|
61
|
+
|
62
|
+
sample_clients_retrieve_and_update(facturama, client_id)
|
63
|
+
|
64
|
+
sample_clients_remove(facturama, client_id)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Obtiene el listado de clientes y muestra la cantidad de los mismos
|
68
|
+
def sample_clients_list(facturama)
|
69
|
+
puts '===== Obtener los clientes - Inicio ====='
|
70
|
+
|
71
|
+
lst_clients = facturama.clients.list # Se obtiene una lista con todos los clientes
|
72
|
+
lst_clients_count = lst_clients.count # Cantidad inicial de clientes
|
73
|
+
|
74
|
+
puts "Cantidad inicial de clientes: #{lst_clients_count}"
|
75
|
+
|
76
|
+
puts '===== Obtener los clientes - Fin ====='
|
77
|
+
end
|
78
|
+
|
79
|
+
# Agrega un cliente
|
80
|
+
def sample_clients_create(facturama)
|
81
|
+
puts '===== Agregar cliente - Inicio ====='
|
82
|
+
|
83
|
+
facturama.clients.create(Facturama::Models::Client.new(
|
84
|
+
{ Id: '',
|
85
|
+
Email: 'pruebas@pruebas.mx',
|
86
|
+
"EmailOp1": '',
|
87
|
+
"EmailOp2": '',
|
88
|
+
Rfc: 'IAÑL750210963',
|
89
|
+
Name: 'LUIS IAN ÑUZCO',
|
90
|
+
CfdiUse: 'P01',
|
91
|
+
Address: { Country: 'MEXICO',
|
92
|
+
ExteriorNumber: '1230',
|
93
|
+
InteriorNumber: 'B',
|
94
|
+
Locality: 'San Luis',
|
95
|
+
Municipality: 'San Luis Potosí',
|
96
|
+
Neighborhood: 'Lomas 4ta',
|
97
|
+
State: 'San Luis Potosí',
|
98
|
+
Street: 'Cañada de Gomez',
|
99
|
+
ZipCode: '30230' } }
|
100
|
+
))
|
101
|
+
|
102
|
+
puts '===== Agregar cliente - Fin ====='
|
103
|
+
end
|
104
|
+
|
105
|
+
# Obtiene un cliente específico, lo edita y lo guarda
|
106
|
+
def sample_clients_retrieve_and_update(facturama, client_id)
|
107
|
+
puts '===== Obtener cliente y editarlo - Inicio ====='
|
108
|
+
|
109
|
+
# Se obtiene el cliente con el Id especificado
|
110
|
+
specific_client = facturama.clients.retrieve(client_id)
|
111
|
+
|
112
|
+
# Se ha encontrado un cliente con ese Id
|
113
|
+
unless specific_client.nil?
|
114
|
+
|
115
|
+
puts 'Specific Client: '
|
116
|
+
puts JSON[specific_client]
|
117
|
+
|
118
|
+
# Edición del campo RFC
|
119
|
+
specific_client['Rfc'] = 'IAÑL750210963'
|
120
|
+
specific_client['Email'] = 'ejemplo@ejemplo.mx'
|
121
|
+
facturama.clients.update(specific_client, client_id)
|
122
|
+
|
123
|
+
# Se obtiene nuevamente el cliente para confirmar que ha cambiado
|
124
|
+
specific_client = facturama.clients.retrieve(client_id)
|
125
|
+
|
126
|
+
if specific_client['Rfc'] == 'IAÑL750210963'
|
127
|
+
puts 'Cliente editado, ahora su RFC es IAÑL750210963'
|
128
|
+
else
|
129
|
+
puts 'Error al editar cliente'
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
puts '===== Obtener cliente y editarlo - Fin ====='
|
134
|
+
end
|
135
|
+
|
136
|
+
# Elimina un cliente
|
137
|
+
def sample_clients_remove(facturama, client_id)
|
138
|
+
puts '===== Eliminar cliente - Inicio ====='
|
139
|
+
|
140
|
+
specific_client = facturama.clients.remove(client_id)
|
141
|
+
|
142
|
+
puts 'Cliente eliminado: '
|
143
|
+
puts JSON[specific_client]
|
144
|
+
|
145
|
+
puts '===== Eliminar cliente - Fin ====='
|
146
|
+
end
|
147
|
+
|
148
|
+
# ---------------------------------------------------------------------------------------------------------------------
|
149
|
+
# EJEMPLO DEL SERVICIO DE PRODUCTOS
|
150
|
+
def sample_products(facturama)
|
151
|
+
sample_products_list(facturama) # Listar todos los productos
|
152
|
+
|
153
|
+
sample_products_create(facturama) # Agregar producto y eliminarlo
|
154
|
+
end
|
155
|
+
|
156
|
+
# Obtiene el listado de productos y muestra la cantidad de los mismos
|
157
|
+
def sample_products_list(facturama)
|
158
|
+
puts '===== Obtener los productos - Inicio ====='
|
159
|
+
|
160
|
+
lst_products = facturama.products.list # Se obtiene una lista con todos los productos
|
161
|
+
lst_products_count = lst_products.count # Cantidad inicial de productos
|
162
|
+
|
163
|
+
puts "Cantidad inicial de productos: #{lst_products_count}"
|
164
|
+
|
165
|
+
puts '===== Obtener los productos - Fin ====='
|
166
|
+
end
|
167
|
+
|
168
|
+
# Agrega un cliente
|
169
|
+
def sample_products_create(facturama)
|
170
|
+
puts '===== Agregar producto - Inicio ====='
|
171
|
+
|
172
|
+
unit = facturama.catalog.units('servicio').first # La primera unidad que tenga que ver con servicio
|
173
|
+
prod = facturama.catalog.products_or_services('desarrollo').first # Se toma el primer producto o servicio
|
174
|
+
|
175
|
+
product_model = Facturama::Models::Product.new(
|
176
|
+
{
|
177
|
+
Unit: 'Servicio',
|
178
|
+
UnitCode: unit['Value'],
|
179
|
+
IdentificationNumber: 'WEB003',
|
180
|
+
Name: 'Sitio Web CMS',
|
181
|
+
Description: 'Desarrollo e implementación de sitio web empleando un CMS',
|
182
|
+
Price: 6500.0,
|
183
|
+
CodeProdServ: prod['Value'],
|
184
|
+
CuentaPredial: '123',
|
185
|
+
|
186
|
+
Taxes: [
|
187
|
+
{
|
188
|
+
Name: 'IVA',
|
189
|
+
Rate: 0.16,
|
190
|
+
IsRetention: false
|
191
|
+
}
|
192
|
+
]
|
193
|
+
}
|
194
|
+
)
|
195
|
+
|
196
|
+
product = facturama.products.create(product_model)
|
197
|
+
|
198
|
+
puts "Se creo exitosamente un producto con el id: #{product['Id']}"
|
199
|
+
|
200
|
+
facturama.products.delete(product['Id'])
|
201
|
+
puts "Se eliminó exitosamente un producto con el id: #{product['Id']}"
|
202
|
+
|
203
|
+
puts '===== Agregar producto - Fin ====='
|
204
|
+
end
|
205
|
+
|
206
|
+
# ---------------------------------------------------------------------------------------------------------------------
|
207
|
+
# EJEMPLO DEL SERVICIO DE CFDI
|
208
|
+
# En la API WEB el emisor es Siempre la entidad fiscal configurada en la cuenta
|
209
|
+
def sample_cfdis(facturama)
|
210
|
+
puts '===== Ejemplo de CFDI - Inicio ====='
|
211
|
+
|
212
|
+
# Se obtiene la moneda con el valor "MXN"
|
213
|
+
lst_currencies = facturama.catalog.currencies
|
214
|
+
currency = lst_currencies.select { |currency| currency['Value'] == 'MXN' }.first
|
215
|
+
|
216
|
+
# Creacion del cfdi en su forma general (sin items / productos) asociados
|
217
|
+
# cfdi_model = sample_cfdis_create(facturama, currency)
|
218
|
+
cfdi_model = sample_cfdis_publico_en_general(facturama, currency)
|
219
|
+
|
220
|
+
# Agregar los items que lleva el cfdi ( para este ejemplo, se agregan con datos aleatorios)
|
221
|
+
# add_items_to_cfdi(facturama, currency, cfdi_model)
|
222
|
+
add_items_to_cfdi40(facturama, currency, cfdi_model)
|
223
|
+
|
224
|
+
# Creación del CFDI mediante la API, para su creación
|
225
|
+
# cfdi = facturama.cfdis.create(cfdi_model)
|
226
|
+
cfdi = facturama.cfdis.create3(cfdi_model)
|
227
|
+
cfdi_uuid = cfdi['Complement']['TaxStamp']['Uuid']
|
228
|
+
puts "Se creó exitosamente el cfdi con el folio fiscal: #{cfdi_uuid}"
|
229
|
+
|
230
|
+
# Descarga de los arvhivos PDF y XML del cfdi recien creado
|
231
|
+
# file_path = "factura" + cfdi_uuid
|
232
|
+
# facturama.cfdis.save_pdf( file_path + ".pdf", cfdi['Id'])
|
233
|
+
# facturama.cfdis.save_xml( file_path + ".xml", cfdi['Id'])
|
234
|
+
|
235
|
+
# Envio del cfdi por correo
|
236
|
+
# if facturama.cfdis.send_by_mail(cfdi['Id'], "chucho@facturama.mx", "Factura del servicio" )
|
237
|
+
# puts "Se envió por correo exitosamente el cfdi con el folio fiscal: " + cfdi_uuid
|
238
|
+
# end
|
239
|
+
|
240
|
+
# Se elmina el cfdi recien creado
|
241
|
+
# facturama.cfdis.remove(cfdi['Id'],"issued",nil,nil)
|
242
|
+
# puts "Se elminó exitosamente el cfdi con el folio fiscal: " + cfdi_uuid
|
243
|
+
|
244
|
+
# Consulta de cfdi por palabra clave o Rfc
|
245
|
+
# lst_by_rfc = facturama.cfdis.list_by_rfc("ESO1202108R2")
|
246
|
+
# lst_by_keyword = facturama.cfdis.list_by_keyword("Software")
|
247
|
+
|
248
|
+
# puts "Se obtiene la lista de facturas por RFC: #{lst_by_rfc.length}"
|
249
|
+
# puts "Se obtiene la lista de facturas por KEYWORD: #{lst_by_keyword.length}"
|
250
|
+
|
251
|
+
puts '===== Ejemplo de CFDI - Fin ====='
|
252
|
+
end
|
253
|
+
|
254
|
+
def sample_cfdis_create(facturama, currency)
|
255
|
+
# Nombre para el CFDI, para el ejemplo, tomado el primero de la lista del catálogo de nombres en el PDF
|
256
|
+
name_for_pdf = facturama.catalog.name_ids.first; # Nombre en el pdf: "Factura"
|
257
|
+
|
258
|
+
# Método de pago
|
259
|
+
payment_method = facturama.catalog.payment_methods.select do |method|
|
260
|
+
method['Name'] == 'Pago en una sola exhibición'
|
261
|
+
end.first
|
262
|
+
|
263
|
+
# Forma de pago
|
264
|
+
payment_form = facturama.catalog.payment_forms.select { |method| method['Name'] == 'Efectivo' }.first
|
265
|
+
|
266
|
+
# Cliente (se toma como cliente el "cliente generico", aquel que tiene el RFC genérico),
|
267
|
+
# (como los clientes son exclusivos para cada usuario, se debe previamente dar de alta este cliente)
|
268
|
+
client = facturama.clients.list.select { |client| client['Rfc'] == 'URE180429TM6' }.first
|
269
|
+
|
270
|
+
# Lugar de expedición
|
271
|
+
branch_office = facturama.branch_office.list.first
|
272
|
+
|
273
|
+
# Fecha de emision (ahora mismo)
|
274
|
+
date = Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
275
|
+
|
276
|
+
cfdi = Facturama::Models::Cfdi.new(
|
277
|
+
{
|
278
|
+
NameId: name_for_pdf['Value'],
|
279
|
+
CfdiType: Facturama::CfdiType::INGRESO,
|
280
|
+
PaymentForm: payment_form['Value'],
|
281
|
+
PaymentMethod: payment_method['Value'],
|
282
|
+
Currency: currency['Value'],
|
283
|
+
Date: date,
|
284
|
+
ExpeditionPlace: branch_office['Address']['ZipCode'],
|
285
|
+
Receiver: {
|
286
|
+
CfdiUse: client['CfdiUse'],
|
287
|
+
Name: client['Name'],
|
288
|
+
Rfc: client['Rfc'],
|
289
|
+
FiscalRegime: client['FiscalRegime'],
|
290
|
+
TaxZipCode: client['TaxZipCode']
|
291
|
+
},
|
292
|
+
Items: []
|
293
|
+
}
|
294
|
+
)
|
295
|
+
end
|
296
|
+
|
297
|
+
def sample_cfdis_publico_en_general(facturama, currency)
|
298
|
+
# Nombre para el CFDI, para el ejemplo, tomado el primero de la lista del catálogo de nombres en el PDF
|
299
|
+
name_for_pdf = facturama.catalog.name_ids.first; # Nombre en el pdf: "Factura"
|
300
|
+
|
301
|
+
# Método de pago
|
302
|
+
payment_method = facturama.catalog.payment_methods.select do |method|
|
303
|
+
method['Name'] == 'Pago en una sola exhibición'
|
304
|
+
end.first
|
305
|
+
|
306
|
+
# Forma de pago
|
307
|
+
payment_form = facturama.catalog.payment_forms.select { |method| method['Name'] == 'Efectivo' }.first
|
308
|
+
|
309
|
+
# Cliente (se toma como cliente el "cliente generico", aquel que tiene el RFC genérico),
|
310
|
+
# (como los clientes son exclusivos para cada usuario, se debe previamente dar de alta este cliente)
|
311
|
+
client = facturama.clients.list.select { |client| client['Rfc'] == 'XAXX010101000' }.first
|
312
|
+
|
313
|
+
# Lugar de expedición
|
314
|
+
branch_office = facturama.branch_office.list.first
|
315
|
+
|
316
|
+
# Fecha de emision (ahora mismo)
|
317
|
+
date = Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
318
|
+
|
319
|
+
cfdi = Facturama::Models::Cfdi.new(
|
320
|
+
{
|
321
|
+
NameId: name_for_pdf['Value'],
|
322
|
+
CfdiType: Facturama::CfdiType::INGRESO,
|
323
|
+
PaymentForm: payment_form['Value'],
|
324
|
+
PaymentMethod: payment_method['Value'],
|
325
|
+
Currency: currency['Value'],
|
326
|
+
Date: date,
|
327
|
+
ExpeditionPlace: '78140',
|
328
|
+
Exportation: '01',
|
329
|
+
GlobalInformation:
|
330
|
+
{
|
331
|
+
Periodicity: '02',
|
332
|
+
Months: '04',
|
333
|
+
Year: '2022'
|
334
|
+
},
|
335
|
+
Receiver: {
|
336
|
+
CfdiUse: client['CfdiUse'],
|
337
|
+
Name: client['Name'],
|
338
|
+
Rfc: client['Rfc'],
|
339
|
+
FiscalRegime: client['FiscalRegime'],
|
340
|
+
TaxZipCode: '78140'
|
341
|
+
},
|
342
|
+
Items: []
|
343
|
+
}
|
344
|
+
)
|
345
|
+
end
|
346
|
+
|
347
|
+
def add_items_to_cfdi(facturama, currency, cfdi)
|
348
|
+
lst_products = facturama.products.list
|
349
|
+
lst_products_size = lst_products.length
|
350
|
+
|
351
|
+
n_items = (rand(lst_products.length) % 10) + 1
|
352
|
+
|
353
|
+
decimals = currency['Decimals'].to_i
|
354
|
+
|
355
|
+
# Lista de conceptos para el CFDI
|
356
|
+
lst_items = []
|
357
|
+
|
358
|
+
n_begin = lst_products_size - 1 - n_items
|
359
|
+
|
360
|
+
(n_begin..lst_products_size).each do |index|
|
361
|
+
product = lst_products[index] # Un producto cualquiera
|
362
|
+
|
363
|
+
break if product.nil?
|
364
|
+
|
365
|
+
quantity = rand(1..5) # una cantidad aleatoria de elementos de este producto
|
366
|
+
|
367
|
+
discount = (product['Price'] % (product['Price'])).zero? ? 1 : rand((product['Price'].to_i))
|
368
|
+
subtotal = (product['Price'] * quantity).round(decimals) # Redondeo de acuerdo a la moneda
|
369
|
+
|
370
|
+
item = Facturama::Models::Item.new({
|
371
|
+
ProductCode: product['CodeProdServ'],
|
372
|
+
UnitCode: product['UnitCode'],
|
373
|
+
Unit: product['Unit'],
|
374
|
+
Description: product['Description'],
|
375
|
+
IdentificationNumber: product['IdentificationNumber'],
|
376
|
+
Quantity: quantity,
|
377
|
+
Discount: discount.round(decimals),
|
378
|
+
UnitPrice: product['Price'].round(decimals),
|
379
|
+
Subtotal: subtotal,
|
380
|
+
Taxes: nil
|
381
|
+
|
382
|
+
})
|
383
|
+
|
384
|
+
base_amount = (subtotal - discount).round(decimals)
|
385
|
+
taxes = product['Taxes'].map do |t|
|
386
|
+
Facturama::Models::Tax.new(
|
387
|
+
Name: t['Name'],
|
388
|
+
IsQuota: t['IsQuota'],
|
389
|
+
IsRetention: t['IsRetention'],
|
390
|
+
Rate: t['Rate'].to_f.round(decimals),
|
391
|
+
Base: base_amount,
|
392
|
+
Total: (base_amount * t['Rate'].to_f).round(decimals)
|
393
|
+
)
|
394
|
+
end
|
395
|
+
|
396
|
+
retentions_amount = 0
|
397
|
+
transfers_amount = 0
|
398
|
+
if taxes.length.positive?
|
399
|
+
item.Taxes = taxes
|
400
|
+
# Calculo del monto total del concepto, tomando en cuenta los impuestos
|
401
|
+
retentions_amount = item.Taxes.select(&:IsRetention).sum(&:Total)
|
402
|
+
transfers_amount = item.Taxes.reject(&:IsRetention).sum(&:Total)
|
403
|
+
|
404
|
+
end
|
405
|
+
|
406
|
+
item.Total = (item.Subtotal - item.Discount + transfers_amount - retentions_amount).round(decimals)
|
407
|
+
|
408
|
+
lst_items.push(item)
|
409
|
+
end
|
410
|
+
|
411
|
+
cfdi.Items = lst_items
|
412
|
+
end
|
413
|
+
|
414
|
+
def add_items_to_cfdi40(_facturama, _currency, cfdi)
|
415
|
+
# Lista de conceptos para el CFDI
|
416
|
+
lst_items = []
|
417
|
+
lst_taxes = []
|
418
|
+
|
419
|
+
item = Facturama::Models::Item.new({
|
420
|
+
ProductCode: '01010101',
|
421
|
+
UnitCode: 'E48',
|
422
|
+
Unit: 'Sain datos',
|
423
|
+
Description: 'GPS estandar pruebas',
|
424
|
+
IdentificationNumber: 'EDL',
|
425
|
+
Quantity: 1.0,
|
426
|
+
Discount: nil,
|
427
|
+
UnitPrice: 100.00,
|
428
|
+
Subtotal: 100.00,
|
429
|
+
TaxObject: '02',
|
430
|
+
ThirdPartyAccount:
|
431
|
+
{
|
432
|
+
Rfc: 'CACX7605101P8',
|
433
|
+
Name: 'XOCHILT CASAS CHAVEZ',
|
434
|
+
FiscalRegime: '616',
|
435
|
+
TaxZipCode: '10740'
|
436
|
+
|
437
|
+
},
|
438
|
+
Taxes: []
|
439
|
+
|
440
|
+
})
|
441
|
+
|
442
|
+
taxes = Facturama::Models::Tax.new({
|
443
|
+
Name: 'IVA',
|
444
|
+
IsRetention: false,
|
445
|
+
Rate: 0.16,
|
446
|
+
Base: 100.00,
|
447
|
+
Total: 16.00
|
448
|
+
|
449
|
+
})
|
450
|
+
lst_taxes.push(taxes)
|
451
|
+
item.Taxes = lst_taxes
|
452
|
+
item.Total = 116.00
|
453
|
+
lst_items.push(item)
|
454
|
+
cfdi.Items = lst_items
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: facturama-ipz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Facturama
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0.rc1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.1.0.rc1
|
27
|
+
description: Funcionalidad básica de creación de Cfdis empleando las APIs Web y Multiemisor
|
28
|
+
email: info@facturama.mx
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/facturama-ipz.rb
|
34
|
+
- lib/facturama/facturama_api_multi.rb
|
35
|
+
- lib/facturama/facturama_api_web.rb
|
36
|
+
- lib/facturama/models/address.rb
|
37
|
+
- lib/facturama/models/branch_office.rb
|
38
|
+
- lib/facturama/models/cfdi.rb
|
39
|
+
- lib/facturama/models/cfdi_relation.rb
|
40
|
+
- lib/facturama/models/cfdi_relations.rb
|
41
|
+
- lib/facturama/models/client.rb
|
42
|
+
- lib/facturama/models/complement.rb
|
43
|
+
- lib/facturama/models/connection_info.rb
|
44
|
+
- lib/facturama/models/csd.rb
|
45
|
+
- lib/facturama/models/exception/facturama_exception.rb
|
46
|
+
- lib/facturama/models/exception/model_exception.rb
|
47
|
+
- lib/facturama/models/globalInformation.rb
|
48
|
+
- lib/facturama/models/image.rb
|
49
|
+
- lib/facturama/models/item.rb
|
50
|
+
- lib/facturama/models/model.rb
|
51
|
+
- lib/facturama/models/product.rb
|
52
|
+
- lib/facturama/models/product_tax.rb
|
53
|
+
- lib/facturama/models/receiver.rb
|
54
|
+
- lib/facturama/models/serie.rb
|
55
|
+
- lib/facturama/models/tax.rb
|
56
|
+
- lib/facturama/models/tax_entity.rb
|
57
|
+
- lib/facturama/models/tax_stamp.rb
|
58
|
+
- lib/facturama/models/thirdPartyAccount.rb
|
59
|
+
- lib/facturama/services/branch_office_service.rb
|
60
|
+
- lib/facturama/services/catalog_service.rb
|
61
|
+
- lib/facturama/services/cfdi_multi_service.rb
|
62
|
+
- lib/facturama/services/cfdi_service.rb
|
63
|
+
- lib/facturama/services/client_service.rb
|
64
|
+
- lib/facturama/services/crud_service.rb
|
65
|
+
- lib/facturama/services/csd_service.rb
|
66
|
+
- lib/facturama/services/http_service.rb
|
67
|
+
- lib/facturama/services/product_service.rb
|
68
|
+
- lib/facturama/version.rb
|
69
|
+
- lib/samples/sample_api.rb
|
70
|
+
- lib/samples/sample_api_multi.rb
|
71
|
+
- lib/samples/sample_api_web.rb
|
72
|
+
homepage: http://rubygems.org/gems/impulzo
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 2.2.0
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubygems_version: 3.2.3
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Facturama API Web y API Multiemisor
|
95
|
+
test_files: []
|