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 +4 -4
- data/app/models/solidus_promotions/benefit.rb +1 -1
- data/app/models/solidus_promotions/permission_sets/solidus_promotion_management.rb +10 -0
- data/app/models/solidus_promotions/promotion.rb +2 -1
- data/app/patches/models/solidus_promotions/in_memory_order_updater_patch.rb +16 -0
- data/app/patches/models/solidus_promotions/{order_recalculator_patch.rb → order_updater_patch.rb} +1 -2
- metadata +5 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9816f1dc64aa56a38370532954b8857c38a66e23b9a1ec06ca8031071849245f
|
|
4
|
+
data.tar.gz: 3d6c2a59d9585cca37cdbc38a82874cffbce16f041e62cad93436f84a9edc788
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/app/patches/models/solidus_promotions/{order_recalculator_patch.rb → order_updater_patch.rb}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module SolidusPromotions
|
|
4
|
-
module
|
|
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.
|
|
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:
|
|
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/
|
|
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:
|
|
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: []
|