Class: CobroDigital::Boleta

Inherits:
Operador show all
Defined in:
lib/cobro_digital/boleta.rb

Constant Summary collapse

GENERAR_BOLETA_WS =
'generar_boleta'
INHABILITAR_BOLETA_WS =
'inhabilitar_boleta'
OBTENER_CODIGO_BARRA_WS =
'obtener_codigo_de_barras'

Instance Attribute Summary

Attributes inherited from Operador

#http_method, #render, #response, #webservice

Class Method Summary collapse

Methods inherited from Operador

#call, #initialize, #parse_response, #request

Constructor Details

This class inherits a constructor from CobroDigital::Operador

Class Method Details

.generar(identificador, buscar, fechas_vencimiento, importes, concepto, plantilla = nil) ⇒ Object

{ ‘identificador’ => ‘Su_identificador’, ‘buscar’ => ‘1AF8’, ‘fechas_vencimiento’ => [‘20170901’,‘20170905’], ‘importes’ => [100.98, 102], ‘concepto’ => ‘Boleta de Prueba’, ‘plantilla’ => ‘init’ }



9
10
11
12
13
14
15
16
17
18
# File 'lib/cobro_digital/boleta.rb', line 9

def self.generar(identificador, buscar, fechas_vencimiento, importes, concepto, plantilla=nil)
  CobroDigital::Boleta.new( :http_method => CobroDigital::Https::POST,
                            :webservice  => GENERAR_BOLETA_WS,
                            :render      => { :identificador      => identificador,
                                           :buscar             => buscar,
                                           :fechas_vencimiento => fechas_vencimiento.map{ |date| date.strftime('%Y%m%d') },
                                              :importes           => importes,
                                            :concepto           => concepto,
                                            :plantilla          => plantilla })
end

.inhabilitar(nro_boleta) ⇒ Object

{ ‘nro_boleta’=>‘1’ }



21
22
23
24
25
# File 'lib/cobro_digital/boleta.rb', line 21

def self.inhabilitar(nro_boleta)
  CobroDigital::Boleta.new( :http_method => CobroDigital::Https::POST,
                            :webservice  => INHABILITAR_BOLETA_WS,
                            :render      => { :nro_boleta  => nro_boleta } )
end

.obtener_codigo_de_barras(nro_boleta) ⇒ Object

{ ‘nro_boleta’=>‘1’ }



28
29
30
31
32
# File 'lib/cobro_digital/boleta.rb', line 28

def self.obtener_codigo_de_barras(nro_boleta)
  CobroDigital::Boleta.new( :http_method => CobroDigital::Https::GET,
                            :webservice  => OBTENER_CODIGO_BARRA_WS,
                            :render      => { :nro_boleta  => nro_boleta } )
end