Class: CobroDigital::Meta

Inherits:
Operador
  • Object
show all
Defined in:
lib/cobro_digital/meta.rb

Constant Summary collapse

META_WS =
'meta'.freeze

Class Method Summary collapse

Class Method Details

.meta(objs) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/cobro_digital/meta.rb', line 64

def self.meta(objs)
  CobroDigital::Meta.new(
    :http_method => CobroDigital::Https::POST,
    :webservice  => META_WS,
    :render      => render(objs)
  )
end

.render(objs) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/cobro_digital/meta.rb', line 56

def self.render(objs)
  querys = {}
  objs.each_with_index do |obj, i|
    querys[i] = obj.render.merge(metodo_webservice: obj.webservice)
  end
  querys
end

.transaction(desde, hasta, filtros = {}) ⇒ Object

md5(microtime(true)*rand()) { 'handshake'=>Digest::MD5.hexdigest(Time.now.to_f.to_s), 'metodo_webservice'=>'meta', '0' => { 'metodo_webservice' => 'crear_pagador', 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s), 'pagador' => { 'Nombre' => 'Juan', 'Su_identificador' => '1AF8', 'Unidad' => '201' } }, '1' => { 'metodo_webservice' => 'crear_pagador', 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s), 'pagador'=> { 'Nombre'=>'Pedro', 'Su_identificador'=>'1AG9', 'Unidad'=>'202' } }, '2' => { 'metodo_webservice' => 'generar_boleta', 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s), 'identificador' => 'Su_identificador', 'buscar' => '1AF8', 'importes'=> [10.50], 'fechas_vencimiento' => ['20160930'], 'plantilla' => 'init', 'concepto' => 'Test I'}, '3' => { 'metodo_webservice' => 'generar_boleta', 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s), 'identificador' => 'Su_identificador', 'buscar' => '1AG9', 'importes'=> [11.99], 'fechas_vencimiento' => ['20160929'], 'plantilla' => 'init', 'concepto' => 'Test II'}, '4' => { 'metodo_webservice' => 'inhabilitar_boleta', 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s), 'nro_boleta' => '4' }, '5' => { 'metodo_webservice' => 'inhabilitar_boleta', 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s), 'nro_boleta' => '65' } }



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cobro_digital/meta.rb', line 42

def self.transaction(desde, hasta, filtros = {})
  filter = {
    ::CobroDigital::Transaccion::FILTRO_TIPO => ::CobroDigital::Transaccion::FILTRO_TIPO_INGRESO
  }

  filter.merge!(filtros) unless filtros.empty?

  CobroDigital::Transaccion.consultar(
    desde,
    hasta,
    filter
  )
end