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.



13
14
15
16
17
# File 'lib/sisow/api/callback.rb', line 13

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.



8
9
10
# File 'lib/sisow/api/callback.rb', line 8

def entrance_code
  @entrance_code
end

#merchant_idObject



52
53
54
# File 'lib/sisow/api/callback.rb', line 52

def merchant_id
  @merchant_id || Sisow.configuration.merchant_id
end

#merchant_keyObject



56
57
58
# File 'lib/sisow/api/callback.rb', line 56

def merchant_key
  @merchant_key || Sisow.configuration.merchant_key
end

#sha1Object

Returns the value of attribute sha1.



8
9
10
# File 'lib/sisow/api/callback.rb', line 8

def sha1
  @sha1
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/sisow/api/callback.rb', line 8

def status
  @status
end

#transaction_idObject

Returns the value of attribute transaction_id.



8
9
10
# File 'lib/sisow/api/callback.rb', line 8

def transaction_id
  @transaction_id
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


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

def cancelled?
  @status == 'Cancelled'
end

#expired?Boolean

Returns:

  • (Boolean)


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

def expired?
  @status == 'Expired'
end

#failure?Boolean

Returns:

  • (Boolean)


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

def failure?
  @status == 'Failure'
end

#pending?Boolean

Returns:

  • (Boolean)


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

def pending?
  @status == 'Pending'
end

#reversed?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/sisow/api/callback.rb', line 48

def reversed?
  @status == 'Reversed'
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  @status == 'Success'
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  valid_callback == true
end

#validate!Object



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

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