solidus_core 2.11.16 → 3.0.0.rc2

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.

Files changed (144) 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/attachment.rb +11 -13
  6. data/app/models/concerns/spree/active_storage_adapter.rb +0 -2
  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/name.rb +2 -20
  14. data/app/models/spree/address.rb +8 -187
  15. data/app/models/spree/adjustment.rb +0 -28
  16. data/app/models/spree/base.rb +12 -48
  17. data/app/models/spree/calculator/flexi_rate.rb +0 -5
  18. data/app/models/spree/calculator.rb +0 -11
  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/active_storage_attachment.rb +2 -10
  23. data/app/models/spree/image/paperclip_attachment.rb +1 -1
  24. data/app/models/spree/image.rb +0 -7
  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 +4 -137
  28. data/app/models/spree/order_cancellations.rb +4 -24
  29. data/app/models/spree/order_shipping.rb +9 -6
  30. data/app/models/spree/order_updater.rb +2 -11
  31. data/app/models/spree/payment/cancellation.rb +3 -22
  32. data/app/models/spree/payment.rb +0 -3
  33. data/app/models/spree/payment_create.rb +1 -13
  34. data/app/models/spree/payment_method/bogus_credit_card.rb +9 -13
  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/payment_method.rb +2 -106
  38. data/app/models/spree/product/scopes.rb +0 -27
  39. data/app/models/spree/product.rb +0 -39
  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.rb +2 -6
  45. data/app/models/spree/promotion_action.rb +2 -12
  46. data/app/models/spree/promotion_code/batch_builder.rb +0 -14
  47. data/app/models/spree/promotion_code.rb +2 -2
  48. data/app/models/spree/promotion_rule.rb +0 -4
  49. data/app/models/spree/refund.rb +0 -60
  50. data/app/models/spree/reimbursement.rb +3 -41
  51. data/app/models/spree/reimbursement_performer.rb +2 -8
  52. data/app/models/spree/reimbursement_type/credit.rb +1 -4
  53. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
  54. data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
  55. data/app/models/spree/return_authorization.rb +1 -4
  56. data/app/models/spree/return_item.rb +1 -19
  57. data/app/models/spree/shipment.rb +1 -54
  58. data/app/models/spree/shipping_method.rb +0 -25
  59. data/app/models/spree/shipping_rate.rb +0 -2
  60. data/app/models/spree/state.rb +0 -4
  61. data/app/models/spree/stock/simple_coordinator.rb +1 -20
  62. data/app/models/spree/stock/splitter/base.rb +2 -7
  63. data/app/models/spree/stock_item.rb +1 -7
  64. data/app/models/spree/store.rb +0 -12
  65. data/app/models/spree/store_credit.rb +0 -8
  66. data/app/models/spree/store_credit_category.rb +0 -32
  67. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
  68. data/app/models/spree/tax_rate.rb +0 -27
  69. data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
  70. data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
  71. data/app/models/spree/taxon.rb +0 -11
  72. data/app/models/spree/user_address.rb +0 -5
  73. data/app/models/spree/variant.rb +2 -46
  74. data/config/locales/en.yml +0 -8
  75. data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
  76. data/lib/generators/solidus/install/install_generator.rb +13 -2
  77. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
  78. data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
  79. data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
  80. data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
  81. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
  82. data/lib/spree/app_configuration.rb +6 -73
  83. data/lib/spree/core/class_constantizer.rb +2 -0
  84. data/lib/spree/core/controller_helpers/auth.rb +1 -14
  85. data/lib/spree/core/controller_helpers/order.rb +2 -22
  86. data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
  87. data/lib/spree/core/controller_helpers/pricing.rb +0 -8
  88. data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
  89. data/lib/spree/core/engine.rb +0 -43
  90. data/lib/spree/core/environment_extension.rb +0 -9
  91. data/lib/spree/core/product_filters.rb +0 -40
  92. data/lib/spree/core/role_configuration.rb +0 -14
  93. data/lib/spree/core/search/base.rb +0 -26
  94. data/lib/spree/core/state_machines.rb +2 -11
  95. data/lib/spree/core/validators/email.rb +1 -1
  96. data/lib/spree/core/version.rb +1 -1
  97. data/lib/spree/core.rb +9 -8
  98. data/lib/spree/event/configuration.rb +0 -5
  99. data/lib/spree/event/subscriber.rb +0 -18
  100. data/lib/spree/event/subscriber_registry.rb +3 -1
  101. data/lib/spree/event.rb +0 -31
  102. data/lib/spree/i18n.rb +0 -22
  103. data/lib/spree/money.rb +3 -18
  104. data/lib/spree/permitted_attributes.rb +3 -60
  105. data/lib/spree/testing_support/blacklist_urls.rb +1 -1
  106. data/lib/spree/testing_support/capybara_ext.rb +0 -30
  107. data/lib/spree/testing_support/controller_requests.rb +0 -82
  108. data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
  109. data/lib/spree/testing_support/dummy_app.rb +6 -16
  110. data/lib/spree/testing_support/factories/order_factory.rb +0 -1
  111. data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
  112. data/lib/spree/testing_support/order_walkthrough.rb +0 -3
  113. data/lib/spree/testing_support/preferences.rb +0 -25
  114. data/lib/spree/testing_support.rb +1 -1
  115. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +20 -15
  116. data/solidus_core.gemspec +1 -24
  117. metadata +9 -74
  118. data/app/mailers/spree/test_mailer.rb +0 -13
  119. data/app/models/concerns/spree/user_payment_source.rb +0 -26
  120. data/app/models/spree/calculator/free_shipping.rb +0 -22
  121. data/app/models/spree/calculator/percent_per_item.rb +0 -51
  122. data/app/models/spree/calculator/price_sack.rb +0 -28
  123. data/app/models/spree/gateway/bogus.rb +0 -13
  124. data/app/models/spree/gateway/bogus_simple.rb +0 -13
  125. data/app/models/spree/gateway.rb +0 -14
  126. data/app/models/spree/order/checkout.rb +0 -244
  127. data/app/models/spree/order_capturing.rb +0 -50
  128. data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
  129. data/lib/generators/spree/install/install_generator.rb +0 -15
  130. data/lib/solidus/migrations/rename_gateways.rb +0 -41
  131. data/lib/spree/core/current_store.rb +0 -24
  132. data/lib/spree/paranoia_deprecations.rb +0 -41
  133. data/lib/spree/preferences/persistable.rb +0 -23
  134. data/lib/spree/promo/environment.rb +0 -12
  135. data/lib/spree/testing_support/bar_ability.rb +0 -19
  136. data/lib/spree/testing_support/fixtures/file.txt +0 -1
  137. data/lib/tasks/core.rake +0 -104
  138. data/lib/tasks/email.rake +0 -12
  139. data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
  140. data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
  141. data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
  142. data/lib/tasks/migrations/rename_gateways.rake +0 -23
  143. data/lib/tasks/order_capturing.rake +0 -27
  144. data/lib/tasks/solidus/check_orders_with_invalid_email.rake +0 -18
