solidus_legacy_promotions 4.6.4 → 4.6.5
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a1f3d45ecedafba24cc02e42d5ad8a6edf69d65c582f73176405811c3d1adaa
|
|
4
|
+
data.tar.gz: 3d7e32c4fd736d62478216c34d1a370b64ae5e187bc3aaf06990da07ce4b0517
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8329b1b42c15c8af828192ba407f1da24c9f593dc48bf4e7c763928ca311f3fa7ac1291e8145ed71f95b1185edcf8f5682951b5ba453db18c4b6c769c156c507
|
|
7
|
+
data.tar.gz: f1c4960b918ccc033be6451daecced317b1f733aa97886ccb78fc9b9df8389d7983e138936b55fc99766f417d06035cb3865861ffbad6628ae3665761eccec4d
|
|
@@ -31,6 +31,45 @@ module Spree
|
|
|
31
31
|
|
|
32
32
|
private
|
|
33
33
|
|
|
34
|
+
def permitted_resource_params
|
|
35
|
+
params.fetch(:promotion, {}).permit(
|
|
36
|
+
:name, :description, :promotion_category_id, :usage_limit, :per_code_usage_limit,
|
|
37
|
+
:starts_at, :expires_at, :apply_automatically, :path,
|
|
38
|
+
promotion_rules_attributes: [
|
|
39
|
+
:id, :product_ids_string, :taxon_ids_string, :user_ids_string,
|
|
40
|
+
*preference_attributes(Spree::Config.promotions.rules),
|
|
41
|
+
{ store_ids: [] }
|
|
42
|
+
],
|
|
43
|
+
promotion_actions_attributes: [
|
|
44
|
+
:id, :calculator_type,
|
|
45
|
+
*preference_attributes(Spree::Config.promotions.actions),
|
|
46
|
+
{ calculator_attributes: preference_attributes(promotion_calculators) }
|
|
47
|
+
]
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def promotion_calculators
|
|
52
|
+
Spree::Config.promotions.actions.flat_map do |action|
|
|
53
|
+
Spree::Config.promotions.calculators[action].to_a
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Permits the preferences declared by the given rule, action or calculator classes,
|
|
58
|
+
# matching each preference's shape (array and hash preferences may hold multiple values).
|
|
59
|
+
def preference_attributes(klasses)
|
|
60
|
+
klasses.uniq.flat_map do |klass|
|
|
61
|
+
instance = klass.new
|
|
62
|
+
instance.defined_preferences.map do |name|
|
|
63
|
+
attribute = :"preferred_#{name}"
|
|
64
|
+
case instance.preference_type(name)
|
|
65
|
+
when :array then [attribute, { attribute => [] }]
|
|
66
|
+
when :hash then { attribute => {} }
|
|
67
|
+
else attribute
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end.flatten.uniq
|
|
71
|
+
end
|
|
72
|
+
|
|
34
73
|
def location_after_save
|
|
35
74
|
spree.edit_admin_promotion_url(@promotion)
|
|
36
75
|
end
|
|
@@ -55,7 +94,7 @@ module Spree
|
|
|
55
94
|
end
|
|
56
95
|
|
|
57
96
|
def promotion_code_batch_params
|
|
58
|
-
params.require(:promotion_code_batch).permit
|
|
97
|
+
params.require(:promotion_code_batch).permit(:base_code, :number_of_codes, :join_characters, :email)
|
|
59
98
|
end
|
|
60
99
|
|
|
61
100
|
def promotion_includes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_legacy_promotions
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.6.
|
|
4
|
+
version: 4.6.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Solidus Team
|
|
@@ -29,28 +29,28 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 4.6.
|
|
32
|
+
version: 4.6.5
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 4.6.
|
|
39
|
+
version: 4.6.5
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: solidus_core
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 4.6.
|
|
46
|
+
version: 4.6.5
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 4.6.
|
|
53
|
+
version: 4.6.5
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: solidus_support
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|