Module: ActiveMerchant::Billing::Integrations::Ogone

Defined in:
lib/active_merchant_ogone.rb,
lib/active_merchant_ogone/helper.rb,
lib/active_merchant_ogone/notification.rb

Defined Under Namespace

Classes: Helper, Notification

Class Method Summary collapse

Class Method Details

.inbound_message_signature(fields, signature) ⇒ Object



40
41
42
43
44
45
# File 'lib/active_merchant_ogone.rb', line 40

def self.inbound_message_signature(fields, signature)
  keys = %w( orderID currency amount PM ACCEPTANCE STATUS CARDNO PAYID NCERROR BRAND )
  datastring = keys.inject('') { |m,key| m.concat(fields[key].to_s) ; m }
  datastring.concat(signature)
  Digest::SHA1.hexdigest(datastring).upcase
end

.notification(post, options = {}) ⇒ Object



29
30
31
# File 'lib/active_merchant_ogone.rb', line 29

def self.notification(post, options={})
  Notification.new(post, options={})
end

.outbound_message_signature(fields, signature) ⇒ Object



33
34
35
36
37
38
# File 'lib/active_merchant_ogone.rb', line 33

def self.outbound_message_signature(fields, signature)
  keys = %w( orderID amount currency PSPID )
  datastring = keys.inject('') { |m,key| m.concat(fields[key].to_s) ; m }
  datastring.concat(signature)
  Digest::SHA1.hexdigest(datastring).upcase
end

.service_urlObject



19
20
21
22
23
24
25
26
27
# File 'lib/active_merchant_ogone.rb', line 19

def self.service_url
  mode = ActiveMerchant::Billing::Base.integration_mode
  case mode
  when :production then self.live_service_url
  when :test       then self.test_service_url
  else
    raise StandardError, "Integration mode set to an invalid value: #{mode}"
  end
end