Sha256: 4646617bb803d0f893e871cb0453487c18c1866a492bd56c3a01a14021e779ec

Contents?: true

Size: 739 Bytes

Versions: 99

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

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

      # All environments except production considered to be test
      test_server = integration_options[:server] != 'production'
      test_mode = integration_options[:test_mode]

      integration_options[:test] = (test_server || 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

99 entries across 99 versions & 1 rubygems

Version Path
solidus_core-4.4.2 app/models/spree/billing_integration.rb
solidus_core-4.4.1 app/models/spree/billing_integration.rb
solidus_core-4.4.0 app/models/spree/billing_integration.rb
solidus_core-4.3.4 app/models/spree/billing_integration.rb
solidus_core-4.2.4 app/models/spree/billing_integration.rb
solidus_core-4.1.5 app/models/spree/billing_integration.rb
solidus_core-4.3.3 app/models/spree/billing_integration.rb
solidus_core-4.3.2 app/models/spree/billing_integration.rb
solidus_core-4.1.4 app/models/spree/billing_integration.rb
solidus_core-4.3.1 app/models/spree/billing_integration.rb
solidus_core-4.3.0 app/models/spree/billing_integration.rb
solidus_core-4.2.3 app/models/spree/billing_integration.rb
solidus_core-4.1.3 app/models/spree/billing_integration.rb
solidus_core-4.0.4 app/models/spree/billing_integration.rb
solidus_core-3.4.6 app/models/spree/billing_integration.rb
solidus_core-4.0.3 app/models/spree/billing_integration.rb
solidus_core-4.1.2 app/models/spree/billing_integration.rb
solidus_core-4.2.2 app/models/spree/billing_integration.rb
solidus_core-3.4.5 app/models/spree/billing_integration.rb
solidus_core-4.2.1 app/models/spree/billing_integration.rb