spree_core 5.2.0.rc2 → 5.2.0
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/helpers/spree/integrations_helper.rb +1 -1
- data/app/jobs/spree/images/save_from_url_job.rb +14 -3
- data/app/models/concerns/spree/calculated_adjustments.rb +1 -1
- data/app/models/concerns/spree/user_methods.rb +1 -1
- data/app/models/spree/address.rb +1 -1
- data/app/models/spree/adjustable/adjustments_updater.rb +1 -1
- data/app/models/spree/asset.rb +2 -2
- data/app/models/spree/calculator.rb +1 -1
- data/app/models/spree/data_feed.rb +1 -1
- data/app/models/spree/export.rb +1 -1
- data/app/models/spree/gateway/bogus.rb +1 -1
- data/app/models/spree/import.rb +1 -1
- data/app/models/spree/import_row.rb +1 -0
- data/app/models/spree/import_schemas/products.rb +1 -1
- data/app/models/spree/metafield_definition.rb +3 -3
- data/app/models/spree/order/payments.rb +2 -0
- data/app/models/spree/order.rb +1 -0
- data/app/models/spree/payment/processing.rb +13 -0
- data/app/models/spree/payment.rb +20 -0
- data/app/models/spree/payment_method.rb +1 -1
- data/app/models/spree/post.rb +2 -2
- data/app/models/spree/post_category.rb +10 -2
- data/app/models/spree/product.rb +37 -3
- data/app/models/spree/shipping_rate.rb +7 -3
- data/app/models/spree/stock/coordinator.rb +1 -1
- data/app/models/spree/store.rb +2 -2
- data/app/models/spree/taxon.rb +1 -0
- data/app/models/spree/theme.rb +4 -4
- data/app/presenters/spree/csv/product_variant_presenter.rb +3 -3
- data/app/services/spree/compare_line_items.rb +1 -1
- data/app/services/spree/imports/row_processors/product_variant.rb +24 -1
- data/app/views/spree/shared/_base_mailer_stylesheets.html.erb +5 -0
- data/config/locales/en.yml +4 -0
- data/lib/generators/spree/cursor_rules/templates/spree_rules.mdc +1 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +31 -24
- data/lib/generators/spree/model/model_generator.rb +21 -0
- data/lib/generators/spree/model/templates/model.rb.tt +22 -0
- data/lib/generators/spree/model_decorator/model_decorator_generator.rb +37 -0
- data/lib/generators/spree/model_decorator/templates/model_decorator.rb.tt +12 -0
- data/lib/spree/analytics.rb +2 -2
- data/lib/spree/core/configuration.rb +1 -0
- data/lib/spree/core/controller_helpers/order.rb +10 -1
- data/lib/spree/core/engine.rb +10 -4
- data/lib/spree/core/importer/order.rb +2 -0
- data/lib/spree/core/importer/product.rb +2 -0
- data/lib/spree/core/partials.rb +42 -0
- data/lib/spree/core/token_generator.rb +1 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +191 -0
- data/lib/spree/testing_support/factories/calculator_factory.rb +2 -2
- data/lib/spree/testing_support/factories/order_factory.rb +7 -4
- metadata +10 -8
|
@@ -61,33 +61,40 @@ end
|
|
|
61
61
|
# uncomment lines below to add your own custom business logic
|
|
62
62
|
# such as promotions, shipping methods, etc
|
|
63
63
|
Rails.application.config.after_initialize do
|
|
64
|
-
#
|
|
65
|
-
#
|
|
64
|
+
# Payment methods and shipping calculators
|
|
65
|
+
# Spree.payment_methods << Spree::PaymentMethods::VerySafeAndReliablePaymentMethod
|
|
66
|
+
# Spree.calculators.shipping_methods << Spree::ShippingMethods::SuperExpensiveNotVeryFastShipping
|
|
67
|
+
# Spree.calculators.tax_rates << Spree::TaxRates::FinanceTeamForcedMeToCodeThis
|
|
66
68
|
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
#
|
|
70
|
-
|
|
71
|
-
# Rails.application.config.spree.adjusters << Spree::Adjustable::Adjuster::TaxTheRich
|
|
69
|
+
# Stock splitters and adjusters
|
|
70
|
+
# Spree.stock_splitters << Spree::Stock::Splitters::SecretLogicSplitter
|
|
71
|
+
# Spree.adjusters << Spree::Adjustable::Adjuster::TaxTheRich
|
|
72
72
|
|
|
73
73
|
# Custom promotions
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
#
|
|
74
|
+
# Spree.calculators.promotion_actions_create_adjustments << Spree::Calculators::PromotionActions::CreateAdjustments::AddDiscountForFriends
|
|
75
|
+
# Spree.calculators.promotion_actions_create_item_adjustments << Spree::Calculators::PromotionActions::CreateItemAdjustments::FinanceTeamForcedMeToCodeThis
|
|
76
|
+
# Spree.promotions.rules << Spree::Promotions::Rules::OnlyForVIPCustomers
|
|
77
|
+
# Spree.promotions.actions << Spree::Promotions::Actions::GiftWithPurchase
|
|
78
|
+
|
|
79
|
+
# Taxon rules
|
|
80
|
+
# Spree.taxon_rules << Spree::TaxonRules::ProductsWithColor
|
|
81
|
+
|
|
82
|
+
# Exports and reports
|
|
83
|
+
# Spree.export_types << Spree::Exports::Payments
|
|
84
|
+
# Spree.reports << Spree::Reports::MassivelyOvercomplexReportForCfo
|
|
85
|
+
|
|
86
|
+
# Page builder (themes, pages, sections, blocks)
|
|
87
|
+
# Spree.page_builder.themes << Spree::Themes::NewShinyTheme
|
|
88
|
+
# Spree.page_builder.theme_layout_sections << Spree::PageSections::SuperImportantCeoBio
|
|
89
|
+
# Spree.page_builder.pages << Spree::Pages::CustomLandingPage
|
|
90
|
+
# Spree.page_builder.page_sections << Spree::PageSections::ContactFormToGetInTouch
|
|
91
|
+
# Spree.page_builder.page_blocks << Spree::PageBlocks::BigRedButtonToCallSales
|
|
92
|
+
|
|
93
|
+
# Storefront partials
|
|
94
|
+
# Spree.storefront.partials.head << 'spree/shared/that_js_snippet_that_marketing_forced_me_to_include'
|
|
95
|
+
|
|
96
|
+
# Admin partials
|
|
97
|
+
# Spree.admin.partials.product_form << 'spree/admin/products/custom_section'
|
|
91
98
|
end
|
|
92
99
|
|
|
93
100
|
Spree.user_class = <%= (options[:user_class].blank? ? 'Spree::LegacyUser' : options[:user_class]).inspect %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "rails/generators/active_record/model/model_generator"
|
|
2
|
+
|
|
3
|
+
module Spree
|
|
4
|
+
class ModelGenerator < ActiveRecord::Generators::ModelGenerator
|
|
5
|
+
|
|
6
|
+
def self.source_paths
|
|
7
|
+
paths = superclass.source_paths
|
|
8
|
+
paths << File.expand_path('templates', __dir__)
|
|
9
|
+
paths.flatten
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class_option :parent, type: :string, default: "Spree::Base", desc: "The parent class for the generated model"
|
|
13
|
+
|
|
14
|
+
desc 'Creates a new Spree model'
|
|
15
|
+
|
|
16
|
+
# Override to prevent module file from being created
|
|
17
|
+
def create_module_file
|
|
18
|
+
return
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class <%= class_name.demodulize %> < <%= parent_class_name.classify %>
|
|
3
|
+
<% attributes.select(&:reference?).each do |attribute| -%>
|
|
4
|
+
belongs_to :<%= attribute.name %><%= ", polymorphic: true" if attribute.polymorphic? %>
|
|
5
|
+
<% end -%>
|
|
6
|
+
<% attributes.select(&:rich_text?).each do |attribute| -%>
|
|
7
|
+
has_rich_text :<%= attribute.name %>
|
|
8
|
+
<% end -%>
|
|
9
|
+
<% attributes.select(&:attachment?).each do |attribute| -%>
|
|
10
|
+
has_one_attached :<%= attribute.name %>
|
|
11
|
+
<% end -%>
|
|
12
|
+
<% attributes.select(&:attachments?).each do |attribute| -%>
|
|
13
|
+
has_many_attached :<%= attribute.name %>
|
|
14
|
+
<% end -%>
|
|
15
|
+
<% attributes.select(&:token?).each do |attribute| -%>
|
|
16
|
+
has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
|
|
17
|
+
<% end -%>
|
|
18
|
+
<% if attributes.any?(&:password_digest?) -%>
|
|
19
|
+
has_secure_password
|
|
20
|
+
<% end -%>
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class ModelDecoratorGenerator < Rails::Generators::NamedBase
|
|
3
|
+
desc 'Creates a model decorator for a Spree model'
|
|
4
|
+
|
|
5
|
+
argument :name, type: :string, required: true, banner: 'Spree::ModelName'
|
|
6
|
+
|
|
7
|
+
def self.source_paths
|
|
8
|
+
paths = superclass.source_paths
|
|
9
|
+
paths << File.expand_path('templates', __dir__)
|
|
10
|
+
paths.flatten
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create_model_decorator_file
|
|
14
|
+
template 'model_decorator.rb.tt', "app/models/#{file_path}_decorator.rb"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
# Returns the model name without the Spree:: prefix
|
|
20
|
+
# e.g., "Spree::Product" => "Product", "Product" => "Product"
|
|
21
|
+
def model_name
|
|
22
|
+
name.sub(/^Spree::/, '').classify
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Returns the decorator module name
|
|
26
|
+
# e.g., "Spree::Product" => "ProductDecorator"
|
|
27
|
+
def decorator_name
|
|
28
|
+
"#{model_name}Decorator"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Returns the file path for the decorator
|
|
32
|
+
# e.g., "Spree::Product" => "spree/product", "Product" => "spree/product"
|
|
33
|
+
def file_path
|
|
34
|
+
"spree/#{model_name.underscore}"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/spree/analytics.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
module Analytics
|
|
3
3
|
def self.events
|
|
4
|
-
@@supported_events ||=
|
|
4
|
+
@@supported_events ||= Spree.analytics.events
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def self.event_handlers
|
|
8
|
-
@@event_handlers ||=
|
|
8
|
+
@@event_handlers ||= Spree.analytics.handlers
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -45,6 +45,7 @@ module Spree
|
|
|
45
45
|
preference :expedited_exchanges, :boolean, default: false # NOTE this requires payment profiles to be supported on your gateway of choice as well as a delayed job handler to be configured with activejob. kicks off an exchange shipment upon return authorization save. charge customer if they do not return items within timely manner.
|
|
46
46
|
preference :expedited_exchanges_days_window, :integer, default: 14 # the amount of days the customer has to return their item after the expedited exchange is shipped in order to avoid being charged
|
|
47
47
|
preference :geocode_addresses, :boolean, default: true
|
|
48
|
+
preference :images_save_from_url_job_attempts, :integer, default: 5
|
|
48
49
|
preference :layout, :string, deprecated: 'Please use Spree::Frontend::Config[:layout] instead'
|
|
49
50
|
preference :logo, :string, deprecated: true
|
|
50
51
|
preference :mailer_logo, :string, deprecated: true
|
|
@@ -118,11 +118,20 @@ module Spree
|
|
|
118
118
|
value: token,
|
|
119
119
|
expires: 90.days.from_now,
|
|
120
120
|
secure: Rails.configuration.force_ssl || Rails.application.config.ssl_options[:secure_cookies],
|
|
121
|
-
domain:
|
|
121
|
+
domain: cookie_domain_without_port,
|
|
122
122
|
httponly: true
|
|
123
123
|
}
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
+
def cookie_domain_without_port
|
|
127
|
+
domain = current_store.url_or_custom_domain
|
|
128
|
+
return nil if domain.blank?
|
|
129
|
+
|
|
130
|
+
# Remove port from domain (e.g., "localhost:3000" -> "localhost")
|
|
131
|
+
# Cookies don't support port numbers in the domain attribute
|
|
132
|
+
domain.split(':').first
|
|
133
|
+
end
|
|
134
|
+
|
|
126
135
|
def last_incomplete_order(includes = {})
|
|
127
136
|
@last_incomplete_order ||= try_spree_current_user.last_incomplete_spree_order(current_store, includes: includes)
|
|
128
137
|
end
|
data/lib/spree/core/engine.rb
CHANGED
|
@@ -24,14 +24,14 @@ module Spree
|
|
|
24
24
|
:page_blocks,
|
|
25
25
|
:reports,
|
|
26
26
|
:translatable_resources,
|
|
27
|
-
:
|
|
28
|
-
:metafield_enabled_resources,
|
|
27
|
+
:metafields,
|
|
29
28
|
:analytics_events,
|
|
30
29
|
:analytics_event_handlers,
|
|
31
30
|
:integrations)
|
|
32
31
|
SpreeCalculators = Struct.new(:shipping_methods, :tax_rates, :promotion_actions_create_adjustments, :promotion_actions_create_item_adjustments)
|
|
33
32
|
PromoEnvironment = Struct.new(:rules, :actions)
|
|
34
33
|
SpreeValidators = Struct.new(:addresses)
|
|
34
|
+
MetafieldsEnvironment = Struct.new(:types, :enabled_resources)
|
|
35
35
|
isolate_namespace Spree
|
|
36
36
|
engine_name 'spree'
|
|
37
37
|
|
|
@@ -66,6 +66,12 @@ module Spree
|
|
|
66
66
|
initializer 'spree.register.adjustable_adjusters' do |app|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
initializer 'spree.register.metafields' do |app|
|
|
70
|
+
app.config.spree.metafields = MetafieldsEnvironment.new
|
|
71
|
+
app.config.spree.metafields.types = []
|
|
72
|
+
app.config.spree.metafields.enabled_resources = []
|
|
73
|
+
end
|
|
74
|
+
|
|
69
75
|
# We need to define promotions rules here so extensions and existing apps
|
|
70
76
|
# can add their custom classes on their initializer files
|
|
71
77
|
initializer 'spree.promo.environment' do |app|
|
|
@@ -260,7 +266,7 @@ module Spree
|
|
|
260
266
|
Spree::Policy
|
|
261
267
|
]
|
|
262
268
|
|
|
263
|
-
Rails.application.config.spree.
|
|
269
|
+
Rails.application.config.spree.metafields.types = [
|
|
264
270
|
Spree::Metafields::ShortText,
|
|
265
271
|
Spree::Metafields::LongText,
|
|
266
272
|
Spree::Metafields::RichText,
|
|
@@ -269,7 +275,7 @@ module Spree
|
|
|
269
275
|
Spree::Metafields::Json
|
|
270
276
|
]
|
|
271
277
|
|
|
272
|
-
Rails.application.config.spree.
|
|
278
|
+
Rails.application.config.spree.metafields.enabled_resources = [
|
|
273
279
|
Spree::Address,
|
|
274
280
|
Spree::Asset,
|
|
275
281
|
Spree::CreditCard,
|
|
@@ -3,6 +3,8 @@ module Spree
|
|
|
3
3
|
module Importer
|
|
4
4
|
class Order
|
|
5
5
|
def self.import(user, params)
|
|
6
|
+
Spree::Deprecation.warn('Spree::Core::Importer::Order is deprecated and will be removed in Spree 6.0. Please use `Spree::Imports::Order` instead.')
|
|
7
|
+
|
|
6
8
|
ensure_country_id_from_params params[:ship_address_attributes]
|
|
7
9
|
ensure_state_id_from_params params[:ship_address_attributes]
|
|
8
10
|
ensure_country_id_from_params params[:bill_address_attributes]
|
|
@@ -5,6 +5,8 @@ module Spree
|
|
|
5
5
|
attr_reader :product, :product_attrs, :variants_attrs, :options_attrs, :store
|
|
6
6
|
|
|
7
7
|
def initialize(product, product_params, options = {})
|
|
8
|
+
Spree::Deprecation.warn('Spree::Core::Importer::Product is deprecated and will be removed in Spree 6.0. Please use `Spree::Imports::Product` instead.')
|
|
9
|
+
|
|
8
10
|
@store = options[:store] || Spree::Store.default
|
|
9
11
|
@product = product || Spree::Product.new(product_params)
|
|
10
12
|
@product.stores << @store if @product.stores.exclude?(@store)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Ability to define partial injection points for Admin and Storefront
|
|
2
|
+
module Spree
|
|
3
|
+
module Core
|
|
4
|
+
class Partials
|
|
5
|
+
def initialize(config, environment)
|
|
6
|
+
@config = config
|
|
7
|
+
@environment = environment
|
|
8
|
+
define_dynamic_methods
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
attr_reader :config, :environment
|
|
12
|
+
|
|
13
|
+
def partial_members
|
|
14
|
+
environment.members.select { |member| member.to_s.end_with?('_partials') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def keys
|
|
18
|
+
partial_members.map { |member| member.to_s.sub(/_partials$/, '') }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def define_dynamic_methods
|
|
24
|
+
# Get all members that end with _partials from the Environment
|
|
25
|
+
partial_members.each do |member|
|
|
26
|
+
# Strip the _partials suffix for the method name
|
|
27
|
+
method_name = member.to_s.sub(/_partials$/, '')
|
|
28
|
+
|
|
29
|
+
# Define getter method on singleton class
|
|
30
|
+
singleton_class.define_method(method_name) do
|
|
31
|
+
config.send(member)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Define setter method on singleton class
|
|
35
|
+
singleton_class.define_method("#{method_name}=") do |value|
|
|
36
|
+
config.send("#{member}=", value)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -2,6 +2,7 @@ module Spree
|
|
|
2
2
|
module Core
|
|
3
3
|
module TokenGenerator
|
|
4
4
|
def generate_token(model_class = Spree::Order)
|
|
5
|
+
Spree::Deprecation.warn('generate_token is deprecated and will be removed in Spree 6.0. Please use Rails secure token generator: https://api.rubyonrails.org/classes/ActiveRecord/SecureToken/ClassMethods.html')
|
|
5
6
|
loop do
|
|
6
7
|
token = "#{random_token}#{unique_ending}"
|
|
7
8
|
break token unless model_class.exists?(token: token)
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
|
@@ -168,6 +168,196 @@ module Spree
|
|
|
168
168
|
yield(Spree::Dependencies)
|
|
169
169
|
end
|
|
170
170
|
|
|
171
|
+
# Environment accessors for easier configuration access
|
|
172
|
+
# Instead of Rails.application.config.spree.payment_methods
|
|
173
|
+
# you can use Spree.payment_methods
|
|
174
|
+
|
|
175
|
+
def self.calculators
|
|
176
|
+
Rails.application.config.spree.calculators
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def self.calculators=(value)
|
|
180
|
+
Rails.application.config.spree.calculators = value
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def self.validators
|
|
184
|
+
Rails.application.config.spree.validators
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def self.validators=(value)
|
|
188
|
+
Rails.application.config.spree.validators = value
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def self.payment_methods
|
|
192
|
+
Rails.application.config.spree.payment_methods
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def self.payment_methods=(value)
|
|
196
|
+
Rails.application.config.spree.payment_methods = value
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def self.adjusters
|
|
200
|
+
Rails.application.config.spree.adjusters
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def self.adjusters=(value)
|
|
204
|
+
Rails.application.config.spree.adjusters = value
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def self.stock_splitters
|
|
208
|
+
Rails.application.config.spree.stock_splitters
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def self.stock_splitters=(value)
|
|
212
|
+
Rails.application.config.spree.stock_splitters = value
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def self.promotions
|
|
216
|
+
Rails.application.config.spree.promotions
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def self.promotions=(value)
|
|
220
|
+
Rails.application.config.spree.promotions = value
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def self.line_item_comparison_hooks
|
|
224
|
+
Rails.application.config.spree.line_item_comparison_hooks
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def self.line_item_comparison_hooks=(value)
|
|
228
|
+
Rails.application.config.spree.line_item_comparison_hooks = value
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def self.data_feed_types
|
|
232
|
+
Rails.application.config.spree.data_feed_types
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def self.data_feed_types=(value)
|
|
236
|
+
Rails.application.config.spree.data_feed_types = value
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def self.export_types
|
|
240
|
+
Rails.application.config.spree.export_types
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def self.export_types=(value)
|
|
244
|
+
Rails.application.config.spree.export_types = value
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def self.import_types
|
|
248
|
+
Rails.application.config.spree.import_types
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def self.import_types=(value)
|
|
252
|
+
Rails.application.config.spree.import_types = value
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def self.taxon_rules
|
|
256
|
+
Rails.application.config.spree.taxon_rules
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def self.taxon_rules=(value)
|
|
260
|
+
Rails.application.config.spree.taxon_rules = value
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def self.reports
|
|
264
|
+
Rails.application.config.spree.reports
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def self.reports=(value)
|
|
268
|
+
Rails.application.config.spree.reports = value
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def self.translatable_resources
|
|
272
|
+
Rails.application.config.spree.translatable_resources
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
def self.translatable_resources=(value)
|
|
276
|
+
Rails.application.config.spree.translatable_resources = value
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def self.metafields
|
|
280
|
+
Rails.application.config.spree.metafields
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def self.integrations
|
|
284
|
+
Rails.application.config.spree.integrations
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def self.integrations=(value)
|
|
288
|
+
Rails.application.config.spree.integrations = value
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Page Builder configuration accessor
|
|
292
|
+
def self.page_builder
|
|
293
|
+
@page_builder ||= PageBuilderConfig.new
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
class PageBuilderConfig
|
|
297
|
+
def themes
|
|
298
|
+
Rails.application.config.spree.themes
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def themes=(value)
|
|
302
|
+
Rails.application.config.spree.themes = value
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def theme_layout_sections
|
|
306
|
+
Rails.application.config.spree.theme_layout_sections
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
def theme_layout_sections=(value)
|
|
310
|
+
Rails.application.config.spree.theme_layout_sections = value
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def pages
|
|
314
|
+
Rails.application.config.spree.pages
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def pages=(value)
|
|
318
|
+
Rails.application.config.spree.pages = value
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def page_sections
|
|
322
|
+
Rails.application.config.spree.page_sections
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def page_sections=(value)
|
|
326
|
+
Rails.application.config.spree.page_sections = value
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def page_blocks
|
|
330
|
+
Rails.application.config.spree.page_blocks
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
def page_blocks=(value)
|
|
334
|
+
Rails.application.config.spree.page_blocks = value
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
def self.analytics
|
|
339
|
+
@analytics ||= AnalyticsConfig.new
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Group analytics configuration options together, but still make it backwards compatible.
|
|
343
|
+
class AnalyticsConfig
|
|
344
|
+
def events
|
|
345
|
+
Rails.application.config.spree.analytics_events
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def events=(value)
|
|
349
|
+
Rails.application.config.spree.analytics_events = value
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def handlers
|
|
353
|
+
Rails.application.config.spree.analytics_event_handlers
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def handlers=(value)
|
|
357
|
+
Rails.application.config.spree.analytics_event_handlers = value
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
|
|
171
361
|
module Core
|
|
172
362
|
autoload :ProductFilters, 'spree/core/product_filters'
|
|
173
363
|
autoload :TokenGenerator, 'spree/core/token_generator'
|
|
@@ -192,6 +382,7 @@ require 'spree/service_module'
|
|
|
192
382
|
require 'spree/database_type_utilities'
|
|
193
383
|
require 'spree/analytics'
|
|
194
384
|
|
|
385
|
+
require 'spree/core/partials'
|
|
195
386
|
require 'spree/core/importer'
|
|
196
387
|
require 'spree/core/query_filters'
|
|
197
388
|
require 'spree/core/controller_helpers/auth'
|
|
@@ -11,11 +11,11 @@ FactoryBot.define do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
factory :shipping_calculator, class: Spree::Calculator::Shipping::FlatRate do
|
|
14
|
-
|
|
14
|
+
preferred_amount { 10.0 }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
factory :shipping_no_amount_calculator, class: Spree::Calculator::Shipping::FlatRate do
|
|
18
|
-
|
|
18
|
+
preferred_amount { 0 }
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
factory :flat_rate_calculator, class: Spree::Calculator::FlatRate do
|
|
@@ -73,7 +73,7 @@ FactoryBot.define do
|
|
|
73
73
|
|
|
74
74
|
after(:create) do |order, evaluator|
|
|
75
75
|
order.refresh_shipment_rates(evaluator.shipping_method_filter)
|
|
76
|
-
order.update_column(:completed_at, Time.current)
|
|
76
|
+
order.update_column(:completed_at, order.completed_at || Time.current)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
factory :completed_order_with_pending_payment do
|
|
@@ -110,13 +110,16 @@ FactoryBot.define do
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
factory :shipped_order do
|
|
113
|
+
shipment_state { 'shipped' }
|
|
114
|
+
|
|
113
115
|
after(:create) do |order|
|
|
114
116
|
order.shipments.each do |shipment|
|
|
115
117
|
shipment.inventory_units.update_all state: 'shipped'
|
|
116
|
-
shipment.
|
|
118
|
+
shipment.update_columns(
|
|
119
|
+
state: 'shipped',
|
|
120
|
+
tracking: '1234567890'
|
|
121
|
+
)
|
|
117
122
|
end
|
|
118
|
-
order.update_column('shipment_state', 'shipped')
|
|
119
|
-
order.reload
|
|
120
123
|
end
|
|
121
124
|
end
|
|
122
125
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.2.0
|
|
4
|
+
version: 5.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
8
8
|
- Spark Solutions Sp. z o.o.
|
|
9
9
|
- Vendo Connect Inc.
|
|
10
|
-
autorequire:
|
|
11
10
|
bindir: bin
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: i18n-tasks
|
|
@@ -1478,6 +1477,10 @@ files:
|
|
|
1478
1477
|
- lib/generators/spree/dummy_model/templates/model.rb.tt
|
|
1479
1478
|
- lib/generators/spree/install/install_generator.rb
|
|
1480
1479
|
- lib/generators/spree/install/templates/config/initializers/spree.rb
|
|
1480
|
+
- lib/generators/spree/model/model_generator.rb
|
|
1481
|
+
- lib/generators/spree/model/templates/model.rb.tt
|
|
1482
|
+
- lib/generators/spree/model_decorator/model_decorator_generator.rb
|
|
1483
|
+
- lib/generators/spree/model_decorator/templates/model_decorator.rb.tt
|
|
1481
1484
|
- lib/mobility/plugins/store_based_fallbacks.rb
|
|
1482
1485
|
- lib/normalize_string.rb
|
|
1483
1486
|
- lib/spree/analytics.rb
|
|
@@ -1500,6 +1503,7 @@ files:
|
|
|
1500
1503
|
- lib/spree/core/importer/order.rb
|
|
1501
1504
|
- lib/spree/core/importer/product.rb
|
|
1502
1505
|
- lib/spree/core/number_generator.rb
|
|
1506
|
+
- lib/spree/core/partials.rb
|
|
1503
1507
|
- lib/spree/core/preferences/configuration.rb
|
|
1504
1508
|
- lib/spree/core/preferences/preferable.rb
|
|
1505
1509
|
- lib/spree/core/preferences/preferable_class_methods.rb
|
|
@@ -1656,10 +1660,9 @@ licenses:
|
|
|
1656
1660
|
- BSD-3-Clause
|
|
1657
1661
|
metadata:
|
|
1658
1662
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
1659
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v5.2.0
|
|
1663
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.2.0
|
|
1660
1664
|
documentation_uri: https://docs.spreecommerce.org/
|
|
1661
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.2.0
|
|
1662
|
-
post_install_message:
|
|
1665
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.2.0
|
|
1663
1666
|
rdoc_options: []
|
|
1664
1667
|
require_paths:
|
|
1665
1668
|
- lib
|
|
@@ -1674,8 +1677,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1674
1677
|
- !ruby/object:Gem::Version
|
|
1675
1678
|
version: 1.8.23
|
|
1676
1679
|
requirements: []
|
|
1677
|
-
rubygems_version: 3.
|
|
1678
|
-
signing_key:
|
|
1680
|
+
rubygems_version: 3.6.9
|
|
1679
1681
|
specification_version: 4
|
|
1680
1682
|
summary: The bare bones necessary for Spree
|
|
1681
1683
|
test_files: []
|