solidus_core 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/spree/in_memory_order_updater.rb +2 -4
- data/app/models/spree/line_item.rb +1 -1
- data/app/models/spree/order_updater.rb +1 -1
- data/app/models/spree/permission_sets/default_customer.rb +3 -3
- data/app/models/spree/shipment.rb +7 -2
- data/app/models/spree/shipping_manifest.rb +44 -9
- data/app/models/spree/stock/estimator.rb +1 -1
- data/app/models/spree/store.rb +1 -1
- data/app/models/spree/variant/pricing_options.rb +1 -1
- data/app/views/layouts/spree/base_mailer.html.erb +1 -0
- data/app/views/layouts/spree/ink.license.txt +28 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +2 -1
- data/lib/spree/testing_support/capybara_ext.rb +9 -1
- data/lib/spree/testing_support/dummy_app.rb +16 -1
- data/vendor/assets/javascripts/jquery.payment.license.txt +25 -0
- data/vendor/assets/javascripts/jsuri.license.txt +12 -0
- 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: 78c29ac128ed3b6ae1572035004a577b125403271d2d331f598a6fae3860003d
|
|
4
|
+
data.tar.gz: aecc835e960dc5b51f163f41ea9abc07dba2ff27717f24c8623a563b14d5e9ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9a161abf80858e4511684189d7f66f93e9a0774f091448702f174586ae10a1c13669d6c0efa6afd9f20470602dc95e55a06bad734913e482195915d053b56d6
|
|
7
|
+
data.tar.gz: ea34f9b2b35829c6888d11ceea67b3b056c1857ab9567fc941827d84c7b23789853ae1f9f2f6aec4381074208fd574742fa571ddbb0d72edee33fb90ccd0c535
|
|
@@ -53,10 +53,10 @@ module Spree
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
Spree::Bus.publish(:order_recalculated, order:)
|
|
57
|
-
|
|
58
56
|
persist_totals if persist
|
|
59
57
|
end
|
|
58
|
+
|
|
59
|
+
Spree::Bus.publish(:order_recalculated, order:) if persist
|
|
60
60
|
end
|
|
61
61
|
alias_method :update, :recalculate
|
|
62
62
|
deprecate update: :recalculate, deprecator: Spree.deprecator
|
|
@@ -236,8 +236,6 @@ module Spree
|
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
def persist_totals
|
|
239
|
-
shipments.each(&:persist_amounts)
|
|
240
|
-
assign_item_totals
|
|
241
239
|
log_state_change("payment")
|
|
242
240
|
log_state_change("shipment")
|
|
243
241
|
order.save!
|
|
@@ -62,7 +62,7 @@ module Spree
|
|
|
62
62
|
# @return [BigDecimal] the amount of this item, taking into consideration
|
|
63
63
|
# all non-tax adjustments.
|
|
64
64
|
def total_before_tax
|
|
65
|
-
amount + adjustments.reject
|
|
65
|
+
amount + adjustments.reject { |adjustment| adjustment.tax? || adjustment.marked_for_destruction? }.sum(&:amount)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# @return [BigDecimal] the amount of this line item before VAT tax
|
|
@@ -27,9 +27,9 @@ module Spree
|
|
|
27
27
|
update_shipments
|
|
28
28
|
recalculate_shipment_state
|
|
29
29
|
end
|
|
30
|
-
Spree::Bus.publish(:order_recalculated, order:)
|
|
31
30
|
persist_totals
|
|
32
31
|
end
|
|
32
|
+
Spree::Bus.publish(:order_recalculated, order:)
|
|
33
33
|
end
|
|
34
34
|
alias_method :update, :recalculate
|
|
35
35
|
deprecate update: :recalculate, deprecator: Spree.deprecator
|
|
@@ -63,18 +63,18 @@ module Spree
|
|
|
63
63
|
can :create, ReturnAuthorization do |return_authorization|
|
|
64
64
|
return_authorization.order.user == user
|
|
65
65
|
end
|
|
66
|
-
can [:read, :update], CreditCard, user_id: user.id
|
|
66
|
+
can [:read, :update], CreditCard, user_id: user.id if user.persisted?
|
|
67
67
|
can :read, Product
|
|
68
68
|
can :read, ProductProperty
|
|
69
69
|
can :read, Property
|
|
70
70
|
can :create, Spree.user_class
|
|
71
|
-
can [:show, :update, :update_email], Spree.user_class, id: user.id
|
|
71
|
+
can [:show, :update, :update_email], Spree.user_class, id: user.id if user.persisted?
|
|
72
72
|
can :read, State
|
|
73
73
|
can :read, StockItem, stock_location: {active: true}
|
|
74
74
|
can :read, StockLocation, active: true
|
|
75
75
|
can :read, Taxon
|
|
76
76
|
can :read, Taxonomy
|
|
77
|
-
can [:save_in_address_book, :remove_from_address_book], Spree.user_class, id: user.id
|
|
77
|
+
can [:save_in_address_book, :remove_from_address_book], Spree.user_class, id: user.id if user.persisted?
|
|
78
78
|
can [:read, :view_out_of_stock], Variant
|
|
79
79
|
can :read, Zone
|
|
80
80
|
end
|
|
@@ -95,7 +95,7 @@ module Spree
|
|
|
95
95
|
# @return [BigDecimal] the amount of this item, taking into consideration
|
|
96
96
|
# all non-tax adjustments.
|
|
97
97
|
def total_before_tax
|
|
98
|
-
amount + adjustments.reject
|
|
98
|
+
amount + adjustments.reject { |adjustment| adjustment.tax? || adjustment.marked_for_destruction? }.sum(&:amount)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
# @return [BigDecimal] the amount of this shipment before VAT tax
|
|
@@ -178,7 +178,12 @@ module Spree
|
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
def manifest
|
|
181
|
-
@manifest ||= Spree::ShippingManifest.new(
|
|
181
|
+
@manifest ||= Spree::ShippingManifest.new(
|
|
182
|
+
inventory_units:,
|
|
183
|
+
# Only when it is already in memory — the manifest treats the order as an
|
|
184
|
+
# optimization and must not cause a query for it.
|
|
185
|
+
order: (order if association(:order).loaded?)
|
|
186
|
+
).items
|
|
182
187
|
end
|
|
183
188
|
|
|
184
189
|
def selected_shipping_rate_id
|
|
@@ -3,28 +3,63 @@
|
|
|
3
3
|
class Spree::ShippingManifest
|
|
4
4
|
ManifestItem = Struct.new(:line_item, :variant, :quantity, :states)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
attr_reader :inventory_units, :order
|
|
7
|
+
|
|
8
|
+
# @param inventory_units [Enumerable<Spree::InventoryUnit>]
|
|
9
|
+
# @param order [Spree::Order, nil] the order the units belong to. When
|
|
10
|
+
# given and its line items are already loaded, the manifest reuses those
|
|
11
|
+
# +Spree::LineItem+ instances rather than letting each inventory unit
|
|
12
|
+
# load its own copy.
|
|
13
|
+
def initialize(inventory_units:, order: nil)
|
|
14
|
+
@inventory_units = inventory_units
|
|
15
|
+
@order = order
|
|
8
16
|
end
|
|
9
17
|
|
|
10
18
|
def for_order(order)
|
|
11
|
-
|
|
12
|
-
inventory_units:
|
|
19
|
+
self.class.new(
|
|
20
|
+
inventory_units: inventory_units.select { |unit| unit.order_id == order.id },
|
|
21
|
+
order: order
|
|
13
22
|
)
|
|
14
23
|
end
|
|
15
24
|
|
|
16
25
|
def items
|
|
17
26
|
# Grouping by the ID means that we don't have to call out to the association accessor
|
|
18
27
|
# This makes the grouping by faster because it results in less SQL cache hits.
|
|
19
|
-
|
|
20
|
-
variant_units.group_by(&:line_item_id).map do |
|
|
28
|
+
inventory_units.group_by(&:variant_id).flat_map do |_variant_id, variant_units|
|
|
29
|
+
variant_units.group_by(&:line_item_id).map do |line_item_id, line_item_units|
|
|
21
30
|
states = {}
|
|
22
|
-
|
|
31
|
+
line_item_units.group_by(&:state).each { |state, iu| states[state] = iu.count }
|
|
23
32
|
|
|
24
|
-
first_unit =
|
|
33
|
+
first_unit = line_item_units.first
|
|
25
34
|
|
|
26
|
-
ManifestItem.new(
|
|
35
|
+
ManifestItem.new(
|
|
36
|
+
line_item_for(line_item_id, first_unit),
|
|
37
|
+
first_unit.variant,
|
|
38
|
+
line_item_units.length,
|
|
39
|
+
states
|
|
40
|
+
)
|
|
27
41
|
end
|
|
28
42
|
end
|
|
29
43
|
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# Prefer the instance the order already holds in memory. Rails has no identity
|
|
48
|
+
# map, so +unit.line_item+ returns a second instance of the same row: it does
|
|
49
|
+
# not reflect adjustments that have been recalculated on the order's own line
|
|
50
|
+
# items but not yet persisted, and it costs a query per line item on top.
|
|
51
|
+
def line_item_for(line_item_id, unit)
|
|
52
|
+
order_line_items.fetch(line_item_id) { unit.line_item }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Empty unless the order's line items are already loaded. This is an
|
|
56
|
+
# optimization for callers that have them, never a reason to run a query.
|
|
57
|
+
def order_line_items
|
|
58
|
+
@order_line_items ||=
|
|
59
|
+
if order&.association(:line_items)&.loaded?
|
|
60
|
+
order.line_items.index_by(&:id)
|
|
61
|
+
else
|
|
62
|
+
{}
|
|
63
|
+
end
|
|
64
|
+
end
|
|
30
65
|
end
|
data/app/models/spree/store.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width">
|
|
6
|
+
<%# The Ink CSS below is MIT licensed; see ink.license.txt in this directory. %>
|
|
6
7
|
<style>
|
|
7
8
|
/**********************************************
|
|
8
9
|
* Ink v1.0.5 - Copyright 2013 ZURB Inc *
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
The mailer layout in this directory (base_mailer.html.erb) inlines the
|
|
2
|
+
CSS of Ink v1.0.5, ZURB's responsive email framework, from
|
|
3
|
+
https://github.com/foundation/foundation-emails (formerly zurb/ink).
|
|
4
|
+
|
|
5
|
+
--------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2013 ZURB, inc.
|
|
8
|
+
|
|
9
|
+
MIT License
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
12
|
+
a copy of this software and associated documentation files (the
|
|
13
|
+
"Software"), to deal in the Software without restriction, including
|
|
14
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
15
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
16
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
17
|
+
the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be
|
|
20
|
+
included in all copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
23
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
24
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
25
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
26
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
28
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/spree/core/version.rb
CHANGED
|
@@ -73,7 +73,7 @@ module Spree
|
|
|
73
73
|
|
|
74
74
|
@@option_type_attributes = [:name, :presentation, option_values_attributes: option_value_attributes]
|
|
75
75
|
|
|
76
|
-
@@payment_attributes = [:
|
|
76
|
+
@@payment_attributes = [:payment_method_id, :payment_method, customer_metadata: {}]
|
|
77
77
|
|
|
78
78
|
@@product_properties_attributes = [:property_name, :value, :position]
|
|
79
79
|
|
|
@@ -165,6 +165,7 @@ module Spree
|
|
|
165
165
|
|
|
166
166
|
@@checkout_payment_attributes = [
|
|
167
167
|
payments_attributes: payment_attributes + [
|
|
168
|
+
:amount,
|
|
168
169
|
source_attributes:
|
|
169
170
|
]
|
|
170
171
|
]
|
|
@@ -4,7 +4,15 @@ module Spree
|
|
|
4
4
|
module TestingSupport
|
|
5
5
|
module CapybaraExt
|
|
6
6
|
def click_icon(type)
|
|
7
|
-
find(".fa-#{type}")
|
|
7
|
+
el = find(".fa-#{type}", visible: :all)
|
|
8
|
+
begin
|
|
9
|
+
el.click
|
|
10
|
+
rescue Selenium::WebDriver::Error::ElementClickInterceptedError
|
|
11
|
+
# When a floating element (eg. tooltips/overlays) intercepts the click,
|
|
12
|
+
# scroll the target into view and dispatch a click via JS to keep tests stable.
|
|
13
|
+
page.execute_script('arguments[0].scrollIntoView({block: "center"});', el.native)
|
|
14
|
+
page.execute_script("arguments[0].click();", el.native)
|
|
15
|
+
end
|
|
8
16
|
end
|
|
9
17
|
|
|
10
18
|
def eventually_fill_in(field, options = {})
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
ENV["RAILS_ENV"] = "test"
|
|
4
4
|
ENV["DISABLE_DATABASE_ENVIRONMENT_CHECK"] = "1"
|
|
5
5
|
|
|
6
|
+
# Speed up the sqlite runs: `fast_sqlite` patches SQLite3::Database#initialize to
|
|
7
|
+
# set `PRAGMA synchronous = OFF` and `journal_mode = MEMORY`, trading durability we
|
|
8
|
+
# don't need for a database the suite recreates anyway.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: The gem is declared `require: false`, and only when DB is sqlite, so it is
|
|
11
|
+
# genuinely absent for the mysql and postgres runs.
|
|
12
|
+
begin
|
|
13
|
+
require "fast_sqlite"
|
|
14
|
+
rescue LoadError
|
|
15
|
+
# Not running against sqlite, nothing to speed up.
|
|
16
|
+
end
|
|
17
|
+
|
|
6
18
|
require "rails"
|
|
7
19
|
require "active_record/railtie"
|
|
8
20
|
require "action_controller/railtie"
|
|
@@ -106,7 +118,10 @@ module DummyApp
|
|
|
106
118
|
|
|
107
119
|
# Set the preview path within the dummy app:
|
|
108
120
|
if ActionMailer::Base.respond_to? :preview_paths # Rails 7.1+
|
|
109
|
-
|
|
121
|
+
# Some Rails versions return a frozen array here; assign a new array
|
|
122
|
+
# to avoid FrozenError when augmenting the paths.
|
|
123
|
+
existing = Array(config.action_mailer.preview_paths)
|
|
124
|
+
config.action_mailer.preview_paths = existing + [File.expand_path("dummy_app/mailer_previews", __dir__)]
|
|
110
125
|
else
|
|
111
126
|
config.action_mailer.preview_path = File.expand_path("dummy_app/mailer_previews", __dir__)
|
|
112
127
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
This license covers the vendored jQuery.payment v1.3.2 (jquery.payment.js
|
|
2
|
+
in this directory), from https://github.com/stripe-archive/jquery.payment.
|
|
3
|
+
|
|
4
|
+
--------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2014 Stripe
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
9
|
+
a copy of this software and associated documentation files (the
|
|
10
|
+
"Software"), to deal in the Software without restriction, including
|
|
11
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
13
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
14
|
+
the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be
|
|
17
|
+
included in all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
22
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
23
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
24
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
25
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
This license covers the vendored jsUri v1.1.1 (jsuri.js in this
|
|
2
|
+
directory), from https://github.com/derek-watson/jsUri.
|
|
3
|
+
|
|
4
|
+
--------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2014, Derek Watson
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_core
|
|
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
|
- Solidus Team
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: actionmailer
|
|
@@ -771,6 +770,7 @@ files:
|
|
|
771
770
|
- app/subscribers/spree/order_mailer_subscriber.rb
|
|
772
771
|
- app/subscribers/spree/reimbursement_mailer_subscriber.rb
|
|
773
772
|
- app/views/layouts/spree/base_mailer.html.erb
|
|
773
|
+
- app/views/layouts/spree/ink.license.txt
|
|
774
774
|
- app/views/spree/carton_mailer/shipped_email.html.erb
|
|
775
775
|
- app/views/spree/carton_mailer/shipped_email.text.erb
|
|
776
776
|
- app/views/spree/order_mailer/cancel_email.html.erb
|
|
@@ -1075,7 +1075,9 @@ files:
|
|
|
1075
1075
|
- lib/tasks/solidus/delete_prices_with_nil_amount.rake
|
|
1076
1076
|
- solidus_core.gemspec
|
|
1077
1077
|
- vendor/assets/javascripts/jquery.payment.js
|
|
1078
|
+
- vendor/assets/javascripts/jquery.payment.license.txt
|
|
1078
1079
|
- vendor/assets/javascripts/jsuri.js
|
|
1080
|
+
- vendor/assets/javascripts/jsuri.license.txt
|
|
1079
1081
|
- vendor/assets/stylesheets/normalize.css
|
|
1080
1082
|
homepage: http://solidus.io
|
|
1081
1083
|
licenses:
|
|
@@ -1119,8 +1121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1119
1121
|
- !ruby/object:Gem::Version
|
|
1120
1122
|
version: 1.8.23
|
|
1121
1123
|
requirements: []
|
|
1122
|
-
rubygems_version:
|
|
1123
|
-
signing_key:
|
|
1124
|
+
rubygems_version: 4.0.10
|
|
1124
1125
|
specification_version: 4
|
|
1125
1126
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|
|
1126
1127
|
test_files: []
|