Sha256: 8835c66455349d727c45621eca00bf8578460427e2d6b6ba31620c22580396fe

Contents?: true

Size: 691 Bytes

Versions: 35

Compression:

Stored size: 691 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::Config.promotion_code_batch_mailer_class
          .promotion_code_batch_finished(promotion_code_batch)
          .deliver_now
      end
    rescue StandardError => e
      if promotion_code_batch.email?
        Spree::Config.promotion_code_batch_mailer_class
          .promotion_code_batch_errored(promotion_code_batch)
          .deliver_now
      end
      raise e
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
solidus_core-2.9.6 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.6 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.5 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.4 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.7.4 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.5 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.3 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.2 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.10.0.beta1 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.7.3 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.1 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.0 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.9.0.rc.1 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.4 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.3 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.7.2 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.2 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.1 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.8.0 app/jobs/spree/promotion_code_batch_job.rb
solidus_core-2.7.1 app/jobs/spree/promotion_code_batch_job.rb