solidus_core 2.11.8 → 2.11.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/models/concerns/spree/active_storage_adapter.rb +2 -0
- data/app/models/concerns/spree/active_storage_adapter/attachment.rb +11 -11
- data/app/models/spree/image/active_storage_attachment.rb +10 -2
- data/app/models/spree/image/paperclip_attachment.rb +1 -1
- data/app/models/spree/payment_method/bogus_credit_card.rb +13 -9
- data/app/models/spree/payment_method/simple_bogus_credit_card.rb +4 -4
- data/app/models/spree/refund.rb +5 -3
- data/lib/generators/solidus/install/install_generator.rb +1 -1
- data/lib/spree/app_configuration.rb +8 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/fixtures/file.txt +1 -0
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +4 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6be99509f3f7cdd74113426927e8751493ea311563e4d2a4fbf57d5661da05d
|
4
|
+
data.tar.gz: e5124764c6cfadd679394db2f28d1a45171f5cf45caa571f679a567a985ac5b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0093e9c554425147adf6bbeadf7a7f4ed91190b5a34664935103bfae6c0cb277d62bb44c974b8a625235a400cc91cf00736fceeb971229d56d97fa83eb5c3947'
|
7
|
+
data.tar.gz: bb18cd30482e0bcd1a8efaf671fba77279a04f3f1bf0cb06632fb9bc577af67544cbabcb14e5eae3347d71f74946fe86dd5ee60d4c49a0f130abe4153b45995a
|
@@ -9,11 +9,9 @@ module Spree
|
|
9
9
|
class Attachment
|
10
10
|
delegate_missing_to :@attachment
|
11
11
|
|
12
|
-
DEFAULT_SIZE = '100%'
|
13
|
-
|
14
12
|
def initialize(attachment, styles: {})
|
15
13
|
@attachment = attachment
|
16
|
-
@styles = styles
|
14
|
+
@styles = normalize_styles(styles)
|
17
15
|
end
|
18
16
|
|
19
17
|
def exists?
|
@@ -21,20 +19,18 @@ module Spree
|
|
21
19
|
end
|
22
20
|
|
23
21
|
def filename
|
24
|
-
blob
|
22
|
+
blob&.filename.to_s
|
25
23
|
end
|
26
24
|
|
27
25
|
def url(style = nil)
|
28
|
-
variant(style)
|
26
|
+
variant(style)&.url
|
29
27
|
end
|
30
28
|
|
31
29
|
def variant(style = nil)
|
32
|
-
size = style_to_size(style
|
30
|
+
size = style_to_size(style)
|
33
31
|
@attachment.variant(
|
34
|
-
|
35
|
-
strip: true
|
36
|
-
'auto-orient': true,
|
37
|
-
colorspace: 'sRGB',
|
32
|
+
resize_to_limit: size,
|
33
|
+
strip: true
|
38
34
|
).processed
|
39
35
|
end
|
40
36
|
|
@@ -61,8 +57,12 @@ module Spree
|
|
61
57
|
@attachment.metadata
|
62
58
|
end
|
63
59
|
|
60
|
+
def normalize_styles(styles)
|
61
|
+
styles.transform_values { |v| v.split('x') }
|
62
|
+
end
|
63
|
+
|
64
64
|
def style_to_size(style)
|
65
|
-
@styles.fetch(style) {
|
65
|
+
@styles.fetch(style&.to_sym) { [width, height] }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -7,6 +7,10 @@ module Spree::Image::ActiveStorageAttachment
|
|
7
7
|
delegate :width, :height, to: :attachment, prefix: true
|
8
8
|
|
9
9
|
included do
|
10
|
+
validates :attachment, presence: true
|
11
|
+
validate :attachment_is_an_image
|
12
|
+
validate :supported_content_type
|
13
|
+
|
10
14
|
has_attachment :attachment,
|
11
15
|
styles: {
|
12
16
|
mini: '48x48>',
|
@@ -15,7 +19,11 @@ module Spree::Image::ActiveStorageAttachment
|
|
15
19
|
large: '1200x1200>'
|
16
20
|
},
|
17
21
|
default_style: :product
|
18
|
-
|
19
|
-
|
22
|
+
|
23
|
+
def supported_content_type
|
24
|
+
unless attachment.content_type.in?(Spree::Config.allowed_image_mime_types)
|
25
|
+
errors.add(:attachment, :content_type_not_supported)
|
26
|
+
end
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
@@ -15,7 +15,7 @@ module Spree::Image::PaperclipAttachment
|
|
15
15
|
convert_options: { all: '-strip -auto-orient -colorspace sRGB' }
|
16
16
|
validates_attachment :attachment,
|
17
17
|
presence: true,
|
18
|
-
content_type: { content_type:
|
18
|
+
content_type: { content_type: Spree::Config.allowed_image_mime_types }
|
19
19
|
|
20
20
|
# save the w,h of the original image (from which others can be calculated)
|
21
21
|
# we need to look at the write-queue for images which have not been saved yet
|
@@ -9,6 +9,10 @@ module Spree
|
|
9
9
|
|
10
10
|
VALID_CCS = ['1', TEST_VISA, TEST_MC, TEST_AMEX, TEST_DISC].flatten
|
11
11
|
|
12
|
+
AUTHORIZATION_CODE = '12345'
|
13
|
+
FAILURE_MESSAGE = 'Bogus Gateway: Forced failure'
|
14
|
+
SUCCESS_MESSAGE = 'Bogus Gateway: Forced success'
|
15
|
+
|
12
16
|
attr_accessor :test
|
13
17
|
|
14
18
|
def gateway_class
|
@@ -26,40 +30,40 @@ module Spree
|
|
26
30
|
def authorize(_money, credit_card, _options = {})
|
27
31
|
profile_id = credit_card.gateway_customer_profile_id
|
28
32
|
if VALID_CCS.include?(credit_card.number) || (profile_id && profile_id.starts_with?('BGS-'))
|
29
|
-
ActiveMerchant::Billing::Response.new(true,
|
33
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'D' })
|
30
34
|
else
|
31
|
-
ActiveMerchant::Billing::Response.new(false,
|
35
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, { message: FAILURE_MESSAGE }, test: true)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
35
39
|
def purchase(_money, credit_card, _options = {})
|
36
40
|
profile_id = credit_card.gateway_customer_profile_id
|
37
41
|
if VALID_CCS.include?(credit_card.number) || (profile_id && profile_id.starts_with?('BGS-'))
|
38
|
-
ActiveMerchant::Billing::Response.new(true,
|
42
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'M' })
|
39
43
|
else
|
40
|
-
ActiveMerchant::Billing::Response.new(false,
|
44
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, message: FAILURE_MESSAGE, test: true)
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
48
|
def credit(_money, _credit_card, _response_code, _options = {})
|
45
|
-
ActiveMerchant::Billing::Response.new(true,
|
49
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
|
46
50
|
end
|
47
51
|
|
48
52
|
def capture(_money, authorization, _gateway_options)
|
49
53
|
if authorization == '12345'
|
50
|
-
ActiveMerchant::Billing::Response.new(true,
|
54
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true)
|
51
55
|
else
|
52
|
-
ActiveMerchant::Billing::Response.new(false,
|
56
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, error: FAILURE_MESSAGE, test: true)
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def void(_response_code, _credit_card, _options = {})
|
57
|
-
ActiveMerchant::Billing::Response.new(true,
|
61
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
|
58
62
|
end
|
59
63
|
|
60
64
|
# @see Spree::PaymentMethod#try_void
|
61
65
|
def try_void(_payment)
|
62
|
-
ActiveMerchant::Billing::Response.new(true,
|
66
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE)
|
63
67
|
end
|
64
68
|
|
65
69
|
def test?
|
@@ -9,17 +9,17 @@ module Spree
|
|
9
9
|
|
10
10
|
def authorize(_money, credit_card, _options = {})
|
11
11
|
if VALID_CCS.include? credit_card.number
|
12
|
-
ActiveMerchant::Billing::Response.new(true,
|
12
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'A' })
|
13
13
|
else
|
14
|
-
ActiveMerchant::Billing::Response.new(false,
|
14
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, { message: FAILURE_MESSAGE }, test: true)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def purchase(_money, credit_card, _options = {})
|
19
19
|
if VALID_CCS.include? credit_card.number
|
20
|
-
ActiveMerchant::Billing::Response.new(true,
|
20
|
+
ActiveMerchant::Billing::Response.new(true, SUCCESS_MESSAGE, {}, test: true, authorization: AUTHORIZATION_CODE, avs_result: { code: 'A' })
|
21
21
|
else
|
22
|
-
ActiveMerchant::Billing::Response.new(false,
|
22
|
+
ActiveMerchant::Billing::Response.new(false, FAILURE_MESSAGE, message: FAILURE_MESSAGE, test: true)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/app/models/spree/refund.rb
CHANGED
@@ -48,6 +48,10 @@ module Spree
|
|
48
48
|
return true if perform_after_create == false
|
49
49
|
return true if transaction_id.present?
|
50
50
|
|
51
|
+
# This is needed otherwise set_perform_after_create_default callback
|
52
|
+
# will print a deprecation warning when save! creates a record
|
53
|
+
self.perform_after_create = false unless persisted?
|
54
|
+
|
51
55
|
credit_cents = money.cents
|
52
56
|
|
53
57
|
@perform_response = process!(credit_cents)
|
@@ -63,9 +67,7 @@ module Spree
|
|
63
67
|
log_entries.build(details: perform_response.to_yaml)
|
64
68
|
|
65
69
|
self.transaction_id = perform_response.authorization
|
66
|
-
|
67
|
-
# will print a deprecation warning when save! creates a record.
|
68
|
-
self.perform_after_create = false unless persisted?
|
70
|
+
|
69
71
|
save!
|
70
72
|
|
71
73
|
update_order
|
@@ -171,7 +171,7 @@ module Solidus
|
|
171
171
|
end
|
172
172
|
|
173
173
|
bundle_cleanly{ run "bundle install" } if @plugins_to_be_installed.any?
|
174
|
-
run "spring stop"
|
174
|
+
run "spring stop" if defined?(Spring)
|
175
175
|
|
176
176
|
@plugin_generators_to_run.each do |plugin_generator_name|
|
177
177
|
generate "#{plugin_generator_name} --skip_migrations=false"
|
@@ -504,6 +504,14 @@ module Spree
|
|
504
504
|
# Enumerable of images adhering to the present_image_class interface
|
505
505
|
class_name_attribute :image_attachment_module, default: 'Spree::Image::PaperclipAttachment'
|
506
506
|
|
507
|
+
# @!attribute [rw] allowed_image_mime_types
|
508
|
+
#
|
509
|
+
# Defines which MIME types are allowed for images
|
510
|
+
# `%w(image/jpeg image/jpg image/png image/gif).freeze` is the default.
|
511
|
+
#
|
512
|
+
# @return [Array]
|
513
|
+
class_name_attribute :allowed_image_mime_types, default: %w(image/jpeg image/jpg image/png image/gif).freeze
|
514
|
+
|
507
515
|
# Allows switching attachment library for Taxon
|
508
516
|
#
|
509
517
|
# `Spree::Taxon::PaperclipAttachment`
|
data/lib/spree/core/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
This is a text file
|
@@ -8,24 +8,12 @@ namespace :solidus do
|
|
8
8
|
if Spree::UserAddress.where(default_billing: true).any?
|
9
9
|
Spree.user_class.joins(:bill_address).update_all(bill_address_id: nil) # rubocop:disable Rails/SkipsModelValidations
|
10
10
|
end
|
11
|
-
|
12
|
-
|
13
|
-
sql = <<~SQL
|
14
|
-
UPDATE spree_user_addresses
|
11
|
+
Spree::UserAddress.joins(
|
12
|
+
<<~SQL
|
15
13
|
JOIN spree_users ON spree_user_addresses.user_id = spree_users.id
|
16
|
-
|
17
|
-
SET spree_user_addresses.default_billing = true
|
14
|
+
AND spree_user_addresses.address_id = spree_users.bill_address_id
|
18
15
|
SQL
|
19
|
-
|
20
|
-
sql = <<~SQL
|
21
|
-
UPDATE spree_user_addresses
|
22
|
-
SET default_billing = true
|
23
|
-
FROM spree_users
|
24
|
-
WHERE spree_user_addresses.address_id = spree_users.bill_address_id
|
25
|
-
AND spree_user_addresses.user_id = spree_users.id;
|
26
|
-
SQL
|
27
|
-
end
|
28
|
-
Spree::Base.connection.execute sql
|
16
|
+
).update_all(default_billing: true)
|
29
17
|
puts "Success"
|
30
18
|
end
|
31
19
|
|
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.11.
|
4
|
+
version: 2.11.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -919,6 +919,7 @@ files:
|
|
919
919
|
- lib/spree/testing_support/factories/zone_factory.rb
|
920
920
|
- lib/spree/testing_support/factory_bot.rb
|
921
921
|
- lib/spree/testing_support/fixtures/blank.jpg
|
922
|
+
- lib/spree/testing_support/fixtures/file.txt
|
922
923
|
- lib/spree/testing_support/flash.rb
|
923
924
|
- lib/spree/testing_support/job_helpers.rb
|
924
925
|
- lib/spree/testing_support/order_walkthrough.rb
|