solidus_core 2.11.6 → 3.0.0

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.

Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree.js.erb +0 -51
  3. data/app/helpers/spree/store_helper.rb +0 -11
  4. data/app/mailers/spree/carton_mailer.rb +1 -5
  5. data/app/models/concerns/spree/active_storage_adapter.rb +2 -0
  6. data/app/models/concerns/spree/active_storage_adapter/attachment.rb +11 -11
  7. data/app/models/concerns/spree/adjustment_source.rb +0 -15
  8. data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
  9. data/app/models/concerns/spree/soft_deletable.rb +2 -4
  10. data/app/models/concerns/spree/user_address_book.rb +0 -37
  11. data/app/models/concerns/spree/user_methods.rb +2 -11
  12. data/app/models/spree/ability.rb +0 -37
  13. data/app/models/spree/address.rb +8 -186
  14. data/app/models/spree/address/name.rb +2 -20
  15. data/app/models/spree/adjustment.rb +0 -28
  16. data/app/models/spree/base.rb +0 -35
  17. data/app/models/spree/calculator.rb +4 -7
  18. data/app/models/spree/calculator/flexi_rate.rb +0 -5
  19. data/app/models/spree/country.rb +1 -6
  20. data/app/models/spree/credit_card.rb +0 -27
  21. data/app/models/spree/customer_return.rb +1 -4
  22. data/app/models/spree/image.rb +0 -7
  23. data/app/models/spree/image/active_storage_attachment.rb +10 -2
  24. data/app/models/spree/image/paperclip_attachment.rb +1 -1
  25. data/app/models/spree/inventory_unit.rb +0 -21
  26. data/app/models/spree/line_item.rb +2 -45
  27. data/app/models/spree/order.rb +3 -136
  28. data/app/models/spree/order_cancellations.rb +4 -24
  29. data/app/models/spree/order_updater.rb +2 -11
  30. data/app/models/spree/payment.rb +0 -3
  31. data/app/models/spree/payment/cancellation.rb +1 -1
  32. data/app/models/spree/payment_create.rb +1 -13
  33. data/app/models/spree/payment_method.rb +5 -103
  34. data/app/models/spree/payment_method/bogus_credit_card.rb +13 -9
  35. data/app/models/spree/payment_method/credit_card.rb +1 -3
  36. data/app/models/spree/payment_method/simple_bogus_credit_card.rb +4 -4
  37. data/app/models/spree/product.rb +0 -39
  38. data/app/models/spree/product/scopes.rb +0 -27
  39. data/app/models/spree/promotion.rb +2 -6
  40. data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
  41. data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
  42. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
  43. data/app/models/spree/promotion/rules/taxon.rb +2 -15
  44. data/app/models/spree/promotion_action.rb +5 -9
  45. data/app/models/spree/promotion_code/batch_builder.rb +0 -14
  46. data/app/models/spree/promotion_rule.rb +4 -0
  47. data/app/models/spree/refund.rb +0 -50
  48. data/app/models/spree/reimbursement.rb +3 -41
  49. data/app/models/spree/reimbursement_performer.rb +2 -8
  50. data/app/models/spree/reimbursement_type/credit.rb +1 -4
  51. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
  52. data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
  53. data/app/models/spree/return_authorization.rb +1 -4
  54. data/app/models/spree/return_item.rb +1 -19
  55. data/app/models/spree/shipment.rb +1 -54
  56. data/app/models/spree/shipping_method.rb +0 -25
  57. data/app/models/spree/shipping_rate.rb +0 -2
  58. data/app/models/spree/state.rb +0 -4
  59. data/app/models/spree/stock/simple_coordinator.rb +0 -14
  60. data/app/models/spree/stock/splitter/base.rb +2 -7
  61. data/app/models/spree/stock_item.rb +1 -7
  62. data/app/models/spree/store.rb +0 -12
  63. data/app/models/spree/store_credit_category.rb +0 -32
  64. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
  65. data/app/models/spree/tax_rate.rb +0 -27
  66. data/app/models/spree/taxon.rb +0 -11
  67. data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
  68. data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
  69. data/app/models/spree/user_address.rb +0 -5
  70. data/app/models/spree/variant.rb +1 -45
  71. data/config/locales/en.yml +0 -8
  72. data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
  73. data/lib/generators/solidus/install/install_generator.rb +13 -2
  74. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
  75. data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
  76. data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
  77. data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
  78. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
  79. data/lib/spree/app_configuration.rb +14 -65
  80. data/lib/spree/core.rb +9 -8
  81. data/lib/spree/core/class_constantizer.rb +2 -0
  82. data/lib/spree/core/controller_helpers/auth.rb +1 -14
  83. data/lib/spree/core/controller_helpers/order.rb +2 -22
  84. data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
  85. data/lib/spree/core/controller_helpers/pricing.rb +0 -8
  86. data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
  87. data/lib/spree/core/engine.rb +0 -35
  88. data/lib/spree/core/environment_extension.rb +0 -9
  89. data/lib/spree/core/product_filters.rb +0 -40
  90. data/lib/spree/core/role_configuration.rb +0 -14
  91. data/lib/spree/core/search/base.rb +0 -26
  92. data/lib/spree/core/state_machines.rb +2 -11
  93. data/lib/spree/core/version.rb +1 -1
  94. data/lib/spree/deprecation.rb +1 -1
  95. data/lib/spree/event.rb +0 -31
  96. data/lib/spree/event/configuration.rb +0 -5
  97. data/lib/spree/event/subscriber.rb +0 -18
  98. data/lib/spree/event/subscriber_registry.rb +3 -1
  99. data/lib/spree/i18n.rb +0 -22
  100. data/lib/spree/money.rb +3 -18
  101. data/lib/spree/permitted_attributes.rb +2 -53
  102. data/lib/spree/preferences/persistable.rb +23 -0
  103. data/lib/spree/testing_support/capybara_ext.rb +0 -30
  104. data/lib/spree/testing_support/controller_requests.rb +0 -82
  105. data/lib/spree/testing_support/dummy_app.rb +6 -14
  106. data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
  107. data/lib/spree/testing_support/factories/order_factory.rb +0 -1
  108. data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
  109. data/lib/spree/testing_support/fixtures/file.txt +1 -0
  110. data/lib/spree/testing_support/order_walkthrough.rb +0 -3
  111. data/lib/spree/testing_support/preferences.rb +0 -25
  112. data/lib/tasks/upgrade.rake +7 -5
  113. data/solidus_core.gemspec +2 -5
  114. metadata +9 -48
  115. data/app/mailers/spree/test_mailer.rb +0 -13
  116. data/app/models/concerns/spree/user_payment_source.rb +0 -26
  117. data/app/models/spree/calculator/free_shipping.rb +0 -22
  118. data/app/models/spree/calculator/percent_per_item.rb +0 -51
  119. data/app/models/spree/calculator/price_sack.rb +0 -28
  120. data/app/models/spree/gateway.rb +0 -14
  121. data/app/models/spree/gateway/bogus.rb +0 -13
  122. data/app/models/spree/gateway/bogus_simple.rb +0 -13
  123. data/app/models/spree/order/checkout.rb +0 -244
  124. data/app/models/spree/order_capturing.rb +0 -50
  125. data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
  126. data/lib/generators/spree/install/install_generator.rb +0 -15
  127. data/lib/solidus/migrations/rename_gateways.rb +0 -41
  128. data/lib/spree/core/current_store.rb +0 -24
  129. data/lib/spree/paranoia_deprecations.rb +0 -41
  130. data/lib/spree/promo/environment.rb +0 -12
  131. data/lib/spree/testing_support/bar_ability.rb +0 -19
  132. data/lib/tasks/core.rake +0 -104
  133. data/lib/tasks/email.rake +0 -12
  134. data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
  135. data/lib/tasks/migrations/migrate_address_names.rake +0 -158
  136. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +0 -38
  137. data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
  138. data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
  139. data/lib/tasks/migrations/rename_gateways.rake +0 -23
  140. data/lib/tasks/order_capturing.rake +0 -27
