Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce and deprecate Order#deliver_order_confirmation_email #3485

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,13 @@ def finalize!
touch :completed_at

Spree::Event.fire 'order_finalized', order: self

if method(:deliver_order_confirmation_email).owner != self.class
Spree::Deprecation.warn \
"deliver_order_confirmation_email has been deprecated and moved to " \
"Spree::MailerSubscriber#order_finalized, please move there any customizations.",
caller(1)
end
end

def fulfill!
Expand All @@ -445,6 +452,16 @@ def fulfill!
save!
end

def deliver_order_confirmation_email
Spree::Deprecation.warn \
"deliver_order_confirmation_email has been deprecated and moved to " \
"Spree::MailerSubscriber#order_finalized.",
caller(1)

Spree::Config.order_mailer_class.confirm_email(order).deliver_later
order.update_column(:confirmation_delivered, true)
kennyadsl marked this conversation as resolved.
Show resolved Hide resolved
end

# Helper methods for checkout steps
def paid?
%w(paid credit_owed).include?(payment_state)
Expand Down