Class: Sisow::Payment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Payment

Returns a new instance of Payment.



14
15
16
17
18
# File 'lib/sisow/payment.rb', line 14

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

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def amount
  @amount
end

#callback_urlObject

Returns the value of attribute callback_url.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def callback_url
  @callback_url
end

#cancel_urlObject

Returns the value of attribute cancel_url.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def cancel_url
  @cancel_url
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def description
  @description
end

#entrance_codeObject

Returns the value of attribute entrance_code.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def entrance_code
  @entrance_code
end

#issuer_idObject

Returns the value of attribute issuer_id.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def issuer_id
  @issuer_id
end

#notify_urlObject

Returns the value of attribute notify_url.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def notify_url
  @notify_url
end

#purchase_idObject

Returns the value of attribute purchase_id.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def purchase_id
  @purchase_id
end

#return_urlObject

Returns the value of attribute return_url.



4
5
6
# File 'lib/sisow/payment.rb', line 4

def return_url
  @return_url
end

Instance Method Details

#ideal?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/sisow/payment.rb', line 38

def ideal?
  payment_method == 'ideal'
end

#payment_methodObject



42
# File 'lib/sisow/payment.rb', line 42

def payment_method; raise 'Implement me in a subclass'; end

#payment_urlObject



20
21
22
# File 'lib/sisow/payment.rb', line 20

def payment_url
  CGI::unescape(response.issuerurl) if response.issuerurl?
end

#shop_idObject



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

def shop_id
  Sisow.configuration.shop_id
end

#transaction_idObject



24
25
26
# File 'lib/sisow/payment.rb', line 24

def transaction_id
  response.trxid if response.trxid?
end

#valid?Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/sisow/payment.rb', line 32

def valid?
  entrance_code.index(/-|_/).nil? &&
  purchase_id.index(/\#|_/).nil? &&
  (!amount.nil? && amount != '')
end