class NotificationMailer < ApplicationMailer default to: ->() { @member.email } def expiration_in_60d set_member mail end def expiration_in_30d set_member mail end def expired set_member mail end def expired_30d_ago set_member mail end def expired_60d_ago set_member mail end def cancelled set_member 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_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