spree_core 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/spree/order.rb +2 -2
- data/app/models/spree/order_contents.rb +0 -1
- data/app/models/spree/order_inventory.rb +4 -3
- data/app/models/spree/shipment.rb +9 -4
- data/config/initializers/premailer_rails.rb +3 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/factories.rb +3 -3
- data/lib/spree/testing_support/factories/address_factory.rb +1 -1
- data/lib/spree/testing_support/factories/adjustment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/calculator_factory.rb +1 -1
- data/lib/spree/testing_support/factories/country_factory.rb +1 -1
- data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
- data/lib/spree/testing_support/factories/customer_return_factory.rb +1 -1
- data/lib/spree/testing_support/factories/image_factory.rb +1 -1
- data/lib/spree/testing_support/factories/inventory_unit_factory.rb +1 -1
- data/lib/spree/testing_support/factories/line_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/options_factory.rb +1 -1
- data/lib/spree/testing_support/factories/order_factory.rb +1 -1
- data/lib/spree/testing_support/factories/payment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/payment_method_factory.rb +1 -1
- data/lib/spree/testing_support/factories/price_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_option_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_property_factory.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_factory.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_rule_factory.rb +1 -1
- data/lib/spree/testing_support/factories/property_factory.rb +1 -1
- data/lib/spree/testing_support/factories/prototype_factory.rb +1 -1
- data/lib/spree/testing_support/factories/refund_factory.rb +1 -1
- data/lib/spree/testing_support/factories/reimbursement_factory.rb +1 -1
- data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/return_authorization_factory.rb +1 -1
- data/lib/spree/testing_support/factories/return_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/role_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipping_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +1 -1
- data/lib/spree/testing_support/factories/state_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_location_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_movement_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_event_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_factory.rb +1 -1
- data/lib/spree/testing_support/factories/tag_factory.rb +1 -1
- data/lib/spree/testing_support/factories/tax_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/tax_rate_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
- data/lib/spree/testing_support/factories/tracker_factory.rb +1 -1
- data/lib/spree/testing_support/factories/user_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_factory.rb +1 -1
- data/lib/spree/testing_support/factories/zone_factory.rb +1 -1
- data/lib/spree/testing_support/factories/zone_member_factory.rb +1 -1
- data/lib/spree/testing_support/order_walkthrough.rb +9 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68cb55c21ddd24f8248dca5549bc6cdb7ce2460c
|
4
|
+
data.tar.gz: b4ca12837622c5f82832b9e7e074e5b77a2fb294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eae5883047bcd05bae1feeb7f6cd1bea296466e28a2b12311f4dddb5c1d7c380e9a60844dfa91e017979bce09f4e85c1d689de4f104a4161b4d1c83acbc2a2f
|
7
|
+
data.tar.gz: a32117843440c4a5c6233bc52feac36293bdaf34ae3568c06df67901c2f4fa3b973d56346bb7a620ef4bef93a850fa517cbea09ff1a95fbf74eded59003a2007
|
data/app/models/spree/order.rb
CHANGED
@@ -268,8 +268,8 @@ module Spree
|
|
268
268
|
self.user = user
|
269
269
|
self.email = user.email if override_email
|
270
270
|
self.created_by ||= user
|
271
|
-
self.bill_address ||= user.bill_address
|
272
|
-
self.ship_address ||= user.ship_address
|
271
|
+
self.bill_address ||= user.bill_address.try(:clone)
|
272
|
+
self.ship_address ||= user.ship_address.try(:clone)
|
273
273
|
|
274
274
|
changes = slice(:user_id, :email, :created_by_id, :bill_address_id, :ship_address_id)
|
275
275
|
|
@@ -72,10 +72,10 @@ module Spree
|
|
72
72
|
if variant.should_track_inventory?
|
73
73
|
on_hand, back_order = shipment.stock_location.fill_status(variant, quantity)
|
74
74
|
|
75
|
-
|
76
|
-
|
75
|
+
shipment.set_up_inventory('on_hand', variant, order, line_item, on_hand)
|
76
|
+
shipment.set_up_inventory('backordered', variant, order, line_item, back_order)
|
77
77
|
else
|
78
|
-
|
78
|
+
shipment.set_up_inventory('on_hand', variant, order, line_item, quantity)
|
79
79
|
end
|
80
80
|
|
81
81
|
# adding to this shipment, and removing from stock_location
|
@@ -103,6 +103,7 @@ module Spree
|
|
103
103
|
end
|
104
104
|
removed_quantity += 1
|
105
105
|
end
|
106
|
+
inventory_unit.save! if inventory_unit.persisted?
|
106
107
|
end
|
107
108
|
|
108
109
|
shipment.destroy if shipment.inventory_units.sum(:quantity).zero?
|
@@ -219,6 +219,7 @@ module Spree
|
|
219
219
|
selected_rate = shipping_rates.detect do |rate|
|
220
220
|
rate.shipping_method_id == original_shipping_method_id
|
221
221
|
end
|
222
|
+
save!
|
222
223
|
self.selected_shipping_rate_id = selected_rate.id if selected_rate
|
223
224
|
end
|
224
225
|
|
@@ -235,12 +236,14 @@ module Spree
|
|
235
236
|
save!
|
236
237
|
end
|
237
238
|
|
238
|
-
def set_up_inventory(state, variant, order, line_item)
|
239
|
+
def set_up_inventory(state, variant, order, line_item, quantity = 1)
|
240
|
+
return if quantity <= 0
|
239
241
|
inventory_units.create(
|
240
242
|
state: state,
|
241
243
|
variant_id: variant.id,
|
242
244
|
order_id: order.id,
|
243
|
-
line_item_id: line_item.id
|
245
|
+
line_item_id: line_item.id,
|
246
|
+
quantity: quantity
|
244
247
|
)
|
245
248
|
end
|
246
249
|
|
@@ -337,6 +340,7 @@ module Spree
|
|
337
340
|
|
338
341
|
order.contents.remove(variant, quantity, shipment: self)
|
339
342
|
order.contents.add(variant, quantity, shipment: new_shipment)
|
343
|
+
order.update_with_updater!
|
340
344
|
|
341
345
|
refresh_rates
|
342
346
|
save!
|
@@ -353,8 +357,9 @@ module Spree
|
|
353
357
|
raise ArgumentError if quantity <= 0 || self == shipment_to_transfer_to
|
354
358
|
|
355
359
|
transaction do
|
356
|
-
order.contents.remove(variant,
|
357
|
-
order.contents.add(variant,
|
360
|
+
order.contents.remove(variant, final_quantity, shipment: self)
|
361
|
+
order.contents.add(variant, final_quantity, shipment: shipment_to_transfer_to)
|
362
|
+
order.update_with_updater!
|
358
363
|
|
359
364
|
refresh_rates
|
360
365
|
save!
|
data/lib/spree/core/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'factory_bot'
|
2
2
|
|
3
3
|
Spree::Zone.class_eval do
|
4
4
|
def self.global
|
5
|
-
find_by(name: 'GlobalZone') ||
|
5
|
+
find_by(name: 'GlobalZone') || FactoryBot.create(:global_zone)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -10,7 +10,7 @@ Dir["#{File.dirname(__FILE__)}/factories/**"].each do |f|
|
|
10
10
|
load File.expand_path(f)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
FactoryBot.define do
|
14
14
|
sequence(:random_string) { FFaker::Lorem.sentence }
|
15
15
|
sequence(:random_description) { FFaker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
|
16
16
|
sequence(:random_email) { FFaker::Internet.email }
|
@@ -1,22 +1,22 @@
|
|
1
1
|
class OrderWalkthrough
|
2
2
|
def self.up_to(state)
|
3
3
|
# A default store must exist to provide store settings
|
4
|
-
|
4
|
+
FactoryBot.create(:store) unless Spree::Store.exists?
|
5
5
|
|
6
6
|
# A payment method must exist for an order to proceed through the Address state
|
7
7
|
unless Spree::PaymentMethod.exists?
|
8
|
-
|
8
|
+
FactoryBot.create(:check_payment_method)
|
9
9
|
end
|
10
10
|
|
11
11
|
# Need to create a valid zone too...
|
12
|
-
zone =
|
13
|
-
country =
|
12
|
+
zone = FactoryBot.create(:zone)
|
13
|
+
country = FactoryBot.create(:country)
|
14
14
|
zone.members << Spree::ZoneMember.create(zoneable: country)
|
15
|
-
country.states <<
|
15
|
+
country.states << FactoryBot.create(:state, country: country)
|
16
16
|
|
17
17
|
# A shipping method must exist for rates to be displayed on checkout page
|
18
18
|
unless Spree::ShippingMethod.exists?
|
19
|
-
|
19
|
+
FactoryBot.create(:shipping_method).tap do |sm|
|
20
20
|
sm.calculator.preferred_amount = 10
|
21
21
|
sm.calculator.preferred_currency = Spree::Config[:currency]
|
22
22
|
sm.calculator.save
|
@@ -38,13 +38,13 @@ class OrderWalkthrough
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def self.add_line_item!(order)
|
41
|
-
|
41
|
+
FactoryBot.create(:line_item, order: order)
|
42
42
|
order.reload
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.address(order)
|
46
|
-
order.bill_address =
|
47
|
-
order.ship_address =
|
46
|
+
order.bill_address = FactoryBot.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
|
47
|
+
order.ship_address = FactoryBot.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
|
48
48
|
order.next!
|
49
49
|
end
|
50
50
|
|
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: 3.4.
|
4
|
+
version: 3.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -568,6 +568,7 @@ files:
|
|
568
568
|
- config/initializers/assets.rb
|
569
569
|
- config/initializers/friendly_id.rb
|
570
570
|
- config/initializers/premailer_assets.rb
|
571
|
+
- config/initializers/premailer_rails.rb
|
571
572
|
- config/locales/en.yml
|
572
573
|
- config/routes.rb
|
573
574
|
- db/default/spree/countries.rb
|