@@ -201,33 +201,6 @@ module Spree
201
201
  where(subquery.arel.exists)
202
202
  end
203
203
 
204
- def self.distinct_by_product_ids(sort_order = nil)
205
- Spree::Deprecation.warn "Product.distinct_by_product_ids is deprecated and should not be used"
206
-
207
- sort_column = sort_order.split(" ").first
208
-
209
- # Postgres will complain when using ordering by expressions not present in
210
- # SELECT DISTINCT. e.g.
211
- #
212
- # PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY
213
- # expressions must appear in select list. e.g.
214
- #
215
- # SELECT DISTINCT "spree_products".* FROM "spree_products" LEFT OUTER JOIN
216
- # "spree_variants" ON "spree_variants"."product_id" = "spree_products"."id" AND "spree_variants"."is_master" = 't'
217
- # AND "spree_variants"."deleted_at" IS NULL LEFT OUTER JOIN "spree_prices" ON
218
- # "spree_prices"."variant_id" = "spree_variants"."id" AND "spree_prices"."currency" = 'USD'
219
- # AND "spree_prices"."deleted_at" IS NULL WHERE "spree_products"."deleted_at" IS NULL AND ('t'='t')
220
- # ORDER BY "spree_prices"."amount" ASC LIMIT 10 OFFSET 0
221
- #
222
- # Don't allow sort_column, a variable coming from params,
223
- # to be anything but a column in the database
224
- if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' && !column_names.include?(sort_column)
225
- all
226
- else
227
- distinct
228
- end
229
- end
230
-
231
204
  class << self
