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
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/integrations/robokassa/helper.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/integrations/robokassa/helper.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/integrations/robokassa/helper.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/integrations/robokassa/helper.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.43.3 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.43.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.43.0 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.9 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.8 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.7 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.6 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.5 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.4 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.3 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.2 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.1 lib/active_merchant/billing/integrations/robokassa/helper.rb
activemerchant-1.42.0 lib/active_merchant/billing/integrations/robokassa/helper.rb