@@ -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
 
@@ -62,18 +62,11 @@ module Spree
62
62
 
63
63
  extend DisplayMoney
64
64
  money_methods(
65
- :cost, :amount, :discounted_cost, :final_price, :item_cost,
65
+ :cost, :amount, :item_cost,
66
66
  :total, :total_before_tax,
67
67
  )
68
- deprecate display_discounted_cost: :display_total_before_tax, deprecator: Spree::Deprecation
69
- deprecate display_final_price: :display_total, deprecator: Spree::Deprecation
70
68
  alias_attribute :amount, :cost
71
69
 
72
- def add_shipping_method(shipping_method, selected = false)
73
- shipping_rates.create(shipping_method: shipping_method, selected: selected, cost: cost)
74
- end
75
- deprecate :add_shipping_method, deprecator: Spree::Deprecation
76
-
77
70
  def after_cancel
78
71
  manifest.each { |item| manifest_restock(item) }
79
72
  end
@@ -90,20 +83,11 @@ module Spree
90
83
  order ? order.currency : Spree::Config[:currency]
91
84
  end
92
85
 
93
- def discounted_cost
94
- cost + promo_total
95
- end
96
- deprecate discounted_cost: :total_before_tax, deprecator: Spree::Deprecation
97
- alias discounted_amount discounted_cost
98
- deprecate discounted_amount: :total_before_tax, deprecator: Spree::Deprecation
99
-
100
86
  # @return [BigDecimal] the amount of this shipment, taking into
