class NotificationMailer < ApplicationMailer default to: ->() { @member.email } def expiration_in_60d set_notification mail end def expiration_in_30d set_notification mail end def expired set_notification mail end def expired_30d_ago set_notification mail end def expired_60d_ago set_notification mail end def cancelled set_notification mail end def registration set_member mail end def first_payment_confirmation set_contribution mail end def payment_renewal_confirmation set_contribution mail end private def set_notification @notification = params[:notification] @member = @notification.member @payment = @notification.member.create_payment end def set_contribution @contribution = params[:contribution] @member = @contribution.member end def set_member @member = params[:member] @payment = @member.create_payment end def default_i18n_subject mailer_scope = self.class.mailer_name.tr("/", ".") I18n.t(:subject, scope: [mailer_scope, action_name], organization_short_name: Config.organization_short_name) end end