mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Move Order #state_changed method out into Checkout concern (alongside order states logic)
This commit is contained in:
@@ -426,19 +426,6 @@ module Spree
|
||||
restart_checkout_flow if state.in?(["payment", "confirmation"])
|
||||
end
|
||||
|
||||
def state_changed(name)
|
||||
state = "#{name}_state"
|
||||
return unless persisted?
|
||||
|
||||
old_state = __send__("#{state}_was")
|
||||
state_changes.create(
|
||||
previous_state: old_state,
|
||||
next_state: __send__(state),
|
||||
name: name,
|
||||
user_id: user_id
|
||||
)
|
||||
end
|
||||
|
||||
def shipped?
|
||||
%w(partial shipped).include?(shipment_state)
|
||||
end
|
||||
|
||||
@@ -136,6 +136,19 @@ module Spree
|
||||
)
|
||||
end
|
||||
|
||||
def state_changed(name)
|
||||
state = "#{name}_state"
|
||||
return unless persisted?
|
||||
|
||||
old_state = __send__("#{state}_was")
|
||||
state_changes.create(
|
||||
previous_state: old_state,
|
||||
next_state: __send__(state),
|
||||
name: name,
|
||||
user_id: user_id
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_payment_method!
|
||||
|
||||
Reference in New Issue
Block a user