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.



16
17
18
19
20
# File 'lib/sisow/payment.rb', line 16

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

#merchant_idObject

Returns the value of attribute merchant_id.



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

def merchant_id
  @merchant_id
end

#merchant_keyObject

Returns the value of attribute merchant_key.



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

def merchant_key
  @merchant_key
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)


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

def ideal?
  payment_method == 'ideal'
end

#payment_methodObject



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

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

#payment_urlObject



22
23
24
# File 'lib/sisow/payment.rb', line 22

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

#shop_idObject



30
31
32
# File 'lib/sisow/payment.rb', line 30

def shop_id
  Sisow.configuration.shop_id
end

#transaction_idObject



26
27
28
# File 'lib/sisow/payment.rb', line 26

def transaction_id
  response.trxid if response.trxid?
end

#valid?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/sisow/payment.rb', line 34

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