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

Constant Summary collapse

INBOUND_ENCRYPTED_VARIABLES =
%w(AAVADDRESS AAVCHECK AAVZIP ACCEPTANCE ALIAS AMOUNT BRAND CARDNO CCCTY SHA-OUT CN COMPLUS CURRENCY CVCCHECK DCC_COMMPERCENTAGE DCC_CONVAMOUNT DCC_CONVCCY DCC_EXCHRATE DCC_EXCHRATESOURCE DCC_EXCHRATETS DCC_INDICATOR DCC_MARGINPERCENTAGE DCC_VALIDHOUS DIGESTCARDNO ECI ED ENCCARDNO IP IPCTY NBREMAILUSAGE NBRIPUSAGE NBRIPUSAGE_ALLTX NBRUSAGE NCERROR ORDERID PAYID PM SCO_CATEGORY SCORING STATUS TRXDATE VC)

Class Method Summary collapse

Class Method Details

.inbound_message_signature(fields, signature = nil) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/active_merchant_ogone.rb', line 50

def self.inbound_message_signature(fields, signature=nil)
  signature ||= self.inbound_signature
  datastring = fields.select  {|k, v| !v.blank? && INBOUND_ENCRYPTED_VARIABLES.include?(k.upcase) }.
                      sort_by {|k, v| k.upcase }.
                      collect {|key, value| "#{key.upcase}=#{value}#{signature}"}.join
                     
  Digest::SHA1.hexdigest(datastring).upcase
end

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



37
38
39
# File 'lib/active_merchant_ogone.rb', line 37

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

.outbound_message_signature(fields, signature = nil) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/active_merchant_ogone.rb', line 41

def self.outbound_message_signature(fields, signature=nil)
  signature ||= self.outbound_signature
  datastring = fields.select {|k, v| !v.blank? }.
                      sort_by {|k, v| k.upcase }.
                      collect{|key, value| "#{key.upcase}=#{value}#{signature}"}.join
                      
  Digest::SHA1.hexdigest(datastring).upcase
end

.service_urlObject



27
28
29
30
31
32
33
34
35
# File 'lib/active_merchant_ogone.rb', line 27

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

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

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/active_merchant_ogone.rb', line 23

def self.setup
  yield(self)
end