mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Extract before_payment_state? method
This commit is contained in:
@@ -316,7 +316,7 @@ module Spree
|
||||
# Creates new tax charges if there are any applicable rates. If prices already
|
||||
# include taxes then price adjustments are created instead.
|
||||
def create_tax_charge!
|
||||
return if state.in?(["cart", "address", "delivery"])
|
||||
return if before_payment_state?
|
||||
|
||||
clear_legacy_taxes!
|
||||
|
||||
@@ -574,6 +574,10 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def before_payment_state?
|
||||
state.in?(["cart", "address", "delivery"])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def deliver_order_confirmation_email
|
||||
|
||||
@@ -24,13 +24,13 @@ class OrderWorkflow
|
||||
end
|
||||
|
||||
def advance_to_payment
|
||||
return unless order.state.in? ["cart", "address", "delivery"]
|
||||
return unless order.before_payment_state?
|
||||
|
||||
advance_to_state("payment", advance_order_options)
|
||||
end
|
||||
|
||||
def advance_checkout(options = {})
|
||||
advance_to = order.state.in?(["cart", "address", "delivery"]) ? "payment" : "confirmation"
|
||||
advance_to = order.before_payment_state? ? "payment" : "confirmation"
|
||||
|
||||
advance_to_state(advance_to, advance_order_options.merge(options))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user