solidus_core 2.10.0.beta1 → 2.10.5

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/base_helper.rb +4 -4
  3. data/app/helpers/spree/products_helper.rb +2 -1
  4. data/app/jobs/spree/promotion_code_batch_job.rb +2 -2
  5. data/app/models/concerns/spree/user_methods.rb +2 -2
  6. data/app/models/spree/address.rb +11 -15
  7. data/app/models/spree/adjustment.rb +11 -0
  8. data/app/models/spree/calculator/price_sack.rb +1 -1
  9. data/app/models/spree/calculator/shipping/flexi_rate.rb +2 -2
  10. data/app/models/spree/calculator/tiered_flat_rate.rb +5 -5
  11. data/app/models/spree/calculator/tiered_percent.rb +6 -6
  12. data/app/models/spree/carton.rb +1 -1
  13. data/app/models/spree/credit_card.rb +2 -2
  14. data/app/models/spree/inventory_unit.rb +1 -19
  15. data/app/models/spree/line_item.rb +1 -1
  16. data/app/models/spree/order.rb +3 -2
  17. data/app/models/spree/order/checkout.rb +1 -1
  18. data/app/models/spree/order/payments.rb +2 -2
  19. data/app/models/spree/order_capturing.rb +2 -2
  20. data/app/models/spree/order_taxation.rb +2 -2
  21. data/app/models/spree/payment.rb +4 -41
  22. data/app/models/spree/payment/processing.rb +2 -2
  23. data/app/models/spree/payment_method.rb +2 -2
  24. data/app/models/spree/product.rb +3 -3
  25. data/app/models/spree/product/scopes.rb +9 -8
  26. data/app/models/spree/promotion.rb +27 -12
  27. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +1 -1
  28. data/app/models/spree/promotion/actions/free_shipping.rb +1 -1
  29. data/app/models/spree/promotion/rules/option_value.rb +2 -2
  30. data/app/models/spree/promotion/rules/product.rb +3 -3
  31. data/app/models/spree/promotion_action.rb +1 -1
  32. data/app/models/spree/promotion_chooser.rb +2 -2
  33. data/app/models/spree/promotion_code.rb +9 -8
  34. data/app/models/spree/promotion_code/batch_builder.rb +3 -3
  35. data/app/models/spree/promotion_rule.rb +1 -1
  36. data/app/models/spree/refund.rb +2 -2
  37. data/app/models/spree/reimbursement.rb +3 -11
  38. data/app/models/spree/reimbursement/reimbursement_type_engine.rb +1 -1
  39. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +2 -2
  40. data/app/models/spree/return_authorization.rb +1 -7
  41. data/app/models/spree/return_item.rb +3 -42
  42. data/app/models/spree/return_item/eligibility_validator/default.rb +1 -1
  43. data/app/models/spree/shipment.rb +4 -38
  44. data/app/models/spree/shipping_calculator.rb +0 -4
  45. data/app/models/spree/shipping_method.rb +1 -1
  46. data/app/models/spree/state.rb +1 -1
  47. data/app/models/spree/stock/differentiator.rb +1 -1
  48. data/app/models/spree/stock/package.rb +1 -1
  49. data/app/models/spree/stock_item.rb +1 -1
  50. data/app/models/spree/stock_quantities.rb +13 -12
  51. data/app/models/spree/tax_calculator/default.rb +0 -4
  52. data/app/models/spree/tax_calculator/shipping_rate.rb +0 -3
  53. data/app/models/spree/tax_rate.rb +4 -0
  54. data/app/models/spree/taxon/paperclip_attachment.rb +13 -0
  55. data/app/models/spree/user_last_url_storer.rb +46 -0
  56. data/app/models/spree/user_last_url_storer/rules/authentication_rule.rb +36 -0
  57. data/app/models/spree/variant.rb +9 -9
  58. data/app/models/spree/wallet/add_payment_sources_to_wallet.rb +1 -1
  59. data/app/models/spree/zone.rb +1 -1
  60. data/config/initializers/money.rb +2 -0
  61. data/config/locales/en.yml +12 -0
  62. data/lib/generators/spree/install/install_generator.rb +3 -0
  63. data/lib/generators/spree/install/templates/config/initializers/spree.rb.tt +8 -0
  64. data/lib/spree/app_configuration.rb +18 -3
  65. data/lib/spree/core.rb +12 -0
  66. data/lib/spree/core/controller_helpers/auth.rb +1 -13
  67. data/lib/spree/core/controller_helpers/strong_parameters.rb +21 -7
  68. data/lib/spree/core/engine.rb +2 -2
  69. data/lib/spree/core/environment_extension.rb +9 -0
  70. data/lib/spree/core/importer/order.rb +27 -26
  71. data/lib/spree/core/product_filters.rb +15 -15
  72. data/lib/spree/core/role_configuration.rb +2 -2
  73. data/lib/spree/core/search/variant.rb +1 -1
  74. data/lib/spree/core/state_machines.rb +78 -0
  75. data/lib/spree/core/state_machines/inventory_unit.rb +42 -0
  76. data/lib/spree/core/state_machines/payment.rb +61 -0
  77. data/lib/spree/core/state_machines/reimbursement.rb +33 -0
  78. data/lib/spree/core/state_machines/return_authorization.rb +32 -0
  79. data/lib/spree/core/state_machines/return_item/acceptance_status.rb +51 -0
  80. data/lib/spree/core/state_machines/return_item/reception_status.rb +42 -0
  81. data/lib/spree/core/state_machines/shipment.rb +58 -0
  82. data/lib/spree/core/stock_configuration.rb +1 -0
  83. data/lib/spree/core/validators/email.rb +1 -8
  84. data/lib/spree/core/version.rb +1 -1
  85. data/lib/spree/money.rb +2 -2
  86. data/lib/spree/permission_sets/user_management.rb +3 -0
  87. data/lib/spree/permitted_attributes.rb +78 -9
  88. data/lib/spree/preferences/static_model_preferences.rb +2 -2
  89. data/lib/spree/testing_support/dummy_app.rb +4 -1
  90. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +8 -1
  91. data/lib/spree/testing_support/factories/promotion_factory.rb +7 -0
  92. data/lib/spree/testing_support/factories/stock_package_factory.rb +1 -1
  93. data/lib/spree/testing_support/factories/user_factory.rb +4 -1
  94. data/solidus_core.gemspec +4 -4
  95. data/spec/lib/spree/core/controller_helpers/strong_parameters_spec.rb +8 -1
  96. data/spec/lib/spree/core/environment_extension_spec.rb +12 -1
  97. data/spec/lib/spree/core/stock_configuration_spec.rb +36 -0
  98. data/spec/lib/spree/core/validators/email_spec.rb +18 -18
  99. data/spec/lib/spree/permitted_attributes_spec.rb +41 -0
  100. data/spec/models/spree/ability_spec.rb +1 -1
  101. data/spec/models/spree/address_spec.rb +23 -0
  102. data/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb +1 -1
  103. data/spec/models/spree/calculator/shipping/flat_rate_spec.rb +1 -1
  104. data/spec/models/spree/calculator/shipping/flexi_rate_spec.rb +2 -2
  105. data/spec/models/spree/calculator/shipping/per_item_spec.rb +1 -1
  106. data/spec/models/spree/calculator/shipping/price_sack_spec.rb +24 -15
  107. data/spec/models/spree/carton_spec.rb +8 -0
  108. data/spec/models/spree/classification_spec.rb +21 -9
  109. data/spec/models/spree/concerns/user_address_book_spec.rb +4 -4
  110. data/spec/models/spree/concerns/user_methods_spec.rb +2 -1
  111. data/spec/models/spree/order_merger_spec.rb +3 -3
  112. data/spec/models/spree/order_spec.rb +8 -15
  113. data/spec/models/spree/order_updater_spec.rb +4 -3
  114. data/spec/models/spree/payment_create_spec.rb +4 -14
  115. data/spec/models/spree/permission_sets/user_management_spec.rb +2 -0
  116. data/spec/models/spree/preference_spec.rb +4 -4
  117. data/spec/models/spree/preferences/preferable_spec.rb +3 -3
  118. data/spec/models/spree/preferences/statically_configurable_spec.rb +2 -2
  119. data/spec/models/spree/promotion/rules/taxon_spec.rb +1 -0
  120. data/spec/models/spree/promotion_rule_spec.rb +6 -6
  121. data/spec/models/spree/promotion_spec.rb +73 -52
  122. data/spec/models/spree/reimbursement_type/original_payment_spec.rb +1 -1
  123. data/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb +1 -1
  124. data/spec/models/spree/returns_calculator_spec.rb +2 -2
  125. data/spec/models/spree/shipping_calculator_spec.rb +1 -13
  126. data/spec/models/spree/shipping_method_spec.rb +32 -0
  127. data/spec/models/spree/stock/availability_validator_spec.rb +2 -2
  128. data/spec/models/spree/stock/differentiator_spec.rb +2 -2
  129. data/spec/models/spree/stock/estimator_spec.rb +3 -3
  130. data/spec/models/spree/stock/package_spec.rb +28 -28
  131. data/spec/models/spree/stock/simple_coordinator_spec.rb +11 -11
  132. data/spec/models/spree/stock/splitter/base_spec.rb +4 -4
  133. data/spec/models/spree/stock/splitter/shipping_category_spec.rb +7 -7
  134. data/spec/models/spree/stock_quantities_spec.rb +1 -1
  135. data/spec/models/spree/store_credit_spec.rb +1 -1
  136. data/spec/models/spree/tax_rate_spec.rb +1 -0
  137. data/spec/models/spree/taxons/paperclip_attachment_spec.rb +29 -0
  138. data/spec/models/spree/user_last_url_storer/rules/authentication_rule_spec.rb +31 -0
  139. data/spec/models/spree/user_last_url_storer_spec.rb +60 -0
  140. metadata +41 -35
  141. data/spec/migrate/20190106184413_remove_code_from_spree_promotions_spec.rb +0 -162
  142. data/spec/models/spree/order/updating_spec.rb +0 -18
