Class: InvoiceData

Inherits:
Object
  • Object
show all
Defined in:
lib/facturas_xml/invoice_data.rb

Constant Summary collapse

ALLOWED_CABECERA_FIELDS =
{
  nitEmisor: {mandatory: true},
  razonSocialEmisor: {mandatory: true},
  municipio: {mandatory: true},
  telefono: {mandatory: true},
  numeroFactura: {mandatory: false},
  cuf: {mandatory: true},
  cufd: {mandatory: true},
  codigoSucursal: {mandatory: true},
  direccion: {mandatory: true},
  codigoPuntoVenta: {mandatory: false},
  fechaEmision: {mandatory: true},
  nombreRazonSocial: {mandatory: false},
  codigoTipoDocumentoIdentidad: {mandatory: true},
  numeroDocumento: {mandatory: true},
  complemento: {mandatory: false},
  codigoCliente: {mandatory: true},
  codigoMetodoPago: {mandatory: true},
  numeroTarjeta: {mandatory: false},
  montoTotal: {mandatory: true},
  montoTotalSujetoIva: {mandatory: true},
  codigoMoneda: {mandatory: true},
  tipoCambio: {mandatory: true},
  montoTotalMoneda: {mandatory: true},
  montoGiftCard: {mandatory: false},
  descuentoAdicional: {mandatory: false},
  codigoExcepcion: {mandatory: false},
  cafc: {mandatory: false},
  leyenda: {mandatory: true},
  usuario: {mandatory: true}
}
ALLOWED_DETALLE_FIELDS =
{
  actividadEconomica: {mandatory: true},
  codigoProductoSin: {mandatory: true},
  codigoProducto: {mandatory: true},
  descripcion: {mandatory: true},
  cantidad: {mandatory: true},
  unidadMedida: {mandatory: true},
  precioUnitario: {mandatory: true},
  montoDescuento: {mandatory: false},
  subTotal: {mandatory: true},
  numeroSerie: {mandatory: false},
  numeroImei: {mandatory: false}
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ InvoiceData

Returns a new instance of InvoiceData.



58
59
60
61
62
# File 'lib/facturas_xml/invoice_data.rb', line 58

def initialize(data = {})
  @data = data

  validate_data
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



2
3
4
# File 'lib/facturas_xml/invoice_data.rb', line 2

def data
  @data
end

Class Method Details

.allowed_cabecera_fieldsObject



50
51
52
# File 'lib/facturas_xml/invoice_data.rb', line 50

def self.allowed_cabecera_fields
  ALLOWED_CABECERA_FIELDS.keys
end

.allowed_detalle_fieldsObject



54
55
56
# File 'lib/facturas_xml/invoice_data.rb', line 54

def self.allowed_detalle_fields
  ALLOWED_DETALLE_FIELDS.keys
end