From 45eedd1e897eab315b95c6710413faf6d08c0211 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 6 Mar 2025 10:04:21 +1100 Subject: [PATCH] Simplify expresssion It's worth noting that a falsy value won't get cached (as before). But I didn't take the time to investigate if that makes a difference or not. --- app/controllers/payment_gateways/stripe_controller.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/payment_gateways/stripe_controller.rb b/app/controllers/payment_gateways/stripe_controller.rb index b49ac05e46..37167a636d 100644 --- a/app/controllers/payment_gateways/stripe_controller.rb +++ b/app/controllers/payment_gateways/stripe_controller.rb @@ -68,11 +68,8 @@ module PaymentGateways end def valid_payment_intent? - @valid_payment_intent ||= if params["payment_intent"]&.starts_with?("pi_") - order_and_payment_valid? - else - false - end + @valid_payment_intent ||= params["payment_intent"]&.starts_with?("pi_") && + order_and_payment_valid? end def order_and_payment_valid?