Module: Spree::OrderMailerDecorator

Defined in:
app/mailers/spree/order_mailer_decorator.rb

Instance Method Summary collapse

Instance Method Details

#cancel_email(order, resend: false) ⇒ Object

overrided



4
5
6
7
8
9
# File 'app/mailers/spree/order_mailer_decorator.rb', line 4

def cancel_email(order, resend: false)
  @order = order.respond_to?(:id) ? order : Spree::Order.find(order)
  return false if @order.email.blank?

  super
end

#confirm_email(order, resend: false) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/mailers/spree/order_mailer_decorator.rb', line 11

def confirm_email(order, resend: false)
  @order = order.respond_to?(:id) ? order : Spree::Order.find(order)
  return false if @order.email.blank?

  @current_store = @order.store
  @product_type = @order.products.first&.product_type || 'accommodation'

  subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
  subject += "#{@current_store&.name} Booking Confirmation ##{@order.number}"

  mail(to: @order.email, from: from_address, subject: subject, store_url: @current_store.url) do |format|
    format.html { render layout: 'spree_cm_commissioner/layouts/order_mailer' }
    format.text
  end
end

#ticket_email(guest, email) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/mailers/spree/order_mailer_decorator.rb', line 27

def ticket_email(guest, email)
  @guest = guest
  @event = @guest.event
  @line_item = @guest.line_item
  @order = @line_item.order
  @email = email

  @current_store = @order.store
  @product_type = @line_item.product_type

  subject = "#{@current_store&.name} Booking Confirmation ##{@order.number}"

  mail(to: @email, from: from_address, subject: subject, store_url: @current_store.url) do |format|
    format.html { render layout: 'spree_cm_commissioner/layouts/line_item_mailer' }
    format.text
  end
end