Class: ActiveMerchant::Billing::Integrations::Moneybookers::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Moneybookers::Notification
- Includes:
- PostsData
- Defined in:
- lib/active_merchant/billing/integrations/moneybookers/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
-
#acknowledge(secret = '') ⇒ Object
Acknowledge the transaction to MoneyBooker.
-
#complete? ⇒ Boolean
was the transaction comlete?.
-
#currency ⇒ Object
currency of mb_amount, will always be the same as the currency of the beneficiary’s account at Moneybookers.com.
-
#gross ⇒ Object
total amount of the payment in Merchants currency (ex 25.46/25.4/25).
- #item_id ⇒ Object
- #md5sig ⇒ Object
-
#merchant_id ⇒ Object
Unique ID from the merchant’s Moneybookers.com account, needed for calculatinon of md5 sig.
- #payer_email ⇒ Object
-
#posted_amount ⇒ Object
amount of the payment as posted by the merchant on the entry form (ex. 39.60/39.6/39).
-
#posted_currency ⇒ Object
currency of the payment as posted by the merchant on the entry form.
-
#received_at ⇒ Object
When was this payment received by the client.
- #receiver_email ⇒ Object
- #status ⇒ Object
-
#test? ⇒ Boolean
Was this a test transaction?.
- #transaction_id ⇒ Object
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Methods inherited from Notification
#amount, #empty!, #gross_cents, #initialize, #valid_sender?
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification
Instance Method Details
#acknowledge(secret = '') ⇒ Object
Acknowledge the transaction to MoneyBooker. This method has to be called after a new apc arrives. It will verify that all the information we received is correct and will return a ok or a fail.
Example:
def ipn
notify = Moneybookers::Notification.new(request.raw_post)
if notify.acknowledge('secretpass')
... process order ... if notify.complete?
else
... log possible hacking attempt ...
end
93 94 95 96 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 93 def acknowledge(secret = '') fields = [merchant_id, transaction_id, Digest::MD5.hexdigest(secret).upcase, gross, currency, status].join md5sig == Digest::MD5.hexdigest(fields).upcase end |
#complete? ⇒ Boolean
was the transaction comlete?
12 13 14 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 12 def complete? status == "2" end |
#currency ⇒ Object
currency of mb_amount, will always be the same as the currency of the beneficiary’s account at Moneybookers.com
55 56 57 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 55 def currency params['mb_currency'] end |
#gross ⇒ Object
total amount of the payment in Merchants currency (ex 25.46/25.4/25)
60 61 62 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 60 def gross params['mb_amount'] end |
#item_id ⇒ Object
20 21 22 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 20 def item_id nil end |
#md5sig ⇒ Object
45 46 47 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 45 def md5sig params['md5sig'] end |
#merchant_id ⇒ Object
Unique ID from the merchant’s Moneybookers.com account, needed for calculatinon of md5 sig
50 51 52 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 50 def merchant_id params['merchant_id'] end |
#payer_email ⇒ Object
37 38 39 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 37 def payer_email params['pay_from_email'] end |
#posted_amount ⇒ Object
amount of the payment as posted by the merchant on the entry form (ex. 39.60/39.6/39)
70 71 72 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 70 def posted_amount params['amount'] end |
#posted_currency ⇒ Object
currency of the payment as posted by the merchant on the entry form
65 66 67 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 65 def posted_currency params['currency'] end |
#received_at ⇒ Object
When was this payment received by the client.
33 34 35 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 33 def received_at nil end |
#receiver_email ⇒ Object
41 42 43 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 41 def receiver_email params['pay_to_email'] end |
#status ⇒ Object
16 17 18 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 16 def status params['status'] end |
#test? ⇒ Boolean
Was this a test transaction?
75 76 77 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 75 def test? false end |
#transaction_id ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/active_merchant/billing/integrations/moneybookers/notification.rb', line 24 def transaction_id if params.has_key?("transaction_id") params['transaction_id'] else params['mb_transaction_id'] end end |