232
205
  private
233
206
 
@@ -38,11 +38,7 @@ module Spree
38
38
 
39
39
  scope :coupons, -> { joins(:codes).distinct }
40
40
  scope :advertised, -> { where(advertise: true) }
41
- scope :active, -> do
42
- return started_and_unexpired if Spree::Config.consider_actionless_promotion_active == true
43
-
44
- has_actions.started_and_unexpired
45
- end
41
+ scope :active, -> { has_actions.started_and_unexpired }
46
42
  scope :started_and_unexpired, -> do
47
43
  table = arel_table
48
44
  time = Time.current
@@ -93,7 +89,7 @@ module Spree
93
89
  end
94
90
 
95
91
  def active?
96
- started? && not_expired? && (Spree::Config.consider_actionless_promotion_active || actions.present?)
92
+ started? && not_expired? && actions.present?
97
93
  end
98
94
 
99
95
  def inactive?
@@ -39,9 +39,6 @@ module Spree
39
39
  # item_total and ship_total
40
40
  def compute_amount(calculable)
41
41
  amount = calculator.compute(calculable)
42
- if !amount.is_a?(BigDecimal)
43
- Spree::Deprecation.warn "#{calculator.class.name}#compute returned #{amount.inspect}, it should return a BigDecimal"
44
- end
45
42
  amount ||= BigDecimal(0)
46
43
  amount = amount.abs
47
44
  [(calculable.item_total + calculable.ship_total), amount].min * -1
@@ -33,9 +33,6 @@ module Spree
33
33
  order = adjustable.is_a?(Order) ? adjustable : adjustable.order
34
34
  return 0 unless promotion.line_item_actionable?(order, adjustable)
35
35
  promotion_amount = calculator.compute(adjustable)
36
- if !promotion_amount.is_a?(BigDecimal)
37
- Spree::Deprecation.warn "#{calculator.class.name}#compute returned #{promotion_amount.inspect}, it should return a BigDecimal"
38
- end
39
36
  promotion_amount ||= BigDecimal(0)
40
37
  promotion_amount = promotion_amount.abs
41
38
  [adjustable.amount, promotion_amount].min * -1
@@ -57,9 +57,6 @@ module Spree
57
57
  #
58
58
  def compute_amount(line_item)
59
59
  adjustment_amount = calculator.compute(PartialLineItem.new(line_item))
60
- if !adjustment_amount.is_a?(BigDecimal)
61
- Spree::Deprecation.warn "#{calculator.class.name}#compute returned #{adjustment_amount.inspect}, it should return a BigDecimal"
62
- end
63
60
  adjustment_amount ||= BigDecimal(0)
64
61
  adjustment_amount = adjustment_amount.abs
65
62
 
@@ -38,11 +38,7 @@ module Spree
38
38
  eligibility_errors.add(:base, eligibility_error_message(:has_excluded_taxon), error_code: :has_excluded_taxon)
39
39
  end
40
40
  else
