mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
add param to ScaAuthorize call for redirect url
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user