mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-22 00:57:26 +00:00
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:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user