solidus_core 2.10.0 → 2.10.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: 0aabcb199c31d99f564afef69740c95363dff238117b5692ff26226f91f6bf06
4
- data.tar.gz: fd982fa13569c953468edb060c7019f541b435cd404787b8c0674ff3db324606
3
+ metadata.gz: 90b8c15a6d8cd5afe92bda035e5030a7fdcb10dee8333e8e29ed856e6e984d8d
4
+ data.tar.gz: 4400ce56c58133a1fe8564a2577b771e568a985227ab4e6cb7ebff79f6c83f04
5
5
  SHA512:
6
- metadata.gz: d0532174df1e8cac35d61f180102c5123dec9f43d41b29d61a6ce37a87cb1d29f60a902de56ba5b0394094ef5c0ea28e13ca81033df598de93209dcf7105dbc5
7
- data.tar.gz: 9df7b935ee802245a93da97b4341aacb7343aac7e6319b5b1673b30a0145f9f46d539aa5c2e3ab190e1e7dbf69b37843ff8c4739497ef24233a572fa49eb6d4d
6
+ metadata.gz: 9925579a8e26a3dae259ca7b646b79e66e13b4dc9ea183c1c836b6382bd277a255cf87f879fee30fa5cc6c24ddb76be8680144b88102a2623015f2383cced868
7
+ data.tar.gz: a281e5378b803c0ef7393eea0cf8a6a62192c5180a90e2d4ca540f7fb0c6b39027e66c1fc3868628a582e758f9a5c45261c8995f90e52e34b4cb1392383840d6
@@ -251,7 +251,7 @@ module Spree
251
251
  ids_or_records_or_names.flatten.map { |taxon|
252
252
  case taxon
253
253
  when Integer then Spree::Taxon.find_by(id: taxon)
254
- when ActiveRecord::Base then t
254
+ when ActiveRecord::Base then taxon
255
255
  when String
256
256
  Spree::Taxon.find_by(name: taxon) ||
257
257
  Spree::Taxon.where("#{taxons}.permalink LIKE ? OR #{taxons}.permalink = ?", "%/#{taxon}/", "#{taxon}/").first
@@ -31,16 +31,30 @@ module Spree
31
31
  end
32
32
 
33
33
  def permitted_checkout_attributes
34
- permitted_attributes.checkout_attributes + [
35
- bill_address_attributes: permitted_address_attributes,
36
- ship_address_attributes: permitted_address_attributes,
37
- payments_attributes: permitted_payment_attributes,
38
- shipments_attributes: permitted_shipment_attributes
39
- ]
34
+ permitted_attributes.checkout_attributes
35
+ end
36
+
37
+ def permitted_checkout_address_attributes
38
+ permitted_attributes.checkout_address_attributes
39
+ end
40
+
41
+ def permitted_checkout_delivery_attributes
42
+ permitted_attributes.checkout_delivery_attributes
43
+ end
44
+
45
+ def permitted_checkout_payment_attributes
46
+ permitted_attributes.checkout_payment_attributes
47
+ end
48
+
49
+ def permitted_checkout_confirm_attributes
50
+ permitted_attributes.checkout_confirm_attributes
40
51
  end
41
52
 
42
53
  def permitted_order_attributes
43
- permitted_checkout_attributes + [
54
+ permitted_checkout_address_attributes +
55
+ permitted_checkout_delivery_attributes +
56
+ permitted_checkout_payment_attributes +
57
+ permitted_checkout_confirm_attributes + [
44
58
  line_items_attributes: permitted_line_item_attributes
45
59
  ]
46
60
  end
@@ -133,7 +133,8 @@ module Spree
133
133
  # spree_wombat serializes payment state as status so imported orders should fall back to status field.
134
134
  payment.state = target[:state] || target[:status] || 'completed'
135
135
  payment.payment_method = Spree::PaymentMethod.find_by!(name: target[:payment_method])
136
- payment.source = create_source_payment_from_params(target[:source], payment) if target[:source]
136
+ source_attributes = target[:source] || target[:source_attributes]
137
+ payment.source = create_source_payment_from_params(source_attributes, payment) if source_attributes
137
138
  payment.save!
138
139
  end
139
140
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "2.10.0"
4
+ VERSION = "2.10.5"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
@@ -8,7 +8,10 @@ module Spree
8
8
  ATTRIBUTES = [
9
9
  :address_attributes,
10
10
  :address_book_attributes,
11
- :checkout_attributes,
11
+ :checkout_address_attributes,
12
+ :checkout_delivery_attributes,
13
+ :checkout_payment_attributes,
14
+ :checkout_confirm_attributes,
12
15
  :credit_card_update_attributes,
13
16
  :customer_return_attributes,
14
17
  :image_attributes,
@@ -45,10 +48,6 @@ module Spree
45
48
 
46
49
  @@address_book_attributes = address_attributes + [:default]
47
50
 
48
- @@checkout_attributes = [
49
- :coupon_code, :email, :special_instructions, :use_billing
50
- ]
51
-
52
51
  @@credit_card_update_attributes = [
53
52
  :month, :year, :expiry, :first_name, :last_name, :name
54
53
  ]
@@ -91,7 +90,7 @@ module Spree
91
90
  :number, :month, :year, :expiry, :verification_value,
92
91
  :first_name, :last_name, :cc_type, :gateway_customer_profile_id,
93
92
  :gateway_payment_profile_id, :last_digits, :name, :encrypted_data,
94
- :existing_card_id, :wallet_payment_source_id
93
+ :existing_card_id, :wallet_payment_source_id, address_attributes: address_attributes
95
94
  ]
96
95
 
97
96
  @@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
@@ -129,5 +128,75 @@ module Spree
129
128
  :product_id, :product, :option_values_attributes, :price,
130
129
  :weight, :height, :width, :depth, :sku, :cost_currency, option_value_ids: [], options: [:name, :value]
131
130
  ]
131
+
132
+ @@checkout_address_attributes = [
133
+ :use_billing,
134
+ :email,
135
+ bill_address_attributes: address_attributes,
136
+ ship_address_attributes: address_attributes
137
+ ]
138
+
139
+ @@checkout_delivery_attributes = [
140
+ :special_instructions,
141
+ shipments_attributes: shipment_attributes
142
+ ]
143
+
144
+ @@checkout_payment_attributes = [
145
+ :coupon_code,
146
+ payments_attributes: payment_attributes + [
147
+ source_attributes: source_attributes
148
+ ]
149
+ ]
150
+
151
+ @@checkout_confirm_attributes = []
152
+
153
+ def self.checkout_attributes
154
+ Spree::Deprecation.warn <<-WARN.squish, caller
155
+ checkout_attributes is deprecated, please use the permitted
156
+ attributes set for the specific step that needs to be updated.
157
+
158
+ E.g. permitted_checkout_address_attributes
159
+ WARN
160
+
161
+ CheckoutAdditionalAttributes.new(
162
+ checkout_address_attributes +
163
+ checkout_delivery_attributes +
164
+ checkout_payment_attributes +
165
+ checkout_confirm_attributes
166
+ )
167
+ end
168
+ end
169
+
170
+ class CheckoutAdditionalAttributes < Array
171
+ def <<(*attributes)
172
+ super
173
+
174
+ inject_attributes_to_all_steps(attributes, :<<)
175
+ end
176
+
177
+ def push(*attributes)
178
+ super
179
+
180
+ inject_attributes_to_all_steps(attributes, :push)
181
+ end
182
+ alias append push
183
+
184
+ def prepend(*attributes)
185
+ super
186
+
187
+ inject_attributes_to_all_steps(attributes, :prepend)
188
+ end
189
+ alias unshift prepend
190
+
191
+ private
192
+
193
+ def inject_attributes_to_all_steps(attributes, method)
194
+ attributes.each do |attribute|
195
+ PermittedAttributes.checkout_address_attributes.send(method, attribute)
196
+ PermittedAttributes.checkout_delivery_attributes.send(method, attribute)
197
+ PermittedAttributes.checkout_payment_attributes.send(method, attribute)
198
+ PermittedAttributes.checkout_confirm_attributes.send(method, attribute)
199
+ end
200
+ end
132
201
  end
133
202
  end
@@ -17,7 +17,10 @@ FactoryBot.define do
17
17
  end
18
18
 
19
19
  factory :admin_user do
20
- spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] }
20
+ after(:create) do |user, _|
21
+ admin_role = Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')
22
+ user.spree_roles << admin_role
23
+ end
21
24
  end
