spree_core 5.3.1 → 5.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 955b622bdd29054fb4bdb3e336a4a72e36c03f20e54cec6704aed0ed00407f17
4
- data.tar.gz: 2b0d4168fa45ce1814d16b42c54241b1b63034a586281bccd5fb6297f1634aac
3
+ metadata.gz: 8852343e0b0e126beaff8b5745ca76527a0c436344f670c2cdab2f27eeb1f23f
4
+ data.tar.gz: a3378bc532a952c8d72190c5ebfb244c07b103a8f4bb67ec3bcf889278395a45
5
5
  SHA512:
6
- metadata.gz: 68f6b6296a2d489c54009a8d52586e268d01c7894785c6cf1d5d0d428a6e8fa2365b8b29296bbc4a4452004efedea81c397d73ceb3047f6e9d9e9370af41fc7e
7
- data.tar.gz: 6ec77c2ecee5028ee57e03664dfb2fec39794867e04659fb0fcb1d7042287a8b912705f1c20674a9be68c00c0050a54d6cc3e05bc73b36f9112b1c2bfb931619
6
+ metadata.gz: 893e2c5b7d12b76c599a35ed91df5062fb8849144c4dd34cfc528b59c7c8d993ef523e443d3aba36e949af5814f68105af80fc3caee9295919d53eb5fe3ed137
7
+ data.tar.gz: 81cdf22db519e0695e36363a097a0b6703e4bba5a44aff5989bb225d5ea2f16e1ffa087507c2af57254bdd1c3fd0b24b5649b56bca0ee8b38bc46bee59172041
@@ -57,6 +57,10 @@ module Spree
57
57
  #
58
58
  attribute :record_selection, :string, default: 'filtered'
59
59
 
60
+ def event_serializer_class
61
+ Spree::Events::ExportSerializer
62
+ end
63
+
60
64
  def done?
61
65
  attachment.present? && attachment.attached?
62
66
  end
@@ -196,7 +200,7 @@ module Spree
196
200
  def model_class
197
201
  klass = "Spree::#{to_s.demodulize.singularize}".safe_constantize
198
202
 
199
- raise NameError, "Missing model class for #{to_s}" unless klass
203
+ raise NameError, "Missing model class for #{self}" unless klass
200
204
 
201
205
  klass
202
206
  end
@@ -225,6 +225,10 @@ module Spree
225
225
  @current_ability ||= Spree.ability_class.new(user, { store: store })
226
226
  end
227
227
 
228
+ def event_serializer_class
229
+ Spree::Events::ImportSerializer
230
+ end
231
+
228
232
  class << self
229
233
  # Returns the available types for the import
230
234
  # @return [Array<Class>]
@@ -14,13 +14,17 @@ module Spree
14
14
  end
15
15
 
16
16
  def bill_address_id=(id)
17
+ return if bill_address_id == id
18
+
17
19
  address = Spree::Address.find_by(id: id)
18
- if address && address.user_id == user_id
20
+ # rubocop:disable Style/ConditionalAssignment
21
+ if address && user_id.present? && address.user_id == user_id
19
22
  self['bill_address_id'] = address.id
20
- bill_address.reload
21
23
  else
22
24
  self['bill_address_id'] = nil
23
25
  end
26
+ # rubocop:enable Style/ConditionalAssignment
27
+ reset_bill_address
24
28
  end
25
29
 
26
30
  def bill_address_attributes=(attributes)
@@ -29,13 +33,17 @@ module Spree
29
33
  end
30
34
 
31
35
  def ship_address_id=(id)
36
+ return if ship_address_id == id
37
+
32
38
  address = Spree::Address.find_by(id: id)
33
- if address && address.user_id == user_id
39
+ # rubocop:disable Style/ConditionalAssignment
40
+ if address && user_id.present? && address.user_id == user_id
34
41
  self['ship_address_id'] = address.id
35
- ship_address.reload
36
42
  else
37
43
  self['ship_address_id'] = nil
38
44
  end
45
+ # rubocop:enable Style/ConditionalAssignment
46
+ reset_ship_address
39
47
  end