41
- # Change this to an exception in a future version of Solidus
42
- warn_invalid_match_policy(assume: 'any')
43
- unless order_taxons.where(id: rule_taxon_ids_with_children).exists?
44
- eligibility_errors.add(:base, eligibility_error_message(:no_matching_taxons), error_code: :no_matching_taxons)
45
- end
41
+ raise "unexpected match policy: #{preferred_match_policy.inspect}"
46
42
  end
47
43
 
48
44
  eligibility_errors.empty?
@@ -60,9 +56,7 @@ module Spree
60
56
  when 'none'
61
57
  !found
62
58
  else
63
- # Change this to an exception in a future version of Solidus
64
- warn_invalid_match_policy(assume: 'any')
65
- found
59
+ raise "unexpected match policy: #{preferred_match_policy.inspect}"
66
60
  end
67
61
  end
68
62
 
@@ -77,13 +71,6 @@ module Spree
77
71
 
78
72
  private
79
73
 
80
- def warn_invalid_match_policy(assume:)
81
- Spree::Deprecation.warn(
82
- "#{self.class.name} id=#{id} has unexpected match policy #{preferred_match_policy.inspect}. "\
83
- "Interpreting it as '#{assume}'."
84
- )
85
- end
86
-
87
74
  # All taxons in an order
88
75
  def taxons_in_order(order)
89
76
  Spree::Taxon.joins(products: { variants_including_master: :line_items })
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spree/preferences/persistable'
4
+
3
5
  module Spree
4
6
  # Base class for all types of promotion action.
5
7
  #
6
8
  # PromotionActions perform the necessary tasks when a promotion is activated
7
9
  # by an event and determined to be eligible.
8
10
  class PromotionAction < Spree::Base
11
+ include Spree::Preferences::Persistable
9
12
  include Spree::SoftDeletable
10
13
 
11
14
  belongs_to :promotion, class_name: 'Spree::Promotion', inverse_of: :promotion_actions, optional: true
@@ -29,15 +32,8 @@ module Spree
29
32
  #
30
33
  # @param order [Spree::Order] the order to remove the action from
31
34
  # @return [void]
32
- def remove_from(order)
33
- Spree::Deprecation.warn("#{self.class.name.inspect} does not define #remove_from. The default behavior may be incorrect and will be removed in a future version of Solidus.", caller)
34
- [order, *order.line_items, *order.shipments].each do |item|
35
- item.adjustments.each do |adjustment|
36
- if adjustment.source == self
37
- item.adjustments.destroy(adjustment)
38
- end
39
- end
40
- end
35
+ def remove_from(_order)
36
+ raise 'remove_from should be implemented in a sub-class of PromotionAction'
41
37
  end
42
38
 
43
39
  def to_partial_path
@@ -10,20 +10,6 @@ class ::Spree::PromotionCode::BatchBuilder
10
10
  sample_characters: ('a'..'z').to_a + (2..9).to_a.map(&:to_s)
11
11
  }
12
12
 
13
- [:random_code_length, :batch_size, :sample_characters].each do |attr|
14
- define_singleton_method(attr) do
15
- Spree::Deprecation.warn "#{name}.#{attr} is deprecated. Use #{name}::DEFAULT_OPTIONS[:#{attr}] instead"
16
- DEFAULT_OPTIONS[attr]
17
- end
18
-
19
- define_singleton_method(:"#{attr}=") do |val|
20
- Spree::Deprecation.warn "#{name}.#{attr}= is deprecated. Use #{name}::DEFAULT_OPTIONS[:#{attr}]= instead"
21
- DEFAULT_OPTIONS[attr] = val
22
- end
23
-
24
- delegate attr, to: self
25
- end
26
-
27
13
  def initialize(promotion_code_batch, options = {})
28
14
  @promotion_code_batch = promotion_code_batch
29
15
  options.assert_valid_keys(*DEFAULT_OPTIONS.keys)
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spree/preferences/persistable'
4
+
3
5
  module Spree
4
6
  # Base class for all promotion rules
5
7
  class PromotionRule < Spree::Base
8
+ include Spree::Preferences::Persistable
9
+
6
10
  belongs_to :promotion, class_name: 'Spree::Promotion', inverse_of: :promotion_rules, optional: true
7
11
 
8
12
  scope :of_type, ->(type) { where(type: type) }
