Pull checkout-workflow-related callback methods out into the Checkout module which defines checkout state changes

This commit is contained in:
Matt-Yorkley
2023-06-07 18:49:20 +01:00
parent 760bf269ca
commit bf051fc35b
2 changed files with 15 additions and 15 deletions

View File

@@ -613,21 +613,6 @@ module Spree
self.email = user.email if user
end
def after_cancel
shipments.each(&:cancel!)
payments.checkout.each(&:void!)
OrderMailer.cancel_email(id).deliver_later if send_cancellation_email
update(payment_state: updater.update_payment_state)
end
def after_resume
shipments.each(&:resume!)
payments.void.each(&:resume!)
update(payment_state: updater.update_payment_state)
end
def use_billing?
@use_billing == true || @use_billing == 'true' || @use_billing == '1'
end

View File

@@ -151,6 +151,21 @@ module Spree
private
def after_cancel
shipments.each(&:cancel!)
payments.checkout.each(&:void!)
OrderMailer.cancel_email(id).deliver_later if send_cancellation_email
update(payment_state: updater.update_payment_state)
end
def after_resume
shipments.each(&:resume!)
payments.void.each(&:resume!)
update(payment_state: updater.update_payment_state)
end
def validate_payment_method!
return unless checkout_processing
return if payments.any?