camaleon_ecommerce 2.0.1 → 2.0.2
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/controllers/plugins/ecommerce/front/checkout_controller.rb +5 -5
- data/app/helpers/plugins/ecommerce/ecommerce_functions_helper.rb +9 -4
- data/db/migrate/20160502221327_add_cama_ecommerce_structure_plugin.rb +1 -1
- data/db/migrate/20160504162311_move_featured_attribute_of_products.rb +1 -1
- data/db/migrate/20160527184747_add_new_cart_structure.rb +1 -1
- data/db/migrate/20160620200501_add_product_attributes_structure.rb +1 -1
- data/db/migrate/20160825174848_set_cama_post_decorator_class.rb +1 -1
- data/db/migrate/20160825232739_migrate_order_data.rb +1 -1
- data/db/migrate/20161202182552_add_cookie_key_to_cart.rb +1 -1
- data/db/migrate/20161213222142_add_invoice_number.rb +1 -1
- data/db/migrate/20161214224919_remove_ecommerce_stock_field.rb +1 -1
- data/lib/ecommerce/version.rb +1 -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: 259fb7c0d7425357cf85f22b4dd36c09f0f793a1
|
4
|
+
data.tar.gz: bca5fac0b47ff2f37795d54e7db45474bc6be598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faa588f0e928cac0e0432e3762ca57444b4cde51193eef635a882cd353828fb6cd325ef8825715ed21ebb79711222a33958b573f91f1a1ab4c20302c05b84c9e
|
7
|
+
data.tar.gz: 64fb1190c45c2a0a1fc0207d24864914e57505f8892526006bb812d8488107f2cab49e542f3e2d884058ab78078b6e4dfb20b2931d1655d5c15ea8c849ac7657
|
@@ -32,7 +32,7 @@ class Plugins::Ecommerce::Front::CheckoutController < Plugins::Ecommerce::FrontC
|
|
32
32
|
errors = ecommerce_verify_cart_errors(@cart)
|
33
33
|
if errors.present?
|
34
34
|
flash[:cama_ecommerce][:error] = errors.join('<br>')
|
35
|
-
redirect_to
|
35
|
+
redirect_to request.referer
|
36
36
|
else
|
37
37
|
hooks_run('plugin_ecommerce_before_complete_free_order', @cart)
|
38
38
|
@cart.set_meta('free_order', true)
|
@@ -42,7 +42,7 @@ class Plugins::Ecommerce::Front::CheckoutController < Plugins::Ecommerce::FrontC
|
|
42
42
|
end
|
43
43
|
else
|
44
44
|
flash[:cama_ecommerce][:error] = "Invalid complete payment"
|
45
|
-
redirect_to
|
45
|
+
redirect_to request.referer
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -74,7 +74,7 @@ class Plugins::Ecommerce::Front::CheckoutController < Plugins::Ecommerce::FrontC
|
|
74
74
|
|
75
75
|
unless product.can_added?(qty, params[:variation_id])
|
76
76
|
flash[:cama_ecommerce][:error] = t('plugins.ecommerce.messages.not_enough_product_qty', product: product.the_variation_title(params[:variation_id]), qty: product.the_qty(params[:variation_id]), default: 'There is not enough products "%{product}" (Available %{qty})')
|
77
|
-
return params[:format] == 'json' ? render(json: flash.discard(:cama_ecommerce).to_hash) : (redirect_to
|
77
|
+
return params[:format] == 'json' ? render(json: flash.discard(:cama_ecommerce).to_hash) : (redirect_to request.referer)
|
78
78
|
end
|
79
79
|
@cart.add_product(product, qty, params[:variation_id])
|
80
80
|
flash[:cama_ecommerce][:notice] = t('plugins.ecommerce.messages.added_product_in_cart', default: 'Product added into cart')
|
@@ -121,7 +121,7 @@ class Plugins::Ecommerce::Front::CheckoutController < Plugins::Ecommerce::FrontC
|
|
121
121
|
if result[:payment_error]
|
122
122
|
flash[:payment_error] = true
|
123
123
|
end
|
124
|
-
redirect_to
|
124
|
+
redirect_to request.referer
|
125
125
|
else
|
126
126
|
commerce_mark_cart_received(@cart)
|
127
127
|
redirect_to plugins_ecommerce_orders_url
|
@@ -153,7 +153,7 @@ class Plugins::Ecommerce::Front::CheckoutController < Plugins::Ecommerce::FrontC
|
|
153
153
|
if res[:error].present?
|
154
154
|
flash[:cama_ecommerce][:error] = res[:error]
|
155
155
|
flash[:payment_error] = true
|
156
|
-
redirect_to
|
156
|
+
redirect_to request.referer
|
157
157
|
else
|
158
158
|
commerce_mark_cart_received(@cart)
|
159
159
|
redirect_to plugins_ecommerce_orders_url
|
@@ -80,14 +80,19 @@ module Plugins::Ecommerce::EcommerceFunctionsHelper
|
|
80
80
|
hooks_run('ecommerce_calculate_exchange', args) # permit to use custom exchange app by setting the value in :exchange attribute
|
81
81
|
return (args[:exchange] * amount).round(2) if args[:exchange].present?
|
82
82
|
|
83
|
-
|
84
|
-
res = open("https://www.google.com/finance/converter?a=1&from=#{args[:from]}&to=#{args[:to]}").read
|
85
|
-
res = res.scan(/\<span class=bld\>(.+?)\<\/span\>/).first.first.split(' ') # => ["69.3000", "BOB"]
|
86
|
-
exchange = res.first.to_f.round(4)
|
83
|
+
exchange = e_finance_exchange_converter(args)
|
87
84
|
cama_ecommerce_post_type.set_option(e_current_visitor_currency, {date: Date.today.to_s, exchange: exchange, base: e_system_currency}, 'currencies')
|
88
85
|
(exchange * amount).round(2)
|
89
86
|
end
|
90
87
|
|
88
|
+
# helper to calculate exchanges
|
89
|
+
def e_finance_exchange_converter(args)
|
90
|
+
# request to google's finance converter site
|
91
|
+
res = open("https://finance.google.com/finance/converter?a=1&from=#{args[:from]}&to=#{args[:to]}").read
|
92
|
+
res = res.scan(/\<span class=bld\>(.+?)\<\/span\>/).first.first.split(' ') # => ["69.3000", "BOB"]
|
93
|
+
res.first.to_f.round(4)
|
94
|
+
end
|
95
|
+
|
91
96
|
# return all currencies to use as a base currency
|
92
97
|
def e_get_all_currencies
|
93
98
|
@_cache_e_get_all_currencies ||= lambda{
|
data/lib/ecommerce/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camaleon_ecommerce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: camaleon_cms
|