@@ -31,7 +31,7 @@ module Spree
31
31
  scope :ready, -> { with_state('ready') }
32
32
  scope :shipped, -> { with_state('shipped') }
33
33
  scope :trackable, -> { where("tracking IS NOT NULL AND tracking != ''") }
34
- scope :with_state, ->(*s) { where(state: s) }
34
+ scope :with_state, ->(*state) { where(state: state) }
35
35
  # sort by most recent shipped_at, falling back to created_at. add "id desc" to make specs that involve this scope more deterministic.
36
36
  scope :reverse_chronological, -> {
37
37
  order(Arel.sql("coalesce(#{Spree::Shipment.table_name}.shipped_at, #{Spree::Shipment.table_name}.created_at) desc"), id: :desc)
@@ -39,41 +39,7 @@ module Spree
39
39
 
40
40
  scope :by_store, ->(store) { joins(:order).merge(Spree::Order.by_store(store)) }
41
41
 
42
- # shipment state machine (see http://github.com/pluginaweek/state_machine/tree/master for details)
43
- state_machine initial: :pending, use_transactions: false do
44
- event :ready do
45
- transition from: :pending, to: :shipped, if: :can_transition_from_pending_to_shipped?
46
- transition from: :pending, to: :ready, if: :can_transition_from_pending_to_ready?
47
- end
48
-
49
- event :pend do
50
- transition from: :ready, to: :pending
51
- end
52
-
53
- event :ship do
54
- transition from: [:ready, :canceled], to: :shipped
55
- end
56
- after_transition to: :shipped, do: :after_ship
57
-
58
- event :cancel do
59
- transition to: :canceled, from: [:pending, :ready]
60
- end
61
- after_transition to: :canceled, do: :after_cancel
62
-
63
- event :resume do
64
- transition from: :canceled, to: :ready, if: :can_transition_from_canceled_to_ready?
65
- transition from: :canceled, to: :pending
66
- end
67
- after_transition from: :canceled, to: [:pending, :ready, :shipped], do: :after_resume
68
-
69
- after_transition do |shipment, transition|
70
- shipment.state_changes.create!(
71
- previous_state: transition.from,
72
- next_state: transition.to,
73
- name: 'shipment'
74
- )
75
- end
76
- end
42
+ include ::Spree::Config.state_machines.shipment
77
43
 
78
44
  self.whitelisted_ransackable_associations = ['order']
79
45
  self.whitelisted_ransackable_attributes = ['number']
@@ -142,7 +108,7 @@ module Spree
142
108
  # @return [BigDecimal] the amount of this item, taking into consideration
143
109
  # all non-tax adjustments.
144
110
  def total_before_tax
145
- amount + adjustments.select { |a| !a.tax? && a.eligible? }.sum(&:amount)
111
+ amount + adjustments.select { |adjustment| !adjustment.tax? && adjustment.eligible? }.sum(&:amount)
146
112
  end
147
113
 
148
114
  # @return [BigDecimal] the amount of this shipment before VAT tax
@@ -219,7 +185,7 @@ module Spree
219
185
  def select_shipping_method(shipping_method)
220
186
  estimator = Spree::Config.stock.estimator_class.new
221
187
  rates = estimator.shipping_rates(to_package, false)
222
- rate = rates.detect { |r| r.shipping_method_id == shipping_method.id }
188
+ rate = rates.detect { |detected| detected.shipping_method_id == shipping_method.id }
223
189
  rate.selected = true
224
190
  self.shipping_rates = [rate]
225
191
  end
@@ -2,10 +2,6 @@
2
2
 
3
3
  module Spree
4
4
  class ShippingCalculator < Calculator
5
- def compute_shipment(_shipment)
6
- raise NotImplementedError, "Please implement 'compute_shipment(shipment)' in your calculator: #{self.class.name}"
7
- end
8
-
9
5
  def compute_package(_package)
10
6
  raise NotImplementedError, "Please implement 'compute_package(package)' in your calculator: #{self.class.name}"
11
7
  end
@@ -41,7 +41,7 @@ module Spree
41
41
 
42
42
  scope :available_to_store, ->(store) do
43
43
  raise ArgumentError, "You must provide a store" if store.nil?
44
- store.shipping_methods.empty? ? all : where(id: store.shipping_method_ids)
44
+ store.shipping_methods.empty? ? all : where(id: store.shipping_methods.ids)
45
45
  end
46
46
 
47
47
  # @param shipping_category_ids [Array<Integer>] ids of desired shipping categories
@@ -24,7 +24,7 @@ module Spree
24
24
  # table of { country.id => [ state.id , state.name ] }, arrays sorted by name
25
25
  # blank is added elsewhere, if needed
26
26
  def self.states_group_by_country_id
27
- state_info = Hash.new { |h, k| h[k] = [] }
27
+ state_info = Hash.new { |hash, key| hash[key] = [] }
28
28
  order(:name).each { |state|
29
29
  state_info[state.country_id.to_s].push [state.id, state.name]
30
30
  }
@@ -14,7 +14,7 @@ module Spree
14
14
  end
15
15
 
16
16
  def missing?
17
- missing.values.any? { |v| v > 0 }
17
+ missing.values.any? { |value| value > 0 }
18
18
  end
19
19
 
20
20
  private
@@ -85,7 +85,7 @@ module Spree
85
85
  # @return [Fixnum] the number of inventory units in the package,
86
86
  # counting only those in the given state if it was specified
87
87
  def quantity(state = nil)
88
- matched_contents = state.nil? ? contents : contents.select { |c| c.state.to_s == state.to_s }
88
+ matched_contents = state.nil? ? contents : contents.select { |content| content.state.to_s == state.to_s }
89
89
  matched_contents.map(&:quantity).sum
90
90
  end
91
91
 
@@ -111,7 +111,7 @@ module Spree
111
111
  def should_touch_variant?
112
112
  # the variant_id changes from nil when a new stock location is added
113
113
  inventory_cache_threshold &&
114
- (saved_change_to_count_on_hand && saved_change_to_count_on_hand.any? { |c| c < inventory_cache_threshold }) ||
114
+ (saved_change_to_count_on_hand&.any? { |cache| cache < inventory_cache_threshold }) ||
115
115
  saved_change_to_variant_id?
116
116
  end
117
117
 
@@ -8,8 +8,8 @@ module Spree
8
8
 
9
9
  # @param quantities [Hash<Spree::Variant=>Numeric>]
10
10
  def initialize(quantities = {})
11
- raise ArgumentError unless quantities.keys.all?{ |v| v.is_a?(Spree::Variant) }
12
- raise ArgumentError unless quantities.values.all?{ |v| v.is_a?(Numeric) }
11
+ raise ArgumentError unless quantities.keys.all?{ |value| value.is_a?(Spree::Variant) }
12
+ raise ArgumentError unless quantities.values.all?{ |value| value.is_a?(Numeric) }
13
13
 
14
14
  @quantities = quantities
15
15
  end
@@ -33,16 +33,16 @@ module Spree
33
33
  # Adds two StockQuantities together
34
34
  # @return [Spree::StockQuantities]
35
35
  def +(other)
36
- combine_with(other) do |_variant, a, b|
37
- (a || 0) + (b || 0)
36
+ combine_with(other) do |_variant, first, second|
37
+ (first || 0) + (second || 0)
38
38
  end
39
39
  end
40
40
 
41
41
  # Subtracts another StockQuantities from this one
42
42
  # @return [Spree::StockQuantities]
43
43
  def -(other)
44
- combine_with(other) do |_variant, a, b|
45
- (a || 0) - (b || 0)
44
+ combine_with(other) do |_variant, first, second|
45
+ (first || 0) - (second || 0)
46
46
  end
47
47
  end
48
48
 
@@ -50,9 +50,10 @@ module Spree
50
50
  # stock which exists in both StockQuantities.
51
51
  # @return [Spree::StockQuantities]
52
52
  def &(other)
53
- combine_with(other) do |_variant, a, b|
54
- next unless a && b
55
- [a, b].min
53
+ combine_with(other) do |_variant, first, second|
54
+ next unless first && second
55
+
56
+ [first, second].min
56
57
  end
57
58
  end
58
59
 
@@ -72,9 +73,9 @@ module Spree
72
73
  def combine_with(other)
73
74
  self.class.new(
74
75
  (variants | other.variants).map do |variant|
75
- a = self[variant]
76
- b = other[variant]
77
- value = yield variant, a, b
76
+ self_v = self[variant]
77
+ other_v = other[variant]
78
+ value = yield variant, self_v, other_v
78
79
  [variant, value]
79
80
  end.to_h.compact
80
81
  )
@@ -8,10 +8,6 @@ module Spree
8
8
  # The class used for tax calculation is configurable, so that the
9
9
  # calculation can easily be pushed to third-party services. Users looking
10
10
  # to provide their own calculator should adhere to the API of this class.
11
- #
12
- # @api experimental
13
- # @note This API is currently in development and likely to change.
14
- # Specifically, the input format is not yet finalized.
15
11
  class Default
16
12
  include Spree::Tax::TaxHelpers
17
13
 
@@ -10,9 +10,6 @@ module Spree
10
10
  # class.
11
11
  #
12
12
  # @see Spree::Tax::ShippingRateTaxer
13
- # @api experimental
14
- # @note This API is currently in development and likely to change.
15
- # Specifically, the input format is not yet finalized.
16
13
  class ShippingRate
17
14
  include Spree::Tax::TaxHelpers
18
15
 
@@ -88,7 +88,11 @@ module Spree
88
88
  scope :included_in_price, -> { where(included_in_price: true) }
89
89
 
90
90
  # Creates necessary tax adjustments for the order.
91
+ #
92
+ # @deprecated Please use `Spree::Tax::OrderAdjuster#adjust!` instead
91
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
+
92
96
  amount = compute_amount(item)
93
97
 
94
98
  item.adjustments.create!(
@@ -18,4 +18,17 @@ module Spree::Taxon::PaperclipAttachment
18
18
  def icon_present?
19
19
  icon.present?
20
20
  end
21
+
22
+ def attachment_partial_name
23
+ 'paperclip'
24
+ end
25
+
26
+ def destroy_attachment(definition)
27
+ return false unless respond_to?(definition)
28
+
29
+ attached_file = send(definition)
30
+ return false unless attached_file.exists?
31
+
32
+ attached_file.destroy
33
+ end
21
34
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ # This service object is responsible for storing the current path into
5
+ # into `session[:spree_user_return_to]` for redirects after successful
6
+ # user/admin authentication.
7
+ class UserLastUrlStorer
8
+ # Lists all the rules that will be evaluated before storing the
9
+ # current path value into the session.
10
+ #
11
+ # @return [Spree::Core::ClassConstantizer::Set] a set of rules
12
+ # that, when matched, will prevent session[:spree_user_return_to]
13
+ # to be set
14
+ #
15
+ # @example This method can be used also to add more rules
16
+ # Spree::UserLastUrlStorer.rules << 'CustomRule'
17
+ #
18
+ # @example it can be used also for removing unwanted rules
19
+ # Spree::UserLastUrlStorer.rules.delete('CustomRule')
20
+ #
21
+ def self.rules
22
+ Spree::Config.user_last_url_storer_rules
23
+ end
24
+
25
+ # @param controller [ApplicationController] an instance of ApplicationController
26
+ # or its subclasses. The controller will be passed to each rule for matching.
27
+ def initialize(controller)
28
+ @controller = controller
29
+ end
30
+
31
+ # Stores into session[:spree_user_return_to] the request full path for
32
+ # future redirects (to be used after successful authentication). When
33
+ # there is a rule match then the request full path is not stored.
34
+ def store_location
35
+ return if self.class.rules.any? { |rule| rule.match? controller }
36
+
37
+ session[:spree_user_return_to] = request.fullpath.gsub('//', '/')
38
+ end
39
+
40
+ private
41
+
42
+ attr_reader :controller
43
+
44
+ delegate :session, :request, to: :controller
45
+ end
46
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ class UserLastUrlStorer
5
+ module Rules
6
+ # This is the basic rule that ships with Solidus that avoids storing in
7
+ # session the current path for login/loout/signup routes, avoiding possibly
8
+ # infinte redirects.
9
+ module AuthenticationRule
10
+ AUTHENTICATION_ROUTES = %w[spree_signup_path spree_login_path spree_logout_path]
11
+
12
+ extend self
13
+
14
+ def match?(controller)
15
+ full_path = controller.request.fullpath
16
+ disallowed_urls(controller).include?(full_path)
17
+ end
18
+
19
+ private
20
+
21
+ def disallowed_urls(controller)
22
+ @disallowed_urls ||= {}
23
+ @disallowed_urls[controller.controller_name] ||= begin
24
+ [].tap do |disallowed_urls|
25
+ AUTHENTICATION_ROUTES.each do |route|
26
+ if controller.respond_to?(route)
27
+ disallowed_urls << controller.send(route)
28
+ end
29
+ end
30
+ end.map! { |url| url[/\/\w+$/] }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -250,12 +250,12 @@ module Spree
250
250
  # no option values on master
251
251
  return if is_master
252
252
 
253
- option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |o|
254
- o.presentation = opt_name
255
- o.save!
253
+ option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |option|
254
+ option.presentation = opt_name
255
+ option.save!
256
256
  end
257
257
 
258
- current_value = option_values.detect { |o| o.option_type.name == opt_name }
258
+ current_value = option_values.detect { |option| option.option_type.name == opt_name }
259
259
 
260
260
  if current_value
261
261
  return if current_value.name == opt_value
@@ -267,9 +267,9 @@ module Spree
267
267
  end
268
268
  end
269
269
 
270
- option_value = Spree::OptionValue.where(option_type_id: option_type.id, name: opt_value).first_or_initialize do |o|
271
- o.presentation = opt_value
272
- o.save!
270
+ option_value = Spree::OptionValue.where(option_type_id: option_type.id, name: opt_value).first_or_initialize do |option|
271
+ option.presentation = opt_value
272
+ option.save!
273
273
  end
274
274
 
275
275
  option_values << option_value
@@ -281,7 +281,7 @@ module Spree
281
281
  # @param opt_name [String] the name of the option whose value you want
282
282
  # @return [String] the option value
283
283
  def option_value(opt_name)
284
- option_values.detect { |o| o.option_type.name == opt_name }.try(:presentation)
284
+ option_values.detect { |option| option.option_type.name == opt_name }.try(:presentation)
285
285
  end
286
286
 
287
287
  # Returns an instance of the globally configured variant price selector class for this variant.
@@ -439,7 +439,7 @@ module Spree
439
439
  end
440
440
 
441
441
  def build_vat_prices
442
- VatPriceGenerator.new(self).run
442
+ Spree::Config.variant_vat_prices_generator_class.new(self).run
443
443
  end
444
444
 
445
445
  def set_position
@@ -19,7 +19,7 @@ class Spree::Wallet::AddPaymentSourcesToWallet
19
19
  sources = payments.map(&:source).
20
20
  uniq.
21
21
  compact.
22
- select { |p| p.try(:reusable?) }
22
+ select { |payment| payment.try(:reusable?) }
23
23
 
24
24
  # add valid sources to wallet and optionally set a default
25
25
  if sources.any?
@@ -40,7 +40,7 @@ module Spree
40
40
  end
41
41
 
42
42
  alias :members :zone_members
43
- accepts_nested_attributes_for :zone_members, allow_destroy: true, reject_if: proc { |a| a['zoneable_id'].blank? }
43
+ accepts_nested_attributes_for :zone_members, allow_destroy: true, reject_if: proc { |member| member['zoneable_id'].blank? }
44
44
 
45
45
  self.whitelisted_ransackable_attributes = %w[name description]
46
46
 
@@ -3,3 +3,5 @@
3
3
  require 'money'
4
4
 
5
5
  Money.locale_backend = :i18n
6
+ Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN
7
+ Money.default_currency = Money::Currency.new(Spree::Config.currency)
@@ -1086,6 +1086,7 @@ en:
1086
1086
  cannot_create_payment_without_payment_methods_html: You cannot create a payment
1087
1087
  for an order without any payment methods defined. %{link}
1088
1088
  cannot_create_returns: Cannot create returns as this order has no shipped units.
1089
+ cannot_edit_orders: You may only edit your current shopping cart.
1089
1090
  cannot_perform_operation: Cannot perform requested operation
1090
1091
  cannot_rebuild_shipments_order_completed: Cannot rebuild shipments for a completed
1091
1092
  order.
@@ -1371,6 +1372,14 @@ en:
1371
1372
  hidden: hidden
1372
1373
  hide_out_of_stock: Hide out of stock
1373
1374
  hints:
1375
+ spree/calculator:
1376
+ tax_rates: This is used to calculate both sales tax (United States-style taxes)
1377
+ and value-added tax (VAT). Typically this calculator should be the only tax
1378
+ calculator required by your store.
1379
+ shipping_methods: This is used to calculate the shipping rates on a per order or
1380
+ per package rate.
1381
+ promotions: This is used to determine the promotional discount to be applied to an
1382
+ order, an item, or shipping charges.
1374
1383
  spree/price:
1375
1384
  country: 'This determines in what country the price is valid.<br/>Default:
1376
1385
  Any Country'
@@ -1519,6 +1528,7 @@ en:
1519
1528
  log_entries: Log Entries
1520
1529
  logged_in_as: Logged in as
1521
1530
  logged_in_succesfully: Logged in successfully
1531
+ logged_in_successfully: Logged in successfully
1522
1532
  logged_out: You have been logged out.
1523
1533
  login: Login
1524
1534
  login_as_existing: Login as Existing Customer
@@ -1548,6 +1558,7 @@ en:
1548
1558
  meta_title: Meta Title
1549
1559
  metadata: Metadata
1550
1560
  minimal_amount: Minimal Amount
1561
+ minimize_menu: Minimize Menu
1551
1562
  modify_stock_count: Modify (+/-)
1552
1563
  month: Month
1553
1564
  more: More
@@ -2103,6 +2114,7 @@ en:
2103
2114
  (i.e. if the tax rate is 5% then enter 0.05)
2104
2115
  tax_rates: Tax Rates
2105
2116
  taxon: Taxon
2117
+ taxon_attachment_removal_error: There was an error removing the attachment
2106
2118
  taxon_edit: Edit Taxon
2107
2119
  taxon_placeholder: Add a Taxon
2108
2120
  taxon_rule: