Skip to content

Commit

Permalink
Reintroduce and deprecate Order#deliver_order_confirmation_email
Browse files Browse the repository at this point in the history
Was removed as part of #3081,
but not being private it's better to keep it around with a deprecation
for a while.
  • Loading branch information
elia authored and kennyadsl committed Feb 4, 2020
1 parent b6f0f6a commit 707d89a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,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 @@ -443,6 +450,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)
end

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

0 comments on commit 707d89a

Please sign in to comment.