Module: OffsitePayments::Integrations::Pay2goCvs

Defined in:
lib/offsite_payments/integrations/pay2go_cvs.rb

Defined Under Namespace

Classes: Fetcher, Helper, Notification

Class Method Summary collapse

Class Method Details

.fetch_url_encode_data(fields) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 37

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::Pay2goCvs.hash_key}&#{raw_data}&HashIV=#{OffsitePayments::Integrations::Pay2goCvs.hash_iv}"

  sha256 = Digest::SHA256.new
  sha256.update hash_raw_data.force_encoding("utf-8")
  sha256.hexdigest.upcase
end

.gateway_urlObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 15

def self.gateway_url
  mode = OffsitePayments.mode
  case mode
  when :production
    'https://core.spgateway.com/API/gateway/cvs'
  when :development
    'https://ccore.spgateway.com/API/gateway/cvs'
  when :test
    'https://ccore.spgateway.com/API/gateway/cvs'
  else
    raise StandardError, "Integration mode set to an invalid value: #{mode}"
  end
end

.notification(post) ⇒ Object



29
30
31
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 29

def self.notification(post)
  Notification.new(post)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



33
34
35
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 33

def self.setup
  yield(self)
end