@@ -15,11 +15,6 @@ module Spree
15
15
  validate :amount_is_less_than_or_equal_to_allowed_amount, on: :create
16
16
 
17
17
  attr_reader :perform_response
18
- attr_accessor :perform_after_create
19
-
20
- after_create :set_perform_after_create_default
21
- after_create :perform!
22
- after_create :clear_perform_after_create
23
18
 
24
19
  scope :non_reimbursement, -> { where(reimbursement_id: nil) }
25
20
 
@@ -45,27 +40,14 @@ module Spree
45
40
  # Attempts to perform the refund,
46
41
  # raises an error if the refund fails.
47
42
  def perform!
48
- return true if perform_after_create == false
49
43
  return true if transaction_id.present?
50
44
 
51
45
  credit_cents = money.cents
52
46
 
53
47
  @perform_response = process!(credit_cents)
54
-
55
- @response = Spree::DeprecatedInstanceVariableProxy.new(
56
- self,
57
- :perform_response,
58
- :@response,
59
- Spree::Deprecation,
60
- "Please, do not use Spree::Refund @response anymore, use Spree::Refund#perform_response"
61
- )
62
-
63
48
  log_entries.build(details: perform_response.to_yaml)
64
49
 
65
50
  self.transaction_id = perform_response.authorization
66
- # This is needed otherwise set_perform_after_create_default callback
67
- # will print a deprecation warning when save! creates a record.
68
- self.perform_after_create = false unless persisted?
69
51
  save!
70
52
 
71
53
  update_order
@@ -73,38 +55,6 @@ module Spree
73
55
 
74
56
  private
75
57
 
76
- # This callback takes care of setting the behavior that determines if it is needed
77
- # to execute the perform! callback after_create.
78
- # Existing code that creates refund without explicitely passing
79
- #
80
- # perform_after_create: false
81
- #
82
- # as attribute will still call perform! but a deprecation warning is emitted in order
83
- # to ask users to change their code with the new supported behavior.
84
- def set_perform_after_create_default
85
- return true if perform_after_create == false
86
-
87
- Spree::Deprecation.warn <<-WARN.strip_heredoc, caller
88
- From Solidus v3.0 onwards, #perform! will need to be explicitly called when creating new
89
- refunds. Please, change your code from:
90
-
91
- Spree::Refund.create(your: attributes)
92
-
93
- to:
94
-
95
- Spree::Refund.create(your: attributes, perform_after_create: false).perform!
96
- WARN
97
-
98
- self.perform_after_create = true
99
- end
100
-
101
- # This is needed to avoid that when you create a refund with perform_after_create = false,
102
- # it's not possibile to call perform! on that instance, since the value of this attribute
103
- # will remain false until a reload of the instance.
104
- def clear_perform_after_create
105
- @perform_after_create = nil
106
- end
107
-
108
58
  # return an activemerchant response object if successful or else raise an error
109
59
  def process!(credit_cents)
110
60
  response = if payment.payment_method.payment_profiles_supported?
@@ -51,14 +51,6 @@ module Spree
51
51
  class_attribute :reimbursement_performer
52
52
  self.reimbursement_performer = ReimbursementPerformer
53
53
 
54
- # These are called if the call to "reimburse!" succeeds.
55
- class_attribute :reimbursement_success_hooks
56
- self.reimbursement_success_hooks = []
57
-
58
- # These are called if the call to "reimburse!" fails.
59
- class_attribute :reimbursement_failure_hooks
60
- self.reimbursement_failure_hooks = []
61
-
62
54
  include ::Spree::Config.state_machines.reimbursement
63
55
 
64
56
  class << self
@@ -91,10 +83,7 @@ module Spree
91
83
  total - paid_amount
92
84
  end
93
85
 
94
- def perform!(created_by: nil)
95
- unless created_by
96
- Spree::Deprecation.warn("Calling #perform on #{self} without created_by is deprecated")
97
- end
86
+ def perform!(created_by:)
98
87
  reimbursement_tax_calculator.call(self)
99
88
  reload
100
89
  update!(total: calculated_total)
@@ -104,21 +93,9 @@ module Spree
104
93
  if unpaid_amount_within_tolerance?
105
94
  reimbursed!
106
95
  Spree::Event.fire 'reimbursement_reimbursed', reimbursement: self
