spree_core 3.3.5 → 3.3.6

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: 1a2abd18d0a6f4ead4edb367efe9f60ea1cf3098
4
- data.tar.gz: e1291c816e63476c91880dd5a5d1d4b02dc69f6d
3
+ metadata.gz: 73e2d20d2e94ec8108511604d21d42356cc17e6f
4
+ data.tar.gz: 15a87566816c184d635ab8dfa37832206e7b5dd9
5
5
  SHA512:
6
- metadata.gz: 864321fd229b5100cf8871d6b69868f8de7ee488928ce881e02acb3b7c014e6f904303731e6677f5acf65e635ee297c034c342993e2699f06b1eb53b00693b66
7
- data.tar.gz: 90a6e8778a862a3d3ec7e773cced3015737b7a5969e707f2b9b06b06bedcf4772ac64d749e28fd2519ad3fab0d56d5ccbfb1d6509b0e175f4a7e473cbf7929a9
6
+ metadata.gz: 114e9c29ef8f116cd2998cc3e8e008a8a369f35f5927f78067d153b31e02987e19d076099c302500d6245a27de76d281577dd4121f258086dd65e6566c4ba577
7
+ data.tar.gz: c1a0a77381b644cd78822fd7d34518cf304e0d7ccd9e81a9f9e424aec589ce3b6df47da707b061de156a7f28fddcec44a967143f11aa8be01c8bb1f7b31667ec
@@ -29,7 +29,7 @@ module Spree
29
29
  # a new pending payment record for the remaining amount to capture later.
30
30
  def capture!(amount = nil)
31
31
  return true if completed?
32
- amount ||= money.money.cents
32
+ amount ||= money.amount_in_cents
33
33
  started_processing!
34
34
  protect_from_connection_error do
35
35
  # Standard ActiveMerchant capture usage
@@ -115,7 +115,7 @@ module Spree
115
115
 
116
116
  def gateway_action(source, action, success_state)
117
117
  protect_from_connection_error do
118
- response = payment_method.send(action, money.money.cents,
118
+ response = payment_method.send(action, money.amount_in_cents,
119
119
  source,
120
120
  gateway_options)
121
121
  handle_response(response, success_state, :failure)
@@ -31,20 +31,12 @@ module Spree
31
31
  end
32
32
 
33
33
  def actionable?(line_item)
34
- pid = line_item.product.id
35
- ovids = line_item.variant.option_values.pluck(:id)
34
+ product_id = line_item.product.id
35
+ option_values_ids = line_item.variant.option_value_ids
36
+ eligible_product_ids = preferred_eligible_values.keys
37
+ eligible_value_ids = preferred_eligible_values[product_id]
36
38
 
37
- product_ids.include?(pid) && (value_ids(pid) - ovids).empty?
38
- end
39
-
40
- private
41
-
42
- def product_ids
43
- preferred_eligible_values.keys
44
- end
45
-
46
- def value_ids(product_id)
47
- preferred_eligible_values[product_id]
39
+ eligible_product_ids.include?(product_id) && (eligible_value_ids & option_values_ids).present?
48
40
  end
49
41
  end
50
42
  end
@@ -43,7 +43,7 @@ module Spree
43
43
  def perform!
44
44
  return true if transaction_id.present?
45
45
 
46
- credit_cents = Spree::Money.new(amount.to_f, currency: payment.currency).money.cents
46
+ credit_cents = Spree::Money.new(amount.to_f, currency: payment.currency).amount_in_cents
47
47
 
48
48
  @response = process!(credit_cents)
49
49
 
@@ -116,12 +116,12 @@ module Spree
116
116
  end
117
117
 
118
118
  config.to_prepare do
119
- # Load spree locales before decorators
120
- I18n.load_path += Dir.glob(
119
+ # Ensure spree locale paths are present before decorators
120
+ I18n.load_path.unshift(*(Dir.glob(
121
121
  File.join(
122
122
  File.dirname(__FILE__), '../../../config/locales', '*.{rb,yml}'
123
123
  )
124
- )
124
+ ) - I18n.load_path))
125
125
 
126
126
  # Load application's model / class decorators
127
127
  Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "3.3.5"
3
+ "3.3.6"
4
4
  end
5
5
  end
data/lib/spree/money.rb CHANGED
@@ -15,13 +15,17 @@ module Spree
15
15
 
16
16
  attr_reader :money
17
17
 
18
- delegate :cents, to: :money
18
+ delegate :cents, :currency, to: :money
19
19
 
20
20
  def initialize(amount, options={})
21
21
  @money = Monetize.parse([amount, (options[:currency] || Spree::Config[:currency])].join)
22
22
  @options = Spree::Money.default_formatting_rules.merge(options)
23
23
  end
24
24
 
25
+ def amount_in_cents
26
+ (cents / currency.subunit_to_unit.to_f * 100).round
27
+ end
28
+
25
29
  def to_s
26
30
  @money.format(@options)
27
31
  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: 3.3.5
4
+ version: 3.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -986,7 +986,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
986
986
  version: 1.8.23
987
987
  requirements: []
988
988
  rubyforge_project:
989
- rubygems_version: 2.6.12
989
+ rubygems_version: 2.6.14
990
990
  signing_key:
991
991
  specification_version: 4
992
992
  summary: The bare bones necessary for Spree.