Sha256: b5b62bcc0784d87a5cdf36e45ca53a4139f7c3937e594d6117e344cdaf8b4755

Contents?: true

Size: 668 Bytes

Versions: 15

Compression:

Stored size: 668 Bytes

Contents

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

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

    def provider
      integration_options = options
      ActiveMerchant::Billing::Base.integration_mode = integration_options[:server].to_sym
      integration_options = options
      integration_options[:test] = true if integration_options[:test_mode]
      @provider ||= provider_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

15 entries across 15 versions & 1 rubygems

Version Path
spree_core-2.0.13 app/models/spree/billing_integration.rb
spree_core-2.0.12 app/models/spree/billing_integration.rb
spree_core-2.0.11 app/models/spree/billing_integration.rb
spree_core-2.0.10 app/models/spree/billing_integration.rb
spree_core-2.0.9 app/models/spree/billing_integration.rb
spree_core-2.0.8 app/models/spree/billing_integration.rb
spree_core-2.0.7 app/models/spree/billing_integration.rb
spree_core-2.0.6 app/models/spree/billing_integration.rb
spree_core-2.0.5 app/models/spree/billing_integration.rb
spree_core-2.0.4 app/models/spree/billing_integration.rb
spree_core-2.0.3 app/models/spree/billing_integration.rb
spree_core-2.0.2 app/models/spree/billing_integration.rb
spree_core-2.0.1 app/models/spree/billing_integration.rb
spree_core-2.0.0 app/models/spree/billing_integration.rb
spree_core-2.0.0.rc1 app/models/spree/billing_integration.rb