class OffsitePayments::Integrations::Moneybookers::Notification

Constants

FAILED_REASON_CODES

Public Instance Methods

acknowledge(authcode = nil) click to toggle source

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
# File lib/offsite_payments/integrations/moneybookers.rb, line 229
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?() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 116
def complete?
  status == 'Completed'
end
currency() click to toggle source

currency of the payment as posted by the merchant on the entry form

# File lib/offsite_payments/integrations/moneybookers.rb, line 186
def currency
  params['currency']
end
failed_reason_code() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 151
def failed_reason_code
  params['failed_reason_code']
end
gross() click to toggle source

amount of the payment as posted by the merchant on the entry form (ex. 39.60/39.6/39)

# File lib/offsite_payments/integrations/moneybookers.rb, line 191
def gross
  params['amount']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 155
def item_id
  params['transaction_id']
end
md5sig() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 176
def md5sig
  params['md5sig']
end
merchant_amount() click to toggle source

total amount of the payment in Merchants currency (ex 25.46/25.4/25)

# File lib/offsite_payments/integrations/moneybookers.rb, line 201
def merchant_amount
  params['mb_amount']
end
merchant_currency() click to toggle source

currency of mb_amount, will always be the same as the currency of the beneficiary’s account at Moneybookers.com

# File lib/offsite_payments/integrations/moneybookers.rb, line 196
def merchant_currency
  params['mb_currency']
end
merchant_id() click to toggle source

Unique ID from the merchant’s Moneybookers.com account, needed for calculatinon of md5 sig

# File lib/offsite_payments/integrations/moneybookers.rb, line 181
def merchant_id
  params['merchant_id']
end
message() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 146
def message
  return unless failed_reason_code
  FAILED_REASON_CODES[failed_reason_code]
end
payer_email() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 168
def payer_email
  params['pay_from_email']
end
received_at() click to toggle source

When was this payment received by the client.

# File lib/offsite_payments/integrations/moneybookers.rb, line 164
def received_at
  nil
end
receiver_email() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 172
def receiver_email
  params['pay_to_email']
end
secret() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 210
def secret
  @options[:credential2]
end
status() click to toggle source

‘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.

# File lib/offsite_payments/integrations/moneybookers.rb, line 125
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() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 142
def status_code
  params['status']
end
test?() click to toggle source

Was this a test transaction?

# File lib/offsite_payments/integrations/moneybookers.rb, line 206
def test?
  false
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/moneybookers.rb, line 159
def transaction_id
  params['mb_transaction_id']
end