Class: ActiveMerchant::Billing::Integrations::Verkkomaksut::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Verkkomaksut::Notification
- Defined in:
- lib/active_merchant/billing/integrations/verkkomaksut/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
-
#acknowledge(authcode) ⇒ Object
Acknowldges 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, #test?, #valid_sender?
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification
Instance Method Details
#acknowledge(authcode) ⇒ Object
Acknowldges the payment. If the authcodes match, returns true.
44 45 46 47 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 44 def acknowledge(authcode) 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
10 11 12 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 10 def complete? params['PAID'] != "0000000000" end |
#method ⇒ Object
Payment method used
20 21 22 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 20 def method params['METHOD'] end |
#order_id ⇒ Object
Order id
15 16 17 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 15 def order_id params['ORDER_NUMBER'] end |
#received_at ⇒ Object
When was this payment received by the client.
25 26 27 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 25 def received_at params['TIMESTAMP'] end |
#security_key ⇒ Object
Security key got from Verkkomaksut
30 31 32 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 30 def security_key params['RETURN_AUTHCODE'] end |
#status ⇒ Object
Another way of asking the payment status
35 36 37 38 39 40 41 |
# File 'lib/active_merchant/billing/integrations/verkkomaksut/notification.rb', line 35 def status if complete? "PAID" else "PENDING" end end |