22
25
 
23
26
  factory :user_with_addresses do |_u|
data/solidus_core.gemspec CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |s|
24
24
  actionmailer actionpack actionview activejob activemodel activerecord
25
25
  activesupport railties
26
26
  ].each do |rails_dep|
27
- s.add_dependency rails_dep, ['>= 5.1', '< 7.0.x']
27
+ s.add_dependency rails_dep, ['>= 5.1', '< 6.1.x']
28
28
  end
29
29
 
30
30
  s.add_dependency 'activemerchant', '~> 1.66'
31
- s.add_dependency 'acts_as_list', '~> 0.3'
31
+ s.add_dependency 'acts_as_list', '< 2.0'
32
32
  s.add_dependency 'awesome_nested_set', '~> 3.2'
33
33
  s.add_dependency 'cancancan', ['>= 2.2', '< 4.0']
34
34
  s.add_dependency 'carmen', '~> 1.1.0'
@@ -23,7 +23,14 @@ RSpec.describe Spree::Core::ControllerHelpers::StrongParameters, type: :controll
23
23
 
24
24
  describe '#permitted_checkout_attributes' do
25
25
  it 'returns Array class' do
26
- expect(controller.permitted_checkout_attributes.class).to eq Array
26
+ Spree::Deprecation.silence do
27
+ expect(controller.permitted_checkout_attributes.class).to eq Spree::CheckoutAdditionalAttributes
28
+ end
29
+ end
30
+
31
+ it 'is deprecated' do
32
+ expect(Spree::Deprecation).to receive(:warn)
33
+ controller.permitted_checkout_attributes
27
34
  end
