spree_core 3.5.0.rc1 → 3.5.0.rc2
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/payment/processing.rb +2 -2
- data/app/models/spree/promotion/rules/option_value.rb +5 -13
- data/app/models/spree/refund.rb +1 -1
- data/app/models/spree/variant.rb +2 -2
- data/config/locales/en.yml +2 -0
- data/db/migrate/20171004223836_remove_icon_from_taxons.rb +4 -4
- data/lib/generators/spree/install/install_generator.rb +0 -3
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/money.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4fca3de896bb0591ba9d103ab1e82973337e93e
|
4
|
+
data.tar.gz: 1d2234919358861241bb21957271dbc1dfc18794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d877f0cd38820656f8a3765d1632c77d08a4b028bc87c7ea965553228cdf9d3e7a06c6cb95acdebd425d66f317db9b6dd1f1c80ce132ec8d2c0ed9c51020473a
|
7
|
+
data.tar.gz: dfa66a216e64df35df31c725b3703c5de810d0450427e4832212270e361b4cf224ce618d42be628a02417f355c639da164b7d11dfa9bde40d731218b5f2da1cf
|
@@ -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.
|
32
|
+
amount ||= money.amount_in_cents
|
33
33
|
started_processing!
|
34
34
|
protect_from_connection_error do
|
35
35
|
# Standard ActiveMerchant capture usage
|
@@ -114,7 +114,7 @@ module Spree
|
|
114
114
|
|
115
115
|
def gateway_action(source, action, success_state)
|
116
116
|
protect_from_connection_error do
|
117
|
-
response = payment_method.send(action, money.
|
117
|
+
response = payment_method.send(action, money.amount_in_cents,
|
118
118
|
source,
|
119
119
|
gateway_options)
|
120
120
|
handle_response(response, success_state, :failure)
|
@@ -31,20 +31,12 @@ module Spree
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def actionable?(line_item)
|
34
|
-
|
35
|
-
|
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
|
-
|
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
|
data/app/models/spree/refund.rb
CHANGED
@@ -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).
|
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
|
|
data/app/models/spree/variant.rb
CHANGED
@@ -276,8 +276,8 @@ module Spree
|
|
276
276
|
# Ensures a new variant takes the product master price when price is not supplied
|
277
277
|
def check_price
|
278
278
|
if price.nil? && Spree::Config[:require_master_price]
|
279
|
-
|
280
|
-
|
279
|
+
return errors.add(:base, :no_master_variant_found_to_infer_price) unless product && product.master
|
280
|
+
return errors.add(:base, :must_supply_price_for_variant_or_master) if self == product.master
|
281
281
|
self.price = product.master.price
|
282
282
|
end
|
283
283
|
if price.present? && currency.nil?
|
data/config/locales/en.yml
CHANGED
@@ -359,6 +359,8 @@ en:
|
|
359
359
|
attributes:
|
360
360
|
base:
|
361
361
|
cannot_destroy_if_attached_to_line_items: Cannot delete variants once they are attached to line items.
|
362
|
+
no_master_variant_found_to_infer_price: No master variant found to infer price
|
363
|
+
must_supply_price_for_variant_or_master: Must supply price for variant or master price for product.
|
362
364
|
|
363
365
|
devise:
|
364
366
|
confirmations:
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class RemoveIconFromTaxons < ActiveRecord::Migration[5.1]
|
2
2
|
def change
|
3
|
-
remove_column :spree_taxons, :icon_file_name
|
4
|
-
remove_column :spree_taxons, :icon_content_type
|
5
|
-
remove_column :spree_taxons, :icon_file_size
|
6
|
-
remove_column :spree_taxons, :icon_updated_at
|
3
|
+
remove_column :spree_taxons, :icon_file_name if column_exists? :spree_taxons, :icon_file_name
|
4
|
+
remove_column :spree_taxons, :icon_content_type if column_exists? :spree_taxons, :icon_content_type
|
5
|
+
remove_column :spree_taxons, :icon_file_size if column_exists? :spree_taxons, :icon_file_size
|
6
|
+
remove_column :spree_taxons, :icon_updated_at if column_exists? :spree_taxons, :icon_updated_at
|
7
7
|
end
|
8
8
|
end
|
@@ -86,9 +86,6 @@ module Spree
|
|
86
86
|
if @copy_views && Spree::Core::Engine.frontend_available?
|
87
87
|
generate 'spree:frontend:copy_views'
|
88
88
|
end
|
89
|
-
if @copy_views && Spree::Core::Engine.backend_available?
|
90
|
-
generate 'spree:backend:copy_views'
|
91
|
-
end
|
92
89
|
end
|
93
90
|
|
94
91
|
def configure_application
|
data/lib/spree/core/version.rb
CHANGED
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.5.0.
|
4
|
+
version: 3.5.0.rc2
|
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-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|