solidus_core 4.7.2 → 4.7.3
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/jobs/spree/base_job.rb +1 -1
- data/app/models/spree/order.rb +7 -0
- data/app/models/spree/payment_create.rb +8 -6
- data/app/models/spree/store.rb +2 -1
- data/lib/generators/solidus/install/app_templates/authentication/existing.rb +0 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/preferences/preferable_class_methods.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6016be6a4a01809df118c168c5dd345f73ed968f3ad53262c45594680491d4cb
|
|
4
|
+
data.tar.gz: 64faf68ec42068af0ca862a72f5253fd1f72c99b12b0616178d10c11879e550a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9b6182a1739ef955f53359f927874aee7bcbed451362e4d228b32ee9526ace50bddca9816fa9383662c41352824a03dcbe6a5d6064ab085271a56c0ae02d7bd
|
|
7
|
+
data.tar.gz: cc30e67a19c56e0f0948501a813e2bdf3810eb19e08ecf18482c771aeff678217d4eb4b1ff050a2f92688cd36bfbb1ca3c55e037fcda9bed71fa4edd04e385c0
|
data/app/jobs/spree/base_job.rb
CHANGED
data/app/models/spree/order.rb
CHANGED
|
@@ -321,8 +321,15 @@ module Spree
|
|
|
321
321
|
|
|
322
322
|
# Associates the specified user with the order.
|
|
323
323
|
def associate_user!(user, override_email = true)
|
|
324
|
+
user_changed = user_id != user.try(:id)
|
|
324
325
|
self.user = user
|
|
325
326
|
attrs_to_set = {user_id: user.try(:id)}
|
|
327
|
+
|
|
328
|
+
if user_changed
|
|
329
|
+
self.guest_token = nil
|
|
330
|
+
attrs_to_set[:guest_token] = create_token
|
|
331
|
+
end
|
|
332
|
+
|
|
326
333
|
attrs_to_set[:email] = user.try(:email) if override_email
|
|
327
334
|
attrs_to_set[:created_by_id] = user.try(:id) if created_by.blank?
|
|
328
335
|
|
|
@@ -11,7 +11,7 @@ module Spree
|
|
|
11
11
|
# * :gateway_customer_profile_id, :gateway_payment_profile_id (String): Gateway
|
|
12
12
|
# identifiers for a new {CreditCard}, e.g. a one-time token. Raises
|
|
13
13
|
# ActiveRecord::RecordNotFound if either already belongs to a {CreditCard}
|
|
14
|
-
# owned by a different user.
|
|
14
|
+
# owned by a different user or order.
|
|
15
15
|
# @param request_env [Hash] rack env of user creating the payment
|
|
16
16
|
# @param payment [Payment] Internal use only. Instead of making a new payment, change the attributes for an existing one.
|
|
17
17
|
def initialize(order, attributes, payment: nil, request_env: {})
|
|
@@ -57,11 +57,11 @@ module Spree
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
# Gateway profile
|
|
60
|
+
# Gateway profile IDs may only be submitted for a new source when they are
|
|
61
61
|
# unknown to the store (e.g. a one-time token) or already belong to the
|
|
62
62
|
# order's user. Raises if either id is stored on a {CreditCard} owned by a
|
|
63
|
-
# different user, so customers cannot pay with another
|
|
64
|
-
# gateway credential.
|
|
63
|
+
# different user or no user, so customers cannot pay with another
|
|
64
|
+
# customer's stored gateway credential.
|
|
65
65
|
def ensure_gateway_profile_ownership!(source_class)
|
|
66
66
|
return unless source_class <= Spree::CreditCard
|
|
67
67
|
|
|
@@ -69,8 +69,10 @@ module Spree
|
|
|
69
69
|
value = source_attributes[attribute]
|
|
70
70
|
next if value.blank?
|
|
71
71
|
|
|
72
|
-
foreign_cards = Spree::CreditCard.where(attribute => value)
|
|
73
|
-
|
|
72
|
+
foreign_cards = Spree::CreditCard.where(attribute => value)
|
|
73
|
+
if order&.user_id
|
|
74
|
+
foreign_cards = foreign_cards.where(user_id: nil).or(foreign_cards.where.not(user_id: order.user_id))
|
|
75
|
+
end
|
|
74
76
|
raise ActiveRecord::RecordNotFound if foreign_cards.exists?
|
|
75
77
|
end
|
|
76
78
|
end
|
data/app/models/spree/store.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Spree
|
|
|
25
25
|
self.allowed_ransackable_attributes = %w[name url code]
|
|
26
26
|
|
|
27
27
|
before_save :ensure_default_exists_and_is_unique
|
|
28
|
-
before_destroy :validate_not_default
|
|
28
|
+
before_destroy :validate_not_default, prepend: true
|
|
29
29
|
|
|
30
30
|
enum :reverse_charge_status, {
|
|
31
31
|
disabled: 0,
|
|
@@ -73,6 +73,7 @@ module Spree
|
|
|
73
73
|
def validate_not_default
|
|
74
74
|
if default
|
|
75
75
|
errors.add(:base, :cannot_destroy_default_store)
|
|
76
|
+
throw :abort
|
|
76
77
|
end
|
|
77
78
|
end
|
|
78
79
|
end
|
|
@@ -4,9 +4,7 @@ begin
|
|
|
4
4
|
user_class.classify.constantize
|
|
5
5
|
rescue NameError
|
|
6
6
|
say_status :error, "Can't find an existing user class named #{user_class.classify}, plese set up one before using this authentication option.", :red
|
|
7
|
-
# rubocop:disable Rails/Exit
|
|
8
7
|
abort
|
|
9
|
-
# rubocop:enable Rails/Exit
|
|
10
8
|
end
|
|
11
9
|
|
|
12
10
|
generate "spree:custom_user #{user_class.shellescape}"
|
data/lib/spree/core/version.rb
CHANGED
|
@@ -111,5 +111,9 @@ module Spree::Preferences
|
|
|
111
111
|
def allowed_admin_form_preference_types
|
|
112
112
|
DEFAULT_ADMIN_FORM_PREFERENCE_TYPES
|
|
113
113
|
end
|
|
114
|
+
|
|
115
|
+
def permitted_preference_attributes
|
|
116
|
+
new.admin_form_preference_names.map { |name| :"preferred_#{name}" }
|
|
117
|
+
end
|
|
114
118
|
end
|
|
115
119
|
end
|