Sha256: 745bc65596de6c03bc313a8b982c9efe322d4f7352d4ef5e6519ccdc92cc1990

Contents?: true

Size: 629 Bytes

Versions: 17

Compression:

Stored size: 629 Bytes

Contents

module Spree
  class BillingIntegration < PaymentMethod
    validates :name, presence: true

    preference :server, :string, default: 'test'
    preference :test_mode, :boolean, default: true

    def gateway
      integration_options = options
      ActiveMerchant::Billing::Base.integration_mode = integration_options[:server].to_sym
      integration_options[:test] = true if integration_options[:test_mode]
      @gateway ||= gateway_class.new(integration_options)
    end

    def options
      options_hash = {}
      preferences.each { |key, value| options_hash[key.to_sym] = value }
      options_hash
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
solidus_core-2.5.2 app/models/spree/billing_integration.rb
solidus_core-2.5.1 app/models/spree/billing_integration.rb
solidus_core-2.5.0 app/models/spree/billing_integration.rb
solidus_core-2.5.0.rc1 app/models/spree/billing_integration.rb
solidus_core-2.5.0.beta2 app/models/spree/billing_integration.rb
solidus_core-2.5.0.beta1 app/models/spree/billing_integration.rb
solidus_core-2.4.2 app/models/spree/billing_integration.rb
solidus_core-2.3.1 app/models/spree/billing_integration.rb
solidus_core-2.4.1 app/models/spree/billing_integration.rb
solidus_core-2.4.0 app/models/spree/billing_integration.rb
solidus_core-2.4.0.rc1 app/models/spree/billing_integration.rb
solidus_core-2.4.0.beta1 app/models/spree/billing_integration.rb
solidus_core-2.3.0 app/models/spree/billing_integration.rb
solidus_core-2.3.0.rc3 app/models/spree/billing_integration.rb
solidus_core-2.3.0.rc2 app/models/spree/billing_integration.rb
solidus_core-2.3.0.rc1 app/models/spree/billing_integration.rb
solidus_core-2.3.0.beta1 app/models/spree/billing_integration.rb