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 CN COMPLUS CREATION_STATUS CURRENCY CVCCHECK DCC_COMMPERCENTAGE DCC_CONVAMOUNT DCC_CONVCCY DCC_EXCHRATE DCC_EXCHRATESOURCE DCC_EXCHRATETS DCC_INDICATOR DCC_MARGINPERCENTAGE DCC_VALIDHOURS DIGESTCARDNO ECI ED ENCCARDNO IP IPCTY NBREMAILUSAGE NBRIPUSAGE NBRIPUSAGE_ALLTX NBRUSAGE NCERROR ORDERID PAYID PM SCO_CATEGORY SCORING SHA-OUT STATUS SUBSCRIPTION_ID TRXDATE VC )

Class Method Summary collapse

Class Method Details

.inbound_message_signature(fields, signature = nil) ⇒ Object



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

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| INBOUND_ENCRYPTED_VARIABLES.index(k.upcase) }.
                      collect {|key, value| "#{key.upcase}=#{value}#{signature}"}.join
                     
  Digest::SHA1.hexdigest(datastring).upcase
end

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



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

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

.outbound_message_signature(fields, signature = nil) ⇒ Object



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

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



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

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:



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

def self.setup
  yield(self)
end