Skip to content

Commit

Permalink
Allow customizing the reimbursement mailer class
Browse files Browse the repository at this point in the history
  • Loading branch information
jtapia committed Jul 11, 2018
1 parent 826d928 commit 4d454fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/app/models/spree/reimbursement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions core/lib/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/lib/spree/mailer_previews/reimbursement_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d454fb

Please sign in to comment.