Module: ActiveMerchant::Billing::Integrations::Paxum::Common

Included in:
Helper, Notification
Defined in:
lib/active_merchant/billing/integrations/paxum/common.rb

Instance Method Summary collapse

Instance Method Details

#generate_signatureObject



17
18
19
# File 'lib/active_merchant/billing/integrations/paxum/common.rb', line 17

def generate_signature
  Digest::MD5.hexdigest(generate_signature_string)
end

#generate_signature_stringObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/active_merchant/billing/integrations/paxum/common.rb', line 6

def generate_signature_string
  @raw_post.slice!(0) if @raw_post.starts_with?("&")
  @raw_post = CGI.unescape(@raw_post)
  @raw_post = "&#{@raw_post}" unless @raw_post.starts_with?("&")
  arr = @raw_post.split('&')
  arr.delete(arr.last)
  data = arr.join('&')

  (data + secret)
end