class OffsitePayments::Integrations::WirecardCheckoutPage::Notification

Public Instance Methods

acknowledge() click to toggle source

Acknowledge the transaction to WirecardCheckoutPage. This method has to be called after a new apc arrives. WirecardCheckoutPage will verify that all the information we received are correct and will return a ok or a fail.

Example:

def ipn
  notify = WirecardCheckoutPageNotification.new(request.raw_post, options)

  if notify.acknowledge
    ... process order ... if notify.complete?
  else
    ... log possible hacking attempt ...
  end
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 304
def acknowledge
  verify_response(params, @options[:secret])
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 244
def complete?
  @paymentstate == 'SUCCESS'
end
gross() click to toggle source

the money amount we received in X.2 decimal.

# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 262
def gross
  params['amount']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 248
def item_id
  params['xActiveMerchantOrderId']
end
method_missing(method_id, *args) click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 316
def method_missing(method_id, *args)
  return params[method_id.to_s] if params.has_key?(method_id.to_s)
end
received_at() click to toggle source

When was this payment received by the client.

# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 257
def received_at
  nil
end
response(umessage = nil) click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 308
def response(umessage = nil)
  if @message || umessage
    '<QPAY-CONFIRMATION-RESPONSE result="NOK" message="' + CGI.escapeHTML(umessage ? umessage : @message) + '"/>'
  else
    '<QPAY-CONFIRMATION-RESPONSE result="OK"/>'
  end
end
status() click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 271
def status
  case @paymentstate
    when 'SUCCESS'
      'Completed'
    when 'PENDING'
      'Pending'
    when 'CANCEL'
      'Cancelled'
    when 'FAILURE'
      'Failed'
    else
      'Error'
  end
end
status_code() click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 286
def status_code
  @paymentstate
end
test?() click to toggle source

Was this a test transaction?

# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 267
def test?
  false
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 252
def transaction_id
  params['orderNumber']
end

Private Instance Methods

parse(post) click to toggle source

Take the posted data and move the relevant data into a hash

# File lib/offsite_payments/integrations/wirecard_checkout_page.rb, line 323
def parse(post)
  @raw = post.to_s
  for line in @raw.split('&')
    key, value = *line.scan( %r{^([A-Za-z0-9_.]+)\=(.*)$} ).flatten
    params[key] = CGI.unescape(value)
  end
end