spree_core 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4be9412583b406e2838b0edc12866be3d271b6a
4
- data.tar.gz: e519d7bff34aaa8c73de122d6d27c4cfc7b2da78
3
+ metadata.gz: e33887c7715be995d8b06aa64c48cc8ff0f63dc1
4
+ data.tar.gz: 7020fb8b5a8e9cd5c20683d5a454c05755e96ec1
5
5
  SHA512:
6
- metadata.gz: 11462b98f62e9ef52fcdb7c8327285f0c024e7c9a72d6ee19eee45e62e66d60a0b1141fc85bf0ee1aa846be067a075b517824affbb97cacf47bb3fd1cb4642c1
7
- data.tar.gz: 6aa0a801e656d7381dfeb0f75960ddae08de7036c358ae3978b3be5632181f702c5e75efb1cc74df17edc1c2492edc8f004c9589e1e480812e869ae965bbb278
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 :included, -> { where(included: true) }
58
+ scope :is_included, -> { where(included: true) }
59
59
  scope :additional, -> { where(included: false) }
60
60
 
61
61
  def closed?
@@ -10,7 +10,11 @@ module Spree
10
10
  end
11
11
 
12
12
  def compute(object=nil)
13
- self.preferred_amount
13
+ if object && preferred_currency.upcase == object.currency.upcase
14
+ preferred_amount
15
+ else
16
+ 0
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -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: :update_order
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 update_order
72
+ def fulfill_order
73
73
  self.reload
74
- order.update!
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.included.reload.map(&:update!).compact.sum
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
 
@@ -297,7 +297,7 @@ module Spree
297
297
  end
298
298
 
299
299
  def outstanding_balance
300
- if self.state == 'canceled' && self.payments.present? && self.payments.completed.size > 0
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 !payments.present? && order.state == 'canceled'
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
@@ -193,7 +193,7 @@ module Spree
193
193
  end
194
194
 
195
195
  def update_order
196
- if self.completed?
196
+ if completed? || void?
197
197
  order.updater.update_payment_total
198
198
  end
199
199
 
@@ -16,14 +16,14 @@ module Spree
16
16
  end
17
17
 
18
18
  def provider_class
19
- raise ::NotImplementedError, 'You must implement provider_class method for this gateway.'
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 ::NotImplementedError, 'You must implement payment_source_class method for this gateway.'
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?)
@@ -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.source = adjustment.originator
18
- adjustment.save
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
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '2.3.6'
3
+ '2.3.7'
4
4
  end
5
5
  end
@@ -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
@@ -2,7 +2,7 @@ FactoryGirl.define do
2
2
  factory :credit_card, class: Spree::CreditCard do
3
3
  verification_value 123
4
4
  month 12
5
- year { Time.now.year }
5
+ year { 1.year.from_now.year }
6
6
  number '4111111111111111'
7
7
  name 'Spree Commerce'
8
8
  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: :calculator, strategy: :build)
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: :no_amount_calculator, strategy: :build)
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.6
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: 2014-12-05 00:00:00.000000000 Z
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: '0'
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: '0'
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: '2.0'
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: '2.0'
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.2.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.