Class: Spree::OrderMailerSubscriber

Inherits:
Object
  • Object
show all
Includes:
Omnes::Subscriber
Defined in:
app/subscribers/spree/order_mailer_subscriber.rb

Overview

Mailing after events on a Order

Instance Method Summary collapse

Instance Method Details

#send_confirmation_email(event) ⇒ Object

Sends confirmation email to the user

Parameters:

  • event (Omnes::UnstructuredEvent)


19
20
21
22
23
24
25
# File 'app/subscribers/spree/order_mailer_subscriber.rb', line 19

def send_confirmation_email(event)
  order = event[:order]
  unless order.confirmation_delivered?
    Spree::Config.order_mailer_class.confirm_email(order).deliver_later
    order.update_column(:confirmation_delivered, true)
  end
end

#send_reimbursement_email(event) ⇒ Object

Sends reimbursement email to the user

Parameters:

  • event (Omnes::UnstructuredEvent)


30
31
32
33
# File 'app/subscribers/spree/order_mailer_subscriber.rb', line 30

def send_reimbursement_email(event)
  reimbursement = event[:reimbursement]
  Spree::Config.reimbursement_mailer_class.reimbursement_email(reimbursement.id).deliver_later
end