mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
Patching up our checkout flow so we don't try to create shipments before we have valid shipping addresses
This commit is contained in:
@@ -11,31 +11,27 @@ class Shop::CheckoutController < Spree::CheckoutController
|
||||
end
|
||||
|
||||
def update
|
||||
begin
|
||||
if @order.update_attributes(params[:order])
|
||||
fire_event('spree.checkout.update')
|
||||
if @order.update_attributes(params[:order])
|
||||
fire_event('spree.checkout.update')
|
||||
|
||||
while @order.state != "complete"
|
||||
if @order.next
|
||||
state_callback(:after)
|
||||
else
|
||||
flash[:error] = t(:payment_processing_failed)
|
||||
respond_with @order, location: main_app.shop_checkout_path
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if @order.state == "complete" || @order.completed?
|
||||
flash.notice = t(:order_processed_successfully)
|
||||
flash[:commerce_tracking] = "nothing special"
|
||||
respond_with(@order, :location => order_path(@order))
|
||||
while @order.state != "complete"
|
||||
if @order.next
|
||||
state_callback(:after)
|
||||
else
|
||||
flash[:error] = t(:payment_processing_failed)
|
||||
respond_with @order, location: main_app.shop_checkout_path
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if @order.state == "complete" || @order.completed?
|
||||
flash.notice = t(:order_processed_successfully)
|
||||
flash[:commerce_tracking] = "nothing special"
|
||||
respond_with(@order, :location => order_path(@order))
|
||||
else
|
||||
respond_with @order, location: main_app.shop_checkout_path
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
else
|
||||
respond_with @order, location: main_app.shop_checkout_path
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user