Class: OffsitePayments::Integrations::Moneybookers::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Moneybookers::Notification
- Defined in:
- lib/offsite_payments/integrations/moneybookers.rb
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
-
#acknowledge(authcode = nil) ⇒ Object
Acknowledge the transaction to MoneyBooker.
- #complete? ⇒ Boolean
-
#currency ⇒ Object
currency of the payment as posted by the merchant on the entry form.
-
#gross ⇒ Object
amount of the payment as posted by the merchant on the entry form (ex. 39.60/39.6/39).
- #item_id ⇒ Object
- #md5sig ⇒ Object
-
#merchant_amount ⇒ Object
total amount of the payment in Merchants currency (ex 25.46/25.4/25).
-
#merchant_currency ⇒ Object
currency of mb_amount, will always be the same as the currency of the beneficiary’s account at Moneybookers.com.
-
#merchant_id ⇒ Object
Unique ID from the merchant’s Moneybookers.com account, needed for calculatinon of md5 sig.
- #payer_email ⇒ Object
-
#received_at ⇒ Object
When was this payment received by the client.
- #receiver_email ⇒ Object
- #secret ⇒ Object
-
#status ⇒ Object
‘2’ Processed – This status is sent when the transaction is processed and the funds have been received on your Moneybookers account.
- #status_code ⇒ Object
-
#test? ⇒ Boolean
Was this a test transaction?.
- #transaction_id ⇒ Object
Methods inherited from Notification
#amount, #empty!, #gross_cents, #initialize, #iso_currency, #valid_sender?
Constructor Details
This class inherits a constructor from OffsitePayments::Notification
Instance Method Details
#acknowledge(authcode = nil) ⇒ 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. The secret (second credential) has to be provided in the parameter :credential2 when instantiating the Notification object.
Example:
def ipn
notify = Moneybookers.notification(request.raw_post, :credential2 => 'secret')
if notify.acknowledge
... process order ... if notify.complete?
else
... log possible hacking attempt ...
end
192 193 194 195 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 192 def acknowledge(authcode = nil) fields = [merchant_id, item_id, Digest::MD5.hexdigest(secret.to_s).upcase, merchant_amount, merchant_currency, status_code].join md5sig == Digest::MD5.hexdigest(fields).upcase end |
#complete? ⇒ Boolean
88 89 90 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 88 def complete? status == 'Completed' end |
#currency ⇒ Object
currency of the payment as posted by the merchant on the entry form
149 150 151 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 149 def currency params['currency'] end |
#gross ⇒ Object
amount of the payment as posted by the merchant on the entry form (ex. 39.60/39.6/39)
154 155 156 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 154 def gross params['amount'] end |
#item_id ⇒ Object
118 119 120 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 118 def item_id params['transaction_id'] end |
#md5sig ⇒ Object
139 140 141 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 139 def md5sig params['md5sig'] end |
#merchant_amount ⇒ Object
total amount of the payment in Merchants currency (ex 25.46/25.4/25)
164 165 166 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 164 def merchant_amount params['mb_amount'] end |
#merchant_currency ⇒ Object
currency of mb_amount, will always be the same as the currency of the beneficiary’s account at Moneybookers.com
159 160 161 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 159 def merchant_currency params['mb_currency'] end |
#merchant_id ⇒ Object
Unique ID from the merchant’s Moneybookers.com account, needed for calculatinon of md5 sig
144 145 146 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 144 def merchant_id params['merchant_id'] end |
#payer_email ⇒ Object
131 132 133 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 131 def payer_email params['pay_from_email'] end |
#received_at ⇒ Object
When was this payment received by the client.
127 128 129 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 127 def received_at nil end |
#receiver_email ⇒ Object
135 136 137 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 135 def receiver_email params['pay_to_email'] end |
#secret ⇒ Object
173 174 175 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 173 def secret @options[:credential2] end |
#status ⇒ Object
‘2’ Processed – This status is sent when the transaction is processed and the funds have been received on your Moneybookers account. ‘0’ Pending – This status is sent when the customers pays via the pending bank transfer option. Such transactions will auto-process IF the bank transfer is received by Moneybookers. We strongly recommend that you do NOT process the order/transaction in your system upon receipt of a pending status from Moneybookers. ‘-1’ Cancelled – Pending transactions can either be cancelled manually by the sender in their online account history or they will auto-cancel after 14 days if still pending. ‘-2’ Failed – This status is sent when the customer tries to pay via Credit Card or Direct Debit but our provider declines the transaction. If you do not accept Credit Card or Direct Debit payments via Moneybookers (see page 17) then you will never receive the failed status. ‘-3’ Chargeback – This status could be received only if your account is configured to receive chargebacks. If this is the case, whenever a chargeback is received by Moneybookers, a -3 status will be posted on the status_url for the reversed transaction.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 97 def status case status_code when '2' 'Completed' when '0' 'Pending' when '-1' 'Cancelled' when '-2' 'Failed' when '-3' 'Reversed' else 'Error' end end |
#status_code ⇒ Object
114 115 116 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 114 def status_code params['status'] end |
#test? ⇒ Boolean
Was this a test transaction?
169 170 171 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 169 def test? false end |
#transaction_id ⇒ Object
122 123 124 |
# File 'lib/offsite_payments/integrations/moneybookers.rb', line 122 def transaction_id params['mb_transaction_id'] end |