101
87
  # consideration all its adjustments.
102
88
  def total
103
89
  cost + adjustment_total
104
90
  end
105
- alias final_price total
106
- deprecate final_price: :total, deprecator: Spree::Deprecation
107
91
 
108
92
  # @return [BigDecimal] the amount of this item, taking into consideration
109
93
  # all non-tax adjustments.
@@ -116,14 +100,10 @@ module Spree
116
100
  def total_excluding_vat
117
101
  total_before_tax - included_tax_total
118
102
  end
119
- alias pre_tax_amount total_excluding_vat
120
- deprecate pre_tax_amount: :total_excluding_vat, deprecator: Spree::Deprecation
121
103
 
122
104
  def total_with_items
123
105
  total + item_cost
124
106
  end
125
- alias final_price_with_items total_with_items
126
- deprecate final_price_with_items: :total_with_items, deprecator: Spree::Deprecation
127
107
 
128
108
  def editable_by?(_user)
129
109
  !shipped?
@@ -320,43 +300,10 @@ module Spree
320
300
  end
321
301
  end
322
302
 
323
- def update!(order_or_attrs)
324
- if order_or_attrs.is_a?(Spree::Order)
325
- Spree::Deprecation.warn "Calling Shipment#update! with an order to update the shipments state is deprecated. Please use Shipment#update_state instead."
326
- if order_or_attrs.object_id != order.object_id
327
- Spree::Deprecation.warn "Additionally, update! is being passed an instance of order which isn't the same object as the shipment's order association"
328
- end
329
- update_state
330
- else
331
- super
332
- end
333
- end
334
-
335
- def transfer_to_location(variant, quantity, stock_location)
336
- Spree::Deprecation.warn("Please use the Spree::FulfilmentChanger class instead of Spree::Shipment#transfer_to_location", caller)
337
- new_shipment = order.shipments.create!(stock_location: stock_location)
338
- transfer_to_shipment(variant, quantity, new_shipment)
339
- end
340
-
341
- def transfer_to_shipment(variant, quantity, shipment_to_transfer_to)
342
- Spree::Deprecation.warn("Please use the Spree::FulfilmentChanger class instead of Spree::Shipment#transfer_to_location", caller)
343
- Spree::FulfilmentChanger.new(
344
- current_shipment: self,
345
- desired_shipment: shipment_to_transfer_to,
346
- variant: variant,
347
- quantity: quantity
348
- ).run!
349
- end
350
-
351
303
  def requires_shipment?
352
304
  !stock_location || stock_location.fulfillable?
353
305
  end
354
306
 
355
- def address
356
- Spree::Deprecation.warn("Calling Shipment#address is deprecated. Use Order#ship_address instead", caller)
357
- order.ship_address if order
358
- end
359
-
360
307
  private
361
308
 
362
309
  def finalize_pending_inventory_units
@@ -6,11 +6,6 @@ module Spree
6
6
  class ShippingMethod < Spree::Base
7
7
  include Spree::SoftDeletable
8
8
  include Spree::CalculatedAdjustments
9
- DISPLAY = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
10
- [:both, :front_end, :back_end],
11
- "Spree::ShippingMethod::DISPLAY is deprecated",
12
- Spree::Deprecation
13
- )
14
9
 
15
10
  has_many :shipping_method_categories, dependent: :destroy
16
11
  has_many :shipping_categories, through: :shipping_method_categories
@@ -95,26 +90,6 @@ module Spree
95
90
  tracking_url.gsub(/:tracking/, ERB::Util.url_encode(tracking)) # :url_encode exists in 1.8.7 through 2.1.0
96
91
  end
97
92
 
98
- def display_on
99
- if available_to_users?
100
- "both"
101
- else
102
- "back_end"
103
- end
104
- end
105
- deprecate display_on: :available_to_users?, deprecator: Spree::Deprecation
106
-
107
- def display_on=(value)
108
- self.available_to_users = (value != "back_end")
109
- end
110
- deprecate 'display_on=': :available_to_users=, deprecator: Spree::Deprecation
111
-
112
- # Some shipping methods are only meant to be set via backend
113
- def frontend?
114
- available_to_users?
115
- end
116
- deprecate frontend?: :available_to_users?, deprecator: Spree::Deprecation
117
-
118
93
  private
