spree_core 4.0.0.beta → 4.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5064fe41cb92fc49b65d326a8104d304e34e53b14cd8ad841207bef116b35464
4
- data.tar.gz: c5288fc5c3b503961af981fe4c374e4bafcb93cb117dcd6e9be983d2c06f96e8
3
+ metadata.gz: f1e151381e092c35c7a9cf8860afc569afee679c44465209bbe1760ada4dd716
4
+ data.tar.gz: 71cb114b3a96d8e865c1d9bbed17e95c54764f71db1c1ca002d05510d27455cc
5
5
  SHA512:
6
- metadata.gz: b70df4383270e04fc466c704e7d97ca152793bb74eec3ca7f66cbe901700671255eb2d94016b66031f43f57fa40ab9817f3498a272624a383a392d998ff675ed
7
- data.tar.gz: 2eaf71128b93b12a4502d4bdb0ef0719ab39c480968a8436b422a723d6c7c43e97c323df636259fe03891fbf924c3043fafab4dc1e505fafa13317717a4c6fbf
6
+ metadata.gz: e7a25734d828b63ffa3ea6db68681ddf0c590c7a516583f76b2c9b8eb300ab4943dbba82e0beac67f2ad1a7915e6bdbe6656c4382df2cc56981d34b98cbd23e1
7
+ data.tar.gz: 073535b1a83ada55a42a391ee4a68f74cd600e0ec41f2fdf7deb2c6657218aba51221cf09a451fe18d14c45003499ac4046ea7ce438c0bd56a0ca99b500eee4b
@@ -8,7 +8,14 @@ module Spree
8
8
  end
9
9
 
10
10
  def compute(object)
11
- (object.amount * preferred_percent) / 100
11
+ computed_amount = (object.amount * preferred_percent / 100).round(2)
12
+
13
+ # We don't want to cause the promotion adjustments to push the order into a negative total.
14
+ if computed_amount > object.amount
15
+ object.amount
16
+ else
17
+ computed_amount
18
+ end
12
19
  end
13
20
  end
14
21
  end
@@ -128,7 +128,7 @@ module Spree
128
128
  before_update :homogenize_line_item_currencies, if: :currency_changed?
129
129
 
130
130
  with_options presence: true do
131
- validates :number, length: { maximum: 32, allow_blank: true }, uniqueness: { allow_blank: true }
131
+ validates :number, length: { maximum: 32, allow_blank: true }, uniqueness: { allow_blank: true, case_sensitive: false }
132
132
  validates :email, length: { maximum: 254, allow_blank: true }, email: { allow_blank: true }, if: :require_email
133
133
  validates :item_count, numericality: { greater_than_or_equal_to: 0, less_than: 2**31, only_integer: true, allow_blank: true }
134
134
  validates :store
@@ -67,7 +67,7 @@ module Spree
67
67
  attributes.delete(:id)
68
68
 
69
69
  if address&.editable?
70
- address.update_attributes(attributes)
70
+ address.update(attributes)
71
71
  return address
72
72
  else
73
73
  attributes.delete(:id)
@@ -21,7 +21,7 @@ module Spree
21
21
 
22
22
  belongs_to :tax_category, class_name: 'Spree::TaxCategory', optional: true
23
23
 
24
- validates :name, presence: true
24
+ validates :name, :display_on, presence: true
25
25
 
26
26
  validate :at_least_one_shipping_category
27
27
 
@@ -48,7 +48,7 @@ module Spree
48
48
  validates :cost_price
49
49
  validates :price
50
50
  end
51
- validates :sku, uniqueness: { conditions: -> { where(deleted_at: nil) } }, allow_blank: true
51
+ validates :sku, uniqueness: { conditions: -> { where(deleted_at: nil) }, case_sensitive: false }, allow_blank: true
52
52
 
53
53
  after_create :create_stock_items
54
54
  after_create :set_master_out_of_stock, unless: :is_master?
@@ -92,7 +92,6 @@ module Spree
92
92
  not_discontinued.not_deleted.
93
93
  for_currency_and_available_price_amount(currency)
94
94
  end
95
-
96
95
  LOCALIZED_NUMBERS = %w(cost_price weight depth width height)
97
96
 
98
97
  LOCALIZED_NUMBERS.each do |m|
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '4.0.0.beta'
3
+ '4.0.0.rc1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta
4
+ version: 4.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-29 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant