Skip to content

Commit 425240b

Browse files
authored
Merge pull request #2795 from jtapia/chore/reimbursement_mailer_customization
Allow customizing the reimbursement mailer class
2 parents dde082e + 4d454fb commit 425240b

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

core/app/models/spree/reimbursement.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def validate_return_items_belong_to_same_order
162162
end
163163

164164
def send_reimbursement_email
165-
Spree::ReimbursementMailer.reimbursement_email(id).deliver_later
165+
Spree::Config.reimbursement_mailer_class.reimbursement_email(id).deliver_later
166166
end
167167

168168
# If there are multiple different reimbursement types for a single

core/lib/spree/app_configuration.rb

+8
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,14 @@ def default_pricing_options
325325
# signature as Spree::PromotionCodeBatchMailer.promotion_code_batch_finished.
326326
class_name_attribute :promotion_code_batch_mailer_class, default: 'Spree::PromotionCodeBatchMailer'
327327

328+
# Allows providing your own Mailer for reimbursement mailer.
329+
#
330+
# @!attribute [rw] reimbursement_mailer_class
331+
# @return [ActionMailer::Base] an object that responds to "reimbursement_email"
332+
# (e.g. an ActionMailer with a "reimbursement_email" method) with the same
333+
# signature as Spree::ReimbursementMailer.reimbursement_email.
334+
class_name_attribute :reimbursement_mailer_class, default: 'Spree::ReimbursementMailer'
335+
328336
# Allows providing your own Mailer for shipped cartons.
329337
#
330338
# @!attribute [rw] carton_shipped_email_class

core/lib/spree/mailer_previews/reimbursement_preview.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ReimbursementPreview < ActionMailer::Preview
66
def reimbursement
77
reimbursement = Reimbursement.last
88
raise "Your database needs at least one Reimbursement to render this preview" unless reimbursement
9-
ReimbursementMailer.reimbursement_email(reimbursement)
9+
Spree::Config.reimbursement_mailer_class.reimbursement_email(reimbursement)
1010
end
1111
end
1212
end

0 commit comments

Comments
 (0)