diff --git a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb b/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb deleted file mode 100644 index fdb8c85454b..00000000000 --- a/legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module SolidusLegacyPromotions - module SpreePromotionCodeBatchDecorator - def process - if state == "pending" - update!(state: "processing") - Spree::PromotionCodeBatchJob.perform_later(self) - else - raise Spree::PromotionCodeBatch::CantProcessStartedBatch.new("Batch #{id} already started") - end - end - - Spree::PromotionCodeBatch.prepend(self) - end -end diff --git a/legacy_promotions/app/models/spree/promotion_code_batch.rb b/legacy_promotions/app/models/spree/promotion_code_batch.rb index 66cbcc50d6a..85a17be14be 100644 --- a/legacy_promotions/app/models/spree/promotion_code_batch.rb +++ b/legacy_promotions/app/models/spree/promotion_code_batch.rb @@ -14,5 +14,14 @@ class CantProcessStartedBatch < StandardError def finished? state == "completed" end + + def process + if state == "pending" + update!(state: "processing") + PromotionCodeBatchJob.perform_later(self) + else + raise CantProcessStartedBatch.new("Batch #{id} already started") + end + end end end