Class: OffsitePayments::Integrations::Verkkomaksut::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Verkkomaksut::Notification
- Defined in:
- lib/offsite_payments/integrations/verkkomaksut.rb
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
-
#acknowledge(authcode = nil) ⇒ Object
Acknowledges the payment.
-
#complete? ⇒ Boolean
Is the payment complete or not.
-
#method ⇒ Object
Payment method used.
-
#order_id ⇒ Object
Order id.
-
#received_at ⇒ Object
When was this payment received by the client.
-
#security_key ⇒ Object
Security key got from Verkkomaksut.
-
#status ⇒ Object
Another way of asking the payment status.
Methods inherited from Notification
#amount, #empty!, #gross, #gross_cents, #initialize, #iso_currency, #test?, #valid_sender?
Constructor Details
This class inherits a constructor from OffsitePayments::Notification
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
Acknowledges the payment. If the authcodes match, returns true.
128 129 130 131 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 128 def acknowledge(authcode = nil) return_authcode = [params["ORDER_NUMBER"], params["TIMESTAMP"], params["PAID"], params["METHOD"], authcode].join("|") Digest::MD5.hexdigest(return_authcode).upcase == params["RETURN_AUTHCODE"] end |
#complete? ⇒ Boolean
Is the payment complete or not. Verkkomaksut only has two statuses: random string or 0000000000 which means pending
94 95 96 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 94 def complete? params['PAID'] != "0000000000" end |
#method ⇒ Object
Payment method used
104 105 106 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 104 def method params['METHOD'] end |
#order_id ⇒ Object
Order id
99 100 101 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 99 def order_id params['ORDER_NUMBER'] end |
#received_at ⇒ Object
When was this payment received by the client.
109 110 111 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 109 def received_at params['TIMESTAMP'] end |
#security_key ⇒ Object
Security key got from Verkkomaksut
114 115 116 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 114 def security_key params['RETURN_AUTHCODE'] end |
#status ⇒ Object
Another way of asking the payment status
119 120 121 122 123 124 125 |
# File 'lib/offsite_payments/integrations/verkkomaksut.rb', line 119 def status if complete? "PAID" else "PENDING" end end |