Module: ActiveMerchant::Billing::Integrations::EasyPay::Common

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

Instance Method Summary collapse

Instance Method Details

#generate_signature(type) ⇒ Object



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

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



26
27
28
29
30
31
32
33
34
35
# File 'lib/active_merchant/billing/integrations/easy_pay/common.rb', line 26

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

#request_signature_stringObject



17
18
19
20
21
22
23
24
# File 'lib/active_merchant/billing/integrations/easy_pay/common.rb', line 17

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