Sha256: fe7081627e0549ac16334de934379d72dca834550b17f75a5979265075f74364

Contents?: true

Size: 1.11 KB

Versions: 19

Compression:

Stored size: 1.11 KB

Contents

module Spree
  class OrderMailer < BaseMailer
    def confirm_email(order, resend = false)
      @order = order
      @store = @order.store
      subject = build_subject(Spree.t('order_mailer.confirm_email.subject'), resend)

      mail(to: @order.email, from: from_address(@store), subject: subject)
    end

    def cancel_email(order, resend = false)
      @order = order
      @store = @order.store
      subject = build_subject(Spree.t('order_mailer.cancel_email.subject'), resend)

      mail(to: @order.email, from: from_address(@store), subject: subject)
    end

    def inventory_cancellation_email(order, inventory_units, resend = false)
      @order, @inventory_units = order, inventory_units
      @store = @order.store
      subject = build_subject(Spree.t('order_mailer.inventory_cancellation.subject'), resend)

      mail(to: @order.email, from: from_address(@store), subject: subject)
    end

    private

    def build_subject(subject_text, resend)
      resend_text = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
      "#{resend_text}#{@order.store.name} #{subject_text} ##{@order.number}"
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
solidus_core-2.4.2 app/mailers/spree/order_mailer.rb
solidus_core-2.3.1 app/mailers/spree/order_mailer.rb
solidus_core-2.4.1 app/mailers/spree/order_mailer.rb
solidus_core-2.2.2 app/mailers/spree/order_mailer.rb
solidus_core-2.1.1 app/mailers/spree/order_mailer.rb
solidus_core-2.4.0 app/mailers/spree/order_mailer.rb
solidus_core-2.4.0.rc1 app/mailers/spree/order_mailer.rb
solidus_core-2.4.0.beta1 app/mailers/spree/order_mailer.rb
solidus_core-2.3.0 app/mailers/spree/order_mailer.rb
solidus_core-2.3.0.rc3 app/mailers/spree/order_mailer.rb
solidus_core-2.3.0.rc2 app/mailers/spree/order_mailer.rb
solidus_core-2.3.0.rc1 app/mailers/spree/order_mailer.rb
solidus_core-2.3.0.beta1 app/mailers/spree/order_mailer.rb
solidus_core-2.2.1 app/mailers/spree/order_mailer.rb
solidus_core-2.2.0 app/mailers/spree/order_mailer.rb
solidus_core-2.2.0.rc1 app/mailers/spree/order_mailer.rb
solidus_core-2.2.0.beta1 app/mailers/spree/order_mailer.rb
solidus_core-2.1.0 app/mailers/spree/order_mailer.rb
solidus_core-2.1.0.rc1 app/mailers/spree/order_mailer.rb