Project

nubefact

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby gem to consume NubeFact API to generate electronic tax document in PERU.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.13
~> 1.10.8
~> 12.3.3
~> 3.6
 Project Readme

NubeFact

Ruby gem to consume NubeFact API to generate electronic tax document in PERU.

Currently only has an interface to create invoice, but can be used easily to consume other operations.

NubeFact API documentation: https://docs.google.com/document/d/1QWWSILBbjd4MDkJl7vCkL2RZvkPh0IC7Wa67BvoYIhA/edit

Se pueden hacer 4 tipos de operaciones con nuestra API:

OPERACIÓN 1: GENERAR FACTURAS, BOLETAS Y NOTAS
OPERACIÓN 2: CONSULTA DE FACTURAS, BOLETAS Y NOTAS
OPERACIÓN 3: GENERAR ANULACIÓN DE FACTURAS, BOLETAS Y NOTAS
OPERACIÓN 4: CONSULTA ANULACIÓN DE FACTURAS, BOLETAS Y NOTAS

How to use:

# Set your url_token and api_token.
# If you are using rails copy this 2 lines to config/initilizers/nubefact.rb
require 'nube_fact'
NubeFact.use_demo! unless Rails.env.production?
NubeFact.url_token = '93123123-ecfc-4496-ac6e-8add6940e238'
NubeFact.api_token = '29842498b15ff41f9817f036b23182e789d5a04f28ca14255822a59bfcee00e4e'

Create an Electronic Invoice

# create a new Invoice object
invoice = NubeFact::Invoice.new({
                               serie: 'F001',
                              numero: 2,
                   sunat_transaction: 2,
           cliente_tipo_de_documento: 0,
         cliente_numero_de_documento: 'AP990427',
                cliente_denominacion: 'Bugs Bunny',
                   cliente_direccion: 'Kra 11 11 A',
                       cliente_email: 'nubefact@mailinator.com',
                              moneda: 2,
                      tipo_de_cambio: 3.25,
                   porcentaje_de_igv: 0,
                      total_inafecta: 65.00,
                               total: 65.00,
   enviar_automaticamente_a_la_sunat: false,
   enviar_automaticamente_al_cliente: true,
                        codigo_unico: 'ABC',
                      formato_de_pdf: 'A5'
})

# Add items
# You don't need to add the fields that are calculated like total or igv
# those got calculated automatically.

invoice.add_item({
  unidad_de_medida: 'ZZ',
  descripcion: 'Osito de peluche de taiwan',
  cantidad: 1,
  valor_unitario: 65.00,
  tipo_de_igv: 16,
})

result = invoice.deliver

ToDo

  • Agregar constantes para los tipos de datos numericos
  • Agreagar soporte para consultar facturas
  • Agregar soporte para crear otros tipos de documetn
  • Agregar soporte para consultar otros tipos de documento
  • Agregar tests usando webmock
  • Alcanzar coverage 100%