spree_core 0.70.0.rc2 → 0.70.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/app/assets/javascripts/admin/taxonomy.js +1 -1
- data/app/controllers/admin/tax_rates_controller.rb +2 -2
- data/app/helpers/admin/base_helper.rb +1 -1
- data/app/helpers/spree/base_helper.rb +1 -1
- data/app/mailers/order_mailer.rb +5 -5
- data/app/mailers/shipment_mailer.rb +3 -3
- data/app/mailers/test_mailer.rb +1 -1
- data/app/models/calculator.rb +7 -9
- data/app/models/calculator/flat_percent_item_total.rb +0 -5
- data/app/models/calculator/flat_rate.rb +0 -5
- data/app/models/calculator/flexi_rate.rb +0 -5
- data/app/models/calculator/per_item.rb +0 -5
- data/app/models/calculator/price_bucket.rb +0 -6
- data/app/models/calculator/sales_tax.rb +1 -6
- data/app/models/calculator/vat.rb +6 -11
- data/app/models/creditcard.rb +12 -10
- data/app/models/order.rb +1 -1
- data/app/models/payment.rb +1 -1
- data/app/models/payment_method.rb +1 -7
- data/app/views/admin/adjustments/_adjustments_table.html.erb +3 -3
- data/app/views/admin/adjustments/_form.html.erb +4 -4
- data/app/views/admin/adjustments/edit.html.erb +7 -7
- data/app/views/admin/adjustments/index.html.erb +2 -2
- data/app/views/admin/adjustments/new.html.erb +6 -6
- data/app/views/admin/configurations/index.html.erb +29 -29
- data/app/views/admin/general_settings/edit.html.erb +5 -5
- data/app/views/admin/general_settings/show.html.erb +4 -5
- data/app/views/admin/images/_form.html.erb +2 -2
- data/app/views/admin/images/edit.html.erb +8 -8
- data/app/views/admin/images/index.html.erb +11 -11
- data/app/views/admin/images/new.html.erb +1 -1
- data/app/views/admin/inventory_settings/edit.html.erb +7 -7
- data/app/views/admin/inventory_settings/show.html.erb +4 -4
- data/app/views/admin/inventory_units/adjust.html.erb +11 -11
- data/app/views/admin/mail_methods/_form.html.erb +23 -26
- data/app/views/admin/mail_methods/edit.html.erb +4 -4
- data/app/views/admin/mail_methods/index.html.erb +6 -6
- data/app/views/admin/mail_methods/new.html.erb +4 -4
- data/app/views/admin/option_types/_available.html.erb +9 -9
- data/app/views/admin/option_types/_form.html.erb +2 -2
- data/app/views/admin/option_types/_option_value_fields.html.erb +3 -3
- data/app/views/admin/option_types/_selected.html.erb +4 -4
- data/app/views/admin/option_types/available.js.erb +1 -1
- data/app/views/admin/option_types/edit.html.erb +10 -10
- data/app/views/admin/option_types/index.html.erb +7 -7
- data/app/views/admin/option_types/new.html.erb +4 -4
- data/app/views/admin/option_types/selected.html.erb +1 -1
- data/app/views/admin/orders/_add_product.html.erb +6 -6
- data/app/views/admin/orders/_form.html.erb +15 -15
- data/app/views/admin/orders/_line_item.html.erb +4 -4
- data/app/views/admin/orders/_user_form.html.erb +11 -11
- data/app/views/admin/orders/edit.html.erb +8 -8
- data/app/views/admin/orders/history.html.erb +8 -8
- data/app/views/admin/orders/index.html.erb +28 -29
- data/app/views/admin/orders/new.html.erb +5 -5
- data/app/views/admin/orders/show.html.erb +7 -7
- data/app/views/admin/orders/user.html.erb +6 -6
- data/app/views/admin/payment_methods/_form.html.erb +15 -15
- data/app/views/admin/payment_methods/edit.html.erb +5 -5
- data/app/views/admin/payment_methods/index.html.erb +9 -10
- data/app/views/admin/payment_methods/new.html.erb +4 -4
- data/app/views/admin/payments/_bill_address_form.html.erb +1 -1
- data/app/views/admin/payments/_form.html.erb +5 -5
- data/app/views/admin/payments/_list.html.erb +5 -5
- data/app/views/admin/payments/_transaction_list.html.erb +6 -6
- data/app/views/admin/payments/credit.html.erb +5 -5
- data/app/views/admin/payments/index.html.erb +8 -8
- data/app/views/admin/payments/new.html.erb +6 -6
- data/app/views/admin/payments/show.html.erb +2 -2
- data/app/views/admin/payments/source_forms/_gateway.html.erb +8 -8
- data/app/views/admin/payments/source_views/_gateway.html.erb +7 -7
- data/app/views/admin/product_groups/_preview.html.erb +2 -2
- data/app/views/admin/product_groups/_product_scope.html.erb +3 -3
- data/app/views/admin/product_groups/edit.html.erb +9 -9
- data/app/views/admin/product_groups/index.html.erb +8 -8
- data/app/views/admin/product_groups/new.html.erb +3 -3
- data/app/views/admin/product_groups/show.html.erb +1 -1
- data/app/views/admin/product_groups/update.js.erb +3 -3
- data/app/views/admin/product_properties/_product_property_fields.html.erb +3 -3
- data/app/views/admin/product_properties/index.html.erb +15 -15
- data/app/views/admin/product_scopes/create.js.erb +3 -3
- data/app/views/admin/product_scopes/destroy.js.erb +3 -3
- data/app/views/admin/products/_form.html.erb +25 -25
- data/app/views/admin/products/_option_types.html.erb +14 -14
- data/app/views/admin/products/_properties_form.erb +1 -1
- data/app/views/admin/products/edit.html.erb +3 -3
- data/app/views/admin/products/index.html.erb +12 -12
- data/app/views/admin/products/new.html.erb +14 -14
- data/app/views/admin/products/show.html.erb +1 -1
- data/app/views/admin/properties/_form.html.erb +2 -2
- data/app/views/admin/properties/edit.html.erb +3 -3
- data/app/views/admin/properties/index.html.erb +6 -6
- data/app/views/admin/properties/new.html.erb +3 -3
- data/app/views/admin/prototypes/_form.html.erb +6 -6
- data/app/views/admin/prototypes/_prototypes.html.erb +3 -4
- data/app/views/admin/prototypes/edit.html.erb +4 -4
- data/app/views/admin/prototypes/index.html.erb +6 -6
- data/app/views/admin/prototypes/new.html.erb +3 -3
- data/app/views/admin/reports/index.html.erb +3 -3
- data/app/views/admin/reports/sales_total.html.erb +7 -7
- data/app/views/admin/return_authorizations/_form.html.erb +13 -14
- data/app/views/admin/return_authorizations/edit.html.erb +10 -10
- data/app/views/admin/return_authorizations/index.html.erb +9 -9
- data/app/views/admin/return_authorizations/new.html.erb +7 -7
- data/app/views/admin/shared/_additional_field.html.erb +1 -1
- data/app/views/admin/shared/_address_form.html.erb +24 -24
- data/app/views/admin/shared/_calculator_fields.html.erb +4 -4
- data/app/views/admin/shared/_configuration_menu.html.erb +12 -12
- data/app/views/admin/shared/_destroy.js.erb +1 -1
- data/app/views/admin/shared/_edit_resource_links.html.erb +2 -2
- data/app/views/admin/shared/_group_from_products_form.html.erb +6 -6
- data/app/views/admin/shared/_head.html.erb +5 -5
- data/app/views/admin/shared/_new_adjustment_button.html.erb +2 -2
- data/app/views/admin/shared/_new_resource_links.html.erb +2 -2
- data/app/views/admin/shared/_order_tabs.html.erb +25 -25
- data/app/views/admin/shared/_product_tabs.html.erb +14 -14
- data/app/views/admin/shared/_report_criteria.html.erb +4 -4
- data/app/views/admin/shared/_show_resource_links.html.erb +3 -3
- data/app/views/admin/shared/_update_order_state.js +4 -4
- data/app/views/admin/shipments/_form.html.erb +15 -15
- data/app/views/admin/shipments/edit.html.erb +11 -11
- data/app/views/admin/shipments/index.html.erb +11 -11
- data/app/views/admin/shipments/new.html.erb +6 -6
- data/app/views/admin/shipping_categories/_form.html.erb +2 -2
- data/app/views/admin/shipping_categories/edit.html.erb +4 -4
- data/app/views/admin/shipping_categories/index.html.erb +8 -8
- data/app/views/admin/shipping_categories/new.html.erb +4 -4
- data/app/views/admin/shipping_methods/_form.html.erb +5 -5
- data/app/views/admin/shipping_methods/edit.html.erb +5 -5
- data/app/views/admin/shipping_methods/index.html.erb +9 -10
- data/app/views/admin/shipping_methods/new.html.erb +4 -4
- data/app/views/admin/states/_form.html.erb +3 -3
- data/app/views/admin/states/_state_list.html.erb +6 -8
- data/app/views/admin/states/edit.html.erb +4 -4
- data/app/views/admin/states/index.html.erb +4 -4
- data/app/views/admin/states/new.html.erb +3 -3
- data/app/views/admin/states/new.js.erb +1 -1
- data/app/views/admin/tax_categories/_form.html.erb +6 -6
- data/app/views/admin/tax_categories/edit.html.erb +4 -4
- data/app/views/admin/tax_categories/index.html.erb +8 -9
- data/app/views/admin/tax_categories/new.html.erb +4 -4
- data/app/views/admin/tax_rates/_form.html.erb +5 -5
- data/app/views/admin/tax_rates/edit.html.erb +5 -5
- data/app/views/admin/tax_rates/index.html.erb +10 -10
- data/app/views/admin/tax_rates/new.html.erb +4 -4
- data/app/views/admin/tax_settings/edit.html.erb +10 -10
- data/app/views/admin/tax_settings/show.html.erb +6 -6
- data/app/views/admin/taxonomies/_form.html.erb +1 -1
- data/app/views/admin/taxonomies/_js_head.html.erb +4 -4
- data/app/views/admin/taxonomies/_list.html.erb +4 -4
- data/app/views/admin/taxonomies/_taxon.html.erb +2 -2
- data/app/views/admin/taxonomies/edit.erb +31 -32
- data/app/views/admin/taxonomies/get_children.json.erb +7 -7
- data/app/views/admin/taxonomies/index.html.erb +4 -4
- data/app/views/admin/taxonomies/new.html.erb +5 -5
- data/app/views/admin/taxons/_form.html.erb +3 -3
- data/app/views/admin/taxons/_taxon_table.html.erb +4 -4
- data/app/views/admin/taxons/edit.html.erb +3 -3
- data/app/views/admin/taxons/remove.html.erb +1 -1
- data/app/views/admin/taxons/select.js.erb +1 -1
- data/app/views/admin/taxons/selected.html.erb +5 -5
- data/app/views/admin/trackers/_form.html.erb +10 -10
- data/app/views/admin/trackers/edit.html.erb +5 -5
- data/app/views/admin/trackers/index.html.erb +8 -8
- data/app/views/admin/trackers/new.html.erb +4 -4
- data/app/views/admin/users/_form.html.erb +6 -6
- data/app/views/admin/users/edit.html.erb +4 -4
- data/app/views/admin/users/index.html.erb +8 -8
- data/app/views/admin/users/new.html.erb +4 -4
- data/app/views/admin/users/show.html.erb +5 -5
- data/app/views/admin/variants/_form.html.erb +5 -5
- data/app/views/admin/variants/edit.html.erb +3 -3
- data/app/views/admin/variants/index.html.erb +14 -18
- data/app/views/admin/variants/new.html.erb +3 -3
- data/app/views/admin/variants/new.js.erb +1 -1
- data/app/views/admin/zones/_country_member.html.erb +1 -1
- data/app/views/admin/zones/_form.html.erb +14 -14
- data/app/views/admin/zones/_state_member.html.erb +1 -1
- data/app/views/admin/zones/edit.html.erb +5 -5
- data/app/views/admin/zones/index.html.erb +5 -5
- data/app/views/admin/zones/new.html.erb +5 -5
- data/app/views/checkout/_address.html.erb +25 -25
- data/app/views/checkout/_confirm.html.erb +1 -1
- data/app/views/checkout/_delivery.html.erb +7 -7
- data/app/views/checkout/_payment.html.erb +3 -3
- data/app/views/checkout/_summary.html.erb +2 -2
- data/app/views/checkout/edit.html.erb +3 -3
- data/app/views/checkout/payment/_gateway.html.erb +9 -9
- data/app/views/checkout/registration.html.erb +6 -6
- data/app/views/content/cvv.html.erb +6 -6
- data/app/views/home/index.html.erb +2 -2
- data/app/views/layouts/admin.html.erb +9 -11
- data/app/views/layouts/spree_application.html.erb +3 -3
- data/app/views/order_mailer/cancel_email.text.erb +2 -2
- data/app/views/orders/_form.html.erb +5 -5
- data/app/views/orders/_line_item.html.erb +3 -3
- data/app/views/orders/edit.html.erb +11 -11
- data/app/views/orders/new.html.erb +3 -3
- data/app/views/orders/show.html.erb +3 -3
- data/app/views/products/_cart_form.html.erb +8 -8
- data/app/views/products/_taxons.html.erb +1 -1
- data/app/views/products/_thumbnails.html.erb +2 -2
- data/app/views/products/index.html.erb +4 -4
- data/app/views/products/show.html.erb +1 -1
- data/app/views/shared/_filters.html.erb +2 -3
- data/app/views/shared/_google_analytics.html.erb +6 -6
- data/app/views/shared/_head.html.erb +3 -3
- data/app/views/shared/_order_details.html.erb +12 -12
- data/app/views/shared/_store_menu.html.erb +1 -1
- data/app/views/shared/_taxonomies.html.erb +1 -1
- data/app/views/shipment_mailer/shipped_email.text.erb +2 -2
- data/app/views/taxons/_taxon.html.erb +1 -1
- data/app/views/taxons/show.html.erb +4 -4
- data/app/views/test_mailer/test_email.text.erb +2 -2
- data/config/locales/en.yml +4 -2
- data/lib/environment_extension.rb +26 -0
- data/lib/generators/spree/site/site_generator.rb +8 -0
- data/lib/product_filters.rb +8 -0
- data/lib/spree/calculated_adjustments.rb +8 -8
- data/lib/spree/environment.rb +12 -0
- data/lib/spree/environment/calculators.rb +10 -0
- data/lib/spree_core.rb +1 -1
- data/lib/spree_core/railtie.rb +36 -46
- data/lib/spree_core/ssl_requirement.rb +1 -1
- data/lib/spree_core/version.rb +1 -1
- metadata +13 -18
- data/config/initializers/sprockets_precompile_patch.rb +0 -16
- data/lib/subclass_registration.rb +0 -21
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
var handle_ajax_error = function(XMLHttpRequest, textStatus, errorThrown){
|
2
2
|
$.jstree.rollback(last_rollback);
|
3
|
-
$("#ajax_error").show().html("<strong>" + server_error + "</strong><br/>" + taxonomy_tree_error);
|
3
|
+
$("#ajax_error").show().html("<strong>" + server_error + "</strong><br />" + taxonomy_tree_error);
|
4
4
|
};
|
5
5
|
|
6
6
|
//var handle_move = function(li, target, droppped, tree, rb) {
|
@@ -5,11 +5,11 @@ class Admin::TaxRatesController < Admin::ResourceController
|
|
5
5
|
create.after :create_after
|
6
6
|
|
7
7
|
private
|
8
|
-
|
8
|
+
|
9
9
|
def load_data
|
10
10
|
@available_zones = Zone.order(:name)
|
11
11
|
@available_categories = TaxCategory.order(:name)
|
12
|
-
@calculators = TaxRate.calculators
|
12
|
+
@calculators = TaxRate.calculators.sort_by(&:name)
|
13
13
|
end
|
14
14
|
|
15
15
|
def update_after
|
@@ -13,7 +13,7 @@ module Admin::BaseHelper
|
|
13
13
|
obj = object.respond_to?(:errors) ? object : instance_variable_get("@#{object}")
|
14
14
|
|
15
15
|
if obj && obj.errors[method].present?
|
16
|
-
errors = obj.errors[method].map{|err| h(err)}.join('<br/>').html_safe
|
16
|
+
errors = obj.errors[method].map{|err| h(err)}.join('<br />').html_safe
|
17
17
|
content_tag(:span, errors, :class => 'formError')
|
18
18
|
else
|
19
19
|
''
|
@@ -146,7 +146,7 @@ module Spree::BaseHelper
|
|
146
146
|
def format_price(price, options={})
|
147
147
|
options.assert_valid_keys(:show_vat_text)
|
148
148
|
options.reverse_merge! :show_vat_text => Spree::Config[:show_price_inc_vat]
|
149
|
-
formatted_price = number_to_currency
|
149
|
+
formatted_price = number_to_currency price
|
150
150
|
if options[:show_vat_text]
|
151
151
|
I18n.t(:price_with_vat_included, :price => formatted_price)
|
152
152
|
else
|
data/app/mailers/order_mailer.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
class OrderMailer < ActionMailer::Base
|
2
|
-
helper
|
2
|
+
helper 'spree/base'
|
3
3
|
|
4
4
|
def confirm_email(order, resend=false)
|
5
5
|
@order = order
|
6
|
-
subject = (resend ? "[
|
7
|
-
subject += "#{Spree::Config[:site_name]} #{t('
|
6
|
+
subject = (resend ? "[#{t(:resend).upcase}] " : "")
|
7
|
+
subject += "#{Spree::Config[:site_name]} #{t('order_mailer.confirm_email.subject')} ##{order.number}"
|
8
8
|
mail(:to => order.email,
|
9
9
|
:subject => subject)
|
10
10
|
end
|
11
11
|
|
12
12
|
def cancel_email(order, resend=false)
|
13
13
|
@order = order
|
14
|
-
subject = (resend ? "[
|
15
|
-
subject += "#{Spree::Config[:site_name]} #{t('
|
14
|
+
subject = (resend ? "[#{t(:resend).upcase}] " : "")
|
15
|
+
subject += "#{Spree::Config[:site_name]} #{t('order_mailer.cancel_email.subject')} ##{order.number}"
|
16
16
|
mail(:to => order.email,
|
17
17
|
:subject => subject)
|
18
18
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class ShipmentMailer < ActionMailer::Base
|
2
|
-
helper
|
2
|
+
helper 'spree/base'
|
3
3
|
|
4
4
|
def shipped_email(shipment, resend=false)
|
5
5
|
@shipment = shipment
|
6
|
-
subject = (resend ? "[
|
7
|
-
subject += "#{Spree::Config[:site_name]} #{t('
|
6
|
+
subject = (resend ? "[#{t(:resend).upcase}] " : "")
|
7
|
+
subject += "#{Spree::Config[:site_name]} #{t('shipment_mailer.shipped_email.subject')} ##{shipment.order.number}"
|
8
8
|
mail(:to => shipment.order.email,
|
9
9
|
:subject => subject)
|
10
10
|
end
|
data/app/mailers/test_mailer.rb
CHANGED
@@ -2,7 +2,7 @@ class TestMailer < ActionMailer::Base
|
|
2
2
|
|
3
3
|
def test_email(mail_method, user)
|
4
4
|
@mail_method = mail_method
|
5
|
-
subject = "#{Spree::Config[:site_name]} #{t('
|
5
|
+
subject = "#{Spree::Config[:site_name]} #{t('test_mailer.test_email.subject')}"
|
6
6
|
mail(:to => user.email,
|
7
7
|
:subject => subject)
|
8
8
|
end
|
data/app/models/calculator.rb
CHANGED
@@ -15,21 +15,19 @@ class Calculator < ActiveRecord::Base
|
|
15
15
|
|
16
16
|
###################################################################
|
17
17
|
|
18
|
-
@@calculators = Set.new
|
19
|
-
# Registers calculator to be used with selected kinds of operations
|
20
18
|
def self.register(*klasses)
|
21
|
-
@@calculators.add(self)
|
22
|
-
klasses.each do |klass|
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
self
|
19
|
+
# @@calculators.add(self)
|
20
|
+
# klasses.each do |klass|
|
21
|
+
# klass = klass.constantize if klass.is_a?(String)
|
22
|
+
# klass.register_calculator(self)
|
23
|
+
# end
|
24
|
+
# self
|
27
25
|
end
|
28
26
|
|
29
27
|
# Returns all calculators applicable for kind of work
|
30
28
|
# If passed nil, will return only general calculators
|
31
29
|
def self.calculators
|
32
|
-
|
30
|
+
Rails.application.config.spree.calculators.all
|
33
31
|
end
|
34
32
|
|
35
33
|
def to_s
|
@@ -5,11 +5,6 @@ class Calculator::FlatPercentItemTotal < Calculator
|
|
5
5
|
I18n.t("flat_percent")
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.register
|
9
|
-
super
|
10
|
-
ShippingMethod.register_calculator(self)
|
11
|
-
end
|
12
|
-
|
13
8
|
def compute(object)
|
14
9
|
return unless object.present? and object.line_items.present?
|
15
10
|
item_total = object.line_items.map(&:amount).sum
|
@@ -7,12 +7,6 @@ class Calculator::PriceBucket < Calculator
|
|
7
7
|
I18n.t("price_bucket")
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.register
|
11
|
-
super
|
12
|
-
#Promotion.register_calculator(self)
|
13
|
-
ShippingMethod.register_calculator(self)
|
14
|
-
end
|
15
|
-
|
16
10
|
# as object we always get line items, as calculable we have Coupon, ShippingMethod
|
17
11
|
def compute(object)
|
18
12
|
if object.is_a?(Array)
|
@@ -4,11 +4,6 @@ class Calculator::SalesTax < Calculator
|
|
4
4
|
I18n.t("sales_tax")
|
5
5
|
end
|
6
6
|
|
7
|
-
def self.register
|
8
|
-
super
|
9
|
-
TaxRate.register_calculator(self)
|
10
|
-
end
|
11
|
-
|
12
7
|
def self.calculate_tax(order, rates)
|
13
8
|
ActiveSupport::Deprecation.warn("please use Calculator::SalesTax#compute instead", caller)
|
14
9
|
|
@@ -45,4 +40,4 @@ class Calculator::SalesTax < Calculator
|
|
45
40
|
sum += line_item.total * rate.amount
|
46
41
|
}
|
47
42
|
end
|
48
|
-
end
|
43
|
+
end
|
@@ -4,18 +4,13 @@ class Calculator::Vat < Calculator
|
|
4
4
|
I18n.t("vat")
|
5
5
|
end
|
6
6
|
|
7
|
-
def self.
|
8
|
-
|
9
|
-
|
7
|
+
def self.calculate_tax_on(taxable)
|
8
|
+
# taxable may be product or variant
|
9
|
+
taxable = taxable.product if taxable.respond_to?(:product)
|
10
|
+
(taxable.price * taxable.effective_tax_rate).round(2, BigDecimal::ROUND_HALF_UP)
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
product = product_or_variant.try(:product) || product_or_variant
|
14
|
-
|
15
|
-
(product_or_variant.price * product.effective_tax_rate).round(2, BigDecimal::ROUND_HALF_UP)
|
16
|
-
end
|
17
|
-
|
18
|
-
# computes vat for line_items associated with order, and tax rate and
|
13
|
+
# computes vat for line_items associated with order, and tax rate and
|
19
14
|
# now coupon discounts are taken into account in tax calcs
|
20
15
|
# and tax is added to shipment if :shipment_inc_vat is set
|
21
16
|
# coupons and shipment are applied if this object is the rate for the default category
|
@@ -24,7 +19,7 @@ class Calculator::Vat < Calculator
|
|
24
19
|
rate = self.calculable
|
25
20
|
tax = 0
|
26
21
|
|
27
|
-
if rate.tax_category.is_default
|
22
|
+
if rate.tax_category.is_default
|
28
23
|
order.adjustments.each do | adjust |
|
29
24
|
next if adjust.originator_type == "TaxRate"
|
30
25
|
next if adjust.originator_type == "ShippingMethod" and not Spree::Config[:shipment_inc_vat]
|
data/app/models/creditcard.rb
CHANGED
@@ -89,8 +89,8 @@ class Creditcard < ActiveRecord::Base
|
|
89
89
|
payment.failure
|
90
90
|
gateway_error(response)
|
91
91
|
end
|
92
|
-
rescue ActiveMerchant::ConnectionError
|
93
|
-
gateway_error
|
92
|
+
rescue ActiveMerchant::ConnectionError => e
|
93
|
+
gateway_error e
|
94
94
|
end
|
95
95
|
|
96
96
|
def purchase(amount, payment)
|
@@ -109,8 +109,8 @@ class Creditcard < ActiveRecord::Base
|
|
109
109
|
payment.failure
|
110
110
|
gateway_error(response) unless response.success?
|
111
111
|
end
|
112
|
-
rescue ActiveMerchant::ConnectionError
|
113
|
-
gateway_error
|
112
|
+
rescue ActiveMerchant::ConnectionError => e
|
113
|
+
gateway_error e
|
114
114
|
end
|
115
115
|
|
116
116
|
def capture(payment)
|
@@ -136,8 +136,8 @@ class Creditcard < ActiveRecord::Base
|
|
136
136
|
payment.failure
|
137
137
|
gateway_error(response)
|
138
138
|
end
|
139
|
-
rescue ActiveMerchant::ConnectionError
|
140
|
-
gateway_error
|
139
|
+
rescue ActiveMerchant::ConnectionError => e
|
140
|
+
gateway_error e
|
141
141
|
end
|
142
142
|
|
143
143
|
def void(payment)
|
@@ -153,8 +153,8 @@ class Creditcard < ActiveRecord::Base
|
|
153
153
|
else
|
154
154
|
gateway_error(response)
|
155
155
|
end
|
156
|
-
rescue ActiveMerchant::ConnectionError
|
157
|
-
gateway_error
|
156
|
+
rescue ActiveMerchant::ConnectionError => e
|
157
|
+
gateway_error e
|
158
158
|
end
|
159
159
|
|
160
160
|
def credit(payment)
|
@@ -180,8 +180,8 @@ class Creditcard < ActiveRecord::Base
|
|
180
180
|
else
|
181
181
|
gateway_error(response)
|
182
182
|
end
|
183
|
-
rescue ActiveMerchant::ConnectionError
|
184
|
-
gateway_error
|
183
|
+
rescue ActiveMerchant::ConnectionError => e
|
184
|
+
gateway_error e
|
185
185
|
end
|
186
186
|
|
187
187
|
def actions
|
@@ -217,6 +217,8 @@ class Creditcard < ActiveRecord::Base
|
|
217
217
|
def gateway_error(error)
|
218
218
|
if error.is_a? ActiveMerchant::Billing::Response
|
219
219
|
text = error.params['message'] || error.params['response_reason_text'] || error.message
|
220
|
+
elsif error.is_a? ActiveMerchant::ConnectionError
|
221
|
+
text = I18n.t(:unable_to_connect_to_gateway)
|
220
222
|
else
|
221
223
|
text = error.to_s
|
222
224
|
end
|
data/app/models/order.rb
CHANGED
@@ -272,7 +272,7 @@ class Order < ActiveRecord::Base
|
|
272
272
|
rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id]) }
|
273
273
|
end
|
274
274
|
matching_rates.each do |rate|
|
275
|
-
rate.create_adjustment( "#{
|
275
|
+
rate.create_adjustment( "#{rate.calculator.description} #{rate.amount*100}%" , self, self, true)
|
276
276
|
end
|
277
277
|
end
|
278
278
|
|
data/app/models/payment.rb
CHANGED
@@ -102,7 +102,7 @@ class Payment < ActiveRecord::Base
|
|
102
102
|
return unless source.is_a?(Creditcard) && source.number && !source.has_payment_profile?
|
103
103
|
payment_method.create_profile(self)
|
104
104
|
rescue ActiveMerchant::ConnectionError => e
|
105
|
-
gateway_error
|
105
|
+
gateway_error e
|
106
106
|
end
|
107
107
|
|
108
108
|
def update_order
|
@@ -2,14 +2,8 @@ class PaymentMethod < ActiveRecord::Base
|
|
2
2
|
DISPLAY = [:both, :front_end, :back_end]
|
3
3
|
default_scope where(:deleted_at => nil)
|
4
4
|
|
5
|
-
@provider = nil
|
6
|
-
@@providers = Set.new
|
7
|
-
def self.register
|
8
|
-
@@providers.add(self)
|
9
|
-
end
|
10
|
-
|
11
5
|
def self.providers
|
12
|
-
|
6
|
+
Rails.application.config.spree.payment_methods
|
13
7
|
end
|
14
8
|
|
15
9
|
def provider_class
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<table class="index" data-hook="adjustments">
|
2
2
|
<tr data-hook="adjustmment_head">
|
3
3
|
<th><%= "#{t('spree.date')}/#{t('spree.time')}" %></th>
|
4
|
-
<th><%= t(
|
5
|
-
<th><%= t(
|
4
|
+
<th><%= t(:description) %></th>
|
5
|
+
<th><%= t(:amount) %></th>
|
6
6
|
<th></th>
|
7
7
|
</tr>
|
8
8
|
<% @order.adjustments.each do |adjustment|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<tr id="<%= dom_id(adjustment) %>" data-hook="adjustment_row">
|
13
13
|
<td><%= adjustment.created_at.to_s(:date_time24) %></td>
|
14
14
|
<td><%= adjustment.label %></td>
|
15
|
-
<td><%= number_to_currency
|
15
|
+
<td><%= number_to_currency adjustment.amount %></td>
|
16
16
|
<td class='actions'>
|
17
17
|
<%= link_to_edit adjustment, :class => 'edit' %>
|
18
18
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<%= f.field_container :amount do %>
|
2
|
-
<%= f.label :amount, t(
|
3
|
-
<%= text_field :adjustment, :amount, {:style =>
|
2
|
+
<%= f.label :amount, t(:amount) %> <span class="required">*</span><br />
|
3
|
+
<%= text_field :adjustment, :amount, {:style => 'width:80px;'} %>
|
4
4
|
<%= f.error_message_on :amount %>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<%= f.field_container :label do %>
|
8
|
-
<%= f.label :label, t(
|
9
|
-
<%= text_field :adjustment, :label, {:style =>
|
8
|
+
<%= f.label :label, t(:description) %> <span class="required">*</span><br />
|
9
|
+
<%= text_field :adjustment, :label, {:style => 'width:180px;'} %>
|
10
10
|
<%= f.error_message_on :label %>
|
11
11
|
<% end %>
|
12
12
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current =>
|
1
|
+
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current => 'Adjustments'} %>
|
2
2
|
|
3
|
-
<h2><%= t(
|
3
|
+
<h2><%= t(:adjustment) %></h2>
|
4
4
|
|
5
|
-
<%= render
|
6
|
-
<%= form_for
|
7
|
-
<%= render :partial =>
|
5
|
+
<%= render 'shared/error_messages', :target => @adjustment %>
|
6
|
+
<%= form_for @adjustment, :url => admin_order_adjustment_path(@order, @adjustment), :html => { :method => :put} do |f| %>
|
7
|
+
<%= render :partial => 'form', :locals => {:f => f} %>
|
8
8
|
|
9
9
|
<p class="form-buttons" data-hook="buttons">
|
10
|
-
<%= button t(
|
11
|
-
<%= t(
|
10
|
+
<%= button t(:continue) %>
|
11
|
+
<%= t(:or) %> <%= link_to t('actions.cancel'), admin_order_adjustments_url(@order) %>
|
12
12
|
</p>
|
13
13
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<%= render 'admin/shared/new_adjustment_button' %>
|
2
|
-
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current =>
|
2
|
+
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current => 'Adjustments'} %>
|
3
3
|
<%= render 'adjustments_table' %>
|
4
|
-
<%= button_link_to t(
|
4
|
+
<%= button_link_to t(:continue), @order.cart? ? new_admin_order_payment_url(@order) : admin_orders_url %>
|
@@ -1,14 +1,14 @@
|
|
1
|
-
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current =>
|
1
|
+
<%= render :partial => 'admin/shared/order_tabs', :locals => {:current => 'Adjustments'} %>
|
2
2
|
|
3
|
-
<h2><%= t(
|
3
|
+
<h2><%= t(:new_adjustment) %></h2>
|
4
4
|
|
5
|
-
<%= render
|
5
|
+
<%= render 'shared/error_messages', :target => @adjustment %>
|
6
6
|
|
7
7
|
<%= form_for @adjustment, :url => admin_order_adjustments_path do |f| %>
|
8
|
-
<%= render :partial =>
|
8
|
+
<%= render :partial => 'form', :locals => {:f => f} %>
|
9
9
|
|
10
10
|
<p class="form-buttons" data-hook="buttons">
|
11
|
-
<%= button t(
|
12
|
-
<%= t(
|
11
|
+
<%= button t(:continue) %>
|
12
|
+
<%= t(:or) %> <%= link_to t('actions.cancel'), admin_order_adjustments_url(@order) %>
|
13
13
|
</p>
|
14
14
|
<% end %>
|
@@ -1,64 +1,64 @@
|
|
1
|
-
<h1><%= t(
|
1
|
+
<h1><%= t(:configurations) %></h1>
|
2
2
|
|
3
3
|
<table class="index" data-hook="configuration">
|
4
4
|
<thead>
|
5
5
|
<tr>
|
6
|
-
<th><%= t(
|
7
|
-
<th><%= t(
|
6
|
+
<th><%= t(:system) %></th>
|
7
|
+
<th><%= t(:description) %></th>
|
8
8
|
</tr>
|
9
9
|
</thead>
|
10
10
|
<tbody data-hook="admin_configurations_menu">
|
11
11
|
<tr>
|
12
|
-
<td><%= link_to t(
|
13
|
-
<td><%= t(
|
12
|
+
<td><%= link_to t(:general_settings), admin_general_settings_path %></td>
|
13
|
+
<td><%= t(:general_settings_description) %></td>
|
14
14
|
</tr>
|
15
15
|
<tr>
|
16
|
-
<td><%= link_to t(
|
17
|
-
<td><%= t(
|
16
|
+
<td><%= link_to t(:mail_methods), admin_mail_methods_path %></td>
|
17
|
+
<td><%= t(:email_server_settings_description) %></td>
|
18
18
|
</tr>
|
19
19
|
<tr>
|
20
|
-
<td><%= link_to t(
|
21
|
-
<td><%= t(
|
20
|
+
<td><%= link_to t(:tax_categories), admin_tax_categories_path %></td>
|
21
|
+
<td><%= t(:tax_categories_setting_description) %></td>
|
22
22
|
</tr>
|
23
23
|
<tr>
|
24
|
-
<td><%= link_to t(
|
25
|
-
<td><%= t(
|
24
|
+
<td><%= link_to t(:zones), admin_zones_path %></td>
|
25
|
+
<td><%= t(:zone_setting_description) %></td>
|
26
26
|
</tr>
|
27
27
|
<tr>
|
28
|
-
<td><%= link_to t(
|
29
|
-
<td><%= t(
|
28
|
+
<td><%= link_to t(:states), admin_country_states_path(Spree::Config[:default_country_id]) %></td>
|
29
|
+
<td><%= t(:state_setting_description) %></td>
|
30
30
|
</tr>
|
31
31
|
<tr>
|
32
|
-
<td><%= link_to t(
|
33
|
-
<td><%= t(
|
32
|
+
<td><%= link_to t(:payment_methods), admin_payment_methods_path %></td>
|
33
|
+
<td><%= t(:payment_methods_setting_description) %></td>
|
34
34
|
</tr>
|
35
35
|
<tr>
|
36
|
-
<td><%= link_to t(
|
37
|
-
<td><%= t(
|
36
|
+
<td><%= link_to t(:taxonomies), admin_taxonomies_path %></td>
|
37
|
+
<td><%= t(:taxonomies_setting_description) %></td>
|
38
38
|
</tr>
|
39
39
|
<tr>
|
40
|
-
<td><%= link_to t(
|
41
|
-
<td><%= t(
|
40
|
+
<td><%= link_to t(:shipping_methods), admin_shipping_methods_path %></td>
|
41
|
+
<td><%= t(:shipping_methods_description) %></td>
|
42
42
|
</tr>
|
43
43
|
<tr>
|
44
|
-
<td><%= link_to t(
|
45
|
-
<td><%= t(
|
44
|
+
<td><%= link_to t(:shipping_categories), admin_shipping_categories_path %></td>
|
45
|
+
<td><%= t(:shipping_categories_description) %></td>
|
46
46
|
</tr>
|
47
47
|
<tr>
|
48
|
-
<td><%= link_to t(
|
49
|
-
<td><%= t(
|
48
|
+
<td><%= link_to t(:inventory_settings), admin_inventory_settings_path %></td>
|
49
|
+
<td><%= t(:inventory_setting_description) %></td>
|
50
50
|
</tr>
|
51
51
|
<tr>
|
52
|
-
<td><%= link_to t(
|
53
|
-
<td><%= t(
|
52
|
+
<td><%= link_to t(:tax_rates), admin_tax_rates_path %></td>
|
53
|
+
<td><%= t(:tax_rates_description) %></td>
|
54
54
|
</tr>
|
55
55
|
<tr>
|
56
|
-
<td><%= link_to t(
|
57
|
-
<td><%= t(
|
56
|
+
<td><%= link_to t(:tax_settings), admin_tax_settings_path %></td>
|
57
|
+
<td><%= t(:tax_settings_description) %></td>
|
58
58
|
</tr>
|
59
59
|
<tr>
|
60
|
-
<td><%= link_to t(
|
61
|
-
<td><%= t(
|
60
|
+
<td><%= link_to t(:analytics_trackers), admin_trackers_path %></td>
|
61
|
+
<td><%= t(:google_analytics_setting_description) %></td>
|
62
62
|
</tr>
|
63
63
|
</tbody>
|
64
64
|
</table>
|