add param to ScaAuthorize call for redirect url

This commit is contained in:
Andy Brett
2021-02-03 09:37:03 -08:00
parent 6e735739a5
commit 5f84cd9f13
2 changed files with 7 additions and 3 deletions

View File

@@ -3,6 +3,8 @@
# Provides the redirect path if a redirect to the payment gateway is needed
module Checkout
class StripeRedirect
include FullUrlHelper
def initialize(params, order)
@params = params
@order = order
@@ -12,7 +14,7 @@ module Checkout
def path
return unless stripe_payment_method?
payment = OrderManagement::Subscriptions::StripeScaPaymentAuthorize.new(@order).call!
payment = OrderManagement::Subscriptions::StripeScaPaymentAuthorize.new(@order).call!(full_checkout_path)
raise if @order.errors.any?
field_with_url(payment)

View File

@@ -3,15 +3,17 @@
module OrderManagement
module Subscriptions
class StripeScaPaymentAuthorize
include FullUrlHelper
def initialize(order)
@order = order
@payment = OrderPaymentFinder.new(@order).last_pending_payment
end
def call!
def call!(redirect_url = full_order_path(@order))
return unless @payment&.checkout?
@payment.authorize!
@payment.authorize!(redirect_url)
@order.errors.add(:base, I18n.t('authorization_failure')) unless @payment.pending?