Class: Sisow::Payment
- Inherits:
-
Object
- Object
- Sisow::Payment
- Defined in:
- lib/sisow/payment.rb
Direct Known Subclasses
BancontactPayment, CreditCardPayment, IdealPayment, PaypalPayment, SofortPayment
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#callback_url ⇒ Object
Returns the value of attribute callback_url.
-
#cancel_url ⇒ Object
Returns the value of attribute cancel_url.
-
#description ⇒ Object
Returns the value of attribute description.
-
#entrance_code ⇒ Object
Returns the value of attribute entrance_code.
-
#issuer_id ⇒ Object
Returns the value of attribute issuer_id.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
-
#merchant_key ⇒ Object
Returns the value of attribute merchant_key.
-
#notify_url ⇒ Object
Returns the value of attribute notify_url.
-
#purchase_id ⇒ Object
Returns the value of attribute purchase_id.
-
#return_url ⇒ Object
Returns the value of attribute return_url.
Instance Method Summary collapse
- #ideal? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Payment
constructor
A new instance of Payment.
- #payment_method ⇒ Object
- #payment_url ⇒ Object
- #shop_id ⇒ Object
- #transaction_id ⇒ Object
- #valid? ⇒ Boolean
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
#amount ⇒ Object
Returns the value of attribute amount.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def amount @amount end |
#callback_url ⇒ Object
Returns the value of attribute callback_url.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def callback_url @callback_url end |
#cancel_url ⇒ Object
Returns the value of attribute cancel_url.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def cancel_url @cancel_url end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def description @description end |
#entrance_code ⇒ Object
Returns the value of attribute entrance_code.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def entrance_code @entrance_code end |
#issuer_id ⇒ Object
Returns the value of attribute issuer_id.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def issuer_id @issuer_id end |
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def merchant_id @merchant_id end |
#merchant_key ⇒ Object
Returns the value of attribute merchant_key.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def merchant_key @merchant_key end |
#notify_url ⇒ Object
Returns the value of attribute notify_url.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def notify_url @notify_url end |
#purchase_id ⇒ Object
Returns the value of attribute purchase_id.
4 5 6 |
# File 'lib/sisow/payment.rb', line 4 def purchase_id @purchase_id end |
#return_url ⇒ Object
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
40 41 42 |
# File 'lib/sisow/payment.rb', line 40 def ideal? payment_method == 'ideal' end |
#payment_method ⇒ Object
44 |
# File 'lib/sisow/payment.rb', line 44 def payment_method; raise 'Implement me in a subclass'; end |
#payment_url ⇒ Object
22 23 24 |
# File 'lib/sisow/payment.rb', line 22 def payment_url CGI::unescape(response.issuerurl) if response.issuerurl? end |
#shop_id ⇒ Object
30 31 32 |
# File 'lib/sisow/payment.rb', line 30 def shop_id Sisow.configuration.shop_id end |
#transaction_id ⇒ Object
26 27 28 |
# File 'lib/sisow/payment.rb', line 26 def transaction_id response.trxid if response.trxid? end |
#valid? ⇒ 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 |