Class: Sisow::Api::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/sisow/api/callback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Callback

Returns a new instance of Callback.



10
11
12
13
14
# File 'lib/sisow/api/callback.rb', line 10

def initialize(attributes = {})
  attributes.each do |k,v|
    send("#{k}=", v)
  end
end

Instance Attribute Details

#entrance_codeObject

Returns the value of attribute entrance_code.



5
6
7
# File 'lib/sisow/api/callback.rb', line 5

def entrance_code
  @entrance_code
end

#sha1Object

Returns the value of attribute sha1.



5
6
7
# File 'lib/sisow/api/callback.rb', line 5

def sha1
  @sha1
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/sisow/api/callback.rb', line 5

def status
  @status
end

#transaction_idObject

Returns the value of attribute transaction_id.



5
6
7
# File 'lib/sisow/api/callback.rb', line 5

def transaction_id
  @transaction_id
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/sisow/api/callback.rb', line 33

def cancelled?
  @status == 'Cancelled'
end

#expired?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/sisow/api/callback.rb', line 29

def expired?
  @status == 'Expired'
end

#failure?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/sisow/api/callback.rb', line 37

def failure?
  @status == 'Failure'
end

#pending?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/sisow/api/callback.rb', line 41

def pending?
  @status == 'Pending'
end

#reversed?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/sisow/api/callback.rb', line 45

def reversed?
  @status == 'Reversed'
end

#success?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/sisow/api/callback.rb', line 25

def success?
  @status == 'Success'
end

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/sisow/api/callback.rb', line 16

def valid?
  valid_callback == true
end

#validate!Object



20
21
22
23
# File 'lib/sisow/api/callback.rb', line 20

def validate!
  return true if valid_callback == true
  raise Sisow::Exception, "This callback is forged" and return if valid_callback == false
end