Merge pull request #13862 from mkllnk/allow_checkout_on_gateway_error

Remove unused switch to allow checkout on failures
This commit is contained in:
David Cook
2026-01-20 12:25:03 +11:00
committed by GitHub
3 changed files with 3 additions and 15 deletions

View File

@@ -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"

View File

@@ -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!

View File

@@ -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