Order confirmation emails are not sent for standing order orders.

This commit is contained in:
Rob Harrington
2016-11-18 09:45:06 +11:00
parent 8ab698d4dc
commit 65db856054
2 changed files with 11 additions and 1 deletions

View File

@@ -293,7 +293,9 @@ Spree::Order.class_eval do
# Overrride of Spree method, that allows us to send separate confirmation emails to user and shop owners
# And separately, to skip sending confirmation email completely for user invoice orders
def deliver_order_confirmation_email
Delayed::Job.enqueue ConfirmOrderJob.new(id) unless account_invoice?
unless account_invoice? || standing_order.present?
Delayed::Job.enqueue ConfirmOrderJob.new(id)
end
end
def changes_allowed?

View File

@@ -572,6 +572,14 @@ describe Spree::Order do
order.deliver_order_confirmation_email
end.to_not enqueue_job ConfirmOrderJob
end
it "does not send confirmation emails when the order belongs to a standing order" do
create(:standing_order_with_items, orders: [order])
expect do
order.deliver_order_confirmation_email
end.to_not enqueue_job ConfirmOrderJob
end
end
describe "associating a customer" do