From c209be9c1784e62d47e64f2b16728eaa50085b35 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 31 Dec 2021 14:25:47 +0000 Subject: [PATCH] Clarify params Spree::Order.to_param outputs the order *number* (not the id) when used to build URLs. This makes it a bit more explicit. --- app/controllers/payment_gateways/stripe_controller.rb | 2 +- config/routes.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/payment_gateways/stripe_controller.rb b/app/controllers/payment_gateways/stripe_controller.rb index 121c8f7d6b..cb9331f3da 100644 --- a/app/controllers/payment_gateways/stripe_controller.rb +++ b/app/controllers/payment_gateways/stripe_controller.rb @@ -33,7 +33,7 @@ module PaymentGateways require_order_authentication! session[:access_token] ||= params[:order_token] - @order = Spree::Order.find_by(number: params[:id]) || current_order + @order = Spree::Order.find_by(number: params[:order_number]) || current_order if @order authorize! :edit, @order, session[:access_token] diff --git a/config/routes.rb b/config/routes.rb index 84c1f1d370..152b9c1435 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,7 +75,7 @@ Openfoodnetwork::Application.routes.draw do get "/paypal/cancel", to: "paypal#cancel", as: :cancel_paypal get "/stripe/confirm", to: "stripe#confirm", as: :confirm_stripe - get "/stripe/authorize", to: "stripe#authorize", as: :authorize_stripe + get "/stripe/authorize/:order_number", to: "stripe#authorize", as: :authorize_stripe end constraints SplitCheckoutConstraint.new do