119
94
 
120
95
  def at_least_one_shipping_category
@@ -19,8 +19,6 @@ module Spree
19
19
  delegate :code, to: :shipping_method, prefix: true
20
20
  alias_attribute :amount, :cost
21
21
 
22
- alias_method :discounted_amount, :amount
23
- deprecate discounted_amount: :total_before_tax, deprecator: Spree::Deprecation
24
22
  alias_method :total_before_tax, :amount
25
23
 
26
24
  extend DisplayMoney
@@ -14,10 +14,6 @@ module Spree
14
14
  )
15
15
  )
16
16
  end
17
- class << self
18
- alias_method :find_all_by_name_or_abbr, :with_name_or_abbr
19
- deprecate find_all_by_name_or_abbr: :with_name_or_abbr, deprecator: Spree::Deprecation
20
- end
21
17
 
22
18
  self.whitelisted_ransackable_attributes = %w[name]
23
19
 
@@ -73,16 +73,11 @@ module Spree
73
73
  packages = split_packages(packages)
74
74
 
75
75
  # Turn the Stock::Packages into a Shipment with rates
76
- shipments = packages.map do |package|
76
+ 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
86
81
  end
87
82
 
88
83
  def split_packages(initial_packages)
@@ -92,20 +87,6 @@ module Spree
92
87
  end
93
88
  end
94
89
 
95
- def allocate_inventory(availability_by_location)
96
- sorted_availability = sort_availability(availability_by_location)
97
-
98
- sorted_availability.transform_values do |available|
99
- # Find the desired inventory which is available at this location
100
- packaged = available & @desired
101
- # Remove found inventory from desired
102
- @desired -= packaged
103
- packaged
104
- end
105
- end
106
- deprecate allocate_inventory: 'allocate_inventory is deprecated. Please write your own allocator defining' \
107
- 'a Spree::Stock::Allocator::Base subclass', deprecator: Spree::Deprecation
108
-
109
90
  def sort_availability(availability)
110
91
  sorted_availability = availability.sort_by do |stock_location_id, _|
111
92
  @stock_locations.find_index do |stock_location|
@@ -6,13 +6,8 @@ module Spree
6
6
  class Base
7
7
  attr_reader :stock_location, :next_splitter
8
8
 
9
- def initialize(stock_location_or_packer, next_splitter = nil)
10
- if stock_location_or_packer.is_a?(Spree::StockLocation)
11
- @stock_location = stock_location_or_packer
12
- else
13
- Spree::Deprecation.warn("Initializing Splitters with a Packer is DEPRECATED. Pass a StockLocation instead.")
14
- @stock_location = stock_location_or_packer.stock_location
15
- end
9
+ def initialize(stock_location, next_splitter = nil)
10
+ @stock_location = stock_location
16
11
  @next_splitter = next_splitter
17
12
  end
18
13
 
@@ -110,13 +110,7 @@ module Spree
110
110
  end
111
111
 
112
112
  def inventory_cache_threshold
113
- # only warn if store is setting binary_inventory_cache (default = false)
114
- @cache_threshold ||= if Spree::Config.binary_inventory_cache
115
- Spree::Deprecation.warn "Spree::Config.binary_inventory_cache=true is DEPRECATED. Instead use Spree::Config.inventory_cache_threshold=1"
116
- 1
117
- else
118
- Spree::Config.inventory_cache_threshold
119
- end
113
+ @cache_threshold ||= Spree::Config.inventory_cache_threshold
120
114
  end
121
115
  end
122
116
  end
@@ -25,12 +25,6 @@ module Spree
25
25
  before_save :ensure_default_exists_and_is_unique
26
26
  before_destroy :validate_not_default
27
27
 
28
- scope :by_url, lambda { |url| where("url like ?", "%#{url}%") }
29
-
30
- class << self
31
- deprecate by_url: "Spree::Store.by_url is DEPRECATED", deprecator: Spree::Deprecation
32
- end
33
-
34
28
  def available_locales
35
29
  locales = super()
36
30
  if locales
@@ -49,12 +43,6 @@ module Spree
49
43
  end
50
44
  end
51
45
 
