Sha256: 44a1b721b150c75dfc13f70bf52bdc1ba458d9cda572673c0c60fb1ca6a3726a

Contents?: true

Size: 1.26 KB

Versions: 58

Compression:

Stored size: 1.26 KB

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Robokassa
        class Helper < ActiveMerchant::Billing::Integrations::Helper
          include Common

          def initialize(order, account, options = {})
            @md5secret = options.delete(:secret)
            super
          end

          def form_fields
            @fields.merge(ActiveMerchant::Billing::Integrations::Robokassa.signature_parameter_name => generate_signature)
          end

          def main_params
            [:account, :amount, :order].map {|key| @fields[mappings[key]]}
          end

          def params
            @fields
          end

          def secret
            @md5secret
          end

          def method_missing(method_id, *args)
            method_id = method_id.to_s.gsub(/=$/, '')

            # support for robokassa custom parameters
            if method_id =~ /^shp/
              add_field method_id, args.last
            end

            super
          end

          mapping :account, 'MrchLogin'
          mapping :amount, 'OutSum'
          mapping :currency, 'IncCurrLabel'
          mapping :order, 'InvId'
          mapping :description, 'Desc'
          mapping :email, 'Email'
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 5 rubygems

Version Path
activemerchant-1.29.3 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.29.2 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.29.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
jelaniharris-activemerchant-1.29.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.29.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-nsp-1.27.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.28.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.27.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.26.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.25.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
jelaniharris-activemerchant-1.24.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.24.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
tlconnor-activemerchant-1.23.3 lib/active_merchant/billing/integrations/robokassa/helper.rb
tlconnor-activemerchant-1.23.2 lib/active_merchant/billing/integrations/robokassa/helper.rb
tlconnor-activemerchant-1.23.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
tlconnor-activemerchant-1.23.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.23.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.22.0 lib/active_merchant/billing/integrations/robokassa/helper.rb