Sha256: 5fd69fd406417ee5528df66f6ecaccd248fc756e345f040d72f2368e2b396cf4

Contents?: true

Size: 659 Bytes

Versions: 8

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

module Spree
  class PromotionCodeBatchJob < ActiveJob::Base
    queue_as :default

    def perform(promotion_code_batch)
      PromotionCode::BatchBuilder.new(
        promotion_code_batch
      ).build_promotion_codes

      if promotion_code_batch.email?
        Spree::PromotionCodeBatchMailer
          .promotion_code_batch_finished(promotion_code_batch)
          .deliver_now
      end
    rescue StandardError => e
      if promotion_code_batch.email?
        Spree::PromotionCodeBatchMailer
          .promotion_code_batch_errored(promotion_code_batch)
          .deliver_now
      end
      raise e
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
solidus_core-2.6.6 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.5 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.4 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.3 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.2 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.1 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.0 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.6.0.rc1 app/jobs/spree/promotion_code_batch_job.rb