Sha256: b4dfd95a9e9ea0e69093e50f14683243431a0be5b7ff457c8bfa2b9027ec7145

Contents?: true

Size: 981 Bytes

Versions: 29

Compression:

Stored size: 981 Bytes

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Platron
        class Helper < ActiveMerchant::Billing::Integrations::Helper
          def initialize(order, account, options = {})
            @secret_key = options.delete(:secret)
            @path = options.delete(:path)
            description = options.delete(:description)
            super
            self.add_field('pg_salt', rand(36**15).to_s(36))
            self.add_field('pg_description', description)
          end

          def form_fields
            @fields.merge('pg_sig' => Common.generate_signature(@fields, @path, @secret_key))
          end

          def params
            @fields
          end

          mapping :account, 'pg_merchant_id'
          mapping :amount, 'pg_amount'
          mapping :order, 'pg_order_id'
          mapping :description, 'pg_description'
          mapping :currency, 'pg_currency'
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
activemerchant-1.41.0 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.40.0 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.39.2 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.39.1 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.39.0 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.38.1 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.38.0 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.37.0 lib/active_merchant/billing/integrations/platron/helper.rb
activemerchant-1.36.0 lib/active_merchant/billing/integrations/platron/helper.rb