solidus_promotions 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaae8dc702bc52d537b6e0e3ab7a77ec52091890f443a6a30a63c3de58c6a097
4
- data.tar.gz: ea14d817d57406914450fe4690b9dbf4db628f11cb456c15b7a92b53fdf293a7
3
+ metadata.gz: 9816f1dc64aa56a38370532954b8857c38a66e23b9a1ec06ca8031071849245f
4
+ data.tar.gz: 3d6c2a59d9585cca37cdbc38a82874cffbce16f041e62cad93436f84a9edc788
5
5
  SHA512:
6
- metadata.gz: 60687b2516232af51dc68e97acbb2ef345eab68265917435991ce48bca89c5cc015c12e96fd2268e65c06ed3b3d38b8b1a2c4a49760fd5d09823886d9866d978
7
- data.tar.gz: 017a4995a3feafd499cff0ccadd46665c003fdc45396f385e639222da15684fb177ee2f0a7bddedb6663a42a392c5301a386f1667281e21e85c45521e7e27070
6
+ metadata.gz: 145db9f71674ed56a44202500d6a91549677e673a11c1c56ec4b90a6442458ec3fb249c4fba968db9997150453f4df2b78badce65b32e66be6bacb1b4195ec7d
7
+ data.tar.gz: bc1fa2598d2b7621b04c11ef31e0e2760d9c9667d6fb25b20a20e677d2aa7616f0a850e0491e815e962189d8784cdeea601e8b6d065f125f788b10f8dba46645
@@ -40,7 +40,7 @@ module SolidusPromotions
40
40
  # @!attribute [rw] promotion
41
41
  # The owning promotion.
42
42
  # @return [SolidusPromotions::Promotion]
43
- belongs_to :promotion, inverse_of: :benefits
43
+ belongs_to :promotion, -> { with_discarded }, inverse_of: :benefits
44
44
  # @!attribute [rw] original_promotion_action
45
45
  # Back-reference to the original Solidus (Spree) promotion action, when migrated.
46
46
  # @return [Spree::PromotionAction, nil]
@@ -3,6 +3,16 @@
3
3
  module SolidusPromotions
4
4
  module PermissionSets
5
5
  class SolidusPromotionManagement < Spree::PermissionSets::Base
6
+ class << self
7
+ def privilege
8
+ :management
9
+ end
10
+
11
+ def category
12
+ :solidus_promotion
13
+ end
14
+ end
15
+
6
16
  def activate!
7
17
  can :manage, SolidusPromotions::Promotion
8
18
  can :manage, SolidusPromotions::Condition
@@ -12,7 +12,7 @@ module SolidusPromotions
12
12
  optional: true,
13
13
  inverse_of: :promotions
14
14
  belongs_to :original_promotion, class_name: "Spree::Promotion", optional: true
15
- has_many :benefits, class_name: "SolidusPromotions::Benefit", dependent: :destroy
15
+ has_many :benefits, class_name: "SolidusPromotions::Benefit", dependent: :destroy, inverse_of: :promotion
16
16
  has_many :conditions, through: :benefits
17
17
  has_many :codes, class_name: "SolidusPromotions::PromotionCode", dependent: :destroy, inverse_of: :promotion
18
18
  has_many :code_batches, class_name: "SolidusPromotions::PromotionCodeBatch", dependent: :destroy
@@ -173,6 +173,7 @@ module SolidusPromotions
173
173
 
174
174
  def delete_cart_connections
175
175
  order_promotions.where(order: Spree::Order.incomplete).destroy_all
176
+ benefits.each(&:remove_adjustments_from_incomplete_orders)
176
177
  end
177
178
  end
178
179
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusPromotions
4
+ module InMemoryOrderUpdaterPatch
5
+ # This is only needed for stores upgrading from the legacy promotion system.
6
+ # Once we've removed support for the legacy promotion system, we can remove this.
7
+ def recalculate(persist: true)
8
+ if SolidusPromotions.config.sync_order_promotions
9
+ MigrationSupport::OrderPromotionSyncer.new(order: order).call
10
+ end
11
+ super
12
+ end
13
+
14
+ Spree::InMemoryOrderUpdater.prepend self
15
+ end
16
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusPromotions
4
- module OrderRecalculatorPatch
4
+ module OrderUpdaterPatch
5
5
  # This is only needed for stores upgrading from the legacy promotion system.
6
6
  # Once we've removed support for the legacy promotion system, we can remove this.
7
7
  def recalculate
@@ -12,6 +12,5 @@ module SolidusPromotions
12
12
  end
13
13
 
14
14
  Spree::OrderUpdater.prepend self
15
- Spree::InMemoryOrderUpdater.prepend self
16
15
  end
17
16
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_promotions
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0
4
+ version: 4.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
8
  - Solidus Team
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2026-04-15 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: csv
@@ -235,9 +234,10 @@ files:
235
234
  - app/models/solidus_promotions/promotion_lane.rb
236
235
  - app/models/solidus_promotions/shipping_rate_discount.rb
237
236
  - app/patches/models/solidus_promotions/adjustment_patch.rb
237
+ - app/patches/models/solidus_promotions/in_memory_order_updater_patch.rb
238
238
  - app/patches/models/solidus_promotions/line_item_patch.rb
239
239
  - app/patches/models/solidus_promotions/order_patch.rb
240
- - app/patches/models/solidus_promotions/order_recalculator_patch.rb
240
+ - app/patches/models/solidus_promotions/order_updater_patch.rb
241
241
  - app/patches/models/solidus_promotions/price_patch.rb
242
242
  - app/patches/models/solidus_promotions/shipment_patch.rb
243
243
  - app/patches/models/solidus_promotions/shipping_rate_patch.rb
@@ -399,7 +399,6 @@ licenses:
399
399
  - BSD-3-Clause
400
400
  metadata:
401
401
  homepage_uri: https://github.com/solidusio/solidus/blob/main/promotions/README.md
402
- post_install_message:
403
402
  rdoc_options: []
404
403
  require_paths:
405
404
  - lib
@@ -414,8 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
414
413
  - !ruby/object:Gem::Version
415
414
  version: '0'
416
415
  requirements: []
417
- rubygems_version: 3.5.22
418
- signing_key:
416
+ rubygems_version: 4.0.10
419
417
  specification_version: 4
420
418
  summary: New promotion system for Solidus
421
419
  test_files: []