52
- def self.current(store_key)
53
- Spree::Deprecation.warn "Spree::Store.current is DEPRECATED"
54
- current_store = Store.find_by(code: store_key) || Store.by_url(store_key).first if store_key
55
- current_store || Store.default
56
- end
57
-
58
46
  def self.default
59
47
  where(default: true).first || new
60
48
  end
@@ -40,14 +40,6 @@ class Spree::StoreCredit < Spree::PaymentSource
40
40
  extend Spree::DisplayMoney
41
41
  money_methods :amount, :amount_used, :amount_authorized
42
42
 
43
- # Sets this store credit's amount to a new value,
44
- # parsing it as a localized number if the new value is a string.
45
- #
46
- # @param number [String, #to_d] a new amount
47
- def amount=(number)
48
- self[:amount] = Spree::LocalizedNumber.parse(number)
49
- end
50
-
51
43
  def amount_remaining
52
44
  return 0.0.to_d if invalidated?
53
45
  amount - amount_used - amount_authorized
@@ -7,39 +7,7 @@ class Spree::StoreCreditCategory < Spree::Base
7
7
  class_attribute :non_expiring_credit_types
8
8
  self.non_expiring_credit_types = [Spree::StoreCreditType::NON_EXPIRING]
9
9
 
10
- # @deprecated
11
- class_attribute :reimbursement_category_name
12
- self.reimbursement_category_name = I18n.t('spree.store_credit_category.default')
13
-
14
- # @deprecated
15
- def self.reimbursement_category(reimbursement)
16
- reimbursement.store_credit_category
17
- end
18
-
19
10
  def non_expiring?
20
11
  self.class.non_expiring_credit_types.include? name
21
12
  end
22
-
23
- public_instance_methods.grep(/^reimbursement_category_name/).each do |method|
24
- deprecate(
25
- method => 'Use Spree::Reimbursement#store_credit_category.name instead',
26
- deprecator: Spree::Deprecation
27
- )
28
- end
29
-
30
- class << self
31
- public_instance_methods.grep(/^reimbursement_category_name/).each do |method|
32
- deprecate(
33
- method => 'Use Spree::Reimbursement.store_credit_category.name instead',
34
- deprecator: Spree::Deprecation
35
- )
36
- end
37
-
38
- public_instance_methods.grep(/^reimbursement_category$/).each do |method|
39
- deprecate(
40
- method => 'Use Spree::Reimbursement.store_credit_category instead',
41
- deprecator: Spree::Deprecation
42
- )
43
- end
44
- end
45
13
  end
@@ -13,22 +13,12 @@ module Spree
13
13
  class ShippingRate
14
14
  include Spree::Tax::TaxHelpers
15
15
 
16
- attr_reader :shipping_rate
17
-
18
16
  # Create a new tax calculator.
19
17
  #
20
18
  # @param [Spree::Order] order the order to calculate taxes on
21
19
  # @return [Spree::TaxCalculator::ShippingRate]
22
20
  def initialize(order)
23
- if order.is_a?(::Spree::ShippingRate)
24
- Spree::Deprecation.warn "passing a single shipping rate to Spree::TaxCalculator::ShippingRate is DEPRECATED. It now expects an order"
25
- shipping_rate = order
26
- @order = shipping_rate.order
27
- @shipping_rate = shipping_rate
28
- else
29
- @order = order
30
- @shipping_rate = nil
31
- end
21
+ @order = order
32
22
  end
33
23
 
34
24
  # Calculate taxes for a shipping rate.
@@ -38,7 +28,6 @@ module Spree
38
28
  # @return [Array<Spree::Tax::ItemTax>] the calculated taxes for the
39
29
  # shipping rate
40
30
  def calculate(shipping_rate)
41
- shipping_rate ||= @shipping_rate
42
31
  rates_for_item(shipping_rate).map do |rate|
43
32
  amount = rate.compute_amount(shipping_rate)
44
33
 
@@ -87,23 +87,6 @@ module Spree
87
87
  end
88
88
  scope :included_in_price, -> { where(included_in_price: true) }
89
89
 
