solidus_core 2.11.6 → 3.0.0

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 (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
@@ -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
 
@@ -87,20 +87,6 @@ module Spree
87
87
  end
88
88
  end
89
89
 
90
- def allocate_inventory(availability_by_location)
91
- sorted_availability = sort_availability(availability_by_location)
92
-
93
- sorted_availability.transform_values do |available|
94
- # Find the desired inventory which is available at this location
95
- packaged = available & @desired
96
- # Remove found inventory from desired
97
- @desired -= packaged
98
- packaged
99
- end
100
- end
101
- deprecate allocate_inventory: 'allocate_inventory is deprecated. Please write your own allocator defining' \
102
- 'a Spree::Stock::Allocator::Base subclass', deprecator: Spree::Deprecation
103
-
104
90
  def sort_availability(availability)
105
91
  sorted_availability = availability.sort_by do |stock_location_id, _|
106
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
@@ -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
@@ -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
@@ -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
 
@@ -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
@@ -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
  #