diff --git a/core/app/models/spree/reimbursement.rb b/core/app/models/spree/reimbursement.rb index acd54703c49..3485039997b 100644 --- a/core/app/models/spree/reimbursement.rb +++ b/core/app/models/spree/reimbursement.rb @@ -162,7 +162,7 @@ def validate_return_items_belong_to_same_order end def send_reimbursement_email - Spree::ReimbursementMailer.reimbursement_email(id).deliver_later + Spree::Config.reimbursement_mailer_class.reimbursement_email(id).deliver_later end # If there are multiple different reimbursement types for a single diff --git a/core/lib/spree/app_configuration.rb b/core/lib/spree/app_configuration.rb index 38ba456eb28..02481706715 100644 --- a/core/lib/spree/app_configuration.rb +++ b/core/lib/spree/app_configuration.rb @@ -316,6 +316,14 @@ def default_pricing_options # 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 reimbursement mailer. + # + # @!attribute [rw] reimbursement_mailer_class + # @return [ActionMailer::Base] an object that responds to "reimbursement_email" + # (e.g. an ActionMailer with a "reimbursement_email" method) with the same + # signature as Spree::ReimbursementMailer.reimbursement_email. + class_name_attribute :reimbursement_mailer_class, default: 'Spree::ReimbursementMailer' + # Allows providing your own Mailer for shipped cartons. # # @!attribute [rw] carton_shipped_email_class diff --git a/core/lib/spree/mailer_previews/reimbursement_preview.rb b/core/lib/spree/mailer_previews/reimbursement_preview.rb index fc8fec37ff4..d431959644c 100644 --- a/core/lib/spree/mailer_previews/reimbursement_preview.rb +++ b/core/lib/spree/mailer_previews/reimbursement_preview.rb @@ -6,7 +6,7 @@ class ReimbursementPreview < ActionMailer::Preview def reimbursement reimbursement = Reimbursement.last raise "Your database needs at least one Reimbursement to render this preview" unless reimbursement - ReimbursementMailer.reimbursement_email(reimbursement) + Spree::Config.reimbursement_mailer_class.reimbursement_email(reimbursement) end end end