solidus_core 2.4.1 → 2.4.2
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.
- checksums.yaml +4 -4
- data/app/models/spree/calculator/default_tax.rb +1 -1
- data/app/models/spree/calculator/flexi_rate.rb +1 -1
- data/app/models/spree/calculator/returns/default_refund_amount.rb +1 -1
- data/app/models/spree/calculator/tiered_flat_rate.rb +1 -1
- data/app/models/spree/calculator/tiered_percent.rb +1 -1
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/promotion/actions/create_adjustment.rb +1 -1
- data/app/models/spree/promotion/actions/create_item_adjustments.rb +1 -1
- data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +1 -1
- data/app/models/spree/promotion/rules/item_total.rb +1 -1
- data/app/models/spree/promotion_chooser.rb +1 -1
- data/db/migrate/20160101010000_solidus_one_four.rb +0 -11
- data/db/migrate/20160420044191_create_spree_wallet_payment_sources.rb +25 -0
- data/db/migrate/20160420181916_migrate_credit_cards_to_wallet_payment_sources.rb +27 -0
- data/lib/spree/core/search/base.rb +5 -13
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/localized_number.rb +1 -1
- data/lib/spree/preferences/preferable.rb +1 -1
- data/lib/spree/testing_support/factories/line_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/order_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_factory.rb +1 -1
- data/spec/lib/search/base_spec.rb +6 -8
- data/spec/lib/spree/money_spec.rb +1 -1
- data/spec/models/spree/calculator/tiered_flat_rate_spec.rb +5 -5
- data/spec/models/spree/calculator/tiered_percent_spec.rb +5 -5
- data/spec/models/spree/price_spec.rb +1 -1
- data/spec/models/spree/reimbursement/credit_spec.rb +1 -1
- data/spec/models/spree/reimbursement_spec.rb +1 -1
- data/spec/models/spree/user_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fedc5c2cdf1cb1e25f80a181af360d2250eb273c
|
4
|
+
data.tar.gz: 75df629b91496ec4e8d94f3624835237d7b0814a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96482c5df0535d60f3daaddba9efe951675e02c7ca38c7bbe3412c903b7020a5655eeafaa509d45af212c04c17161f26a759ab7ba587695929601c0f8f0f710c
|
7
|
+
data.tar.gz: f23eec90d1da8eb97d4ffe8efd47be92ca48de63b7821282c0f96dd8146626283a9646a504cbd2961b97d4da3fab86cdc5990a759d91c4c3273cd515819896ef
|
@@ -15,7 +15,7 @@ module Spree
|
|
15
15
|
items_count = object.quantity
|
16
16
|
items_count = [items_count, preferred_max_items].min unless preferred_max_items.zero?
|
17
17
|
|
18
|
-
return BigDecimal
|
18
|
+
return BigDecimal(0) if items_count == 0
|
19
19
|
|
20
20
|
additional_items_count = items_count - 1
|
21
21
|
preferred_first_item + preferred_additional_item * additional_items_count
|
@@ -39,7 +39,7 @@ module Spree
|
|
39
39
|
if !amount.is_a?(BigDecimal)
|
40
40
|
Spree::Deprecation.warn "#{calculator.class.name}#compute returned #{amount.inspect}, it should return a BigDecimal"
|
41
41
|
end
|
42
|
-
amount ||= BigDecimal
|
42
|
+
amount ||= BigDecimal(0)
|
43
43
|
amount = amount.abs
|
44
44
|
[(calculable.item_total + calculable.ship_total), amount].min * -1
|
45
45
|
end
|
@@ -35,7 +35,7 @@ module Spree
|
|
35
35
|
if !promotion_amount.is_a?(BigDecimal)
|
36
36
|
Spree::Deprecation.warn "#{calculator.class.name}#compute returned #{promotion_amount.inspect}, it should return a BigDecimal"
|
37
37
|
end
|
38
|
-
promotion_amount ||= BigDecimal
|
38
|
+
promotion_amount ||= BigDecimal(0)
|
39
39
|
promotion_amount = promotion_amount.abs
|
40
40
|
[adjustable.amount, promotion_amount].min * -1
|
41
41
|
end
|
@@ -56,7 +56,7 @@ module Spree::Promotion::Actions
|
|
56
56
|
if !adjustment_amount.is_a?(BigDecimal)
|
57
57
|
Spree::Deprecation.warn "#{calculator.class.name}#compute returned #{adjustment_amount.inspect}, it should return a BigDecimal"
|
58
58
|
end
|
59
|
-
adjustment_amount ||= BigDecimal
|
59
|
+
adjustment_amount ||= BigDecimal(0)
|
60
60
|
adjustment_amount = adjustment_amount.abs
|
61
61
|
|
62
62
|
order = line_item.order
|
@@ -17,7 +17,7 @@ module Spree
|
|
17
17
|
def eligible?(order, _options = {})
|
18
18
|
return false unless order.currency == preferred_currency
|
19
19
|
item_total = order.item_total
|
20
|
-
unless item_total.send(preferred_operator == 'gte' ? :>= : :>, BigDecimal
|
20
|
+
unless item_total.send(preferred_operator == 'gte' ? :>= : :>, BigDecimal(preferred_amount.to_s))
|
21
21
|
eligibility_errors.add(:base, ineligible_message)
|
22
22
|
end
|
23
23
|
|
@@ -1120,17 +1120,6 @@ class SolidusOneFour < ActiveRecord::Migration[5.0]
|
|
1120
1120
|
t.index ["track_inventory"], name: "index_spree_variants_on_track_inventory"
|
1121
1121
|
end
|
1122
1122
|
|
1123
|
-
create_table "spree_wallet_payment_sources", force: :cascade do |t|
|
1124
|
-
t.integer "user_id", null: false
|
1125
|
-
t.string "payment_source_type", null: false
|
1126
|
-
t.integer "payment_source_id", null: false
|
1127
|
-
t.boolean "default", default: false, null: false
|
1128
|
-
t.datetime "created_at", null: false
|
1129
|
-
t.datetime "updated_at", null: false
|
1130
|
-
t.index ["user_id", "payment_source_id", "payment_source_type"], name: "index_spree_wallet_payment_sources_on_source_and_user", unique: true
|
1131
|
-
t.index ["user_id"], name: "index_spree_wallet_payment_sources_on_user_id"
|
1132
|
-
end
|
1133
|
-
|
1134
1123
|
create_table "spree_zone_members", force: :cascade do |t|
|
1135
1124
|
t.string "zoneable_type"
|
1136
1125
|
t.integer "zoneable_id"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateSpreeWalletPaymentSources < ActiveRecord::Migration[4.2]
|
2
|
+
def change
|
3
|
+
return if table_exists?(:spree_wallet_payment_sources)
|
4
|
+
|
5
|
+
create_table :spree_wallet_payment_sources do |t|
|
6
|
+
t.references(
|
7
|
+
:user,
|
8
|
+
foreign_key: { to_table: Spree.user_class.table_name },
|
9
|
+
index: true,
|
10
|
+
null: false,
|
11
|
+
)
|
12
|
+
t.references :payment_source, polymorphic: true, null: false
|
13
|
+
t.boolean :default, default: false, null: false
|
14
|
+
|
15
|
+
t.timestamps null: false
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index(
|
19
|
+
:spree_wallet_payment_sources,
|
20
|
+
[:user_id, :payment_source_id, :payment_source_type],
|
21
|
+
unique: true,
|
22
|
+
name: 'index_spree_wallet_payment_sources_on_source_and_user',
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class MigrateCreditCardsToWalletPaymentSources < ActiveRecord::Migration[4.2]
|
2
|
+
class CreditCard < ActiveRecord::Base
|
3
|
+
self.table_name = 'spree_credit_cards'
|
4
|
+
end
|
5
|
+
class WalletPaymentSource < ActiveRecord::Base
|
6
|
+
self.table_name = 'spree_wallet_payment_sources'
|
7
|
+
end
|
8
|
+
|
9
|
+
def up
|
10
|
+
credit_cards = CreditCard.
|
11
|
+
where.not(gateway_customer_profile_id: nil).
|
12
|
+
where.not(user_id: nil)
|
13
|
+
|
14
|
+
credit_cards.find_each do |credit_card|
|
15
|
+
WalletPaymentSource.find_or_create_by!(
|
16
|
+
user_id: credit_card.user_id,
|
17
|
+
payment_source_id: credit_card.id,
|
18
|
+
payment_source_type: 'Spree::CreditCard'
|
19
|
+
) do |wallet_source|
|
20
|
+
wallet_source.default = credit_card.default
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def down
|
26
|
+
end
|
27
|
+
end
|
@@ -27,15 +27,12 @@ module Spree
|
|
27
27
|
|
28
28
|
def retrieve_products
|
29
29
|
@products = get_base_scope
|
30
|
+
curr_page = page || 1
|
30
31
|
|
31
32
|
unless Spree::Config.show_products_without_price
|
32
33
|
@products = @products.joins(:prices).merge(Spree::Price.where(pricing_options.search_arguments)).distinct
|
33
34
|
end
|
34
|
-
|
35
|
-
curr_page = @properties[:page] || 1
|
36
|
-
@products = @products.page(curr_page).per(@properties[:per_page])
|
37
|
-
end
|
38
|
-
@products
|
35
|
+
@products = @products.page(curr_page).per(per_page)
|
39
36
|
end
|
40
37
|
|
41
38
|
def method_missing(name)
|
@@ -104,14 +101,9 @@ module Spree
|
|
104
101
|
@properties[:search] = params[:search]
|
105
102
|
@properties[:include_images] = params[:include_images]
|
106
103
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
per_page = params[:per_page].to_i
|
112
|
-
@properties[:per_page] = per_page > 0 ? per_page : Spree::Config[:products_per_page]
|
113
|
-
@properties[:page] = (params[:page].to_i <= 0) ? 1 : params[:page].to_i
|
114
|
-
end
|
104
|
+
per_page = params[:per_page].to_i
|
105
|
+
@properties[:per_page] = per_page > 0 ? per_page : Spree::Config[:products_per_page]
|
106
|
+
@properties[:page] = (params[:page].to_i <= 0) ? 1 : params[:page].to_i
|
115
107
|
end
|
116
108
|
end
|
117
109
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -4,7 +4,7 @@ require 'spree/testing_support/factories/option_type_factory'
|
|
4
4
|
require 'spree/testing_support/factories/product_factory'
|
5
5
|
|
6
6
|
FactoryGirl.define do
|
7
|
-
sequence(:random_float) { BigDecimal
|
7
|
+
sequence(:random_float) { BigDecimal("#{rand(200)}.#{rand(99)}") }
|
8
8
|
|
9
9
|
factory :base_variant, class: 'Spree::Variant' do
|
10
10
|
price 19.99
|
@@ -35,15 +35,13 @@ RSpec.describe Spree::Core::Search::Base do
|
|
35
35
|
it "switches to next page according to the page parameter" do
|
36
36
|
@product3 = create(:product, name: "RoR Pants", price: 14.00)
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
expect(searcher.retrieve_products.count).to eq(2)
|
38
|
+
params = { per_page: "2" }
|
39
|
+
searcher = Spree::Core::Search::Base.new(params)
|
40
|
+
expect(searcher.retrieve_products.count).to eq(2)
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
42
|
+
params[:page] = "2"
|
43
|
+
searcher = Spree::Core::Search::Base.new(params)
|
44
|
+
expect(searcher.retrieve_products.count).to eq(1)
|
47
45
|
end
|
48
46
|
|
49
47
|
it "maps search params to named scopes" do
|
@@ -18,7 +18,7 @@ RSpec.describe Spree::Calculator::TieredFlatRate, type: :model do
|
|
18
18
|
before { calculator.preferred_tiers = { 20 => 20 } }
|
19
19
|
it "converts successfully" do
|
20
20
|
is_expected.to be true
|
21
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
21
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20') => BigDecimal('20') })
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ RSpec.describe Spree::Calculator::TieredFlatRate, type: :model do
|
|
26
26
|
before { calculator.preferred_tiers = { 20.5 => 20.5 } }
|
27
27
|
it "converts successfully" do
|
28
28
|
is_expected.to be true
|
29
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
29
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20.5') => BigDecimal('20.5') })
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -34,7 +34,7 @@ RSpec.describe Spree::Calculator::TieredFlatRate, type: :model do
|
|
34
34
|
before { calculator.preferred_tiers = { "20" => 20 } }
|
35
35
|
it "converts successfully" do
|
36
36
|
is_expected.to be true
|
37
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
37
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20') => BigDecimal('20') })
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ RSpec.describe Spree::Calculator::TieredFlatRate, type: :model do
|
|
42
42
|
before { calculator.preferred_tiers = { " 20 " => 20 } }
|
43
43
|
it "converts successfully" do
|
44
44
|
is_expected.to be true
|
45
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
45
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20') => BigDecimal('20') })
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,7 +50,7 @@ RSpec.describe Spree::Calculator::TieredFlatRate, type: :model do
|
|
50
50
|
before { calculator.preferred_tiers = { "20.5" => "20.5" } }
|
51
51
|
it "converts successfully" do
|
52
52
|
is_expected.to be true
|
53
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
53
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20.5') => BigDecimal('20.5') })
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -34,7 +34,7 @@ RSpec.describe Spree::Calculator::TieredPercent, type: :model do
|
|
34
34
|
before { calculator.preferred_tiers = { 20 => 20 } }
|
35
35
|
it "converts successfully" do
|
36
36
|
is_expected.to be true
|
37
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
37
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20') => BigDecimal('20') })
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ RSpec.describe Spree::Calculator::TieredPercent, type: :model do
|
|
42
42
|
before { calculator.preferred_tiers = { 20.5 => 20.5 } }
|
43
43
|
it "converts successfully" do
|
44
44
|
is_expected.to be true
|
45
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
45
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20.5') => BigDecimal('20.5') })
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,7 +50,7 @@ RSpec.describe Spree::Calculator::TieredPercent, type: :model do
|
|
50
50
|
before { calculator.preferred_tiers = { "20" => 20 } }
|
51
51
|
it "converts successfully" do
|
52
52
|
is_expected.to be true
|
53
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
53
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20') => BigDecimal('20') })
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -58,7 +58,7 @@ RSpec.describe Spree::Calculator::TieredPercent, type: :model do
|
|
58
58
|
before { calculator.preferred_tiers = { " 20 " => 20 } }
|
59
59
|
it "converts successfully" do
|
60
60
|
is_expected.to be true
|
61
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
61
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20') => BigDecimal('20') })
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -66,7 +66,7 @@ RSpec.describe Spree::Calculator::TieredPercent, type: :model do
|
|
66
66
|
before { calculator.preferred_tiers = { "20.5" => "20.5" } }
|
67
67
|
it "converts successfully" do
|
68
68
|
is_expected.to be true
|
69
|
-
expect(calculator.preferred_tiers).to eq({ BigDecimal
|
69
|
+
expect(calculator.preferred_tiers).to eq({ BigDecimal('20.5') => BigDecimal('20.5') })
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -12,7 +12,7 @@ module Spree
|
|
12
12
|
before { allow(reimbursement).to receive(:credits).and_return([credit_double, credit_double]) }
|
13
13
|
|
14
14
|
it 'should sum the amounts of all of the reimbursements credits' do
|
15
|
-
expect(subject).to eq BigDecimal
|
15
|
+
expect(subject).to eq BigDecimal('199.98')
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -53,7 +53,7 @@ RSpec.describe Spree::Reimbursement, type: :model do
|
|
53
53
|
let(:shipping_method) { create :shipping_method, zones: [tax_zone] }
|
54
54
|
let(:variant) { create :variant }
|
55
55
|
let(:order) { create(:order_with_line_items, state: 'payment', line_items_attributes: [{ variant: variant, price: line_items_price }], shipment_cost: 0, shipping_method: shipping_method) }
|
56
|
-
let(:line_items_price) { BigDecimal
|
56
|
+
let(:line_items_price) { BigDecimal(10) }
|
57
57
|
let(:line_item) { order.line_items.first }
|
58
58
|
let(:inventory_unit) { line_item.inventory_units.first }
|
59
59
|
let(:payment) { build(:payment, amount: payment_amount, order: order, state: 'checkout') }
|
@@ -102,7 +102,7 @@ end
|
|
102
102
|
|
103
103
|
RSpec.describe Spree.user_class, type: :model do
|
104
104
|
context "reporting" do
|
105
|
-
let(:order_value) { BigDecimal
|
105
|
+
let(:order_value) { BigDecimal("80.94") }
|
106
106
|
let(:order_count) { 4 }
|
107
107
|
let(:orders) { Array.new(order_count, double(total: order_value)) }
|
108
108
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -529,6 +529,8 @@ files:
|
|
529
529
|
- db/default/spree/stores.rb
|
530
530
|
- db/default/spree/zones.rb
|
531
531
|
- db/migrate/20160101010000_solidus_one_four.rb
|
532
|
+
- db/migrate/20160420044191_create_spree_wallet_payment_sources.rb
|
533
|
+
- db/migrate/20160420181916_migrate_credit_cards_to_wallet_payment_sources.rb
|
532
534
|
- db/migrate/20160924135758_remove_is_default_from_prices.rb
|
533
535
|
- db/migrate/20161009141333_remove_currency_from_line_items.rb
|
534
536
|
- db/migrate/20161014221052_add_available_to_columns_and_remove_display_on_from_payment_methods.rb
|