spree_core 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/base_controller.rb +1 -2
- data/app/helpers/spree/products_helper.rb +8 -3
- data/app/mailers/spree/base_mailer.rb +5 -0
- data/app/models/spree/ability.rb +0 -3
- data/app/models/spree/adjustment.rb +2 -1
- data/app/models/spree/app_configuration.rb +2 -0
- data/app/models/spree/classification.rb +3 -0
- data/app/models/spree/country.rb +2 -1
- data/app/models/spree/image.rb +1 -1
- data/app/models/spree/line_item.rb +2 -0
- data/app/models/spree/order.rb +33 -16
- data/app/models/spree/order/checkout.rb +1 -1
- data/app/models/spree/payment.rb +14 -2
- data/app/models/spree/payment/processing.rb +3 -3
- data/app/models/spree/preferences/configuration.rb +5 -1
- data/app/models/spree/preferences/preferable.rb +5 -1
- data/app/models/spree/preferences/store.rb +14 -15
- data/app/models/spree/product.rb +4 -3
- data/app/models/spree/product/scopes.rb +7 -14
- data/app/models/spree/return_authorization.rb +3 -6
- data/app/models/spree/shipment.rb +4 -1
- data/app/models/spree/state.rb +1 -0
- data/app/models/spree/stock/availability_validator.rb +1 -1
- data/app/models/spree/stock/estimator.rb +26 -26
- data/app/models/spree/stock/quantifier.rb +1 -1
- data/app/models/spree/stock_item.rb +11 -7
- data/app/models/spree/variant.rb +4 -3
- data/config/locales/en.yml +8 -2
- data/config/routes.rb +1 -0
- data/db/default/spree/countries.rb +26 -26
- data/db/migrate/20130213191427_create_default_stock.rb +5 -2
- data/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb +15 -0
- data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +19 -0
- data/db/migrate/20130909115621_change_states_required_for_countries.rb +9 -0
- data/db/migrate/20131001013410_remove_unused_credit_card_fields.rb +12 -0
- data/lib/spree/core/controller_helpers/order.rb +1 -1
- data/lib/spree/core/controller_helpers/ssl.rb +22 -13
- data/lib/spree/core/engine.rb +2 -10
- data/lib/spree/core/permalinks.rb +1 -5
- data/lib/spree/core/preference_rescue.rb +25 -0
- data/lib/spree/core/product_filters.rb +34 -38
- data/lib/spree/core/routes.rb +48 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/money.rb +4 -0
- data/lib/spree/permitted_attributes.rb +1 -1
- data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
- metadata +15 -9
- data/app/views/spree/shared/_address.html.erb +0 -38
@@ -23,8 +23,7 @@ module Spree
|
|
23
23
|
# We should not define price scopes here, as they require something slightly different
|
24
24
|
next if name.to_s.include?("master_price")
|
25
25
|
parts = name.to_s.match(/(.*)_by_(.*)/)
|
26
|
-
|
27
|
-
self.scope(name.to_s, -> { relation.order(order_text) })
|
26
|
+
self.scope(name.to_s, -> { relation.order("#{Product.quoted_table_name}.#{parts[2]} #{parts[1] == 'ascend' ? "ASC" : "DESC"}") })
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
@@ -68,14 +67,11 @@ module Spree
|
|
68
67
|
#
|
69
68
|
# SELECT COUNT(*) ...
|
70
69
|
add_search_scope :in_taxon do |taxon|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
scope.joins(:taxons).
|
78
|
-
where(Taxon.table_name => { :id => taxon.self_and_descendants.map(&:id) })
|
70
|
+
select("spree_products.id, spree_products.*").
|
71
|
+
where(id: Classification.select('spree_products_taxons.product_id').
|
72
|
+
joins(:taxon).
|
73
|
+
where(Taxon.table_name => { :id => taxon.self_and_descendants.pluck(:id) })
|
74
|
+
)
|
79
75
|
end
|
80
76
|
|
81
77
|
# This scope selects products in all taxons AND all its descendants
|
@@ -215,10 +211,7 @@ module Spree
|
|
215
211
|
# problem shown in #1247.
|
216
212
|
def self.group_by_products_id
|
217
213
|
if (ActiveRecord::Base.connection.adapter_name == 'PostgreSQL')
|
218
|
-
|
219
|
-
if table_exists?
|
220
|
-
group(column_names.map { |col_name| "#{table_name}.#{col_name}"})
|
221
|
-
end
|
214
|
+
group(column_names.map { |col_name| "#{table_name}.#{col_name}"})
|
222
215
|
else
|
223
216
|
group("#{self.quoted_table_name}.id")
|
224
217
|
end
|
@@ -63,19 +63,16 @@ module Spree
|
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
66
|
+
|
66
67
|
def must_have_shipped_units
|
67
68
|
errors.add(:order, Spree.t(:has_no_shipped_units)) if order.nil? || !order.shipped_shipments.any?
|
68
69
|
end
|
69
70
|
|
70
71
|
def generate_number
|
71
|
-
|
72
|
-
|
73
|
-
record = true
|
74
|
-
while record
|
72
|
+
self.number ||= loop do
|
75
73
|
random = "RMA#{Array.new(9){rand(9)}.join}"
|
76
|
-
|
74
|
+
break random unless self.class.exists?(number: random)
|
77
75
|
end
|
78
|
-
self.number = random
|
79
76
|
end
|
80
77
|
|
81
78
|
def process_return
|
@@ -103,11 +103,14 @@ module Spree
|
|
103
103
|
def refresh_rates
|
104
104
|
return shipping_rates if shipped?
|
105
105
|
|
106
|
+
# StockEstimator.new assigment below will replace the current shipping_method
|
107
|
+
original_shipping_method_id = shipping_method.try(:id)
|
108
|
+
|
106
109
|
self.shipping_rates = Stock::Estimator.new(order).shipping_rates(to_package)
|
107
110
|
|
108
111
|
if shipping_method
|
109
112
|
selected_rate = shipping_rates.detect { |rate|
|
110
|
-
rate.shipping_method_id ==
|
113
|
+
rate.shipping_method_id == original_shipping_method_id
|
111
114
|
}
|
112
115
|
self.selected_shipping_rate_id = selected_rate.id if selected_rate
|
113
116
|
end
|
data/app/models/spree/state.rb
CHANGED
@@ -17,7 +17,7 @@ module Spree
|
|
17
17
|
display_name = %Q{#{variant.name}}
|
18
18
|
display_name += %Q{ (#{variant.options_text})} unless variant.options_text.blank?
|
19
19
|
|
20
|
-
line_item.errors[:quantity] << Spree.t(:
|
20
|
+
line_item.errors[:quantity] << Spree.t(:selected_quantity_not_available, :scope => :order_populator, :item => display_name.inspect)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -9,41 +9,41 @@ module Spree
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def shipping_rates(package, frontend_only = true)
|
12
|
-
shipping_rates =
|
13
|
-
shipping_methods = shipping_methods(package)
|
14
|
-
return [] unless shipping_methods
|
15
|
-
|
16
|
-
shipping_methods.each do |shipping_method|
|
17
|
-
cost = calculate_cost(shipping_method, package)
|
18
|
-
shipping_rates << shipping_method.shipping_rates.new(:cost => cost) unless cost.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
shipping_rates.sort_by! { |r| r.cost || 0 }
|
12
|
+
shipping_rates = calculate_shipping_rates(package)
|
22
13
|
|
23
14
|
unless shipping_rates.empty?
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
else
|
29
|
-
shipping_rates.first.selected = true
|
30
|
-
end
|
15
|
+
available_rates = shipping_rates.clone
|
16
|
+
available_rates.select! { |rate| rate.shipping_method.frontend? } if frontend_only
|
17
|
+
choose_default_shipping_rate(available_rates)
|
31
18
|
end
|
32
19
|
|
33
|
-
shipping_rates
|
20
|
+
sort_shipping_rates(shipping_rates)
|
34
21
|
end
|
35
22
|
|
36
23
|
private
|
37
|
-
def
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
24
|
+
def choose_default_shipping_rate(shipping_rates)
|
25
|
+
shipping_rates.min_by(&:cost).selected = true
|
26
|
+
end
|
27
|
+
|
28
|
+
def sort_shipping_rates(shipping_rates)
|
29
|
+
shipping_rates.sort_by!(&:cost)
|
30
|
+
end
|
31
|
+
|
32
|
+
def calculate_shipping_rates(package)
|
33
|
+
shipping_methods(package).map do |shipping_method|
|
34
|
+
cost = shipping_method.calculator.compute(package)
|
35
|
+
shipping_method.shipping_rates.new(cost: cost) if cost
|
36
|
+
end.compact
|
43
37
|
end
|
44
38
|
|
45
|
-
def
|
46
|
-
|
39
|
+
def shipping_methods(package)
|
40
|
+
package.shipping_methods.select do |ship_method|
|
41
|
+
calculator = ship_method.calculator
|
42
|
+
calculator.available?(package) &&
|
43
|
+
ship_method.include?(order.ship_address) &&
|
44
|
+
(calculator.preferences[:currency].nil? ||
|
45
|
+
calculator.preferences[:currency] == currency)
|
46
|
+
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -7,7 +7,7 @@ module Spree
|
|
7
7
|
has_many :stock_movements
|
8
8
|
|
9
9
|
validates_presence_of :stock_location, :variant
|
10
|
-
validates_uniqueness_of :variant_id, scope: :stock_location_id
|
10
|
+
validates_uniqueness_of :variant_id, scope: [:stock_location_id, :deleted_at]
|
11
11
|
|
12
12
|
delegate :weight, to: :variant
|
13
13
|
|
@@ -22,7 +22,7 @@ module Spree
|
|
22
22
|
def adjust_count_on_hand(value)
|
23
23
|
self.with_lock do
|
24
24
|
self.count_on_hand = self.count_on_hand + value
|
25
|
-
process_backorders
|
25
|
+
process_backorders(count_on_hand - count_on_hand_was)
|
26
26
|
|
27
27
|
self.save!
|
28
28
|
end
|
@@ -30,7 +30,7 @@ module Spree
|
|
30
30
|
|
31
31
|
def set_count_on_hand(value)
|
32
32
|
self.count_on_hand = value
|
33
|
-
process_backorders
|
33
|
+
process_backorders(count_on_hand - count_on_hand_was)
|
34
34
|
|
35
35
|
self.save!
|
36
36
|
end
|
@@ -49,10 +49,14 @@ module Spree
|
|
49
49
|
write_attribute(:count_on_hand, value)
|
50
50
|
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
# Process backorders based on amount of stock received
|
53
|
+
# If stock was -20 and is now -15 (increase of 5 units), then we should process 5 inventory orders.
|
54
|
+
# If stock was -20 but then was -25 (decrease of 5 units), do nothing.
|
55
|
+
def process_backorders(number)
|
56
|
+
if number > 0
|
57
|
+
backordered_inventory_units.first(number).each do |unit|
|
58
|
+
unit.fill_backorder
|
59
|
+
end
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end
|
data/app/models/spree/variant.rb
CHANGED
@@ -15,7 +15,7 @@ module Spree
|
|
15
15
|
has_many :stock_locations, through: :stock_items
|
16
16
|
has_many :stock_movements
|
17
17
|
|
18
|
-
has_and_belongs_to_many :option_values, join_table: :spree_option_values_variants
|
18
|
+
has_and_belongs_to_many :option_values, join_table: :spree_option_values_variants, class_name: "Spree::OptionValue"
|
19
19
|
has_many :images, -> { order(:position) }, as: :viewable, dependent: :destroy, class_name: "Spree::Image"
|
20
20
|
|
21
21
|
has_one :default_price,
|
@@ -23,7 +23,7 @@ module Spree
|
|
23
23
|
class_name: 'Spree::Price',
|
24
24
|
dependent: :destroy
|
25
25
|
|
26
|
-
delegate_belongs_to :default_price, :display_price, :display_amount, :price, :price=, :currency
|
26
|
+
delegate_belongs_to :default_price, :display_price, :display_amount, :price, :price=, :currency
|
27
27
|
|
28
28
|
has_many :prices,
|
29
29
|
class_name: 'Spree::Price',
|
@@ -31,7 +31,8 @@ module Spree
|
|
31
31
|
|
32
32
|
validate :check_price
|
33
33
|
validates :price, numericality: { greater_than_or_equal_to: 0 }, presence: true, if: proc { Spree::Config[:require_master_price] }
|
34
|
-
|
34
|
+
|
35
|
+
validates :cost_price, numericality: { greater_than_or_equal_to: 0, allow_nil: true }
|
35
36
|
|
36
37
|
before_validation :set_cost_currency
|
37
38
|
after_save :save_default_price
|
data/config/locales/en.yml
CHANGED
@@ -214,6 +214,10 @@ en:
|
|
214
214
|
other: Zones
|
215
215
|
errors:
|
216
216
|
models:
|
217
|
+
spree/classification:
|
218
|
+
attributes:
|
219
|
+
taxon_id:
|
220
|
+
already_linked: "is already linked to this product"
|
217
221
|
spree/credit_card:
|
218
222
|
attributes:
|
219
223
|
base:
|
@@ -395,6 +399,7 @@ en:
|
|
395
399
|
capture: Capture
|
396
400
|
card_code: Card Code
|
397
401
|
card_number: Card Number
|
402
|
+
card_type: Brand
|
398
403
|
card_type_is: Card type is
|
399
404
|
cart: Cart
|
400
405
|
categories: Categories
|
@@ -639,7 +644,6 @@ en:
|
|
639
644
|
login_name: Login
|
640
645
|
logout: Logout
|
641
646
|
look_for_similar_items: Look for similar items
|
642
|
-
maestro_or_solo_cards: Maestro/Solo cards
|
643
647
|
mail_method_settings: Mail Method Settings
|
644
648
|
mail_methods: Mail Methods
|
645
649
|
make_refund: Make refund
|
@@ -751,6 +755,7 @@ en:
|
|
751
755
|
order_number: Order
|
752
756
|
order_populator:
|
753
757
|
out_of_stock: ! '%{item} is out of stock.'
|
758
|
+
selected_quantity_not_available: ! 'Selected quantity of %{item} is not available.'
|
754
759
|
please_enter_reasonable_quantity: Please enter a reasonable quantity.
|
755
760
|
order_processed_successfully: Your order has been processed successfully
|
756
761
|
order_state:
|
@@ -989,8 +994,9 @@ en:
|
|
989
994
|
special_instructions: Special Instructions
|
990
995
|
split: Split
|
991
996
|
spree_gateway_error_flash_for_checkout: There was a problem with your payment information. Please check your information and try again.
|
997
|
+
ssl:
|
998
|
+
change_protocol: "Please switch to using HTTP (rather than HTTPS) and retry this request."
|
992
999
|
start: Start
|
993
|
-
start_date: Valid from
|
994
1000
|
state: State
|
995
1001
|
state_based: State Based
|
996
1002
|
states: States
|
data/config/routes.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Spree::Core::Engine.draw_routes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Spree::Country.create!([
|
2
2
|
{ name: "Chad", iso3: "TCD", iso: "TD", iso_name: "CHAD", numcode: "148" },
|
3
3
|
{ name: "Faroe Islands", iso3: "FRO", iso: "FO", iso_name: "FAROE ISLANDS", numcode: "234" },
|
4
|
-
{ name: "India", iso3: "IND", iso: "IN", iso_name: "INDIA", numcode: "356" },
|
4
|
+
{ name: "India", iso3: "IND", iso: "IN", iso_name: "INDIA", numcode: "356", states_required: true },
|
5
5
|
{ name: "Nicaragua", iso3: "NIC", iso: "NI", iso_name: "NICARAGUA", numcode: "558" },
|
6
6
|
{ name: "Saint Lucia", iso3: "LCA", iso: "LC", iso_name: "SAINT LUCIA", numcode: "662" },
|
7
7
|
{ name: "Fiji", iso3: "FJI", iso: "FJ", iso_name: "FIJI", numcode: "242" },
|
@@ -9,14 +9,14 @@ Spree::Country.create!([
|
|
9
9
|
{ name: "Niger", iso3: "NER", iso: "NE", iso_name: "NIGER", numcode: "562" },
|
10
10
|
{ name: "Saint Pierre and Miquelon", iso3: "SPM", iso: "PM", iso_name: "SAINT PIERRE AND MIQUELON", numcode: "666" },
|
11
11
|
{ name: "Finland", iso3: "FIN", iso: "FI", iso_name: "FINLAND", numcode: "246" },
|
12
|
-
{ name: "Nigeria", iso3: "NGA", iso: "NG", iso_name: "NIGERIA", numcode: "566" },
|
12
|
+
{ name: "Nigeria", iso3: "NGA", iso: "NG", iso_name: "NIGERIA", numcode: "566", states_required: true },
|
13
13
|
{ name: "Saint Vincent and the Grenadines", iso3: "VCT", iso: "VC", iso_name: "SAINT VINCENT AND THE GRENADINES", numcode: "670" },
|
14
14
|
{ name: "France", iso3: "FRA", iso: "FR", iso_name: "FRANCE", numcode: "250" },
|
15
15
|
{ name: "Iran, Islamic Republic of", iso3: "IRN", iso: "IR", iso_name: "IRAN, ISLAMIC REPUBLIC OF", numcode: "364" },
|
16
16
|
{ name: "Niue", iso3: "NIU", iso: "NU", iso_name: "NIUE", numcode: "570" },
|
17
17
|
{ name: "Samoa", iso3: "WSM", iso: "WS", iso_name: "SAMOA", numcode: "882" },
|
18
18
|
{ name: "French Guiana", iso3: "GUF", iso: "GF", iso_name: "FRENCH GUIANA", numcode: "254" },
|
19
|
-
{ name: "Iraq", iso3: "IRQ", iso: "IQ", iso_name: "IRAQ", numcode: "368" },
|
19
|
+
{ name: "Iraq", iso3: "IRQ", iso: "IQ", iso_name: "IRAQ", numcode: "368", states_required: true },
|
20
20
|
{ name: "San Marino", iso3: "SMR", iso: "SM", iso_name: "SAN MARINO", numcode: "674" },
|
21
21
|
{ name: "Ireland", iso3: "IRL", iso: "IE", iso_name: "IRELAND", numcode: "372" },
|
22
22
|
{ name: "Sao Tome and Principe", iso3: "STP", iso: "ST", iso_name: "SAO TOME AND PRINCIPE", numcode: "678" },
|
@@ -27,7 +27,7 @@ Spree::Country.create!([
|
|
27
27
|
{ name: "Jamaica", iso3: "JAM", iso: "JM", iso_name: "JAMAICA", numcode: "388" },
|
28
28
|
{ name: "Japan", iso3: "JPN", iso: "JP", iso_name: "JAPAN", numcode: "392" },
|
29
29
|
{ name: "Jordan", iso3: "JOR", iso: "JO", iso_name: "JORDAN", numcode: "400" },
|
30
|
-
{ name: "Belgium", iso3: "BEL", iso: "BE", iso_name: "BELGIUM", numcode: "56" },
|
30
|
+
{ name: "Belgium", iso3: "BEL", iso: "BE", iso_name: "BELGIUM", numcode: "56", states_required: true },
|
31
31
|
{ name: "Belize", iso3: "BLZ", iso: "BZ", iso_name: "BELIZE", numcode: "84" },
|
32
32
|
{ name: "Kazakhstan", iso3: "KAZ", iso: "KZ", iso_name: "KAZAKHSTAN", numcode: "398" },
|
33
33
|
{ name: "Uganda", iso3: "UGA", iso: "UG", iso_name: "UGANDA", numcode: "800" },
|
@@ -36,19 +36,19 @@ Spree::Country.create!([
|
|
36
36
|
{ name: "Ukraine", iso3: "UKR", iso: "UA", iso_name: "UKRAINE", numcode: "804" },
|
37
37
|
{ name: "Bermuda", iso3: "BMU", iso: "BM", iso_name: "BERMUDA", numcode: "60" },
|
38
38
|
{ name: "Kiribati", iso3: "KIR", iso: "KI", iso_name: "KIRIBATI", numcode: "296" },
|
39
|
-
{ name: "Mexico", iso3: "MEX", iso: "MX", iso_name: "MEXICO", numcode: "484" },
|
40
|
-
{ name: "United Arab Emirates", iso3: "ARE", iso: "AE", iso_name: "UNITED ARAB EMIRATES", numcode: "784" },
|
39
|
+
{ name: "Mexico", iso3: "MEX", iso: "MX", iso_name: "MEXICO", numcode: "484", states_required: true },
|
40
|
+
{ name: "United Arab Emirates", iso3: "ARE", iso: "AE", iso_name: "UNITED ARAB EMIRATES", numcode: "784", states_required: true },
|
41
41
|
{ name: "Bhutan", iso3: "BTN", iso: "BT", iso_name: "BHUTAN", numcode: "64" },
|
42
42
|
{ name: "Cuba", iso3: "CUB", iso: "CU", iso_name: "CUBA", numcode: "192" },
|
43
43
|
{ name: "North Korea", iso3: "PRK", iso: "KP", iso_name: "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF", numcode: "408" },
|
44
|
-
{ name: "Micronesia, Federated States of", iso3: "FSM", iso: "FM", iso_name: "MICRONESIA, FEDERATED STATES OF", numcode: "583" },
|
44
|
+
{ name: "Micronesia, Federated States of", iso3: "FSM", iso: "FM", iso_name: "MICRONESIA, FEDERATED STATES OF", numcode: "583", states_required: true },
|
45
45
|
{ name: "United Kingdom", iso3: "GBR", iso: "GB", iso_name: "UNITED KINGDOM", numcode: "826" },
|
46
46
|
{ name: "Bolivia", iso3: "BOL", iso: "BO", iso_name: "BOLIVIA", numcode: "68" },
|
47
47
|
{ name: "Cyprus", iso3: "CYP", iso: "CY", iso_name: "CYPRUS", numcode: "196" },
|
48
48
|
{ name: "South Korea", iso3: "KOR", iso: "KR", iso_name: "KOREA, REPUBLIC OF", numcode: "410" },
|
49
49
|
{ name: "Moldova, Republic of", iso3: "MDA", iso: "MD", iso_name: "MOLDOVA, REPUBLIC OF", numcode: "498" },
|
50
|
-
{ name: "United States", iso3: "USA", iso: "US", iso_name: "UNITED STATES", numcode: "840" },
|
51
|
-
{ name: "Bosnia and Herzegovina", iso3: "BIH", iso: "BA", iso_name: "BOSNIA AND HERZEGOVINA", numcode: "70" },
|
50
|
+
{ name: "United States", iso3: "USA", iso: "US", iso_name: "UNITED STATES", numcode: "840", states_required: true },
|
51
|
+
{ name: "Bosnia and Herzegovina", iso3: "BIH", iso: "BA", iso_name: "BOSNIA AND HERZEGOVINA", numcode: "70", states_required: true },
|
52
52
|
{ name: "Czech Republic", iso3: "CZE", iso: "CZ", iso_name: "CZECH REPUBLIC", numcode: "203" },
|
53
53
|
{ name: "Kuwait", iso3: "KWT", iso: "KW", iso_name: "KUWAIT", numcode: "414" },
|
54
54
|
{ name: "Monaco", iso3: "MCO", iso: "MC", iso_name: "MONACO", numcode: "492" },
|
@@ -59,7 +59,7 @@ Spree::Country.create!([
|
|
59
59
|
{ name: "Kyrgyzstan", iso3: "KGZ", iso: "KG", iso_name: "KYRGYZSTAN", numcode: "417" },
|
60
60
|
{ name: "Mongolia", iso3: "MNG", iso: "MN", iso_name: "MONGOLIA", numcode: "496" },
|
61
61
|
{ name: "Philippines", iso3: "PHL", iso: "PH", iso_name: "PHILIPPINES", numcode: "608" },
|
62
|
-
{ name: "Brazil", iso3: "BRA", iso: "BR", iso_name: "BRAZIL", numcode: "76" },
|
62
|
+
{ name: "Brazil", iso3: "BRA", iso: "BR", iso_name: "BRAZIL", numcode: "76", states_required: true },
|
63
63
|
{ name: "Djibouti", iso3: "DJI", iso: "DJ", iso_name: "DJIBOUTI", numcode: "262" },
|
64
64
|
{ name: "Guam", iso3: "GUM", iso: "GU", iso_name: "GUAM", numcode: "316" },
|
65
65
|
{ name: "Lao People's Democratic Republic", iso3: "LAO", iso: "LA", iso_name: "LAO PEOPLE'S DEMOCRATIC REPUBLIC", numcode: "418" },
|
@@ -75,8 +75,8 @@ Spree::Country.create!([
|
|
75
75
|
{ name: "Dominican Republic", iso3: "DOM", iso: "DO", iso_name: "DOMINICAN REPUBLIC", numcode: "214" },
|
76
76
|
{ name: "Mozambique", iso3: "MOZ", iso: "MZ", iso_name: "MOZAMBIQUE", numcode: "508" },
|
77
77
|
{ name: "Portugal", iso3: "PRT", iso: "PT", iso_name: "PORTUGAL", numcode: "620" },
|
78
|
-
{ name: "Sudan", iso3: "SDN", iso: "SD", iso_name: "SUDAN", numcode: "736" },
|
79
|
-
{ name: "Venezuela", iso3: "VEN", iso: "VE", iso_name: "VENEZUELA", numcode: "862" },
|
78
|
+
{ name: "Sudan", iso3: "SDN", iso: "SD", iso_name: "SUDAN", numcode: "736", states_required: true },
|
79
|
+
{ name: "Venezuela", iso3: "VEN", iso: "VE", iso_name: "VENEZUELA", numcode: "862", states_required: true },
|
80
80
|
{ name: "Ecuador", iso3: "ECU", iso: "EC", iso_name: "ECUADOR", numcode: "218" },
|
81
81
|
{ name: "Guinea", iso3: "GIN", iso: "GN", iso_name: "GUINEA", numcode: "324" },
|
82
82
|
{ name: "Myanmar", iso3: "MMR", iso: "MM", iso_name: "MYANMAR", numcode: "104" },
|
@@ -95,11 +95,11 @@ Spree::Country.create!([
|
|
95
95
|
{ name: "Romania", iso3: "ROM", iso: "RO", iso_name: "ROMANIA", numcode: "642" },
|
96
96
|
{ name: "Swaziland", iso3: "SWZ", iso: "SZ", iso_name: "SWAZILAND", numcode: "748" },
|
97
97
|
{ name: "Holy See (Vatican City State)", iso3: "VAT", iso: "VA", iso_name: "HOLY SEE (VATICAN CITY STATE)", numcode: "336" },
|
98
|
-
{ name: "Russian Federation", iso3: "RUS", iso: "RU", iso_name: "RUSSIAN FEDERATION", numcode: "643" },
|
98
|
+
{ name: "Russian Federation", iso3: "RUS", iso: "RU", iso_name: "RUSSIAN FEDERATION", numcode: "643", states_required: true },
|
99
99
|
{ name: "Sweden", iso3: "SWE", iso: "SE", iso_name: "SWEDEN", numcode: "752" },
|
100
100
|
{ name: "Honduras", iso3: "HND", iso: "HN", iso_name: "HONDURAS", numcode: "340" },
|
101
101
|
{ name: "Rwanda", iso3: "RWA", iso: "RW", iso_name: "RWANDA", numcode: "646" },
|
102
|
-
{ name: "Switzerland", iso3: "CHE", iso: "CH", iso_name: "SWITZERLAND", numcode: "756" },
|
102
|
+
{ name: "Switzerland", iso3: "CHE", iso: "CH", iso_name: "SWITZERLAND", numcode: "756", states_required: true },
|
103
103
|
{ name: "Hong Kong", iso3: "HKG", iso: "HK", iso_name: "HONG KONG", numcode: "344" },
|
104
104
|
{ name: "Syrian Arab Republic", iso3: "SYR", iso: "SY", iso_name: "SYRIAN ARAB REPUBLIC", numcode: "760" },
|
105
105
|
{ name: "Taiwan", iso3: "TWN", iso: "TW", iso_name: "TAIWAN, PROVINCE OF CHINA", numcode: "158" },
|
@@ -107,9 +107,9 @@ Spree::Country.create!([
|
|
107
107
|
{ name: "Tanzania, United Republic of", iso3: "TZA", iso: "TZ", iso_name: "TANZANIA, UNITED REPUBLIC OF", numcode: "834" },
|
108
108
|
{ name: "Armenia", iso3: "ARM", iso: "AM", iso_name: "ARMENIA", numcode: "51" },
|
109
109
|
{ name: "Aruba", iso3: "ABW", iso: "AW", iso_name: "ARUBA", numcode: "533" },
|
110
|
-
{ name: "Australia", iso3: "AUS", iso: "AU", iso_name: "AUSTRALIA", numcode: "36" },
|
110
|
+
{ name: "Australia", iso3: "AUS", iso: "AU", iso_name: "AUSTRALIA", numcode: "36", states_required: true },
|
111
111
|
{ name: "Thailand", iso3: "THA", iso: "TH", iso_name: "THAILAND", numcode: "764" },
|
112
|
-
{ name: "Austria", iso3: "AUT", iso: "AT", iso_name: "AUSTRIA", numcode: "40" },
|
112
|
+
{ name: "Austria", iso3: "AUT", iso: "AT", iso_name: "AUSTRIA", numcode: "40", states_required: true },
|
113
113
|
{ name: "Madagascar", iso3: "MDG", iso: "MG", iso_name: "MADAGASCAR", numcode: "450" },
|
114
114
|
{ name: "Togo", iso3: "TGO", iso: "TG", iso_name: "TOGO", numcode: "768" },
|
115
115
|
{ name: "Azerbaijan", iso3: "AZE", iso: "AZ", iso_name: "AZERBAIJAN", numcode: "31" },
|
@@ -118,14 +118,14 @@ Spree::Country.create!([
|
|
118
118
|
{ name: "Tokelau", iso3: "TKL", iso: "TK", iso_name: "TOKELAU", numcode: "772" },
|
119
119
|
{ name: "Bahamas", iso3: "BHS", iso: "BS", iso_name: "BAHAMAS", numcode: "44" },
|
120
120
|
{ name: "China", iso3: "CHN", iso: "CN", iso_name: "CHINA", numcode: "156" },
|
121
|
-
{ name: "Malaysia", iso3: "MYS", iso: "MY", iso_name: "MALAYSIA", numcode: "458" },
|
121
|
+
{ name: "Malaysia", iso3: "MYS", iso: "MY", iso_name: "MALAYSIA", numcode: "458", states_required: true },
|
122
122
|
{ name: "Tonga", iso3: "TON", iso: "TO", iso_name: "TONGA", numcode: "776" },
|
123
123
|
{ name: "Bahrain", iso3: "BHR", iso: "BH", iso_name: "BAHRAIN", numcode: "48" },
|
124
124
|
{ name: "Colombia", iso3: "COL", iso: "CO", iso_name: "COLOMBIA", numcode: "170" },
|
125
125
|
{ name: "Maldives", iso3: "MDV", iso: "MV", iso_name: "MALDIVES", numcode: "462" },
|
126
126
|
{ name: "Trinidad and Tobago", iso3: "TTO", iso: "TT", iso_name: "TRINIDAD AND TOBAGO", numcode: "780" },
|
127
127
|
{ name: "Bangladesh", iso3: "BGD", iso: "BD", iso_name: "BANGLADESH", numcode: "50" },
|
128
|
-
{ name: "Comoros", iso3: "COM", iso: "KM", iso_name: "COMOROS", numcode: "174" },
|
128
|
+
{ name: "Comoros", iso3: "COM", iso: "KM", iso_name: "COMOROS", numcode: "174", states_required: true },
|
129
129
|
{ name: "French Polynesia", iso3: "PYF", iso: "PF", iso_name: "FRENCH POLYNESIA", numcode: "258" },
|
130
130
|
{ name: "Mali", iso3: "MLI", iso: "ML", iso_name: "MALI", numcode: "466" },
|
131
131
|
{ name: "Norfolk Island", iso3: "NFK", iso: "NF", iso_name: "NORFOLK ISLAND", numcode: "574" },
|
@@ -149,11 +149,11 @@ Spree::Country.create!([
|
|
149
149
|
{ name: "Turks and Caicos Islands", iso3: "TCA", iso: "TC", iso_name: "TURKS AND CAICOS ISLANDS", numcode: "796" },
|
150
150
|
{ name: "Georgia", iso3: "GEO", iso: "GE", iso_name: "GEORGIA", numcode: "268" },
|
151
151
|
{ name: "Mauritania", iso3: "MRT", iso: "MR", iso_name: "MAURITANIA", numcode: "478" },
|
152
|
-
{ name: "Pakistan", iso3: "PAK", iso: "PK", iso_name: "PAKISTAN", numcode: "586" },
|
152
|
+
{ name: "Pakistan", iso3: "PAK", iso: "PK", iso_name: "PAKISTAN", numcode: "586", states_required: true },
|
153
153
|
{ name: "Sierra Leone", iso3: "SLE", iso: "SL", iso_name: "SIERRA LEONE", numcode: "694" },
|
154
154
|
{ name: "Tuvalu", iso3: "TUV", iso: "TV", iso_name: "TUVALU", numcode: "798" },
|
155
155
|
{ name: "Costa Rica", iso3: "CRI", iso: "CR", iso_name: "COSTA RICA", numcode: "188" },
|
156
|
-
{ name: "Germany", iso3: "DEU", iso: "DE", iso_name: "GERMANY", numcode: "276" },
|
156
|
+
{ name: "Germany", iso3: "DEU", iso: "DE", iso_name: "GERMANY", numcode: "276", states_required: true },
|
157
157
|
{ name: "Mauritius", iso3: "MUS", iso: "MU", iso_name: "MAURITIUS", numcode: "480" },
|
158
158
|
{ name: "Palau", iso3: "PLW", iso: "PW", iso_name: "PALAU", numcode: "585" },
|
159
159
|
{ name: "Cote D'Ivoire", iso3: "CIV", iso: "CI", iso_name: "COTE D'IVOIRE", numcode: "384" },
|
@@ -170,7 +170,7 @@ Spree::Country.create!([
|
|
170
170
|
{ name: "Peru", iso3: "PER", iso: "PE", iso_name: "PERU", numcode: "604" },
|
171
171
|
{ name: "Solomon Islands", iso3: "SLB", iso: "SB", iso_name: "SOLOMON ISLANDS", numcode: "90" },
|
172
172
|
{ name: "Greenland", iso3: "GRL", iso: "GL", iso_name: "GREENLAND", numcode: "304" },
|
173
|
-
{ name: "Somalia", iso3: "SOM", iso: "SO", iso_name: "SOMALIA", numcode: "706" },
|
173
|
+
{ name: "Somalia", iso3: "SOM", iso: "SO", iso_name: "SOMALIA", numcode: "706", states_required: true },
|
174
174
|
{ name: "Grenada", iso3: "GRD", iso: "GD", iso_name: "GRENADA", numcode: "308" },
|
175
175
|
{ name: "South Africa", iso3: "ZAF", iso: "ZA", iso_name: "SOUTH AFRICA", numcode: "710" },
|
176
176
|
{ name: "Spain", iso3: "ESP", iso: "ES", iso_name: "SPAIN", numcode: "724" },
|
@@ -198,11 +198,11 @@ Spree::Country.create!([
|
|
198
198
|
{ name: "Antigua and Barbuda", iso3: "ATG", iso: "AG", iso_name: "ANTIGUA AND BARBUDA", numcode: "28" },
|
199
199
|
{ name: "Cameroon", iso3: "CMR", iso: "CM", iso_name: "CAMEROON", numcode: "120" },
|
200
200
|
{ name: "Liechtenstein", iso3: "LIE", iso: "LI", iso_name: "LIECHTENSTEIN", numcode: "438" },
|
201
|
-
{ name: "Nepal", iso3: "NPL", iso: "NP", iso_name: "NEPAL", numcode: "524" },
|
201
|
+
{ name: "Nepal", iso3: "NPL", iso: "NP", iso_name: "NEPAL", numcode: "524", states_required: true },
|
202
202
|
{ name: "Wallis and Futuna", iso3: "WLF", iso: "WF", iso_name: "WALLIS AND FUTUNA", numcode: "876" },
|
203
203
|
{ name: "Western Sahara", iso3: "ESH", iso: "EH", iso_name: "WESTERN SAHARA", numcode: "732" },
|
204
|
-
{ name: "Argentina", iso3: "ARG", iso: "AR", iso_name: "ARGENTINA", numcode: "32" },
|
205
|
-
{ name: "Canada", iso3: "CAN", iso: "CA", iso_name: "CANADA", numcode: "124" },
|
204
|
+
{ name: "Argentina", iso3: "ARG", iso: "AR", iso_name: "ARGENTINA", numcode: "32", states_required: true },
|
205
|
+
{ name: "Canada", iso3: "CAN", iso: "CA", iso_name: "CANADA", numcode: "124", states_required: true },
|
206
206
|
{ name: "Eritrea", iso3: "ERI", iso: "ER", iso_name: "ERITREA", numcode: "232" },
|
207
207
|
{ name: "Lithuania", iso3: "LTU", iso: "LT", iso_name: "LITHUANIA", numcode: "440" },
|
208
208
|
{ name: "Netherlands", iso3: "NLD", iso: "NL", iso_name: "NETHERLANDS", numcode: "528" },
|
@@ -214,7 +214,7 @@ Spree::Country.create!([
|
|
214
214
|
{ name: "Saint Helena", iso3: "SHN", iso: "SH", iso_name: "SAINT HELENA", numcode: "654" },
|
215
215
|
{ name: "Zambia", iso3: "ZMB", iso: "ZM", iso_name: "ZAMBIA", numcode: "894" },
|
216
216
|
{ name: "Cayman Islands", iso3: "CYM", iso: "KY", iso_name: "CAYMAN ISLANDS", numcode: "136" },
|
217
|
-
{ name: "Ethiopia", iso3: "ETH", iso: "ET", iso_name: "ETHIOPIA", numcode: "231" },
|
217
|
+
{ name: "Ethiopia", iso3: "ETH", iso: "ET", iso_name: "ETHIOPIA", numcode: "231", states_required: true },
|
218
218
|
{ name: "Hungary", iso3: "HUN", iso: "HU", iso_name: "HUNGARY", numcode: "348" },
|
219
219
|
{ name: "Macao", iso3: "MAC", iso: "MO", iso_name: "MACAO", numcode: "446" },
|
220
220
|
{ name: "New Caledonia", iso3: "NCL", iso: "NC", iso_name: "NEW CALEDONIA", numcode: "540" },
|
@@ -224,7 +224,7 @@ Spree::Country.create!([
|
|
224
224
|
{ name: "Iceland", iso3: "ISL", iso: "IS", iso_name: "ICELAND", numcode: "352" },
|
225
225
|
{ name: "Macedonia", iso3: "MKD", iso: "MK", iso_name: "MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF", numcode: "807" },
|
226
226
|
{ name: "New Zealand", iso3: "NZL", iso: "NZ", iso_name: "NEW ZEALAND", numcode: "554" },
|
227
|
-
{ name: "Saint Kitts and Nevis", iso3: "KNA", iso: "KN", iso_name: "SAINT KITTS AND NEVIS", numcode: "659" },
|
227
|
+
{ name: "Saint Kitts and Nevis", iso3: "KNA", iso: "KN", iso_name: "SAINT KITTS AND NEVIS", numcode: "659", states_required: true },
|
228
228
|
{ name: "Serbia", iso3: "SRB", iso: "RS", "iso_name" => "SERBIA", numcode: "999" }
|
229
229
|
])
|
230
230
|
Spree::Config[:default_country_id] = Spree::Country.find_by(name: "United States").id
|