class OffsitePayments::Integrations::QuickpayV10::Notification

credential3: private key checksum_header: QuickPay-Checksum-Sha256 request header value

Public Instance Methods

acknowledge(authcode = nil) click to toggle source

Quickpay doesn’t do acknowledgements of callback notifications Instead it provides a SHA256 checksum header

# File lib/offsite_payments/integrations/quickpay_v10.rb, line 161
def acknowledge(authcode = nil)
  generate_checksum == checksum_header
end
checksum_header() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 155
def checksum_header
  @options[:checksum_header]
end
complete?() click to toggle source

tech.quickpay.net/appendixes/errors/

# File lib/offsite_payments/integrations/quickpay_v10.rb, line 102
def complete?
  status == '20000'
end
generate_checksum() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 151
def generate_checksum
  OpenSSL::HMAC.hexdigest('sha256', @options[:credential3], @raw)
end
gross() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 118
def gross
  "%.2f" % (gross_cents / 100.0)
end
gross_cents() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 122
def gross_cents
  last_operation['amount']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 106
def item_id
  params['order_id']
end
last_operation() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 126
def last_operation
  params['operations'].last
end
parse(post) click to toggle source

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

# File lib/offsite_payments/integrations/quickpay_v10.rb, line 166
def parse(post)
  @raw = post.to_s
  @params = JSON.parse(post)
end
received_at() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 114
def received_at
  Time.iso8601(params['created_at'])
end
status() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 130
def status
  last_operation['qp_status_code'] if last_operation
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/quickpay_v10.rb, line 110
def transaction_id
  params['id']
end