Class: Tang::StripeMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/tang/stripe_mailer.rb

Instance Method Summary collapse

Instance Method Details

#admin_dispute_created(charge) ⇒ Object



6
7
8
9
# File 'app/mailers/tang/stripe_mailer.rb', line 6

def admin_dispute_created(charge)
  @charge = charge
  mail(to: Tang.admin_email, subject: "Dispute created on charge #{@charge.stripe_id}")
end

#admin_payment_failed(charge) ⇒ Object



16
17
18
19
# File 'app/mailers/tang/stripe_mailer.rb', line 16

def admin_payment_failed(charge)
  @charge = charge
  mail(to: Tang.admin_email, subject: "Oh no! Charge failed!")
end

#admin_payment_succeeded(charge) ⇒ Object



11
12
13
14
# File 'app/mailers/tang/stripe_mailer.rb', line 11

def admin_payment_succeeded(charge)
  @charge = charge
  mail(to: Tang.admin_email, subject: "Woo! Charge succeeded!")
end

#customer_payment_failed(charge) ⇒ Object



28
29
30
31
32
33
# File 'app/mailers/tang/stripe_mailer.rb', line 28

def customer_payment_failed(charge)
  @charge = charge
  if @charge.customer.present?
    mail(to: @charge.customer.email, subject: "Oops! Your payment could not be processed.")
  end
end

#customer_payment_succeeded(charge) ⇒ Object



21
22
23
24
25
26
# File 'app/mailers/tang/stripe_mailer.rb', line 21

def customer_payment_succeeded(charge)
  @receipt = charge
  if @receipt.customer.present?
    mail(to: @receipt.customer.email, subject: "Thank you!")
  end
end