Class: PuntoPagos::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/puntopagos/status.rb

Instance Method Summary collapse

Constructor Details

#initialize(env = nil) ⇒ Status

Returns a new instance of Status.



3
4
5
6
7
8
9
# File 'lib/puntopagos/status.rb', line 3

def initialize env = nil
  @env = env
  @@config ||= PuntoPagos::Config.new(env)
  @@function = "transaccion/traer"
  @@endpoint = "transaccion"
  @@response = nil
end

Instance Method Details

#check(token, trx_id, amount) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/puntopagos/status.rb', line 12

def check  token, trx_id, amount
  timestamp = get_timestamp
  message = create_message(token, trx_id, amount, timestamp)
  authorization = PuntoPagos::Authorization.new(@env)
  signature = authorization.sign(message)
  executioner = PuntoPagos::Executioner.new(@env)
  @@response = executioner.call_api(token, @@endpoint, :get, signature, timestamp)
end

#errorObject



25
26
27
# File 'lib/puntopagos/status.rb', line 25

def error
  @@response['error']
end

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/puntopagos/status.rb', line 21

def valid?
  @@response['respuesta'] == '00'
end