Sha256: 7f75c591ba5042f8cdef7a68b24c10b8e0b4ee367b238c851d51b530caefdcac

Contents?: true

Size: 972 Bytes

Versions: 2

Compression:

Stored size: 972 Bytes

Contents

module Tang
  class StripeMailer < ApplicationMailer
    helper Tang::ApplicationHelper
    default from: Tang.admin_email

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

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

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

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

    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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tang-0.2.2 app/mailers/tang/stripe_mailer.rb
tang-0.2.1 app/mailers/tang/stripe_mailer.rb