spree_core 4.4.0.rc2 → 4.4.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/concerns/spree/metadata.rb +15 -2
- data/app/models/spree/fulfilment_changer.rb +1 -1
- data/app/models/spree/order/store_credit.rb +8 -0
- data/app/models/spree/order_contents.rb +31 -0
- data/app/models/spree/preferences/preferable_class_methods.rb +2 -0
- data/lib/spree/core/engine.rb +0 -7
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/metadata.rb +34 -3
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6f1530fed2a687bd1eb187fbc25fc58fcd257d498f9e9f641291f99991f0e46
|
|
4
|
+
data.tar.gz: fd670b73289d5515e3e27dd5f80451f3c866865ea278cfb8e8d9b43d3c650a46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d83b92fbf213054613dd642a968a6958c6a54dcdd4177c54385b3a82bf567de92cc5d0c21a18deda0768dfeafb2b955fcf508c1392ded7071e7c499c29afcb73
|
|
7
|
+
data.tar.gz: c4e3da90f798233259263b922a5ac32999d4e34c46a64b0731e316c5eada252b18bce0c53cc4651e977b3984aa343ef80570cdbf96378600f362d23d3bc2b320
|
|
@@ -3,8 +3,21 @@ module Spree
|
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
5
|
included do
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
attribute :public_metadata, default: {} if Rails.version.to_f >= 6.1
|
|
7
|
+
attribute :private_metadata, default: {} if Rails.version.to_f >= 6.1
|
|
8
|
+
serialize :public_metadata, HashSerializer
|
|
9
|
+
serialize :private_metadata, HashSerializer
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# https://nandovieira.com/using-postgresql-and-jsonb-with-ruby-on-rails
|
|
13
|
+
class HashSerializer
|
|
14
|
+
def self.dump(hash)
|
|
15
|
+
hash
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.load(hash)
|
|
19
|
+
(hash || {}).with_indifferent_access
|
|
20
|
+
end
|
|
8
21
|
end
|
|
9
22
|
end
|
|
10
23
|
end
|
|
@@ -92,7 +92,7 @@ module Spree
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def get_desired_shipment_inventory_unit(state)
|
|
95
|
-
desired_shipment.inventory_units.find_or_create_by(state: state) do |unit|
|
|
95
|
+
desired_shipment.inventory_units.find_or_create_by(state: state, variant: variant) do |unit|
|
|
96
96
|
current_shipment_unit = current_shipment_units.first
|
|
97
97
|
unit.variant_id = current_shipment_unit.variant_id
|
|
98
98
|
unit.order_id = current_shipment_unit.order_id
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
class Order < Spree::Base
|
|
3
3
|
module StoreCredit
|
|
4
|
+
def add_store_credit_payments(amount = nil)
|
|
5
|
+
Spree::Dependencies.checkout_add_store_credit_service.constantize.call(order: self, amount: amount)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def remove_store_credit_payments
|
|
9
|
+
Spree::Dependencies.checkout_remove_store_credit_service.constantize.call(order: self)
|
|
10
|
+
end
|
|
11
|
+
|
|
4
12
|
def covered_by_store_credit?
|
|
5
13
|
return false unless user
|
|
6
14
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class OrderContents
|
|
3
|
+
attr_accessor :order, :currency
|
|
4
|
+
|
|
5
|
+
def initialize(order)
|
|
6
|
+
@order = order
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def add(variant, quantity = 1, options = {})
|
|
10
|
+
Spree::Dependencies.cart_add_item_service.constantize.call(order: order,
|
|
11
|
+
variant: variant,
|
|
12
|
+
quantity: quantity,
|
|
13
|
+
options: options).value
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def remove(variant, quantity = 1, options = {})
|
|
17
|
+
Spree::Dependencies.cart_remove_item_service.constantize.call(order: order,
|
|
18
|
+
variant: variant,
|
|
19
|
+
quantity: quantity,
|
|
20
|
+
options: options).value
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def remove_line_item(line_item, options = {})
|
|
24
|
+
Spree::Cart::RemoveLineItem.call(order: @order, line_item: line_item, options: options).value
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update_cart(params)
|
|
28
|
+
Spree::Dependencies.cart_update_service.constantize.call(order: order, params: params).value
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -19,6 +19,8 @@ module Spree::Preferences
|
|
|
19
19
|
value = convert_preference_value(value, type)
|
|
20
20
|
preferences[name] = value
|
|
21
21
|
|
|
22
|
+
ActiveSupport::Deprecation.warn("`#{name}` is deprecated. #{deprecated}") if deprecated
|
|
23
|
+
|
|
22
24
|
# If this is an activerecord object, we need to inform
|
|
23
25
|
# ActiveRecord::Dirty that this value has changed, since this is an
|
|
24
26
|
# in-place update to the preferences hash.
|
data/lib/spree/core/engine.rb
CHANGED
|
@@ -134,13 +134,6 @@ module Spree
|
|
|
134
134
|
Migrations.new(config, engine_name).check
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
initializer 'spree.core.checking_deprecated_preferences' do
|
|
138
|
-
Spree::Config.deprecated_preferences.each do |pref|
|
|
139
|
-
# FIXME: we should only notify about deprecated preferences that are in use, not all of them
|
|
140
|
-
# warn "[DEPRECATION] Spree::Config[:#{pref[:name]}] is deprecated. #{pref[:message]}"
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
137
|
config.to_prepare do
|
|
145
138
|
# Ensure spree locale paths are present before decorators
|
|
146
139
|
I18n.load_path.unshift(*(Dir.glob(
|
data/lib/spree/core/version.rb
CHANGED
|
@@ -4,10 +4,13 @@ shared_examples_for 'metadata' do |factory: described_class.name.demodulize.unde
|
|
|
4
4
|
it { expect(subject.has_attribute?(:public_metadata)).to be_truthy }
|
|
5
5
|
it { expect(subject.has_attribute?(:private_metadata)).to be_truthy }
|
|
6
6
|
|
|
7
|
-
it { expect(subject.public_metadata
|
|
8
|
-
it { expect(subject.private_metadata
|
|
7
|
+
it { expect(subject.public_metadata).to eq({}) }
|
|
8
|
+
it { expect(subject.private_metadata).to eq({}) }
|
|
9
9
|
|
|
10
|
-
it
|
|
10
|
+
it { expect(subject.public_metadata.class).to eq(ActiveSupport::HashWithIndifferentAccess) }
|
|
11
|
+
it { expect(subject.private_metadata.class).to eq(ActiveSupport::HashWithIndifferentAccess) }
|
|
12
|
+
|
|
13
|
+
it 'reads data as symbolized keys' do
|
|
11
14
|
string = subject.public_metadata[:color] = 'red'
|
|
12
15
|
number = subject.public_metadata[:priority] = 1
|
|
13
16
|
array = subject.public_metadata[:keywords] = ['k1', 'k2']
|
|
@@ -20,4 +23,32 @@ shared_examples_for 'metadata' do |factory: described_class.name.demodulize.unde
|
|
|
20
23
|
expect(subject.public_metadata[:keywords]).to eq(array)
|
|
21
24
|
expect(subject.public_metadata[:additional_data]).to eq(hash.stringify_keys)
|
|
22
25
|
end
|
|
26
|
+
|
|
27
|
+
it 'reads data as not symbolized keys' do
|
|
28
|
+
string = subject.public_metadata[:color] = 'red'
|
|
29
|
+
number = subject.public_metadata[:priority] = 1
|
|
30
|
+
array = subject.public_metadata[:keywords] = ['k1', 'k2']
|
|
31
|
+
hash = subject.public_metadata[:additional_data] = { size: 'big', material: 'wool' }
|
|
32
|
+
|
|
33
|
+
subject.save!
|
|
34
|
+
|
|
35
|
+
expect(subject.public_metadata['color']).to eq(string)
|
|
36
|
+
expect(subject.public_metadata['priority']).to eq(number)
|
|
37
|
+
expect(subject.public_metadata['keywords']).to eq(array)
|
|
38
|
+
expect(subject.public_metadata['additional_data']).to eq(hash.stringify_keys)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'can query records by metadata properties', skip: ENV['DB'] == 'mysql' do
|
|
42
|
+
subject.public_metadata[:color] = 'red'
|
|
43
|
+
subject.public_metadata[:priority] = 1
|
|
44
|
+
subject.public_metadata[:keywords] = ['k1', 'k2']
|
|
45
|
+
subject.public_metadata[:additional_data] = { size: 'big', material: 'wool' }
|
|
46
|
+
|
|
47
|
+
subject.save!
|
|
48
|
+
|
|
49
|
+
expect(described_class.where("public_metadata->>'color' = ?", 'red').count).to eq(1)
|
|
50
|
+
expect(described_class.where("public_metadata->>'priority' = ?", '1').count).to eq(1)
|
|
51
|
+
expect(described_class.where("public_metadata -> 'keywords' ? :keyword", keyword: 'k1').count).to eq(1)
|
|
52
|
+
expect(described_class.where("public_metadata -> 'additional_data' ->> 'size' = :size", size: 'big').count).to eq(1)
|
|
53
|
+
end
|
|
23
54
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.4.
|
|
4
|
+
version: 4.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-04-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: actionpack
|
|
@@ -583,6 +583,7 @@ files:
|
|
|
583
583
|
- app/models/spree/order/emails.rb
|
|
584
584
|
- app/models/spree/order/payments.rb
|
|
585
585
|
- app/models/spree/order/store_credit.rb
|
|
586
|
+
- app/models/spree/order_contents.rb
|
|
586
587
|
- app/models/spree/order_inventory.rb
|
|
587
588
|
- app/models/spree/order_merger.rb
|
|
588
589
|
- app/models/spree/order_promotion.rb
|
|
@@ -977,9 +978,9 @@ licenses:
|
|
|
977
978
|
- BSD-3-Clause
|
|
978
979
|
metadata:
|
|
979
980
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
980
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.4.
|
|
981
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.4.1
|
|
981
982
|
documentation_uri: https://dev-docs.spreecommerce.org/
|
|
982
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.4.
|
|
983
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.4.1
|
|
983
984
|
post_install_message:
|
|
984
985
|
rdoc_options: []
|
|
985
986
|
require_paths:
|
|
@@ -995,7 +996,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
995
996
|
- !ruby/object:Gem::Version
|
|
996
997
|
version: 1.8.23
|
|
997
998
|
requirements: []
|
|
998
|
-
rubygems_version: 3.
|
|
999
|
+
rubygems_version: 3.5.3
|
|
999
1000
|
signing_key:
|
|
1000
1001
|
specification_version: 4
|
|
1001
1002
|
summary: The bare bones necessary for Spree
|