Sha256: da02e5562116e7f7a1e7c770fa219c5adace823c809f7467b621d27c0cba4670

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 Bytes

Contents

module Tang
  class StripeMailer < ApplicationMailer
    add_template_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

4 entries across 4 versions & 1 rubygems

Version Path
tang-0.2.0 app/mailers/tang/stripe_mailer.rb
tang-0.1.0 app/mailers/tang/stripe_mailer.rb
tang-0.0.9 app/mailers/tang/stripe_mailer.rb
tang-0.0.8 app/mailers/tang/stripe_mailer.rb