107
- if reimbursement_success_hooks.any?
108
- Spree::Deprecation.warn \
109
- "reimbursement_success_hooks are deprecated. Please remove them " \
110
- "and subscribe to `reimbursement_reimbursed` event instead", caller(1)
111
- end
112
- reimbursement_success_hooks.each { |hook| hook.call self }
113
96
  else
114
97
  errored!
115
98
  Spree::Event.fire 'reimbursement_errored', reimbursement: self
116
- if reimbursement_failure_hooks.any?
117
- Spree::Deprecation.warn \
118
- "reimbursement_failure_hooks are deprecated. Please remove them " \
119
- "and subscribe to `reimbursement_errored` event instead", caller(1)
120
- end
121
- reimbursement_failure_hooks.each { |hook| hook.call self }
122
99
  end
123
100
 
124
101
  if errored?
@@ -126,10 +103,7 @@ module Spree
126
103
  end
127
104
  end
128
105
 
129
- def simulate(created_by: nil)
130
- unless created_by
131
- Spree::Deprecation.warn("Calling #simulate on #{self} without created_by is deprecated")
132
- end
106
+ def simulate(created_by:)
133
107
  reimbursement_simulator_tax_calculator.call(self)
134
108
  reload
135
109
  update!(total: calculated_total)
@@ -154,10 +128,7 @@ module Spree
154
128
  # @api public
155
129
  # @param [Spree.user_class] created_by the user that is performing this action
156
130
  # @return [void]
157
- def return_all(created_by: nil)
158
- unless created_by
159
- Spree::Deprecation.warn("Calling #return_all on #{self} without created_by is deprecated")
160
- end
131
+ def return_all(created_by:)
161
132
  return_items.each(&:accept!)
162
133
  save!
163
134
  perform!(created_by: created_by)
@@ -168,15 +139,6 @@ module Spree
168
139
  #
169
140
  # @return [Spree::StoreCreditCategory]
170
141
  def store_credit_category
171
- if Spree::Config.use_legacy_store_credit_reimbursement_category_name
172
- Spree::Deprecation.warn("Using the legacy reimbursement_category_name is deprecated. "\
173
- "Set Spree::Config.use_legacy_store_credit_reimbursement_category_name to false to use "\
174
- "the new version instead.", caller)
175
-
176
- name = Spree::StoreCreditCategory.reimbursement_category_name
177
- return Spree::StoreCreditCategory.find_by(name: name) || Spree::StoreCreditCategory.first
178
- end
179
-
180
142
  Spree::StoreCreditCategory.find_by(name: Spree::StoreCreditCategory::REIMBURSEMENT)
181
143
  end
182
144
 
@@ -11,18 +11,12 @@ module Spree
11
11
  # - #description
12
12
  # - #display_amount
13
13
  # so they can be displayed in the Admin UI appropriately.
14
- def simulate(reimbursement, created_by: nil)
15
- unless created_by
16
- Spree::Deprecation.warn("Calling #simulate on #{self} without created_by is deprecated")
17
- end
14
+ def simulate(reimbursement, created_by:)
18
15
  execute(reimbursement, true, created_by: created_by)
19
16
  end
20
17
 
21
18
  # Actually perform the reimbursement
22
- def perform(reimbursement, created_by: nil)
23
- unless created_by
24
- Spree::Deprecation.warn("Calling #perform on #{self} without created_by is deprecated")
25
- end
19
+ def perform(reimbursement, created_by:)
26
20
  execute(reimbursement, false, created_by: created_by)
27
21
  end
28
22
 
@@ -5,10 +5,7 @@ module Spree
5
5
  extend Spree::ReimbursementType::ReimbursementHelpers
6
6
 
7
7
  class << self
8
- def reimburse(reimbursement, return_items, simulate, created_by: nil)
9
- unless created_by
10
- Spree::Deprecation.warn("Calling #reimburse on #{self} without created_by is deprecated")
11
- end
8
+ def reimburse(reimbursement, return_items, simulate, created_by:)
12
9
  unpaid_amount = return_items.sum(&:total).round(2, :down)
13
10
  reimbursement_list, _unpaid_amount = create_credits(reimbursement, unpaid_amount, simulate, created_by: created_by)
14
11
  reimbursement_list
