Class: Spree::OrderMailer

Inherits:
BaseMailer
  • Object
show all
Defined in:
app/mailers/spree/order_mailer.rb

Instance Method Summary collapse

Instance Method Details

#cancel_email(order, resend = false) ⇒ Object



23
24
25
26
27
28
29
30
# File 'app/mailers/spree/order_mailer.rb', line 23

def cancel_email(order, resend = false)
  @order = order.respond_to?(:id) ? order : Spree::Order.find(order)
  current_store = @order.store
  with_store_locale(current_store, @order.locale) do
    subject = order_email_subject(current_store, Spree.t('order_mailer.cancel_email.subject'), @order.number, resend: resend)
    mail(to: @order.email, subject: subject, store_url: current_store.storefront_url)
  end
end

#confirm_email(order, resend = false) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/mailers/spree/order_mailer.rb', line 5

def confirm_email(order, resend = false)
  @order = order.respond_to?(:id) ? order : Spree::Order.find(order)
  current_store = @order.store
  with_store_locale(current_store, @order.locale) do
    subject = order_email_subject(current_store, Spree.t('order_mailer.confirm_email.subject'), @order.number, resend: resend)
    mail(to: @order.email, subject: subject, store_url: current_store.storefront_url)
  end
end


32
33
34
35
36
37
38
39
40
41
# File 'app/mailers/spree/order_mailer.rb', line 32

def payment_link_email(order_id)
  @order = Spree::Order.incomplete.not_canceled.find(order_id)
  @current_store = @order.store
  @checkout_payment_url = spree.checkout_state_url(@order.token, :payment, host: @current_store.storefront_url)

  with_store_locale(@current_store, @order.locale) do
    mail(to: @order.email, subject: Spree.t('order_mailer.payment_link_email.subject', number: @order.number),
         store_url: @current_store.storefront_url)
  end
end

#store_owner_notification_email(order) ⇒ Object



14
15
16
17
18
19
20
21
# File 'app/mailers/spree/order_mailer.rb', line 14

def store_owner_notification_email(order)
  @order = order.respond_to?(:id) ? order : Spree::Order.find(order)
  current_store = @order.store
  with_store_locale(current_store) do
    subject = Spree.t('order_mailer.store_owner_notification_email.subject', store_name: current_store.name)
    mail(to: current_store.new_order_notifications_email, subject: subject, store_url: current_store.storefront_url)
  end
end