Module: OffsitePayments::Integrations::EasyPay::Common

Included in:
Helper, Notification
Defined in:
lib/offsite_payments/integrations/easy_pay.rb

Instance Method Summary collapse

Instance Method Details

#generate_signature(type) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/offsite_payments/integrations/easy_pay.rb', line 23

def generate_signature(type)
  string = case type
  when :request
    request_signature_string
  when :notify
    notify_signature_string
  end

  Digest::MD5.hexdigest(string)
end

#notify_signature_stringObject



43
44
45
46
47
48
49
50
51
52
# File 'lib/offsite_payments/integrations/easy_pay.rb', line 43

def notify_signature_string
  [
    params['order_mer_code'],
    params['sum'],
    params['mer_no'],
    params['card'],
    params['purch_date'],
    secret
  ].join
end

#request_signature_stringObject



34
35
36
37
38
39
40
41
# File 'lib/offsite_payments/integrations/easy_pay.rb', line 34

def request_signature_string
  [
    @fields[mappings[:account]],
    @secret,
    @fields[mappings[:order]],
    @fields[mappings[:amount]]
  ].join
end