Class: Payola::AdminMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/payola/admin_mailer.rb

Instance Method Summary collapse

Instance Method Details

#dispute(sale_guid) ⇒ Object



13
14
15
# File 'app/mailers/payola/admin_mailer.rb', line 13

def dispute(sale_guid)
  send_admin_mail(sale_guid)
end

#failure(sale_guid) ⇒ Object



17
18
19
# File 'app/mailers/payola/admin_mailer.rb', line 17

def failure(sale_guid)
  send_admin_mail(sale_guid)
end

#receipt(sale_guid) ⇒ Object



5
6
7
# File 'app/mailers/payola/admin_mailer.rb', line 5

def receipt(sale_guid)
  send_admin_mail(sale_guid)
end

#refund(sale_guid) ⇒ Object



9
10
11
# File 'app/mailers/payola/admin_mailer.rb', line 9

def refund(sale_guid)
  send_admin_mail(sale_guid)
end

#send_admin_mail(sale_guid) ⇒ Object



21
22
23
24
25
26
27
# File 'app/mailers/payola/admin_mailer.rb', line 21

def send_admin_mail(sale_guid)
  ActiveRecord::Base.connection_pool.with_connection do
    @sale = Payola::Sale.find_by(guid: sale_guid)
    @product = @sale.product
    mail(from: Payola.support_email, to: Payola.support_email)
  end
end