solidus_core 3.0.3 → 3.0.6
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/active_storage_adapter/attachment.rb +4 -2
- data/app/models/spree/order_shipping.rb +6 -9
- data/app/models/spree/product.rb +1 -0
- data/app/models/spree/promotion_code.rb +2 -2
- data/app/models/spree/refund.rb +8 -0
- data/app/models/spree/store_credit.rb +8 -0
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/blacklist_urls.rb +1 -1
- data/lib/spree/testing_support/dummy_app.rb +1 -0
- data/lib/tasks/solidus/check_orders_with_invalid_email.rake +18 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d1ce3955d5e6602144201d2672f85af4d0c9c27ea04ed25b3bd13945e1a22c7
|
4
|
+
data.tar.gz: 8726f50bdd8922267dcda829078e4ea4a70a39766098076b1f792145fdfb18b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9517bfb7a7df1a91a16f4c03a1455016be0a328bf2cb58f50da97270d2b221a084539df35be76df57ec7928a23cf3049a0a8dbcfd0d1e60a47242630d462c694
|
7
|
+
data.tar.gz: e5742706f8c34b9ca310787c6ded79a4203eb3bce38127db4f31ef3276b23cedb2a7849b8226b5110f73124a5dab3e570f8202a38d583cb6c4f9c775b14ab392
|
@@ -30,7 +30,9 @@ module Spree
|
|
30
30
|
size = style_to_size(style)
|
31
31
|
@attachment.variant(
|
32
32
|
resize_to_limit: size,
|
33
|
-
|
33
|
+
saver: {
|
34
|
+
strip: true
|
35
|
+
}
|
34
36
|
).processed
|
35
37
|
end
|
36
38
|
|
@@ -58,7 +60,7 @@ module Spree
|
|
58
60
|
end
|
59
61
|
|
60
62
|
def normalize_styles(styles)
|
61
|
-
styles.transform_values { |v| v.split('x') }
|
63
|
+
styles.transform_values { |v| v.split('x').map(&:to_i) }
|
62
64
|
end
|
63
65
|
|
64
66
|
def style_to_size(style)
|
@@ -62,18 +62,15 @@ class Spree::OrderShipping
|
|
62
62
|
end
|
63
63
|
|
64
64
|
inventory_units.map(&:shipment).uniq.each do |shipment|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
# TODO: make OrderShipping#ship_shipment call Shipment#ship! rather than
|
71
|
-
# having Shipment#ship! call OrderShipping#ship_shipment. We only really
|
72
|
-
# need this `update_columns` for the specs, until we make that change.
|
73
|
-
shipment.update_columns(state: 'shipped', shipped_at: Time.current)
|
65
|
+
if shipment.inventory_units.reload.all? { |iu| iu.shipped? || iu.canceled? }
|
66
|
+
shipment.update!(state: "shipped", shipped_at: Time.current, tracking: tracking_number)
|
67
|
+
else
|
68
|
+
shipment.update!(tracking: tracking_number)
|
69
|
+
end
|
74
70
|
end
|
75
71
|
|
76
72
|
send_shipment_emails(carton) if stock_location.fulfillable? && !suppress_mailer # e.g. digital gift cards that aren't actually shipped
|
73
|
+
@order.shipments.reload
|
77
74
|
@order.recalculate
|
78
75
|
|
79
76
|
carton
|
data/app/models/spree/product.rb
CHANGED
@@ -5,12 +5,12 @@ class Spree::PromotionCode < Spree::Base
|
|
5
5
|
belongs_to :promotion_code_batch, class_name: "Spree::PromotionCodeBatch", optional: true
|
6
6
|
has_many :adjustments
|
7
7
|
|
8
|
+
before_validation :normalize_code
|
9
|
+
|
8
10
|
validates :value, presence: true, uniqueness: { allow_blank: true, case_sensitive: true }
|
9
11
|
validates :promotion, presence: true
|
10
12
|
validate :promotion_not_apply_automatically, on: :create
|
11
13
|
|
12
|
-
before_save :normalize_code
|
13
|
-
|
14
14
|
self.whitelisted_ransackable_attributes = ['value']
|
15
15
|
|
16
16
|
# Whether the promotion code has exceeded its usage restrictions
|
data/app/models/spree/refund.rb
CHANGED
@@ -31,6 +31,14 @@ module Spree
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
# Sets this price's amount to a new value, parsing it if the new value is
|
35
|
+
# a string.
|
36
|
+
#
|
37
|
+
# @param price [String, #to_d] a new amount
|
38
|
+
def amount=(price)
|
39
|
+
self[:amount] = Spree::LocalizedNumber.parse(price)
|
40
|
+
end
|
41
|
+
|
34
42
|
def description
|
35
43
|
payment.payment_method.name
|
36
44
|
end
|
@@ -40,6 +40,14 @@ class Spree::StoreCredit < Spree::PaymentSource
|
|
40
40
|
extend Spree::DisplayMoney
|
41
41
|
money_methods :amount, :amount_used, :amount_authorized
|
42
42
|
|
43
|
+
# Sets this store credit's amount to a new value,
|
44
|
+
# parsing it as a localized number if the new value is a string.
|
45
|
+
#
|
46
|
+
# @param number [String, #to_d] a new amount
|
47
|
+
def amount=(number)
|
48
|
+
self[:amount] = Spree::LocalizedNumber.parse(number)
|
49
|
+
end
|
50
|
+
|
43
51
|
def amount_remaining
|
44
52
|
return 0.0.to_d if invalidated?
|
45
53
|
amount - amount_used - amount_authorized
|
@@ -12,7 +12,7 @@ module Spree
|
|
12
12
|
# end
|
13
13
|
#
|
14
14
|
class EmailValidator < ActiveModel::EachValidator
|
15
|
-
EMAIL_REGEXP =
|
15
|
+
EMAIL_REGEXP = URI::MailTo::EMAIL_REGEXP
|
16
16
|
|
17
17
|
def validate_each(record, attribute, value)
|
18
18
|
unless EMAIL_REGEXP.match? value
|
data/lib/spree/core/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :solidus do
|
4
|
+
desc 'Prints orders with invalid email (after fix for GHSA-qxmr-qxh6-2cc9)'
|
5
|
+
task check_orders_with_invalid_email: :environment do
|
6
|
+
matches = Spree::Order.find_each.reduce([]) do |matches, order|
|
7
|
+
order.email.nil? || Spree::EmailValidator::EMAIL_REGEXP.match?(order.email) ? matches : matches + [order]
|
8
|
+
end
|
9
|
+
if matches.any?
|
10
|
+
puts 'Email / ID / Number'
|
11
|
+
puts(matches.map do |order|
|
12
|
+
"#{order.email} / #{order.id} / #{order.number}"
|
13
|
+
end.join("\n"))
|
14
|
+
else
|
15
|
+
puts 'NO MATCHES'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -903,6 +903,7 @@ files:
|
|
903
903
|
- lib/spree/testing_support/url_helpers.rb
|
904
904
|
- lib/spree/user_class_handle.rb
|
905
905
|
- lib/spree_core.rb
|
906
|
+
- lib/tasks/solidus/check_orders_with_invalid_email.rake
|
906
907
|
- lib/tasks/upgrade.rake
|
907
908
|
- solidus_core.gemspec
|
908
909
|
- vendor/assets/javascripts/jquery.payment.js
|
@@ -944,7 +945,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
944
945
|
- !ruby/object:Gem::Version
|
945
946
|
version: 1.8.23
|
946
947
|
requirements: []
|
947
|
-
rubygems_version: 3.
|
948
|
+
rubygems_version: 3.2.31
|
948
949
|
signing_key:
|
949
950
|
specification_version: 4
|
950
951
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|