@@ -34,8 +34,7 @@ module Spree
34
34
  refund = reimbursement.refunds.build({
35
35
  payment: payment,
36
36
  amount: amount,
37
- reason: Spree::RefundReason.return_processing_reason,
38
- perform_after_create: false
37
+ reason: Spree::RefundReason.return_processing_reason
39
38
  })
40
39
 
41
40
  if simulate
@@ -4,10 +4,7 @@ class Spree::ReimbursementType::StoreCredit < Spree::ReimbursementType
4
4
  extend Spree::ReimbursementType::ReimbursementHelpers
5
5
 
6
6
  class << self
7
- def reimburse(reimbursement, return_items, simulate, created_by: nil)
8
- unless created_by
9
- Spree::Deprecation.warn("Calling #reimburse on #{self} without created_by is deprecated")
10
- end
7
+ def reimburse(reimbursement, return_items, simulate, created_by:)
11
8
  unpaid_amount = return_items.sum(&:total).to_d.round(2, :down)
12
9
  payments = store_credit_payments(reimbursement)
13
10
  reimbursement_list = []
@@ -25,16 +25,13 @@ module Spree
25
25
  include ::Spree::Config.state_machines.return_authorization
26
26
 
27
27
  extend DisplayMoney
28
- money_methods :pre_tax_total, :amount, :total_excluding_vat
29
- deprecate display_pre_tax_total: :display_total_excluding_vat, deprecator: Spree::Deprecation
28
+ money_methods :amount, :total_excluding_vat
30
29
 
31
30
  self.whitelisted_ransackable_attributes = ['memo']
32
31
 
33
32
  def total_excluding_vat
34
33
  return_items.sum(&:total_excluding_vat)
35
34
  end
36
- alias pre_tax_total total_excluding_vat
37
- deprecate pre_tax_total: :total_excluding_vat, deprecator: Spree::Deprecation
38
35
 
39
36
  def amount
40
37
  return_items.sum(:amount)
@@ -81,8 +81,7 @@ module Spree
81
81
  include ::Spree::Config.state_machines.return_item_acceptance
82
82
 
83
83
  extend DisplayMoney
84
- money_methods :pre_tax_amount, :amount, :total, :total_excluding_vat
85
- deprecate display_pre_tax_amount: :display_total_excluding_vat, deprecator: Spree::Deprecation
84
+ money_methods :amount, :total, :total_excluding_vat
86
85
 
87
86
  # @return [Boolean] true when this retur item is in a complete reception
88
87
  # state
@@ -90,14 +89,6 @@ module Spree
90
89
  COMPLETED_RECEPTION_STATUSES.map(&:to_s).include?(reception_status.to_s)
91
90
  end
92
91
 
93
- def skip_customer_return_processing=(value)
94
- @skip_customer_return_processing = value
95
- Deprecation.warn \
96
- 'From Solidus v2.11 onwards, #skip_customer_return_processing does ' \
97
- 'nothing, and #process_inventory_unit! will restore calling ' \
98
- 'customer_return#process_return!', caller(1)
99
- end
100
-
101
92
  # @param inventory_unit [Spree::InventoryUnit] the inventory for which we
102
93
  # want a return item
103
94
  # @return [Spree::ReturnItem] a valid return item for the given inventory
@@ -134,8 +125,6 @@ module Spree
134
125
  def total_excluding_vat
135
126
  amount - included_tax_total
136
127
  end
137
- alias pre_tax_amount total_excluding_vat
138
- deprecate pre_tax_amount: :total_excluding_vat, deprecator: Spree::Deprecation
139
128
 
140
129
  # @note This uses the exchange_variant_engine configured on the class.
141
130
  # @param stock_locations [Array<Spree::StockLocation>] the stock locations to check
@@ -206,13 +195,6 @@ module Spree
206
195
  customer_return.stock_location.restock(inventory_unit.variant, 1, customer_return)
207
196
  end
208
197
 
209
- unless @skip_customer_return_processing.nil?
210
- Deprecation.warn \
211
- 'From Solidus v2.11 onwards, #skip_customer_return_processing does ' \
212
- 'nothing, and #process_inventory_unit! will restore calling ' \
213
- 'customer_return#process_return!'
214
- end
215
-
216
198
  customer_return&.process_return!
217
199
  end
218
200