spree_core 2.3.6 → 2.3.7
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 +4 -4
- data/app/models/spree/adjustment.rb +1 -1
- data/app/models/spree/calculator/flat_rate.rb +5 -1
- data/app/models/spree/inventory_unit.rb +3 -3
- data/app/models/spree/item_adjustments.rb +1 -1
- data/app/models/spree/order.rb +7 -1
- data/app/models/spree/order_updater.rb +1 -3
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/payment_method.rb +2 -6
- data/app/models/spree/return_authorization.rb +1 -1
- data/config/locales/en.yml +2 -0
- data/db/migrate/20130807024301_upgrade_adjustments.rb +5 -4
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/factories/calculator_factory.rb +8 -0
- data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e33887c7715be995d8b06aa64c48cc8ff0f63dc1
|
4
|
+
data.tar.gz: 7020fb8b5a8e9cd5c20683d5a454c05755e96ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9da8aef7d8db0730a650136689e512686a1b4f2332ce7a7bb1eec5a5d62aa12b280dd8d56d5c39a1cec63956206d4bfdf957e3952f3f02f83360852eba5f065
|
7
|
+
data.tar.gz: 48a64ef3a959e0abbb99fc36b7572424c56ea8cbdd2619a446288865354760452d6bde8e14c229a5476c1e51985718d1b1187b0ef1cb9ddbaadd86a52a5186df
|
@@ -55,7 +55,7 @@ module Spree
|
|
55
55
|
scope :credit, -> { where("#{quoted_table_name}.amount < 0") }
|
56
56
|
scope :promotion, -> { where(source_type: 'Spree::PromotionAction') }
|
57
57
|
scope :return_authorization, -> { where(source_type: "Spree::ReturnAuthorization") }
|
58
|
-
scope :
|
58
|
+
scope :is_included, -> { where(included: true) }
|
59
59
|
scope :additional, -> { where(included: false) }
|
60
60
|
|
61
61
|
def closed?
|
@@ -21,7 +21,7 @@ module Spree
|
|
21
21
|
event :fill_backorder do
|
22
22
|
transition to: :on_hand, from: :backordered
|
23
23
|
end
|
24
|
-
after_transition on: :fill_backorder, do: :
|
24
|
+
after_transition on: :fill_backorder, do: :fulfill_order
|
25
25
|
|
26
26
|
event :ship do
|
27
27
|
transition to: :shipped, if: :allow_ship?
|
@@ -69,9 +69,9 @@ module Spree
|
|
69
69
|
Spree::Config[:allow_backorder_shipping] || self.on_hand?
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
72
|
+
def fulfill_order
|
73
73
|
self.reload
|
74
|
-
order.
|
74
|
+
order.fulfill!
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -52,7 +52,7 @@ module Spree
|
|
52
52
|
additional_tax_total = 0
|
53
53
|
run_callbacks :tax_adjustments do
|
54
54
|
tax = (item.respond_to?(:all_adjustments) ? item.all_adjustments : item.adjustments).tax
|
55
|
-
included_tax_total = tax.
|
55
|
+
included_tax_total = tax.is_included.reload.map(&:update!).compact.sum
|
56
56
|
additional_tax_total = tax.additional.reload.map(&:update!).compact.sum
|
57
57
|
end
|
58
58
|
|
data/app/models/spree/order.rb
CHANGED
@@ -297,7 +297,7 @@ module Spree
|
|
297
297
|
end
|
298
298
|
|
299
299
|
def outstanding_balance
|
300
|
-
if
|
300
|
+
if state == 'canceled'
|
301
301
|
-1 * payment_total
|
302
302
|
else
|
303
303
|
total - payment_total
|
@@ -347,6 +347,12 @@ module Spree
|
|
347
347
|
consider_risk
|
348
348
|
end
|
349
349
|
|
350
|
+
def fulfill!
|
351
|
+
shipments.each { |shipment| shipment.update!(self) if shipment.persisted? }
|
352
|
+
updater.update_shipment_state
|
353
|
+
save!
|
354
|
+
end
|
355
|
+
|
350
356
|
def deliver_order_confirmation_email
|
351
357
|
OrderMailer.confirm_email(self.id).deliver
|
352
358
|
update_column(:confirmation_delivered, true)
|
@@ -158,9 +158,7 @@ module Spree
|
|
158
158
|
last_state = order.payment_state
|
159
159
|
if payments.present? && payments.valid.size == 0
|
160
160
|
order.payment_state = 'failed'
|
161
|
-
elsif
|
162
|
-
order.payment_state = 'void'
|
163
|
-
elsif order.state == 'canceled' && order.payment_total == 0 && payments.completed.size > 0
|
161
|
+
elsif order.state == 'canceled' && order.payment_total == 0
|
164
162
|
order.payment_state = 'void'
|
165
163
|
else
|
166
164
|
order.payment_state = 'balance_due' if order.outstanding_balance > 0
|
data/app/models/spree/payment.rb
CHANGED
@@ -16,14 +16,14 @@ module Spree
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def provider_class
|
19
|
-
raise
|
19
|
+
raise 'You must implement provider_class method for this gateway.'
|
20
20
|
end
|
21
21
|
|
22
22
|
# The class that will process payments for this payment type, used for @payment.source
|
23
23
|
# e.g. CreditCard in the case of a the Gateway payment type
|
24
24
|
# nil means the payment method doesn't require a source e.g. check
|
25
25
|
def payment_source_class
|
26
|
-
raise
|
26
|
+
raise 'You must implement payment_source_class method for this gateway.'
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.available(display_on = 'both')
|
@@ -67,9 +67,5 @@ module Spree
|
|
67
67
|
def supports?(source)
|
68
68
|
true
|
69
69
|
end
|
70
|
-
|
71
|
-
def cancel(response)
|
72
|
-
raise ::NotImplementedError, 'You must implement cancel method for this payment method.'
|
73
|
-
end
|
74
70
|
end
|
75
71
|
end
|
@@ -91,7 +91,7 @@ module Spree
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
Adjustment.create(adjustable: order, amount: compute_amount, label: Spree.t(:rma_credit), source: self)
|
94
|
+
Adjustment.create(adjustable: order, amount: compute_amount, label: Spree.t(:rma_credit), order: order, source: self)
|
95
95
|
order.update!
|
96
96
|
|
97
97
|
order.return if inventory_units.all?(&:returned?)
|
data/config/locales/en.yml
CHANGED
@@ -1166,7 +1166,9 @@ en:
|
|
1166
1166
|
usage_limit: Usage Limit
|
1167
1167
|
use_app_default: Use App Default
|
1168
1168
|
use_billing_address: Use Billing Address
|
1169
|
+
use_existing_cc: Use an existing card on file
|
1169
1170
|
use_new_cc: Use a new card
|
1171
|
+
use_new_cc_or_payment_method: Use a new card / payment method
|
1170
1172
|
use_s3: Use Amazon S3 For Images
|
1171
1173
|
user: User
|
1172
1174
|
user_rule:
|
@@ -9,13 +9,14 @@ class UpgradeAdjustments < ActiveRecord::Migration
|
|
9
9
|
# Account for possible invalid data
|
10
10
|
next if adjustment.source.nil?
|
11
11
|
adjustment.source.update_column(:cost, adjustment.amount)
|
12
|
-
adjustment.destroy
|
12
|
+
adjustment.destroy!
|
13
13
|
end
|
14
14
|
|
15
15
|
# Tax adjustments have their sources altered
|
16
16
|
Spree::Adjustment.where(:originator_type => "Spree::TaxRate").find_each do |adjustment|
|
17
|
-
adjustment.
|
18
|
-
adjustment.
|
17
|
+
adjustment.source_id = adjustment.originator_id
|
18
|
+
adjustment.source_type = "Spree::TaxRate"
|
19
|
+
adjustment.save!
|
19
20
|
end
|
20
21
|
|
21
22
|
# Promotion adjustments have their source altered also
|
@@ -33,7 +34,7 @@ class UpgradeAdjustments < ActiveRecord::Migration
|
|
33
34
|
# Fail silently. This is primarily in instances where the calculator no longer exists
|
34
35
|
end
|
35
36
|
|
36
|
-
adjustment.save
|
37
|
+
adjustment.save!
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
data/lib/spree/core/version.rb
CHANGED
@@ -9,4 +9,12 @@ FactoryGirl.define do
|
|
9
9
|
|
10
10
|
factory :default_tax_calculator, class: Spree::Calculator::DefaultTax do
|
11
11
|
end
|
12
|
+
|
13
|
+
factory :shipping_calculator, class: Spree::Calculator::Shipping::FlatRate do
|
14
|
+
after(:create) { |c| c.set_preference(:amount, 10.0) }
|
15
|
+
end
|
16
|
+
|
17
|
+
factory :shipping_no_amount_calculator, class: Spree::Calculator::Shipping::FlatRate do
|
18
|
+
after(:create) { |c| c.set_preference(:amount, 0) }
|
19
|
+
end
|
12
20
|
end
|
@@ -10,11 +10,11 @@ FactoryGirl.define do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
factory :shipping_method, class: Spree::ShippingMethod do
|
13
|
-
association(:calculator, factory: :
|
13
|
+
association(:calculator, factory: :shipping_calculator, strategy: :build)
|
14
14
|
end
|
15
15
|
|
16
16
|
factory :free_shipping_method, class: Spree::ShippingMethod do
|
17
|
-
association(:calculator, factory: :
|
17
|
+
association(:calculator, factory: :shipping_no_amount_calculator, strategy: :build)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
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: 2.3.
|
4
|
+
version: 2.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -202,16 +202,16 @@ dependencies:
|
|
202
202
|
name: monetize
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
204
204
|
requirements:
|
205
|
-
- - "
|
205
|
+
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: '
|
207
|
+
version: '1.1'
|
208
208
|
type: :runtime
|
209
209
|
prerelease: false
|
210
210
|
version_requirements: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
|
-
- - "
|
212
|
+
- - "~>"
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version: '
|
214
|
+
version: '1.1'
|
215
215
|
- !ruby/object:Gem::Dependency
|
216
216
|
name: paperclip
|
217
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,14 +232,14 @@ dependencies:
|
|
232
232
|
requirements:
|
233
233
|
- - "~>"
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
version:
|
235
|
+
version: 2.0.5
|
236
236
|
type: :runtime
|
237
237
|
prerelease: false
|
238
238
|
version_requirements: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
240
|
- - "~>"
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version:
|
242
|
+
version: 2.0.5
|
243
243
|
- !ruby/object:Gem::Dependency
|
244
244
|
name: rails
|
245
245
|
requirement: !ruby/object:Gem::Requirement
|
@@ -759,7 +759,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
759
759
|
version: '0'
|
760
760
|
requirements: []
|
761
761
|
rubyforge_project:
|
762
|
-
rubygems_version: 2.
|
762
|
+
rubygems_version: 2.4.5
|
763
763
|
signing_key:
|
764
764
|
specification_version: 4
|
765
765
|
summary: The bare bones necessary for Spree.
|