Sha256: 71dde4f0ffb69dd2f59a355a8e1e964674f52a60f9d6ee5c390f592f899f3b25

Contents?: true

Size: 1.34 KB

Versions: 28

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

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

    def authorize(_money, credit_card, _options = {})
      if VALID_CCS.include? credit_card.number
        ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'A' })
      else
        ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, { message: FAILURE_MESSAGE }, test: true)
      end
    end

    def purchase(_money, credit_card, _options = {})
      if VALID_CCS.include? credit_card.number
        ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'A' })
      else
        ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, message: FAILURE_MESSAGE, test: true)
      end
    end

    def void(_response_code, options = {})
      if options[:originator].completed?
        ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
      else
        ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
solidus_core-4.2.4 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.1.5 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.1.4 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.2.3 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.1.3 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.0.4 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-3.4.6 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.0.3 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.1.2 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.2.2 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-3.4.5 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.2.1 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.2.0 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.1.1 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.0.2 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-3.4.4 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-3.3.4 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-3.3.3 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-3.4.3 app/models/spree/payment_method/simple_bogus_credit_card.rb
solidus_core-4.0.1 app/models/spree/payment_method/simple_bogus_credit_card.rb