mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Move shipping method id setting code to OrderWorkflow service
This commit is contained in:
@@ -175,9 +175,7 @@ class CheckoutController < Spree::StoreController
|
||||
return if redirect_to_payment_gateway
|
||||
end
|
||||
|
||||
@order.select_shipping_method(shipping_method_id) if @order.state == "delivery"
|
||||
|
||||
next if OrderWorkflow.new(@order).next
|
||||
next if OrderWorkflow.new(@order).next({ shipping_method_id: shipping_method_id })
|
||||
|
||||
return update_failed
|
||||
end
|
||||
|
||||
@@ -13,9 +13,13 @@ class OrderWorkflow
|
||||
advance_order!(advance_order_options)
|
||||
end
|
||||
|
||||
def next
|
||||
def next(options = {})
|
||||
tries ||= 3
|
||||
order.next
|
||||
result = order.next
|
||||
|
||||
after_transition_hook(options)
|
||||
|
||||
result
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
retry unless (tries -= 1).zero?
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user