Remove useless branch calling #void

StripeSCA is the only method with a different method signature for
`#void` but the additional parameter wasn't used. So this special case
can just be removed.
This commit is contained in:
Maikel Linke
2026-02-03 11:28:15 +11:00
parent e87965bda0
commit 2749965e73
4 changed files with 6 additions and 16 deletions

View File

@@ -84,7 +84,7 @@ module Spree
end
# NOTE: this method is required by Spree::Payment::Processing
def void(payment_intent_id, _creditcard, gateway_options)
def void(payment_intent_id, gateway_options)
payment_intent_response = Stripe::PaymentIntent.retrieve(
payment_intent_id, stripe_account: stripe_account_id
)

View File

@@ -58,16 +58,7 @@ module Spree
protect_from_connection_error do
check_environment
response = if payment_method.payment_profiles_supported?
# Gateways supporting payment profiles will need access to credit
# card object because this stores the payment profile information
# so supply the authorization itself as well as the credit card,
# rather than just the authorization code
payment_method.void(response_code, source, gateway_options)
else
# Standard ActiveMerchant void usage
payment_method.void(response_code, gateway_options)
end
response = payment_method.void(response_code, gateway_options)
record_response(response)

View File

@@ -109,7 +109,7 @@ RSpec.describe Spree::Gateway::StripeSCA, :vcr, :stripe_version do
end
it "refunds the payment" do
response = subject.void(payment_intent.id, nil, {})
response = subject.void(payment_intent.id, {})
expect(response.success?).to eq true
end
@@ -131,7 +131,7 @@ RSpec.describe Spree::Gateway::StripeSCA, :vcr, :stripe_version do
end
it "void the payment" do
response = subject.void(payment_intent.id, nil, {})
response = subject.void(payment_intent.id, {})
expect(response.success?).to eq true
end

View File

@@ -347,8 +347,7 @@ RSpec.describe Spree::Payment do
context "when profiles are supported" do
it "should call payment_enterprise.void with the payment's response_code" do
allow(payment_method).to receive(:payment_profiles_supported) { true }
expect(payment_method).to receive(:void).with('123', card,
expect(payment_method).to receive(:void).with('123',
anything).and_return(success_response)
payment.void_transaction!
end
@@ -357,7 +356,7 @@ RSpec.describe Spree::Payment do
context "when profiles are not supported" do
it "should call payment_gateway.void with the payment's response_code" do
allow(payment_method).to receive(:payment_profiles_supported) { false }
expect(payment_method).to receive(:void).with('123', card,
expect(payment_method).to receive(:void).with('123',
anything).and_return(success_response)
payment.void_transaction!
end