90
- # Creates necessary tax adjustments for the order.
91
- #
92
- # @deprecated Please use `Spree::Tax::OrderAdjuster#adjust!` instead
93
- def adjust(_order_tax_zone, item)
94
- Spree::Deprecation.warn("`Spree::TaxRate#adjust` is deprecated. Please use `Spree::Tax::OrderAdjuster#adjust!` instead.", caller)
95
-
96
- amount = compute_amount(item)
97
-
98
- item.adjustments.create!(
99
- source: self,
100
- amount: amount,
101
- order_id: item.order_id,
102
- label: adjustment_label(amount),
103
- included: included_in_price
104
- )
105
- end
106
-
107
90
  # This method is used by Adjustment#update to recalculate the cost.
108
91
  def compute_amount(item)
109
92
  calculator.compute(item)
@@ -123,16 +106,6 @@ module Spree
123
106
  )
124
107
  end
125
108
 
126
- def tax_category=(category)
127
- self.tax_categories = [category]
128
- end
129
-
130
- def tax_category
131
- tax_categories[0]
132
- end
133
-
134
- deprecate :tax_category => :tax_categories, :tax_category= => :tax_categories=, deprecator: Spree::Deprecation
135
-
136
109
  private
137
110
 
138
111
  def amount_for_adjustment_label
@@ -10,9 +10,4 @@ module Spree::Taxon::ActiveStorageAttachment
10
10
  default_style: :mini
11
11
  validate :icon_is_an_image
12
12
  end
13
-
14
- def attachment_partial_name
15
- Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
16
- 'paperclip'
17
- end
18
13
  end
@@ -19,11 +19,6 @@ module Spree::Taxon::PaperclipAttachment
19
19
  icon.present?
20
20
  end
21
21
 
22
- def attachment_partial_name
23
- Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
24
- 'paperclip'
25
- end
26
-
27
22
  def destroy_attachment(definition)
28
23
  return false unless respond_to?(definition)
29
24
 
@@ -29,17 +29,6 @@ module Spree
29
29
 
30
30
  self.whitelisted_ransackable_attributes = %w[name]
31
31
 
32
- # @note This method is meant to be overridden on a store by store basis.
33
- # @return [Array] filters that should be used for a taxon
34
- def applicable_filters
35
- Spree::Deprecation.warn "Spree::Taxon#applicable_filters is deprecated, if you are using this functionality please move it into your own application."
36
-
37
- fs = []
38
- fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)
39
- fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)
40
- fs
41
- end
42
-
43
32
  # @return [String] meta_title if set otherwise a string containing the
44
33
  # root name and taxon name
45
34
  def seo_title
@@ -19,11 +19,6 @@ module Spree
19
19
  scope :default_billing, -> { where(default_billing: true) }
20
20
  scope :active, -> { where(archived: false) }
21
21
 
22
- scope :default, -> do
23
- Spree::Deprecation.warn "This scope is deprecated. Please start using ::default_shipping."
24
- default_shipping
25
- end
26
-
27
22
  default_scope -> { order([default: :desc, updated_at: :desc]) }
28
23
  end
29
24
  end
@@ -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: :variants_including_master, optional: false
33
+ belongs_to :product, -> { with_discarded }, touch: true, class_name: 'Spree::Product', inverse_of: :variants, 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?,
@@ -83,7 +83,7 @@ module Spree
83
83
  after_save :clear_in_stock_cache
84
84
  after_touch :clear_in_stock_cache
85
85
 
86
- after_real_destroy :destroy_option_values_variants
86
+ after_destroy :destroy_option_values_variants
87
87
 
88
88
  # Returns variants that are in stock. When stock locations are provided as
89
89
  # a parameter, the scope is limited to variants that are in stock in the
@@ -121,17 +121,6 @@ module Spree
121
121
  self.whitelisted_ransackable_associations = %w[option_values product prices default_price]
122
122
  self.whitelisted_ransackable_attributes = %w[weight sku]
123
123
 
124
- # Returns variants that are not deleted and have a price in the given
125
- # currency.
126
- #
127
- # @deprecated Please use the .with_prices scope instead
128
- # @param currency [String] the currency to filter by; defaults to Spree's default
129
- # @return [ActiveRecord::Relation]
130
- def self.active(currency = nil)
131
- Spree::Deprecation.warn("`Variant.active(currency)` is deprecated. Please use `Variant.with_prices(pricing_options)` instead.", caller)
132
- joins(:prices).where(deleted_at: nil).where('spree_prices.currency' => currency || Spree::Config[:currency]).where('spree_prices.amount IS NOT NULL')
133
- end
134
-
135
124
  # Returns variants that have a price for the given pricing options