40
48
 
41
49
  def ship_address_attributes=(attributes)
@@ -66,7 +66,10 @@ module Spree
66
66
  # @return [BigDecimal] The total amount of store credits applied to the order.
67
67
  def total_applied_store_credit
68
68
  if payments.loaded?
69
- payments.find_all(&:store_credit?).find_all(&:valid?).sum(&:amount) || BigDecimal::ZERO
69
+ payments.
70
+ find_all(&:store_credit?).
71
+ reject(&:has_invalid_state?).
72
+ sum(&:amount) || BigDecimal::ZERO
70
73
  else
71
74
  payments.store_credits.valid.sum(:amount)
72
75
  end
@@ -278,6 +278,10 @@ module Spree
278
278
  end
279
279
  end
280
280
 
281
+ def has_invalid_state?
282
+ INVALID_STATES.include?(state)
283
+ end
284
+
281
285
  private
282
286
 
283
287
  def set_amount
@@ -302,10 +306,6 @@ module Spree
302
306
  publish_event('payment.voided')
303
307
  end
304
308
 
305
- def has_invalid_state?
306
- INVALID_STATES.include?(state)
307
- end
308
-
309
309
  def validate_source
310
310
  if source && !source.valid?
311
311
  source.errors.map { |error| { field: error.attribute, message: error&.message } }.each do |err|
@@ -31,6 +31,10 @@ module Spree
31
31
  #
32
32
  has_one_attached :attachment, service: Spree.private_storage_service_name
33
33
 
34
+ def event_serializer_class
35
+ Spree::Events::ReportSerializer
36
+ end
37
+
34
38
  def self.report_type
35
39
  name.demodulize.underscore
36
40
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- VERSION = '5.3.1'.freeze
2
+ VERSION = '5.3.2'.freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -3,7 +3,7 @@ require 'generators/spree/dummy_model/dummy_model_generator'
3
3
 
4
4
  desc 'Generates a dummy app for testing'
5
5
  namespace :common do
6
- task :test_app, :user_class do |_t, args|
6
+ task :test_app, [:authentication, :user_class, :admin_user_class, :css, :javascript, :install_admin, :install_storefront] do |_t, args|
7
7
  args.with_defaults(
8
8
  authentication: 'dummy',
9
9
  user_class: 'Spree::LegacyUser',
@@ -2,8 +2,21 @@ require 'spree/testing_support/common_rake'
2
2
 
3
3
  desc 'Generates a dummy app for testing an extension'
4
4
  namespace :extension do
5
- task :test_app, [:authentication, :user_class] do |_t, args|
5
+ task :test_app, [:options] do |_t, args|
6
6
  Spree::DummyGeneratorHelper.inject_extension_requirements = true
7
- Rake::Task['common:test_app'].execute(args)
7
+ # Support both hash passed as first arg and named options
8
+ options = args[:options].is_a?(Hash) ? args[:options] : args.to_h
9
+ Rake::Task['common:test_app'].execute(Rake::TaskArguments.new(
10
+ [:authentication, :user_class, :admin_user_class, :css, :javascript, :install_admin, :install_storefront],
11
+ [
12
+ options[:authentication],
13
+ options[:user_class],
14
+ options[:admin_user_class],
15
+ options[:css],
16
+ options[:javascript],
17
+ options[:install_admin],
18
+ options[:install_storefront]
19
+ ]
20
+ ))
8
21
  end
9
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -1717,9 +1717,9 @@ licenses:
1717
1717
  - BSD-3-Clause
1718
1718
  metadata:
1719
1719
  bug_tracker_uri: https://github.com/spree/spree/issues
1720
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.1
1720
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.2
1721
1721
  documentation_uri: https://docs.spreecommerce.org/
1722
- source_code_uri: https://github.com/spree/spree/tree/v5.3.1
1722
+ source_code_uri: https://github.com/spree/spree/tree/v5.3.2
1723
1723
  rdoc_options: []
1724
1724
  require_paths:
1725
1725
  - lib