Sha256: b68095b25a48badb14ba3fdf5662b9546059ee6d34ab2233c6bfb98c312da0a6

Contents?: true

Size: 1.01 KB

Versions: 26

Compression:

Stored size: 1.01 KB

Contents

module Spree
  # Bogus Gateway that doesn't support payment profiles.
  class Gateway::BogusSimple < Gateway::Bogus
    def payment_profiles_supported?
      false
    end

    def authorize(_money, credit_card, _options = {})
      if VALID_CCS.include? credit_card.number
        ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'A' })
      else
        ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { message: 'Bogus Gateway: Forced failure' }, test: true)
      end
    end

    def purchase(_money, credit_card, _options = {})
      if VALID_CCS.include? credit_card.number
        ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'A' })
      else
        ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', message: 'Bogus Gateway: Forced failure', test: true)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
solidus_core-1.4.0.beta1 app/models/spree/gateway/bogus_simple.rb
solidus_core-1.3.1 app/models/spree/gateway/bogus_simple.rb
solidus_core-1.3.0 app/models/spree/gateway/bogus_simple.rb
solidus_core-1.3.0.rc2 app/models/spree/gateway/bogus_simple.rb
solidus_core-1.3.0.rc1 app/models/spree/gateway/bogus_simple.rb
solidus_core-1.3.0.beta1 app/models/spree/gateway/bogus_simple.rb