diff --git a/app/controllers/spree/admin/payments_controller.rb b/app/controllers/spree/admin/payments_controller.rb index 8d6fc851f3..fb06010b63 100644 --- a/app/controllers/spree/admin/payments_controller.rb +++ b/app/controllers/spree/admin/payments_controller.rb @@ -153,7 +153,7 @@ module Spree def authorize_stripe_sca_payment return unless @payment.payment_method.class == Spree::Gateway::StripeSCA - @payment.authorize! + @payment.authorize!(spree.order_path(@payment.order, only_path: false)) if @payment.cvv_response_message.present? PaymentMailer.authorize_payment(@payment).deliver raise Spree::Core::GatewayError, I18n.t('action_required') diff --git a/app/models/spree/gateway/stripe_sca.rb b/app/models/spree/gateway/stripe_sca.rb index a3ccde45b2..fa5b4d8d4a 100644 --- a/app/models/spree/gateway/stripe_sca.rb +++ b/app/models/spree/gateway/stripe_sca.rb @@ -110,7 +110,7 @@ module Spree def options_for_authorize(money, creditcard, gateway_options) options = basic_options(gateway_options) - options[:return_url] = full_checkout_path + options[:return_url] = gateway_options[:return_url] || full_checkout_path customer_id, payment_method_id = Stripe::CreditCardCloner.new(creditcard, stripe_account_id).find_or_clone diff --git a/app/models/spree/payment/processing.rb b/app/models/spree/payment/processing.rb index 36704362a8..108cb1b61d 100644 --- a/app/models/spree/payment/processing.rb +++ b/app/models/spree/payment/processing.rb @@ -23,9 +23,9 @@ module Spree end end - def authorize! + def authorize!(return_url = nil) started_processing! - gateway_action(source, :authorize, :pend) + gateway_action(source, :authorize, :pend, return_url: return_url) end def purchase! @@ -222,7 +222,7 @@ module Spree refund_amount.to_f end - def gateway_action(source, action, success_state) + def gateway_action(source, action, success_state, options = {}) protect_from_connection_error do check_environment @@ -230,7 +230,7 @@ module Spree action, (amount * 100).round, source, - gateway_options + gateway_options.merge(options) ) handle_response(response, success_state, :failure) end