solidus_core 2.11.10 → 2.11.11
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.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/models/spree/order.rb +1 -1
- data/app/models/spree/payment/cancellation.rb +22 -3
- data/app/models/spree/product.rb +0 -1
- data/app/models/spree/stock/simple_coordinator.rb +6 -1
- data/app/models/spree/variant.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +7 -1
- data/lib/spree/testing_support/dummy_app.rb +1 -0
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +13 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a612b396e4f6bd4624851ca8c6a234c6cc1628c8e6edf889d62fb57830b452a2
|
4
|
+
data.tar.gz: 95129bf8b5ad056d9356b63b4a89eaf36697208d16035e84b7627d8d3a710996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba3b3f8246277100e2b3f9f71edca05cd76a1352e851cff75a36c68f7eb8107485ac7d258a0ea15703e3e7582542c24aef1d0201e9d3697b6fbbe80e6315581c
|
7
|
+
data.tar.gz: 219847c0d55e4b02063c69e32a7a0a0399600d083ab915c707722be181f87a591b87a2245e241ba77cee23253ca869228e638eecb8d3ebceb17e67371a125f05
|
data/app/models/spree/order.rb
CHANGED
@@ -584,7 +584,7 @@ module Spree
|
|
584
584
|
raise CannotRebuildShipments.new(I18n.t('spree.cannot_rebuild_shipments_shipments_not_pending'))
|
585
585
|
else
|
586
586
|
shipments.destroy_all
|
587
|
-
|
587
|
+
shipments.push(*Spree::Config.stock.coordinator_class.new(self).shipments)
|
588
588
|
end
|
589
589
|
end
|
590
590
|
|
@@ -26,10 +26,16 @@ module Spree
|
|
26
26
|
# @param payment [Spree::Payment] - the payment that should be canceled
|
27
27
|
#
|
28
28
|
def cancel(payment)
|
29
|
-
|
30
|
-
|
29
|
+
# For payment methods already implemeting `try_void`
|
30
|
+
if try_void_available?(payment.payment_method)
|
31
|
+
if response = payment.payment_method.try_void(payment)
|
32
|
+
payment.handle_void_response(response)
|
33
|
+
else
|
34
|
+
payment.refunds.create!(amount: payment.credit_allowed, reason: refund_reason, perform_after_create: false).perform!
|
35
|
+
end
|
31
36
|
else
|
32
|
-
|
37
|
+
# For payment methods not yet implemeting `try_void`
|
38
|
+
deprecated_behavior(payment)
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
@@ -38,6 +44,19 @@ module Spree
|
|
38
44
|
def refund_reason
|
39
45
|
Spree::RefundReason.where(name: reason).first_or_create
|
40
46
|
end
|
47
|
+
|
48
|
+
def try_void_available?(payment_method)
|
49
|
+
payment_method.respond_to?(:try_void) &&
|
50
|
+
payment_method.method(:try_void).owner != Spree::PaymentMethod
|
51
|
+
end
|
52
|
+
|
53
|
+
def deprecated_behavior(payment)
|
54
|
+
Spree::Deprecation.warn "#{payment.payment_method.class.name}#cancel is deprecated and will be removed. " \
|
55
|
+
'Please implement a `try_void` method instead that returns a response object if void succeeds ' \
|
56
|
+
'or `false|nil` if not. Solidus will refund the payment then.'
|
57
|
+
response = payment.payment_method.cancel(payment.response_code)
|
58
|
+
payment.handle_void_response(response)
|
59
|
+
end
|
41
60
|
end
|
42
61
|
end
|
43
62
|
end
|
data/app/models/spree/product.rb
CHANGED
@@ -73,11 +73,16 @@ module Spree
|
|
73
73
|
packages = split_packages(packages)
|
74
74
|
|
75
75
|
# Turn the Stock::Packages into a Shipment with rates
|
76
|
-
packages.map do |package|
|
76
|
+
shipments = packages.map do |package|
|
77
77
|
shipment = package.shipment = package.to_shipment
|
78
78
|
shipment.shipping_rates = Spree::Config.stock.estimator_class.new.shipping_rates(package)
|
79
79
|
shipment
|
80
80
|
end
|
81
|
+
|
82
|
+
# Make sure we don't add the proposed shipments to the order
|
83
|
+
order.shipments = order.shipments - shipments
|
84
|
+
|
85
|
+
shipments
|
81
86
|
end
|
82
87
|
|
83
88
|
def split_packages(initial_packages)
|
data/app/models/spree/variant.rb
CHANGED
@@ -30,7 +30,7 @@ module Spree
|
|
30
30
|
attr_writer :rebuild_vat_prices
|
31
31
|
include Spree::DefaultPrice
|
32
32
|
|
33
|
-
belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :
|
33
|
+
belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :variants_including_master, optional: false
|
34
34
|
belongs_to :tax_category, class_name: 'Spree::TaxCategory', optional: true
|
35
35
|
|
36
36
|
delegate :name, :description, :slug, :available_on, :discontinue_on, :discontinued?,
|
data/lib/spree/core/version.rb
CHANGED
@@ -52,7 +52,13 @@ module Spree
|
|
52
52
|
:month, :year, :expiry, :first_name, :last_name, :name
|
53
53
|
]
|
54
54
|
|
55
|
-
@@customer_return_attributes = [
|
55
|
+
@@customer_return_attributes = [
|
56
|
+
:stock_location_id, return_items_attributes: [
|
57
|
+
:id, :inventory_unit_id, :return_authorization_id, :returned, :amount,
|
58
|
+
:reception_status_event, :acceptance_status, :exchange_variant_id,
|
59
|
+
:resellable, :return_reason_id
|
60
|
+
]
|
61
|
+
]
|
56
62
|
|
57
63
|
@@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
|
58
64
|
|
@@ -3,22 +3,29 @@
|
|
3
3
|
namespace :solidus do
|
4
4
|
namespace :migrations do
|
5
5
|
namespace :migrate_default_billing_addresses_to_address_book do
|
6
|
-
task up: :environment do
|
7
|
-
|
6
|
+
task :up, [:batch_size] => [:environment] do |_t, args|
|
7
|
+
batch_size = args[:batch_size] || 100_000
|
8
|
+
print "Migrating default billing addresses to address book in batches of #{batch_size} ... "
|
8
9
|
if Spree::UserAddress.where(default_billing: true).any?
|
9
|
-
Spree.user_class.joins(:bill_address).
|
10
|
+
Spree.user_class.joins(:bill_address).in_batches(of: batch_size).each do |batch|
|
11
|
+
batch.update_all(bill_address_id: nil) # rubocop:disable Rails/SkipsModelValidations
|
12
|
+
end
|
10
13
|
end
|
11
14
|
Spree::UserAddress.joins(
|
12
15
|
<<~SQL
|
13
16
|
JOIN spree_users ON spree_user_addresses.user_id = spree_users.id
|
14
17
|
AND spree_user_addresses.address_id = spree_users.bill_address_id
|
15
18
|
SQL
|
16
|
-
).
|
19
|
+
).in_batches(of: batch_size).each do |batch|
|
20
|
+
batch.update_all(default_billing: true) # rubocop:disable Rails/SkipsModelValidations
|
21
|
+
end
|
22
|
+
|
17
23
|
puts "Success"
|
18
24
|
end
|
19
25
|
|
20
|
-
task down: :environment do
|
21
|
-
|
26
|
+
task :down, [:batch_size] => [:environment] do |_t, args|
|
27
|
+
batch_size = args[:batch_size] || 100_000
|
28
|
+
Spree::UserAddress.in_batches(of: batch_size).update_all(default_billing: false) # rubocop:disable Rails/SkipsModelValidations
|
22
29
|
puts "Rolled back default billing address migration to address book"
|
23
30
|
end
|
24
31
|
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: 2.11.
|
4
|
+
version: 2.11.11
|
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-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -985,7 +985,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
985
985
|
- !ruby/object:Gem::Version
|
986
986
|
version: 1.8.23
|
987
987
|
requirements: []
|
988
|
-
rubygems_version: 3.
|
988
|
+
rubygems_version: 3.2.20
|
989
989
|
signing_key:
|
990
990
|
specification_version: 4
|
991
991
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|