136
125
  # If you have modified the pricing options class, you might want to modify this scope too.
137
126
  #
@@ -304,26 +293,6 @@ module Spree
304
293
  diff && diff.zero?
305
294
  end
306
295
 
307
- # Converts the variant's price to the given currency.
308
- #
309
- # @deprecated Please use #price_for(pricing_options) instead
310
- # @param currency [String] the desired currency
311
- # @return [Spree::Price] the price in the desired currency
312
- def price_in(currency)
313
- prices.currently_valid.find_by(currency: currency)
314
- end
315
- deprecate price_in: :price_for, deprecator: Spree::Deprecation
316
-
317
- # Fetches the price amount in the specified currency.
318
- #
319
- # @deprecated Please use #price_for instead and use a money object rathern than a BigDecimal.
320
- # @param currency (see #price)
321
- # @return [Float] the amount in the specified currency.
322
- def amount_in(currency)
323
- price_in(currency).try(:amount)
324
- end
325
- deprecate amount_in: :price_for, deprecator: Spree::Deprecation
326
-
327
296
  # Generates a friendly name and sku string.
328
297
  #
329
298
  # @return [String]
@@ -367,19 +336,6 @@ module Spree
367
336
  track_inventory? && Spree::Config.track_inventory_levels
368
337
  end
369
338
 
370
- # Image that can be used for the variant.
371
- #
372
- # Will first search for images on the variant. If it doesn't find any,
373
- # it'll fallback to any variant image (unless +fallback+ is +false+) or to
374
- # a new {Spree::Image}.
375
- # @param fallback [Boolean] whether or not we should fallback to an image
376
- # not from this variant
377
- # @return [Spree::Image] the image to display
378
- def display_image(fallback: true)
379
- Spree::Deprecation.warn('Spree::Variant#display_image is DEPRECATED. Choose an image from Spree::Variant#gallery instead')
380
- images.first || (fallback && product.variant_images.first) || Spree::Image.new
381
- end
382
-
383
339
  # Determines the variant's property values by verifying which of the product's
384
340
  # variant property rules apply to itself.
385
341
  #
@@ -26,8 +26,6 @@ en:
26
26
  address2: Street Address (cont'd)
27
27
  city: City
28
28
  company: Company
29
- firstname: First Name
30
- lastname: Last Name
31
29
  name: Name
32
30
  phone: Phone
33
31
  zipcode: Zip Code
@@ -76,7 +74,6 @@ en:
76
74
  created_at: Date/Time
77
75
  name: Name
78
76
  number: Return Number
79
- pre_tax_total: Pre-Tax Total
80
77
  reimbursement_status: Reimbursement status
81
78
  total: Total
82
79
  total_excluding_vat: Pre-Tax Total
@@ -130,8 +127,6 @@ en:
130
127
  spree/order/bill_address:
131
128
  address1: Billing address street
132
129
  city: Billing address city
133
- firstname: Billing address first name
134
- lastname: Billing address last name
135
130
  name: Billing address name
136
131
  phone: Billing address phone
137
132
  state: Billing address state
@@ -139,8 +134,6 @@ en:
139
134
  spree/order/ship_address:
140
135
  address1: Shipping address street
141
136
  city: Shipping address city
142
- firstname: Shipping address first name
143
- lastname: Shipping address last name
144
137
  name: Shipping address name
145
138
  phone: Shipping address phone
146
139
  state: Shipping address state
@@ -282,7 +275,6 @@ en:
282
275
  type: Type
283
276
  spree/return_authorization:
284
277
  amount: Amount
285
- pre_tax_total: Pre-Tax Total
286
278
  total_excluding_vat: Pre-Tax Total
287
279
  spree/return_item:
288
280
  acceptance_status: Acceptance Status
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class AddApplyToAllToVariantPropertyRule < ActiveRecord::Migration[5.1]
4
- def up
4
+ def change
5
5
  add_column :spree_variant_property_rules, :apply_to_all, :boolean, default: false, null: false
6
6
  change_column :spree_variant_property_rules, :apply_to_all, :boolean, default: true
7
7
  end