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

Allow customizing the promotion code batch mailer class #2796

Merged
merged 1 commit into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions core/app/jobs/spree/promotion_code_batch_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def perform(promotion_code_batch)
).build_promotion_codes

if promotion_code_batch.email?
Spree::PromotionCodeBatchMailer
Spree::Config.promotion_code_batch_mailer_class
.promotion_code_batch_finished(promotion_code_batch)
.deliver_now
end
rescue StandardError => e
if promotion_code_batch.email?
Spree::PromotionCodeBatchMailer
Spree::Config.promotion_code_batch_mailer_class
.promotion_code_batch_errored(promotion_code_batch)
.deliver_now
end
Expand Down
9 changes: 9 additions & 0 deletions core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@ def default_pricing_options
# @api experimental
class_name_attribute :shipping_rate_tax_calculator_class, default: 'Spree::TaxCalculator::ShippingRate'

# Allows providing your own Mailer for promotion code batch mailer.
#
# @!attribute [rw] promotion_code_batch_mailer_class
# @return [ActionMailer::Base] an object that responds to "promotion_code_batch_finished",
# and "promotion_code_batch_errored"
# (e.g. an ActionMailer with a "promotion_code_batch_finished" method) with the same
# signature as Spree::PromotionCodeBatchMailer.promotion_code_batch_finished.
class_name_attribute :promotion_code_batch_mailer_class, default: 'Spree::PromotionCodeBatchMailer'

# Allows providing your own Mailer for shipped cartons.
#
# @!attribute [rw] carton_shipped_email_class
Expand Down