From bac123f223452fe8212762bd1d54118b382bc9cc Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 19 Jan 2026 14:35:54 +1100 Subject: [PATCH] Remove unused switch to allow checkout on failures The inherited payment logic is complicated enough. Removing this dead code makes it slightly simpler. --- app/models/spree/app_configuration.rb | 1 - app/models/spree/order.rb | 9 ++------- spec/models/spree/order_spec.rb | 8 +------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/models/spree/app_configuration.rb b/app/models/spree/app_configuration.rb index a3069b3b02..ee10ba1b74 100644 --- a/app/models/spree/app_configuration.rb +++ b/app/models/spree/app_configuration.rb @@ -31,7 +31,6 @@ module Spree preference :admin_products_per_page, :integer, default: 10 # Should only be true if you don't need to track inventory preference :allow_backorder_shipping, :boolean, default: false - preference :allow_checkout_on_gateway_error, :boolean, default: false preference :allow_guest_checkout, :boolean, default: true preference :currency_decimal_mark, :string, default: "." preference :currency_symbol_position, :string, default: "before" diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index 160041bfff..70e568b867 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -437,18 +437,13 @@ module Spree # # Returns: # - true if all pending_payments processed successfully - # - true if a payment failed, ie. raised a GatewayError - # which gets rescued and converted to TRUE when - # :allow_checkout_gateway_error is set to true # - false if a payment failed, ie. raised a GatewayError - # which gets rescued and converted to FALSE when - # :allow_checkout_on_gateway_error is set to false + # which gets rescued and converted to FALSE # def process_payments! process_each_payment(&:process!) rescue Core::GatewayError => e - result = !!Spree::Config[:allow_checkout_on_gateway_error] - errors.add(:base, e.message) && (return result) + errors.add(:base, e.message) && (return false) end def process_payments_offline! diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 1baabc5878..be8bf6019c 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -299,13 +299,7 @@ RSpec.describe Spree::Order do context "when a payment raises a GatewayError" do before { expect(payment).to receive(:process!).and_raise(Spree::Core::GatewayError) } - it "returns true when configured to allow checkout on gateway failures" do - Spree::Config.set allow_checkout_on_gateway_error: true - expect(order.process_payments!).to be_truthy - end - - it "returns false when not configured to allow checkout on gateway failures" do - Spree::Config.set allow_checkout_on_gateway_error: false + it "returns false" do expect(order.process_payments!).to be_falsy end end