28
35
  end
29
36
 
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails_helper"
4
+
5
+ RSpec.describe Spree::PermittedAttributes do
6
+ describe ".checkout_attributes" do
7
+ subject(:permitted_attributes) { described_class }
8
+
9
+ it "when read emits a deprecation warning and return all steps attributes" do
10
+ expect(Spree::Deprecation).to receive(:warn)
11
+ all_attributes = permitted_attributes.checkout_attributes
12
+
13
+ expect(all_attributes).to include(*permitted_attributes.checkout_address_attributes)
14
+ expect(all_attributes).to include(*permitted_attributes.checkout_delivery_attributes)
15
+ expect(all_attributes).to include(*permitted_attributes.checkout_payment_attributes)
16
+ end
17
+
18
+ it "when changed emits a deprecation warning and push changes to all steps' attributes" do
19
+ expect(Spree::Deprecation).to receive(:warn).exactly(4).times
20
+ permitted_attributes.checkout_attributes.push :appended_attribute
21
+ permitted_attributes.checkout_attributes.append :appended_with_alias_attribute
22
+ permitted_attributes.checkout_attributes << :another_appended_attribute
23
+ permitted_attributes.checkout_attributes.prepend :prepended_attribute
24
+
25
+ checkout_steps_attributes = [
26
+ permitted_attributes.checkout_address_attributes,
27
+ permitted_attributes.checkout_delivery_attributes,
28
+ permitted_attributes.checkout_payment_attributes,
29
+ permitted_attributes.checkout_confirm_attributes
30
+ ]
31
+
32
+ checkout_steps_attributes.each do |step_attributes|
33
+ expect(step_attributes).to include(
34
+ :appended_attribute,
35
+ :appended_with_alias_attribute,
36
+ :another_appended_attribute,
37
+ :prepended_attribute)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -59,7 +59,7 @@ RSpec.describe Spree::Ability, type: :model do
59
59
  let(:resource) { Object.new }
60
60
 
61
61
  context 'with admin user' do
62
- let(:user) { build :admin_user }
62
+ let(:user) { create :admin_user }
63
63
  it_should_behave_like 'access granted'
64
64
  it_should_behave_like 'index allowed'
65
65
  end
@@ -101,6 +101,7 @@ RSpec.describe Spree::Promotion::Rules::Taxon, type: :model do
101
101
  before do
102
102
  taxon.children << taxon2
103
103
  taxon.save!
104
+ taxon.reload
104
105
  product.taxons = [taxon2, taxon3]
105
106
  rule.taxons = [taxon, taxon3]
