Skip to content

Commit 826d928

Browse files
authored
Merge pull request #2796 from jtapia/chore/promotion_code_batch_mailer_customization
Allow customizing the promotion code batch mailer class
2 parents 9a93b1e + c8e3e48 commit 826d928

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

core/app/jobs/spree/promotion_code_batch_job.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ def perform(promotion_code_batch)
1010
).build_promotion_codes
1111

1212
if promotion_code_batch.email?
13-
Spree::PromotionCodeBatchMailer
13+
Spree::Config.promotion_code_batch_mailer_class
1414
.promotion_code_batch_finished(promotion_code_batch)
1515
.deliver_now
1616
end
1717
rescue StandardError => e
1818
if promotion_code_batch.email?
19-
Spree::PromotionCodeBatchMailer
19+
Spree::Config.promotion_code_batch_mailer_class
2020
.promotion_code_batch_errored(promotion_code_batch)
2121
.deliver_now
2222
end

core/lib/spree/app_configuration.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ def default_pricing_options
307307
# @api experimental
308308
class_name_attribute :shipping_rate_tax_calculator_class, default: 'Spree::TaxCalculator::ShippingRate'
309309

310+
# Allows providing your own Mailer for promotion code batch mailer.
311+
#
312+
# @!attribute [rw] promotion_code_batch_mailer_class
313+
# @return [ActionMailer::Base] an object that responds to "promotion_code_batch_finished",
314+
# and "promotion_code_batch_errored"
315+
# (e.g. an ActionMailer with a "promotion_code_batch_finished" method) with the same
316+
# signature as Spree::PromotionCodeBatchMailer.promotion_code_batch_finished.
317+
class_name_attribute :promotion_code_batch_mailer_class, default: 'Spree::PromotionCodeBatchMailer'
318+
310319
# Allows providing your own Mailer for shipped cartons.
311320
#
312321
# @!attribute [rw] carton_shipped_email_class

0 commit comments

Comments
 (0)