Sha256: 1a046b357e9d9164849b706420a84dc51bf76eab31e7a0cc3fc38650d80005cd

Contents?: true

Size: 848 Bytes

Versions: 23

Compression:

Stored size: 848 Bytes

Contents

# frozen_string_literal: true

require 'spree/event/subscriber'

module Spree
  # Legacy subscriber
  #
  # This subscriber module is used by the legacy pub/sub system (see
  # {Spree::Event}).
  module MailerSubscriber
    include Spree::Event::Subscriber

    event_action :order_finalized
    event_action :send_reimbursement_email, event_name: :reimbursement_reimbursed

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

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
solidus_core-3.4.6 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.4.5 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.4.4 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.3.4 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.9 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.8 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.3.3 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.4.3 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.4.2 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.7 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.3.2 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.4.1 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.4.0 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.3.1 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.6 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.3.0 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.5 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.4 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.3 app/subscribers/spree/mailer_subscriber.rb
solidus_core-3.2.2 app/subscribers/spree/mailer_subscriber.rb