106
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 7.0.x
22
+ version: 6.1.x
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 7.0.x
32
+ version: 6.1.x
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: actionpack
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '5.1'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: 7.0.x
42
+ version: 6.1.x
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '5.1'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: 7.0.x
52
+ version: 6.1.x
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: actionview
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '5.1'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: 7.0.x
62
+ version: 6.1.x
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '5.1'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: 7.0.x
72
+ version: 6.1.x
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: activejob
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,7 @@ dependencies:
79
79
  version: '5.1'
80
80
  - - "<"
81
81
  - !ruby/object:Gem::Version
82
- version: 7.0.x
82
+ version: 6.1.x
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '5.1'
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: 7.0.x
92
+ version: 6.1.x
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: activemodel
95
95
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '5.1'
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: 7.0.x
102
+ version: 6.1.x
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '5.1'
110
110
  - - "<"
111
111
  - !ruby/object:Gem::Version
112
- version: 7.0.x
112
+ version: 6.1.x
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: activerecord
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -119,7 +119,7 @@ dependencies:
119
119
  version: '5.1'
120
120
  - - "<"
121
121
  - !ruby/object:Gem::Version
122
- version: 7.0.x
122
+ version: 6.1.x
123
123
  type: :runtime
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
@@ -129,7 +129,7 @@ dependencies:
129
129
  version: '5.1'
130
130
  - - "<"
131
131
  - !ruby/object:Gem::Version
132
- version: 7.0.x
132
+ version: 6.1.x
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: activesupport
135
135
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +139,7 @@ dependencies:
139
139
  version: '5.1'
140
140
  - - "<"
141
141
  - !ruby/object:Gem::Version
142
- version: 7.0.x
142
+ version: 6.1.x
143
143
  type: :runtime
144
144
  prerelease: false
145
145
  version_requirements: !ruby/object:Gem::Requirement
@@ -149,7 +149,7 @@ dependencies:
149
149
  version: '5.1'
150
150
  - - "<"
151
151
  - !ruby/object:Gem::Version
152
- version: 7.0.x
152
+ version: 6.1.x
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: railties
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -159,7 +159,7 @@ dependencies:
159
159
  version: '5.1'
160
160
  - - "<"
161
161
  - !ruby/object:Gem::Version
162
- version: 7.0.x
162
+ version: 6.1.x
163
163
  type: :runtime
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
@@ -169,7 +169,7 @@ dependencies:
169
169
  version: '5.1'
170
170
  - - "<"
171
171
  - !ruby/object:Gem::Version
172
- version: 7.0.x
172
+ version: 6.1.x
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: activemerchant
175
175
  requirement: !ruby/object:Gem::Requirement
@@ -188,16 +188,16 @@ dependencies:
188
188
  name: acts_as_list
189
189
  requirement: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - "~>"
191
+ - - "<"
192
192
  - !ruby/object:Gem::Version
193
- version: '0.3'
193
+ version: '2.0'
194
194
  type: :runtime
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
197
197
  requirements:
198
- - - "~>"
198
+ - - "<"
199
199
  - !ruby/object:Gem::Version
200
- version: '0.3'
200
+ version: '2.0'
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: awesome_nested_set
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -976,6 +976,7 @@ files:
976
976
  - spec/lib/spree/migrations_spec.rb
977
977
  - spec/lib/spree/money_spec.rb
978
978
  - spec/lib/spree/permission_sets/default_customer_spec.rb
979
+ - spec/lib/spree/permitted_attributes_spec.rb
979
980
  - spec/lib/spree/promo/environment_spec.rb
980
981
  - spec/lib/tasks/dummy_task.rake
981
982
  - spec/lib/tasks/dummy_task_spec.rb
@@ -1220,7 +1221,7 @@ homepage: http://solidus.io
1220
1221
  licenses:
1221
1222
  - BSD-3-Clause
1222
1223
  metadata: {}
1223
- post_install_message:
1224
+ post_install_message:
1224
1225
  rdoc_options: []
1225
1226
  require_paths:
1226
1227
  - lib
@@ -1235,8 +1236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1235
1236
  - !ruby/object:Gem::Version
1236
1237
  version: 1.8.23
1237
1238
  requirements: []
1238
- rubygems_version: 3.0.3
1239
- signing_key:
1239
+ rubygems_version: 3.1.4
1240
+ signing_key:
1240
1241
  specification_version: 4
1241
1242
  summary: Essential models, mailers, and classes for the Solidus e-commerce project.
1242
1243
  test_files: []