solidus_legacy_promotions 4.4.1 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7e25a87b32de8febdd67d28fa5a558d26c5128875d06b637b8ed52bfa0a2dc9
4
- data.tar.gz: 98d7ff2153ecc29358483226092aa7001aa4f1e4e3a64ed0db8d97c662ad9786
3
+ metadata.gz: e6ebac885d12110287f2152e42e064669b4f6eaf137ab7a07741e39636135484
4
+ data.tar.gz: 917e5b3e78b24f99b85301fdf3dae18d1a77b946b4500ccfa090027bff78ea03
5
5
  SHA512:
6
- metadata.gz: f71034d931089916518921d45a125ec90a345d1db2fe1579eabfb0fe39afa3e0ec55c6d548929a7b25ac48359a3b8330b5cb87e90293e98d63c567b3ec5ed649
7
- data.tar.gz: 690f0d2397d6fbe4d1bc144aef2b4f8f49fc7a7ea061be32b249452f30b7ca72c6382c91f8a882960887d16f9b0da2bbe82160855210b9f0cc2035fe3b2e83fc
6
+ metadata.gz: c6165f9b03a15c4c07b08cd3e571c6abd798e1396d182ea2352f56e604b92594b8fcd02e6951b095aa2497e85c88418bfd0c91c06e4cfff459b496d62fc2b825
7
+ data.tar.gz: 87561f7492154ad168c48d91070cfb8a44da8aae324645044e271b9150ac83a24a3b440824e4504680b51f6ee98acb0670e0e81dfb73eea0a924e238f1594260
@@ -14,5 +14,14 @@ module Spree
14
14
  def finished?
15
15
  state == "completed"
16
16
  end
17
+
18
+ def process
19
+ if state == "pending"
20
+ update!(state: "processing")
21
+ PromotionCodeBatchJob.perform_later(self)
22
+ else
23
+ raise CantProcessStartedBatch.new("Batch #{id} already started")
24
+ end
25
+ end
17
26
  end
18
27
  end
@@ -100,12 +100,17 @@ module SolidusLegacyPromotions
100
100
  end
101
101
 
102
102
  initializer "solidus_legacy_promotions", after: "spree.load_config_initializers" do
103
- Spree::Config.order_contents_class = "Spree::OrderContents"
104
- Spree::Config.promotions = SolidusLegacyPromotions::Configuration.new
105
- Spree::Config.adjustment_promotion_source_types << "Spree::PromotionAction"
103
+ # Only set these if there is no promotion configuration set. In this case,
104
+ # we're running on a store without the new `solidus_promotions` gem and we
105
+ # need to set the configuration to the legacy one.
106
+ if Spree::Config.promotions.is_a?(Spree::Core::NullPromotionConfiguration)
107
+ Spree::Config.order_contents_class = "Spree::OrderContents"
108
+ Spree::Config.promotions = SolidusLegacyPromotions::Configuration.new
109
+ end
106
110
 
107
111
  Spree::Api::Config.adjustment_attributes << :promotion_code_id
108
112
  Spree::Api::Config.adjustment_attributes << :eligible
113
+ Spree::Config.adjustment_promotion_source_types << "Spree::PromotionAction"
109
114
  end
110
115
  end
111
116
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_legacy_promotions
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.1
4
+ version: 4.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.4.1
19
+ version: 4.4.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.4.1
26
+ version: 4.4.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.4.1
33
+ version: 4.4.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.4.1
40
+ version: 4.4.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: solidus_support
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,6 @@ files:
82
82
  - app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb
83
83
  - app/decorators/solidus_legacy_promotions/models/spree_order_updater_decorator.rb
84
84
  - app/decorators/solidus_legacy_promotions/models/spree_product_decorator.rb
85
- - app/decorators/solidus_legacy_promotions/models/spree_promotion_code_batch_decorator.rb
86
85
  - app/decorators/solidus_legacy_promotions/models/spree_shipment_decorator.rb
87
86
  - app/helpers/spree/admin/promotions_helper.rb
88
87
  - app/helpers/spree/promotion_rules_helper.rb
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusLegacyPromotions
4
- module SpreePromotionCodeBatchDecorator
5
- def process
6
- if state == "pending"
7
- update!(state: "processing")
8
- Spree::PromotionCodeBatchJob.perform_later(self)
9
- else
10
- raise Spree::PromotionCodeBatch::CantProcessStartedBatch.new("Batch #{id} already started")
11
- end
12
- end
13
-
14
- Spree::PromotionCodeBatch.prepend(self)
15
- end
16
- end