mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix Rubocop warnings and tidy up
This commit is contained in:
@@ -4,9 +4,9 @@ module OrderStockCheck
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def ensure_sufficient_stock_lines
|
||||
if @order.insufficient_stock_lines.present?
|
||||
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
|
||||
redirect_to main_app.cart_path
|
||||
end
|
||||
return true if @order.insufficient_stock_lines.blank?
|
||||
|
||||
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
|
||||
redirect_to main_app.cart_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +60,8 @@ Spree::PaypalController.class_eval do
|
||||
@order = current_order || raise(ActiveRecord::RecordNotFound)
|
||||
# At this point the user has come back from the Paypal form, and we get one
|
||||
# last chance to interact with the payment process before the money moves...
|
||||
ensure_sufficient_stock_lines
|
||||
return unless ensure_sufficient_stock_lines
|
||||
|
||||
@order.payments.create!({
|
||||
source: Spree::PaypalExpressCheckout.create({
|
||||
token: params[:token],
|
||||
|
||||
Reference in New Issue
Block a user