module OffsitePayments::Integrations::Pay2go

Public Class Methods

fetch_url_encode_data(fields) click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 34
def self.fetch_url_encode_data(fields)
  check_fields = [:"Amt", :"MerchantID", :"MerchantOrderNo", :"TimeStamp", :"Version"]
  raw_data = fields.sort.map{|field, value|
    "#{field}=#{value}" if check_fields.include?(field.to_sym)
  }.compact.join('&')

  hash_raw_data = "HashKey=#{OffsitePayments::Integrations::Pay2go.hash_key}&#{raw_data}&HashIV=#{OffsitePayments::Integrations::Pay2go.hash_iv}"

  sha256 = Digest::SHA256.new
  sha256.update hash_raw_data.force_encoding("utf-8")
  sha256.hexdigest.upcase
end
notification(post) click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 26
def self.notification(post)
  Notification.new(post)
end
service_url() click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 12
def self.service_url
  mode = OffsitePayments.mode
  case mode
  when :production
    'https://core.spgateway.com/MPG/mpg_gateway'
  when :development
    'https://ccore.spgateway.com/MPG/mpg_gateway'
  when :test
    'https://ccore.spgateway.com/MPG/mpg_gateway'
  else
    raise StandardError, "Integration mode set to an invalid value: #{mode}"
  end
end
setup() { |self| ... } click to toggle source
# File lib/offsite_payments/integrations/pay2go.rb, line 30
def self.setup
  yield(self)
end