Skip to content

Commit

Permalink
Merge pull request #2796 from jtapia/chore/promotion_code_batch_maile…
Browse files Browse the repository at this point in the history
…r_customization

Allow customizing the promotion code batch mailer class
  • Loading branch information
gmacdougall committed Jul 11, 2018
2 parents 9a93b1e + c8e3e48 commit 826d928
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit 826d928

Please sign in to comment.