spree_core 4.1.13 → 4.2.0.rc4
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/spree/base_controller.rb +1 -2
- data/app/finders/spree/addresses/find.rb +1 -12
- data/app/finders/spree/base_finder.rb +14 -0
- data/app/finders/spree/countries/find.rb +11 -3
- data/app/finders/spree/credit_cards/find.rb +2 -2
- data/app/finders/spree/orders/find_current.rb +1 -1
- data/app/helpers/spree/base_helper.rb +61 -20
- data/app/helpers/spree/mail_helper.rb +29 -0
- data/app/helpers/spree/products_helper.rb +2 -1
- data/app/mailers/spree/base_mailer.rb +19 -5
- data/app/mailers/spree/order_mailer.rb +13 -4
- data/app/mailers/spree/reimbursement_mailer.rb +4 -2
- data/app/mailers/spree/shipment_mailer.rb +4 -2
- data/app/models/concerns/spree/default_price.rb +3 -6
- data/app/models/concerns/spree/user_methods.rb +11 -5
- data/app/models/concerns/spree/user_payment_source.rb +1 -1
- data/app/models/spree/ability.rb +45 -34
- data/app/models/spree/address.rb +17 -1
- data/app/models/spree/adjustment.rb +1 -0
- data/app/models/spree/app_configuration.rb +4 -0
- data/app/models/spree/app_dependencies.rb +4 -2
- data/app/models/spree/base.rb +5 -0
- data/app/models/spree/credit_card.rb +5 -0
- data/app/models/spree/fulfilment_changer.rb +58 -16
- data/app/models/spree/inventory_unit.rb +2 -7
- data/app/models/spree/line_item.rb +8 -7
- data/app/models/spree/log_entry.rb +1 -1
- data/app/models/spree/option_type.rb +7 -1
- data/app/models/spree/order.rb +27 -5
- data/app/models/spree/order/payments.rb +10 -2
- data/app/models/spree/payment.rb +18 -4
- data/app/models/spree/payment/processing.rb +2 -2
- data/app/models/spree/payment_method.rb +3 -3
- data/app/models/spree/preferences/store.rb +1 -1
- data/app/models/spree/price.rb +25 -6
- data/app/models/spree/product.rb +29 -9
- data/app/models/spree/promotion.rb +10 -15
- data/app/models/spree/promotion/rules/product.rb +2 -1
- data/app/models/spree/promotion/rules/user.rb +2 -1
- data/app/models/spree/promotion_handler/coupon.rb +1 -1
- data/app/models/spree/promotion_handler/promotion_duplicator.rb +9 -3
- data/app/models/spree/refund.rb +2 -2
- data/app/models/spree/reimbursement.rb +2 -0
- data/app/models/spree/return_item/eligibility_validator/default.rb +0 -2
- data/app/models/spree/return_item/eligibility_validator/{r_m_a_required.rb → rma_required.rb} +0 -0
- data/app/models/spree/shipment.rb +3 -6
- data/app/models/spree/shipping_method.rb +1 -5
- data/app/models/spree/shipping_rate.rb +2 -11
- data/app/models/spree/stock/availability_validator.rb +3 -4
- data/app/models/spree/stock_item.rb +1 -5
- data/app/models/spree/stock_location.rb +13 -2
- data/app/models/spree/store.rb +51 -2
- data/app/models/spree/store_credit.rb +1 -1
- data/app/models/spree/variant.rb +16 -10
- data/app/models/spree/zone.rb +17 -4
- data/app/presenters/spree/variant_presenter.rb +9 -1
- data/app/presenters/spree/variants/option_types_presenter.rb +1 -0
- data/app/services/spree/account/addresses/create.rb +6 -1
- data/app/services/spree/account/addresses/{base.rb → helper.rb} +1 -3
- data/app/services/spree/account/addresses/update.rb +6 -1
- data/app/services/spree/compare_line_items.rb +4 -2
- data/app/sorters/spree/base_sorter.rb +35 -0
- data/app/sorters/spree/orders/sort.rb +1 -37
- data/app/sorters/spree/products/sort.rb +9 -32
- data/app/validators/email_validator.rb +1 -1
- data/app/views/layouts/spree/base_mailer.html.erb +45 -40
- data/app/views/spree/order_mailer/cancel_email.html.erb +19 -25
- data/app/views/spree/order_mailer/cancel_email.text.erb +24 -2
- data/app/views/spree/order_mailer/confirm_email.html.erb +18 -65
- data/app/views/spree/order_mailer/confirm_email.text.erb +2 -1
- data/app/views/spree/order_mailer/store_owner_notification_email.html.erb +23 -0
- data/app/views/spree/order_mailer/store_owner_notification_email.text.erb +38 -0
- data/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb +53 -58
- data/app/views/spree/reimbursement_mailer/reimbursement_email.text.erb +3 -1
- data/app/views/spree/shared/_base_mailer_footer.html.erb +6 -14
- data/app/views/spree/shared/_base_mailer_header.html.erb +12 -32
- data/app/views/spree/shared/_base_mailer_stylesheets.html.erb +293 -625
- data/app/views/spree/shared/_purchased_items_table.html.erb +60 -0
- data/app/views/spree/shared/purchased_items_table/_adjustment.html.erb +13 -0
- data/app/views/spree/shared/purchased_items_table/_line_item.html.erb +27 -0
- data/app/views/spree/shared/purchased_items_table/_subtotal.html.erb +13 -0
- data/app/views/spree/shared/purchased_items_table/_total.html.erb +13 -0
- data/app/views/spree/shipment_mailer/shipped_email.html.erb +31 -36
- data/app/views/spree/shipment_mailer/shipped_email.text.erb +2 -1
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/inflections.rb +3 -0
- data/config/initializers/rails61_fixes.rb +3 -0
- data/config/locales/en.yml +145 -19
- data/db/default/spree/countries.rb +10 -4
- data/db/default/spree/states.rb +42 -5
- data/db/default/spree/stores.rb +17 -12
- data/db/default/spree/zones.rb +5 -2
- data/db/migrate/20130326175857_add_stock_location_to_rma.rb +1 -1
- data/db/migrate/20140309033438_create_store_from_preferences.rb +1 -1
- data/db/migrate/20191017121054_add_supported_currencies_to_store.rb +10 -0
- data/db/migrate/20200102141311_add_social_to_spree_stores.rb +3 -0
- data/db/migrate/20200308210757_add_default_locale_to_spree_store.rb +7 -0
- data/db/migrate/20200310145140_add_customer_support_email_to_spree_store.rb +7 -0
- data/db/migrate/20200421095017_add_compare_at_amount_to_spree_prices.rb +7 -0
- data/db/migrate/20200423123001_add_default_country_id_to_spree_store.rb +9 -0
- data/db/migrate/20200430072209_add_footer_fields_to_spree_stores.rb +8 -0
- data/db/migrate/20200513154939_add_show_property_to_spree_product_properties.rb +5 -0
- data/db/migrate/20200607161221_add_store_owner_order_notification_delivered_to_spree_orders.rb +7 -0
- data/db/migrate/20200607161222_add_new_order_notifications_email_to_spree_stores.rb +7 -0
- data/db/migrate/20200610113542_add_label_to_spree_addresses.rb +5 -0
- data/db/migrate/20200826075557_add_unique_index_on_taxon_id_and_product_id_to_spree_products_taxons.rb +5 -0
- data/db/migrate/20201006110150_add_checkout_zone_field_to_store.rb +12 -0
- data/db/migrate/20201012091259_add_filterable_column_to_spree_option_types.rb +6 -0
- data/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb +5 -0
- data/db/migrate/20201127084048_add_default_country_kind_to_spree_zones.rb +5 -0
- data/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb +5 -0
- data/db/migrate/20210114182625_create_spree_payment_methods_stores.rb +10 -0
- data/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb +15 -0
- data/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb +5 -0
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/backend/all.js +0 -2
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/frontend/all.js +0 -2
- data/lib/generators/spree/mailers_preview/mailers_preview_generator.rb +23 -0
- data/lib/generators/spree/mailers_preview/templates/mailers/previews/order_preview.rb +13 -0
- data/lib/generators/spree/mailers_preview/templates/mailers/previews/reimbursement_preview.rb +5 -0
- data/lib/generators/spree/mailers_preview/templates/mailers/previews/shipment_preview.rb +5 -0
- data/lib/generators/spree/mailers_preview/templates/mailers/previews/user_preview.rb +11 -0
- data/lib/spree/core.rb +2 -0
- data/lib/spree/core/controller_helpers/common.rb +1 -0
- data/lib/spree/core/controller_helpers/currency_helpers.rb +15 -0
- data/lib/spree/core/controller_helpers/order.rb +9 -4
- data/lib/spree/core/controller_helpers/store.rb +16 -1
- data/lib/spree/core/importer/order.rb +9 -9
- data/lib/spree/core/product_filters.rb +3 -3
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/i18n.rb +7 -21
- data/lib/spree/permitted_attributes.rb +8 -5
- data/lib/spree/service_module.rb +6 -2
- data/lib/spree/testing_support/authorization_helpers.rb +7 -4
- data/lib/spree/testing_support/capybara_config.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_factory.rb +29 -17
- data/lib/spree/testing_support/factories/shipment_factory.rb +7 -9
- data/lib/spree/testing_support/factories/store_factory.rb +11 -8
- data/lib/spree/testing_support/factories/zone_factory.rb +16 -13
- data/lib/spree/testing_support/i18n.rb +1 -1
- data/lib/spree/testing_support/order_walkthrough.rb +8 -3
- data/lib/spree/testing_support/rspec_retry_config.rb +10 -0
- data/spree_core.gemspec +10 -8
- data/vendor/assets/javascripts/cleave.js +1669 -0
- metadata +105 -30
- data/app/views/spree/order_mailer/_adjustment.html.erb +0 -8
- data/app/views/spree/order_mailer/_subtotal.html.erb +0 -8
- data/app/views/spree/order_mailer/_total.html.erb +0 -8
- data/lib/spree/i18n/base.rb +0 -17
- data/lib/spree/i18n/initializer.rb +0 -1
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
require 'carmen'
|
|
2
2
|
|
|
3
|
+
EXCLUDED_COUNTRIES = ['AQ', 'AX', 'GS', 'UM', 'HM', 'IO', 'EH', 'BV', 'TF'].freeze
|
|
4
|
+
|
|
3
5
|
Carmen::Country.all.each do |country|
|
|
6
|
+
# Skip the creation of some territories, uninhabited islands and the Antarctic.
|
|
7
|
+
next if EXCLUDED_COUNTRIES.include?(country.alpha_2_code)
|
|
8
|
+
|
|
4
9
|
Spree::Country.where(
|
|
5
10
|
name: country.name,
|
|
6
11
|
iso3: country.alpha_3_code,
|
|
7
12
|
iso: country.alpha_2_code,
|
|
8
13
|
iso_name: country.name.upcase,
|
|
9
|
-
numcode: country.numeric_code
|
|
10
|
-
states_required: country.subregions?
|
|
14
|
+
numcode: country.numeric_code
|
|
11
15
|
).first_or_create
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
Spree::Config[:default_country_id] = Spree::Country.find_by(iso: 'US').id
|
|
15
19
|
|
|
16
|
-
#
|
|
17
|
-
|
|
20
|
+
# Find countries that do not use postal codes (by iso) and set 'zipcode_required' to false for them.
|
|
18
21
|
Spree::Country.where(iso: Spree::Address::NO_ZIPCODE_ISO_CODES).update_all(zipcode_required: false)
|
|
22
|
+
|
|
23
|
+
# Find all countries that require a state (province) at checkout and set 'states_required' to true.
|
|
24
|
+
Spree::Country.where(iso: Spree::Address::STATES_REQUIRED).update_all(states_required: true)
|
data/db/default/spree/states.rb
CHANGED
|
@@ -1,12 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
EXCLUDED_US_STATES = ['UM', 'AS', 'MP', 'VI', 'PR', 'GU'].freeze
|
|
4
|
+
EXCLUDED_CN_STATES = ['HK', 'MO', 'TW'].freeze
|
|
5
|
+
|
|
6
|
+
def state_level(country, subregion)
|
|
7
|
+
country.states.where(
|
|
8
|
+
name: subregion.name,
|
|
9
|
+
abbr: subregion.code
|
|
10
|
+
).first_or_create
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def province_level(country, subregion)
|
|
14
|
+
subregion.subregions.each do |province|
|
|
15
|
+
country.states.where(
|
|
16
|
+
name: province.name,
|
|
17
|
+
abbr: province.code
|
|
18
|
+
).first_or_create
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
1
22
|
Spree::Country.where(states_required: true).each do |country|
|
|
2
23
|
carmen_country = Carmen::Country.named(country.name)
|
|
3
24
|
next unless carmen_country
|
|
4
25
|
|
|
5
26
|
carmen_country.subregions.each do |subregion|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
27
|
+
if carmen_country.alpha_2_code == 'US'
|
|
28
|
+
# Produces 50 states, one postal district (Washington DC)
|
|
29
|
+
# and 3 APO's as you would expect to see on any good U.S. states list.
|
|
30
|
+
next if EXCLUDED_US_STATES.include?(subregion.code)
|
|
31
|
+
|
|
32
|
+
state_level(country, subregion)
|
|
33
|
+
elsif carmen_country.alpha_2_code == 'CA' || carmen_country.alpha_2_code == 'MX'
|
|
34
|
+
# Force Canada and Mexico to use state-level data import from Carmen Gem
|
|
35
|
+
# else we pull in a subset of provinces that are not common at checkout.
|
|
36
|
+
state_level(country, subregion)
|
|
37
|
+
elsif carmen_country.alpha_2_code == 'CN'
|
|
38
|
+
# Removes 3 "States" from that list that are also listed as Countries,
|
|
39
|
+
# Hong Kong, Taiwan and Macao
|
|
40
|
+
next if EXCLUDED_CN_STATES.include?(subregion.code)
|
|
41
|
+
|
|
42
|
+
state_level(country, subregion)
|
|
43
|
+
elsif subregion.subregions?
|
|
44
|
+
province_level(country, subregion)
|
|
45
|
+
else
|
|
46
|
+
state_level(country, subregion)
|
|
47
|
+
end
|
|
11
48
|
end
|
|
12
49
|
end
|
data/db/default/spree/stores.rb
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
default_store = Spree::Store.default
|
|
2
|
+
|
|
3
|
+
if default_store.persisted?
|
|
4
|
+
default_store.update!(default_country_id: Spree::Config[:default_country_id])
|
|
5
|
+
else
|
|
3
6
|
Spree::Store.new do |s|
|
|
4
|
-
s.name
|
|
5
|
-
s.code
|
|
6
|
-
s.url
|
|
7
|
-
s.mail_from_address
|
|
8
|
-
s.
|
|
9
|
-
s.
|
|
10
|
-
s.
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
13
|
-
s.
|
|
7
|
+
s.name = 'Spree Demo Site'
|
|
8
|
+
s.code = 'spree'
|
|
9
|
+
s.url = Rails.application.routes.default_url_options[:host] || 'demo.spreecommerce.org'
|
|
10
|
+
s.mail_from_address = 'no-reply@example.com'
|
|
11
|
+
s.customer_support_email = 'support@example.com'
|
|
12
|
+
s.default_currency = 'USD'
|
|
13
|
+
s.default_country_id = Spree::Config[:default_country_id]
|
|
14
|
+
s.seo_title = 'Spree Commerce Demo Shop'
|
|
15
|
+
s.meta_description = 'This is the new Spree UX DEMO | OVERVIEW: http://bit.ly/new-spree-ux | DOCS: http://bit.ly/spree-ux-customization-docs | CONTACT: https://spreecommerce.org/contact/'
|
|
16
|
+
s.facebook = 'spreecommerce'
|
|
17
|
+
s.twitter = 'spreecommerce'
|
|
18
|
+
s.instagram = 'spreecommerce'
|
|
14
19
|
end.save!
|
|
15
20
|
end
|
data/db/default/spree/zones.rb
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
eu_vat = Spree::Zone.where(name: 'EU_VAT', description: 'Countries that make up the EU VAT zone.', kind: 'country').first_or_create!
|
|
2
|
+
uk_vat = Spree::Zone.where(name: 'UK_VAT', kind: 'country').first_or_create!
|
|
2
3
|
north_america = Spree::Zone.where(name: 'North America', description: 'USA + Canada', kind: 'country').first_or_create!
|
|
3
4
|
south_america = Spree::Zone.where(name: 'South America', description: 'South America', kind: 'country').first_or_create!
|
|
4
5
|
middle_east = Spree::Zone.where(name: 'Middle East', description: 'Middle East', kind: 'country').first_or_create!
|
|
5
6
|
asia = Spree::Zone.where(name: 'Asia', description: 'Asia', kind: 'country').first_or_create!
|
|
6
7
|
|
|
7
|
-
%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG
|
|
8
|
+
%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG LT CY LU MT DK NL EE HR CZ GR).each do |name|
|
|
8
9
|
eu_vat.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
|
|
9
10
|
end
|
|
10
11
|
|
|
12
|
+
uk_vat.zone_members.where(zoneable: Spree::Country.find_by(iso: 'GB')).first_or_create!
|
|
13
|
+
|
|
11
14
|
%w(US CA).each do |name|
|
|
12
15
|
north_america.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
|
|
13
16
|
end
|
|
@@ -16,7 +19,7 @@ end
|
|
|
16
19
|
middle_east.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
|
|
17
20
|
end
|
|
18
21
|
|
|
19
|
-
%w(AF AM AZ BH BD BT BN KH CN CX CC
|
|
22
|
+
%w(AF AM AZ BH BD BT BN KH CN CX CC GE HK IN ID IR IQ IL JP JO KZ KW KG LA LB MO MY MV MN MM NP
|
|
20
23
|
KP OM PK PS PH QA SA SG KR LK SY TW TJ TH TR TM AE UZ VN YE).each do |name|
|
|
21
24
|
asia.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
|
|
22
25
|
end
|
|
@@ -28,7 +28,7 @@ class CreateStoreFromPreferences < ActiveRecord::Migration[4.2]
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
s.meta_description = preference_store.get('spree/app_configuration/default_meta_description') do
|
|
31
|
-
'
|
|
31
|
+
'This is the new Spree UX DEMO | OVERVIEW: http://bit.ly/new-spree-ux | DOCS: http://bit.ly/spree-ux-customization-docs | CONTACT: https://spreecommerce.org/contact/'
|
|
32
32
|
end
|
|
33
33
|
s.meta_keywords = preference_store.get('spree/app_configuration/default_meta_keywords') {}
|
|
34
34
|
s.seo_title = preference_store.get('spree/app_configuration/default_seo_title') do
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class AddSupportedCurrenciesToStore < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
unless column_exists?(:spree_stores, :supported_currencies)
|
|
4
|
+
add_column :spree_stores, :supported_currencies, :string
|
|
5
|
+
Spree::Store.all.each do |store|
|
|
6
|
+
store.update_attribute(:supported_currencies, store.default_currency)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -3,5 +3,8 @@ class AddSocialToSpreeStores < ActiveRecord::Migration[6.0]
|
|
|
3
3
|
add_column :spree_stores, :facebook, :string
|
|
4
4
|
add_column :spree_stores, :twitter, :string
|
|
5
5
|
add_column :spree_stores, :instagram, :string
|
|
6
|
+
|
|
7
|
+
# Fix cache issue #10381
|
|
8
|
+
Rails.cache.delete('default_store')
|
|
6
9
|
end
|
|
7
10
|
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AddDefaultCountryIdToSpreeStore < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
unless column_exists?(:spree_stores, :default_country_id)
|
|
4
|
+
add_column :spree_stores, :default_country_id, :integer
|
|
5
|
+
Spree::Store.reset_column_information
|
|
6
|
+
Spree::Store.update_all(default_country_id: Spree::Config[:default_country_id])
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AddFooterFieldsToSpreeStores < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
add_column :spree_stores, :description, :text unless column_exists?(:spree_stores, :description)
|
|
4
|
+
add_column :spree_stores, :address, :text unless column_exists?(:spree_stores, :address)
|
|
5
|
+
add_column :spree_stores, :contact_phone, :string unless column_exists?(:spree_stores, :contact_phone)
|
|
6
|
+
add_column :spree_stores, :contact_email, :string unless column_exists?(:spree_stores, :contact_email)
|
|
7
|
+
end
|
|
8
|
+
end
|
data/db/migrate/20200607161221_add_store_owner_order_notification_delivered_to_spree_orders.rb
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class AddStoreOwnerOrderNotificationDeliveredToSpreeOrders < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
unless column_exists?(:spree_orders, :store_owner_notification_delivered)
|
|
4
|
+
add_column :spree_orders, :store_owner_notification_delivered, :boolean
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class AddCheckoutZoneFieldToStore < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
unless column_exists?(:spree_stores, :checkout_zone_id)
|
|
4
|
+
add_column :spree_stores, :checkout_zone_id, :integer
|
|
5
|
+
|
|
6
|
+
Spree::Store.reset_column_information
|
|
7
|
+
|
|
8
|
+
default_zone = Spree::Zone.default_checkout_zone
|
|
9
|
+
Spree::Store.update_all(checkout_zone_id: default_zone.id) if default_zone.present?
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class CreateSpreePaymentMethodsStores < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
create_table :spree_payment_methods_stores, id: false do |t|
|
|
4
|
+
t.belongs_to :payment_method
|
|
5
|
+
t.belongs_to :store
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
add_index :spree_payment_methods_stores, [:payment_method_id, :store_id], unique: true, name: 'payment_mentod_id_store_id_unique_index'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class MigrateDataPaymentMethodsStores < ActiveRecord::Migration[6.0]
|
|
2
|
+
def up
|
|
3
|
+
Spree::PaymentMethod.all.each do |payment_method|
|
|
4
|
+
next if payment_method.store_ids.any?
|
|
5
|
+
|
|
6
|
+
if payment_method[:store_id].present?
|
|
7
|
+
payment_method.store_ids = payment_method[:store_id]
|
|
8
|
+
else
|
|
9
|
+
payment_method.store_ids = Spree::Store.ids
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
payment_method.save
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
5
|
// the compiled file.
|
|
6
6
|
//
|
|
7
|
-
//= require jquery
|
|
8
|
-
//= require jquery_ujs
|
|
9
7
|
//= require spree/backend
|
|
10
8
|
<% unless options[:lib_name] == 'spree' || options[:lib_name] == 'spree/backend' %>
|
|
11
9
|
<% filename = "spree/backend/#{ options[:lib_name].gsub("/", "_") }" %>
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
5
|
// the compiled file.
|
|
6
6
|
//
|
|
7
|
-
//= require jquery
|
|
8
|
-
//= require jquery_ujs
|
|
9
7
|
//= require accounting.min
|
|
10
8
|
//= require spree/frontend
|
|
11
9
|
<% unless options[:lib_name] == 'spree' || options[:lib_name] == 'spree/frontend' %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'spree/core'
|
|
3
|
+
|
|
4
|
+
module Spree
|
|
5
|
+
class MailersPreviewGenerator < Rails::Generators::Base
|
|
6
|
+
desc 'Generates mailers preview for development proposes'
|
|
7
|
+
|
|
8
|
+
def self.source_paths
|
|
9
|
+
[
|
|
10
|
+
File.expand_path('templates', __dir__)
|
|
11
|
+
]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def copy_mailers_previews
|
|
15
|
+
preview_path = Rails.application.config.action_mailer.preview_path || 'test/mailers/previews'
|
|
16
|
+
|
|
17
|
+
template 'mailers/previews/order_preview.rb', "#{preview_path}/order_preview.rb"
|
|
18
|
+
template 'mailers/previews/shipment_preview.rb', "#{preview_path}/shipment_preview.rb"
|
|
19
|
+
template 'mailers/previews/reimbursement_preview.rb', "#{preview_path}/reimbursement_preview.rb"
|
|
20
|
+
template 'mailers/previews/user_preview.rb', "#{preview_path}/user_preview.rb"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class OrderPreview < ActionMailer::Preview
|
|
2
|
+
def confirm_email
|
|
3
|
+
Spree::OrderMailer.confirm_email(Spree::Order.complete.first)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def cancel_email
|
|
7
|
+
Spree::OrderMailer.cancel_email(Spree::Order.complete.first)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def store_owner_notification_email
|
|
11
|
+
Spree::OrderMailer.store_owner_notification_email(Spree::Order.complete.first)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class UserPreview < ActionMailer::Preview
|
|
2
|
+
def reset_password_instructions
|
|
3
|
+
Spree::UserMailer.reset_password_instructions(Spree.user_class.first, 'your_token', { current_store_id: Spree::Store.default.id })
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
if Spree::Auth::Config[:confirmable]
|
|
7
|
+
def confirmation_instructions
|
|
8
|
+
Spree::UserMailer.confirmation_instructions(Spree.user_class.first, 'your_token')
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
data/lib/spree/core.rb
CHANGED
|
@@ -13,6 +13,7 @@ require 'premailer/rails'
|
|
|
13
13
|
require 'ransack'
|
|
14
14
|
require 'responders'
|
|
15
15
|
require 'state_machines-activerecord'
|
|
16
|
+
require 'active_storage_validations'
|
|
16
17
|
|
|
17
18
|
# This is required because ActiveModel::Validations#invalid? conflicts with the
|
|
18
19
|
# invalid state of a Payment. In the future this should be removed.
|
|
@@ -104,3 +105,4 @@ require 'spree/core/controller_helpers/order'
|
|
|
104
105
|
require 'spree/core/controller_helpers/search'
|
|
105
106
|
require 'spree/core/controller_helpers/store'
|
|
106
107
|
require 'spree/core/controller_helpers/strong_parameters'
|
|
108
|
+
require 'spree/core/controller_helpers/currency_helpers'
|