mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Memoize Checkout#valid_payment_intent_provided?
This commit is contained in:
@@ -148,12 +148,14 @@ class CheckoutController < ::BaseController
|
||||
end
|
||||
|
||||
def valid_payment_intent_provided?
|
||||
return false unless params["payment_intent"]&.starts_with?("pi_")
|
||||
@valid_payment_intent_provided ||= begin
|
||||
return false unless params["payment_intent"]&.starts_with?("pi_")
|
||||
|
||||
last_payment = OrderPaymentFinder.new(@order).last_payment
|
||||
@order.state == "payment" &&
|
||||
last_payment&.state == "requires_authorization" &&
|
||||
last_payment&.response_code == params["payment_intent"]
|
||||
last_payment = OrderPaymentFinder.new(@order).last_payment
|
||||
@order.state == "payment" &&
|
||||
last_payment&.state == "requires_authorization" &&
|
||||
last_payment&.response_code == params["payment_intent"]
|
||||
end
|
||||
end
|
||||
|
||||
def handle_redirect_from_stripe
|
||||
|
||||
Reference in New Issue
Block a user