Sha256: 4e040a8e4e0ed165e5b2796fc96e378caa2372ae0e7c7381e2e836b242f1f436

Contents?: true

Size: 997 Bytes

Versions: 4

Compression:

Stored size: 997 Bytes

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module EasyPay
        module Common
          def generate_signature(type)
            string = case type
                     when :request
                       request_signature_string
                     when :notify
                       notify_signature_string
                     end

            Digest::MD5.hexdigest(string)
          end

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

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

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
activemerchant-nsp-1.27.0 lib/active_merchant/billing/integrations/easy_pay/common.rb
activemerchant-1.27.0 lib/active_merchant/billing/integrations/easy_pay/common.rb
activemerchant-1.26.0 lib/active_merchant/billing/integrations/easy_pay/common.rb
activemerchant-1.25.0 lib/active_merchant/billing/integrations/easy_pay/common.rb