Sha256: ad23f4505cf95cd4cbe68044c36749177ebff4d58a967ee555fd4c6c3005f886

Contents?: true

Size: 1.1 KB

Versions: 82

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

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

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

    def cancel_email(order, resend = false)
      @order = order
      @store = @order.store
      subject = build_subject(t('.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(t('spree.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 ? "[#{t('spree.resend').upcase}] " : '')
      "#{resend_text}#{@order.store.name} #{subject_text} ##{@order.number}"
    end
  end
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
solidus_core-4.3.4 app/mailers/spree/order_mailer.rb
solidus_core-4.2.4 app/mailers/spree/order_mailer.rb
solidus_core-4.1.5 app/mailers/spree/order_mailer.rb
solidus_core-4.3.3 app/mailers/spree/order_mailer.rb
solidus_core-4.3.2 app/mailers/spree/order_mailer.rb
solidus_core-4.1.4 app/mailers/spree/order_mailer.rb
solidus_core-4.3.1 app/mailers/spree/order_mailer.rb
solidus_core-4.3.0 app/mailers/spree/order_mailer.rb
solidus_core-4.2.3 app/mailers/spree/order_mailer.rb
solidus_core-4.1.3 app/mailers/spree/order_mailer.rb
solidus_core-4.0.4 app/mailers/spree/order_mailer.rb
solidus_core-3.4.6 app/mailers/spree/order_mailer.rb
solidus_core-4.0.3 app/mailers/spree/order_mailer.rb
solidus_core-4.1.2 app/mailers/spree/order_mailer.rb
solidus_core-4.2.2 app/mailers/spree/order_mailer.rb
solidus_core-3.4.5 app/mailers/spree/order_mailer.rb
solidus_core-4.2.1 app/mailers/spree/order_mailer.rb
solidus_core-4.2.0 app/mailers/spree/order_mailer.rb
solidus_core-4.1.1 app/mailers/spree/order_mailer.rb
solidus_core-4.0.2 app/mailers/spree/order_mailer.rb