Class: Stall::CustomerMailer

Inherits:
BaseMailer show all
Defined in:
app/mailers/stall/customer_mailer.rb

Instance Method Summary collapse

Instance Method Details

#order_paid_email(cart) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/mailers/stall/customer_mailer.rb', line 3

def order_paid_email(cart)
  I18n.with_locale(cart.customer.locale) do
    @cart = cart

    mail from: sender_email_for(cart),
         to: cart.customer.email,
         subject: I18n.t('stall.mailers.customer.order_paid_email.subject', ref: cart.reference)
  end
end

#order_shipped_email(cart) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/mailers/stall/customer_mailer.rb', line 13

def order_shipped_email(cart)
  I18n.with_locale(cart.customer.locale) do
    @cart = cart

    @calculator = if (calculator_class = Stall::Shipping::Calculator.for(cart.shipment.shipping_method))
      calculator_class.new(cart, cart.shipment.shipping_method)
    end

    @tracking_url = if @calculator.try(:trackable?)
      cart.shipment.tracking_code.presence && @calculator.tracking_url
    end

    subject = t('stall.mailers.customer.order_shipped_email.subject', ref: cart.reference)

    mail from: sender_email_for(cart),
         to: cart.customer.email,
         subject: subject
  end
end