solidus_core 2.8.6 → 2.9.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/assets/images/logo/solidus.svg +1 -18
- data/app/assets/images/logo/solidus_logo.png +0 -0
- data/app/mailers/spree/test_mailer.rb +2 -0
- data/app/models/concerns/spree/default_price.rb +1 -1
- data/app/models/concerns/spree/ransackable_attributes.rb +1 -1
- data/app/models/concerns/spree/user_reporting.rb +1 -1
- data/app/models/spree/billing_integration.rb +7 -2
- data/app/models/spree/country.rb +2 -0
- data/app/models/spree/customer_return.rb +1 -1
- data/app/models/spree/image/paperclip_attachment.rb +55 -0
- data/app/models/spree/image.rb +2 -44
- data/app/models/spree/inventory_unit.rb +0 -1
- data/app/models/spree/option_type.rb +2 -0
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/order.rb +8 -13
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/payment_method.rb +8 -4
- data/app/models/spree/product.rb +1 -1
- data/app/models/spree/promotion/rules/first_order.rb +1 -3
- data/app/models/spree/promotion/rules/item_total.rb +9 -1
- data/app/models/spree/promotion/rules/one_use_per_user.rb +2 -2
- data/app/models/spree/promotion/rules/product.rb +3 -3
- data/app/models/spree/promotion/rules/taxon.rb +5 -8
- data/app/models/spree/promotion/rules/user_logged_in.rb +1 -1
- data/app/models/spree/promotion.rb +18 -11
- data/app/models/spree/promotion_handler/coupon.rb +19 -3
- data/app/models/spree/property.rb +2 -0
- data/app/models/spree/reimbursement.rb +5 -5
- data/app/models/spree/return_item.rb +6 -2
- data/app/models/spree/state.rb +6 -0
- data/app/models/spree/stock/location_filter/active.rb +14 -0
- data/app/models/spree/stock/location_filter/base.rb +43 -0
- data/app/models/spree/stock/simple_coordinator.rb +4 -1
- data/app/models/spree/stock_location.rb +2 -0
- data/app/models/spree/tax_category.rb +11 -0
- data/app/models/spree/taxon/paperclip_attachment.rb +21 -0
- data/app/models/spree/taxon.rb +4 -11
- data/app/models/spree/taxonomy.rb +2 -0
- data/app/models/spree/unit_cancel.rb +12 -1
- data/app/models/spree/variant/pricing_options.rb +10 -0
- data/app/models/spree/variant.rb +1 -1
- data/app/models/spree/wallet_payment_source.rb +26 -10
- data/app/models/spree/zone.rb +1 -1
- data/app/subscribers/spree/mailer_subscriber.rb +25 -0
- data/app/views/spree/order_mailer/inventory_cancellation_email.text.erb +3 -3
- data/config/locales/en.yml +26 -53
- data/db/default/spree/store_credit.rb +1 -0
- data/db/migrate/20161123154034_add_available_to_users_and_remove_display_on_from_shipping_methods.rb +1 -1
- data/db/migrate/20170608074534_rename_bogus_gateways.rb +9 -8
- data/db/migrate/20190220093635_drop_spree_store_credit_update_reasons.rb +19 -0
- data/lib/generators/spree/install/install_generator.rb +21 -19
- data/lib/generators/spree/install/templates/config/initializers/spree.rb.tt +29 -1
- data/lib/solidus/migrations/rename_gateways.rb +2 -0
- data/lib/spree/app_configuration.rb +69 -47
- data/lib/spree/core/class_constantizer.rb +6 -0
- data/lib/spree/core/controller_helpers/pricing.rb +1 -4
- data/lib/spree/core/controller_helpers/strong_parameters.rb +7 -21
- data/lib/spree/core/engine.rb +11 -0
- data/lib/spree/core/environment/promotions.rb +15 -0
- data/lib/spree/core/environment.rb +1 -1
- data/lib/spree/core/environment_extension.rb +0 -4
- data/lib/spree/core/importer/order.rb +1 -3
- data/lib/spree/core/stock_configuration.rb +5 -0
- data/lib/spree/core/version.rb +3 -1
- data/lib/spree/core.rb +2 -0
- data/lib/spree/deprecation.rb +50 -0
- data/lib/spree/event/adapters/active_support_notifications.rb +35 -0
- data/lib/spree/event/configuration.rb +25 -0
- data/lib/spree/event/subscriber.rb +84 -0
- data/lib/spree/event.rb +117 -0
- data/lib/spree/permitted_attributes.rb +7 -76
- data/lib/spree/promo/environment.rb +6 -7
- data/lib/spree/testing_support/capybara_ext.rb +15 -0
- data/lib/spree/testing_support/common_rake.rb +1 -1
- data/lib/spree/testing_support/dummy_app.rb +3 -10
- data/lib/spree/testing_support/factories/promotion_factory.rb +10 -0
- data/lib/spree/testing_support/factories/return_item_factory.rb +1 -0
- data/lib/spree/testing_support/preferences.rb +62 -0
- data/lib/tasks/email.rake +2 -0
- data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +4 -0
- data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +2 -0
- data/lib/tasks/migrations/migrate_user_addresses.rake +3 -0
- data/lib/tasks/migrations/rename_gateways.rake +2 -0
- data/lib/tasks/order_capturing.rake +2 -0
- data/spec/helpers/base_helper_spec.rb +3 -3
- data/spec/helpers/products_helper_spec.rb +2 -2
- data/spec/lib/spree/app_configuration_spec.rb +140 -0
- data/spec/lib/spree/core/class_constantizer_spec.rb +20 -0
- data/spec/lib/spree/core/controller_helpers/pricing_spec.rb +13 -0
- data/spec/lib/spree/core/controller_helpers/strong_parameters_spec.rb +1 -8
- data/spec/lib/spree/core/environment_extension_spec.rb +22 -23
- data/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/preferences_spec.rb +33 -0
- data/spec/lib/spree/event/subscriber_spec.rb +85 -0
- data/spec/lib/spree/event_spec.rb +118 -0
- data/spec/lib/spree/money_spec.rb +3 -9
- data/spec/lib/spree/promo/environment_spec.rb +53 -0
- data/spec/lib/tasks/migrations/migrate_shipping_rate_taxes_spec.rb +5 -3
- data/spec/mailers/order_mailer_spec.rb +1 -1
- data/spec/mailers/test_mailer_spec.rb +3 -1
- data/spec/models/spree/address_spec.rb +5 -4
- data/spec/models/spree/concerns/user_address_book_spec.rb +4 -4
- data/spec/models/spree/country_spec.rb +5 -5
- data/spec/models/spree/customer_return_spec.rb +1 -1
- data/spec/models/spree/order/checkout_spec.rb +3 -7
- data/spec/models/spree/order/finalizing_spec.rb +1 -1
- data/spec/models/spree/order/payment_spec.rb +3 -3
- data/spec/models/spree/order_inventory_spec.rb +1 -1
- data/spec/models/spree/order_spec.rb +67 -2
- data/spec/models/spree/order_updater_spec.rb +2 -2
- data/spec/models/spree/payment_spec.rb +12 -0
- data/spec/models/spree/product_spec.rb +3 -3
- data/spec/models/spree/promotion/rules/first_order_spec.rb +13 -3
- data/spec/models/spree/promotion/rules/item_total_spec.rb +15 -0
- data/spec/models/spree/promotion/rules/one_use_per_user_spec.rb +10 -0
- data/spec/models/spree/promotion/rules/product_spec.rb +15 -0
- data/spec/models/spree/promotion/rules/taxon_spec.rb +59 -8
- data/spec/models/spree/promotion/rules/user_logged_in_spec.rb +5 -0
- data/spec/models/spree/promotion_handler/shipping_spec.rb +1 -1
- data/spec/models/spree/promotion_spec.rb +80 -0
- data/spec/models/spree/reimbursement_spec.rb +3 -2
- data/spec/models/spree/return_item_spec.rb +9 -0
- data/spec/models/spree/shipment_spec.rb +3 -3
- data/spec/models/spree/stock/availability_spec.rb +1 -1
- data/spec/models/spree/stock/estimator_spec.rb +5 -7
- data/spec/models/spree/stock/location_filter/active_spec.rb +22 -0
- data/spec/models/spree/stock/location_sorter/default_first_spec.rb +4 -2
- data/spec/models/spree/stock/location_sorter/unsorted_spec.rb +3 -1
- data/spec/models/spree/stock/quantifier_spec.rb +1 -1
- data/spec/models/spree/stock/simple_coordinator_spec.rb +5 -0
- data/spec/models/spree/stock_item_spec.rb +3 -2
- data/spec/models/spree/stock_movement_spec.rb +1 -1
- data/spec/models/spree/store_credit_spec.rb +1 -1
- data/spec/models/spree/tax/order_adjuster_spec.rb +1 -1
- data/spec/models/spree/tax/taxation_integration_spec.rb +1 -1
- data/spec/models/spree/tax_category_spec.rb +21 -0
- data/spec/models/spree/taxon_spec.rb +28 -0
- data/spec/models/spree/unit_cancel_spec.rb +41 -0
- data/spec/models/spree/user_spec.rb +3 -3
- data/spec/models/spree/variant/pricing_options_spec.rb +23 -0
- data/spec/models/spree/variant/vat_price_generator_spec.rb +1 -1
- data/spec/models/spree/variant_spec.rb +11 -8
- data/spec/models/spree/wallet_payment_source_spec.rb +35 -6
- data/spec/models/spree/wallet_spec.rb +1 -1
- data/spec/rails_helper.rb +1 -0
- data/spec/spec_helper.rb +0 -4
- data/spec/support/concerns/default_price.rb +8 -0
- metadata +21 -6
- data/spec/lib/spree/permitted_attributes_spec.rb +0 -41
- data/spec/models/spree/app_configuration_spec.rb +0 -55
- /data/{spec/support/shared_contexts → lib/spree/testing_support}/rake.rb +0 -0
|
@@ -130,6 +130,8 @@ module Spree
|
|
|
130
130
|
after_transition any => any, do: :persist_acceptance_status_errors
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
+
attr_accessor :skip_customer_return_processing
|
|
134
|
+
|
|
133
135
|
# @param inventory_unit [Spree::InventoryUnit] the inventory for which we
|
|
134
136
|
# want a return item
|
|
135
137
|
# @return [Spree::ReturnItem] a valid return item for the given inventory
|
|
@@ -233,10 +235,12 @@ module Spree
|
|
|
233
235
|
|
|
234
236
|
def process_inventory_unit!
|
|
235
237
|
inventory_unit.return!
|
|
236
|
-
|
|
237
238
|
if customer_return
|
|
238
239
|
customer_return.stock_location.restock(inventory_unit.variant, 1, customer_return) if should_restock?
|
|
239
|
-
|
|
240
|
+
unless skip_customer_return_processing
|
|
241
|
+
Deprecation.warn 'From Solidus v2.9 onwards, #process_inventory_unit! will not call customer_return#process_return!'
|
|
242
|
+
customer_return.process_return!
|
|
243
|
+
end
|
|
240
244
|
end
|
|
241
245
|
end
|
|
242
246
|
|
data/app/models/spree/state.rb
CHANGED
|
@@ -19,6 +19,8 @@ module Spree
|
|
|
19
19
|
deprecate find_all_by_name_or_abbr: :with_name_or_abbr, deprecator: Spree::Deprecation
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
self.whitelisted_ransackable_attributes = %w[name]
|
|
23
|
+
|
|
22
24
|
# table of { country.id => [ state.id , state.name ] }, arrays sorted by name
|
|
23
25
|
# blank is added elsewhere, if needed
|
|
24
26
|
def self.states_group_by_country_id
|
|
@@ -36,5 +38,9 @@ module Spree
|
|
|
36
38
|
def to_s
|
|
37
39
|
name
|
|
38
40
|
end
|
|
41
|
+
|
|
42
|
+
def state_with_country
|
|
43
|
+
"#{name} (#{country})"
|
|
44
|
+
end
|
|
39
45
|
end
|
|
40
46
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spree
|
|
4
|
+
module Stock
|
|
5
|
+
module LocationFilter
|
|
6
|
+
# This stock location filter return all active stock locations
|
|
7
|
+
class Active < Spree::Stock::LocationFilter::Base
|
|
8
|
+
def filter
|
|
9
|
+
stock_locations.active
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spree
|
|
4
|
+
module Stock
|
|
5
|
+
module LocationFilter
|
|
6
|
+
# Stock location filters are used to which stock location should be
|
|
7
|
+
# considered when allocating stocks for a new shipment
|
|
8
|
+
#
|
|
9
|
+
# @abstract To implement your own location filter, subclass and
|
|
10
|
+
# implement {#filter}.
|
|
11
|
+
class Base
|
|
12
|
+
# @!attribute [r] stock_locations
|
|
13
|
+
# @return [Enumerable<Spree::StockLocation>]
|
|
14
|
+
# a collection of locations to sort
|
|
15
|
+
attr_reader :stock_locations
|
|
16
|
+
|
|
17
|
+
# @!attribute [r] order
|
|
18
|
+
# @return <Spree::Order>
|
|
19
|
+
# the order we are creating the shipment for
|
|
20
|
+
attr_reader :order
|
|
21
|
+
|
|
22
|
+
# Initializes the stock location filter.
|
|
23
|
+
#
|
|
24
|
+
# @param stock_locations [Enumerable<Spree::StockLocation>]
|
|
25
|
+
# a collection of locations to sort
|
|
26
|
+
# @param order <Spree::Order>
|
|
27
|
+
# the order we are creating the shipment for
|
|
28
|
+
def initialize(stock_locations, order)
|
|
29
|
+
@stock_locations = stock_locations
|
|
30
|
+
@order = order
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Filter the stock locations.
|
|
34
|
+
#
|
|
35
|
+
# @return [Enumerable<Spree::StockLocation>]
|
|
36
|
+
# a collection of filtered stock locations
|
|
37
|
+
def filter
|
|
38
|
+
raise NotImplementedError
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -26,7 +26,10 @@ module Spree
|
|
|
26
26
|
@order = order
|
|
27
27
|
@inventory_units = inventory_units || InventoryUnitBuilder.new(order).units
|
|
28
28
|
@splitters = Spree::Config.environment.stock_splitters
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
filtered_stock_locations = Spree::Config.stock.location_filter_class.new(Spree::StockLocation.all, @order).filter
|
|
31
|
+
sorted_stock_locations = Spree::Config.stock.location_sorter_class.new(filtered_stock_locations).sort
|
|
32
|
+
@stock_locations = sorted_stock_locations
|
|
30
33
|
|
|
31
34
|
@inventory_units_by_variant = @inventory_units.group_by(&:variant)
|
|
32
35
|
@desired = Spree::StockQuantities.new(@inventory_units_by_variant.transform_values(&:count))
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'discard'
|
|
4
|
+
|
|
3
5
|
module Spree
|
|
4
6
|
class TaxCategory < Spree::Base
|
|
5
7
|
acts_as_paranoid
|
|
8
|
+
include Spree::ParanoiaDeprecations
|
|
9
|
+
|
|
10
|
+
include Discard::Model
|
|
11
|
+
self.discard_column = :deleted_at
|
|
12
|
+
|
|
13
|
+
after_discard do
|
|
14
|
+
self.tax_rate_tax_categories = []
|
|
15
|
+
end
|
|
16
|
+
|
|
6
17
|
validates :name, presence: true
|
|
7
18
|
validates_uniqueness_of :name, unless: :deleted_at
|
|
8
19
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spree::Taxon::PaperclipAttachment
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
has_attached_file :icon,
|
|
8
|
+
styles: { mini: '32x32>', normal: '128x128>' },
|
|
9
|
+
default_style: :mini,
|
|
10
|
+
url: '/spree/taxons/:id/:style/:basename.:extension',
|
|
11
|
+
path: ':rails_root/public/spree/taxons/:id/:style/:basename.:extension',
|
|
12
|
+
default_url: '/assets/default_taxon.png'
|
|
13
|
+
|
|
14
|
+
validates_attachment :icon,
|
|
15
|
+
content_type: { content_type: %w[image/jpg image/jpeg image/png image/gif] }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def icon_present?
|
|
19
|
+
icon.present?
|
|
20
|
+
end
|
|
21
|
+
end
|
data/app/models/spree/taxon.rb
CHANGED
|
@@ -25,15 +25,9 @@ module Spree
|
|
|
25
25
|
after_save :touch_ancestors_and_taxonomy
|
|
26
26
|
after_touch :touch_ancestors_and_taxonomy
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
styles: { mini: '32x32>', normal: '128x128>' },
|
|
30
|
-
default_style: :mini,
|
|
31
|
-
url: '/spree/taxons/:id/:style/:basename.:extension',
|
|
32
|
-
path: ':rails_root/public/spree/taxons/:id/:style/:basename.:extension',
|
|
33
|
-
default_url: '/assets/default_taxon.png'
|
|
28
|
+
include ::Spree::Config.taxon_attachment_module
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] }
|
|
30
|
+
self.whitelisted_ransackable_attributes = %w[name]
|
|
37
31
|
|
|
38
32
|
# @note This method is meant to be overridden on a store by store basis.
|
|
39
33
|
# @return [Array] filters that should be used for a taxon
|
|
@@ -59,9 +53,8 @@ module Spree
|
|
|
59
53
|
# Sets this taxons permalink to a valid url encoded string based on its
|
|
60
54
|
# name and its parents permalink (if present.)
|
|
61
55
|
def set_permalink
|
|
62
|
-
permalink_tail = permalink.split('/').last
|
|
63
|
-
|
|
64
|
-
self.permalink_part = permalink_tail
|
|
56
|
+
permalink_tail = permalink.present? ? permalink.split('/').last : name
|
|
57
|
+
self.permalink_part = Spree::Config.taxon_url_parametizer_class.parameterize(permalink_tail)
|
|
65
58
|
end
|
|
66
59
|
|
|
67
60
|
# Update the permalink for this taxon and all children (if necessary)
|
|
@@ -34,6 +34,17 @@ class Spree::UnitCancel < Spree::Base
|
|
|
34
34
|
# This method is used by Adjustment#update to recalculate the cost.
|
|
35
35
|
def compute_amount(line_item)
|
|
36
36
|
raise "Adjustable does not match line item" unless line_item == inventory_unit.line_item
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
-weighted_line_item_amount(line_item)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def weighted_line_item_amount(line_item)
|
|
44
|
+
line_item.total_before_tax / quantity_of_line_item(line_item)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def quantity_of_line_item(line_item)
|
|
48
|
+
BigDecimal(line_item.inventory_units.not_canceled.reject(&:original_return_item).size)
|
|
38
49
|
end
|
|
39
50
|
end
|
|
@@ -49,6 +49,16 @@ module Spree
|
|
|
49
49
|
new(currency: price.currency, country_iso: price.country_iso)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
# This creates the correct pricing options for a price, so the store owners can easily customize how to
|
|
53
|
+
# find the pricing based on the view context, having available current_store, current_spree_user, request.host_name, etc.
|
|
54
|
+
# @return [Spree::Variant::PricingOptions] pricing options for pricing a line item
|
|
55
|
+
def self.from_context(context)
|
|
56
|
+
new(
|
|
57
|
+
currency: context.current_store.try!(:default_currency).presence || Spree::Config[:currency],
|
|
58
|
+
country_iso: context.current_store.try!(:cart_tax_country_iso).presence
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
52
62
|
# @return [Hash] The hash of exact desired attributes
|
|
53
63
|
attr_reader :desired_attributes
|
|
54
64
|
|
data/app/models/spree/variant.rb
CHANGED
|
@@ -121,7 +121,7 @@ module Spree
|
|
|
121
121
|
Spree::StockItem.arel_table[:count_on_hand].gt(0),
|
|
122
122
|
Spree::StockItem.arel_table[:backorderable].eq(true)
|
|
123
123
|
]
|
|
124
|
-
joins(:stock_items).where(arel_conditions.inject(:or))
|
|
124
|
+
joins(:stock_items).where(arel_conditions.inject(:or)).distinct
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
self.whitelisted_ransackable_associations = %w[option_values product prices default_price]
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
module Spree
|
|
4
|
+
class WalletPaymentSource < Spree::Base
|
|
5
|
+
belongs_to :user, class_name: Spree::UserClassHandle.new, foreign_key: 'user_id', inverse_of: :wallet_payment_sources
|
|
6
|
+
belongs_to :payment_source, polymorphic: true, inverse_of: :wallet_payment_sources
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
validates_presence_of :user
|
|
9
|
+
validates_presence_of :payment_source
|
|
10
|
+
validates :user_id, uniqueness: {
|
|
11
|
+
scope: [:payment_source_type, :payment_source_id],
|
|
12
|
+
message: :payment_source_already_exists
|
|
13
|
+
}
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
validate :check_for_payment_source_class
|
|
16
|
+
validate :validate_payment_source_ownership
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
private
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
def check_for_payment_source_class
|
|
21
|
+
if !payment_source.is_a?(Spree::PaymentSource)
|
|
22
|
+
errors.add(:payment_source, :has_to_be_payment_source_class)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def validate_payment_source_ownership
|
|
27
|
+
return unless payment_source.present?
|
|
28
|
+
|
|
29
|
+
if payment_source.respond_to?(:user_id) &&
|
|
30
|
+
payment_source.user_id != user_id
|
|
31
|
+
errors.add(:payment_source, :not_owned_by_user)
|
|
32
|
+
end
|
|
17
33
|
end
|
|
18
34
|
end
|
|
19
35
|
end
|
data/app/models/spree/zone.rb
CHANGED
|
@@ -42,7 +42,7 @@ module Spree
|
|
|
42
42
|
alias :members :zone_members
|
|
43
43
|
accepts_nested_attributes_for :zone_members, allow_destroy: true, reject_if: proc { |a| a['zoneable_id'].blank? }
|
|
44
44
|
|
|
45
|
-
self.whitelisted_ransackable_attributes = [
|
|
45
|
+
self.whitelisted_ransackable_attributes = %w[name description]
|
|
46
46
|
|
|
47
47
|
# Returns all zones that contain any of the zone members of the zone passed
|
|
48
48
|
# in. This also includes any country zones that contain the state of the
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spree/event/subscriber'
|
|
4
|
+
|
|
5
|
+
module Spree
|
|
6
|
+
module MailerSubscriber
|
|
7
|
+
include Spree::Event::Subscriber
|
|
8
|
+
|
|
9
|
+
event_action :order_finalized
|
|
10
|
+
event_action :send_reimbursement_email, event_name: :reimbursement_reimbursed
|
|
11
|
+
|
|
12
|
+
def order_finalized(event)
|
|
13
|
+
order = event.payload[:order]
|
|
14
|
+
unless order.confirmation_delivered?
|
|
15
|
+
Spree::Config.order_mailer_class.confirm_email(order).deliver_later
|
|
16
|
+
order.update_column(:confirmation_delivered, true)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def send_reimbursement_email(event)
|
|
21
|
+
reimbursement = event.payload[:reimbursement]
|
|
22
|
+
Spree::Config.reimbursement_mailer_class.reimbursement_email(reimbursement.id).deliver_later
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<%= t('order_mailer.inventory_cancellation.dear_customer') %>
|
|
1
|
+
<%= t('spree.order_mailer.inventory_cancellation.dear_customer') %>
|
|
2
2
|
|
|
3
|
-
<%= t('order_mailer.inventory_cancellation.instructions') %>
|
|
3
|
+
<%= t('spree.order_mailer.inventory_cancellation.instructions') %>
|
|
4
4
|
|
|
5
5
|
============================================================
|
|
6
|
-
<%= t('order_mailer.inventory_cancellation.order_summary_canceled') %>
|
|
6
|
+
<%= t('spree.order_mailer.inventory_cancellation.order_summary_canceled') %>
|
|
7
7
|
============================================================
|
|
8
8
|
<% @inventory_units.each do |item| %>
|
|
9
9
|
<%= item.variant.sku %> <%= raw(item.variant.product.name) %> <%= raw(item.variant.options_text) -%>
|
data/config/locales/en.yml
CHANGED
|
@@ -97,6 +97,7 @@ en:
|
|
|
97
97
|
total: Total price
|
|
98
98
|
spree/log_entry:
|
|
99
99
|
details: Message
|
|
100
|
+
created_at: Date/Time
|
|
100
101
|
spree/option_type:
|
|
101
102
|
name: Name
|
|
102
103
|
presentation: Presentation
|
|
@@ -147,6 +148,9 @@ en:
|
|
|
147
148
|
number: Identifier
|
|
148
149
|
response_code: Transaction ID
|
|
149
150
|
state: State
|
|
151
|
+
spree/payment_capture_event:
|
|
152
|
+
created_at: Date/Time
|
|
153
|
+
amount: Amount
|
|
150
154
|
spree/payment_method:
|
|
151
155
|
active: Active
|
|
152
156
|
auto_capture: Auto Capture
|
|
@@ -318,7 +322,6 @@ en:
|
|
|
318
322
|
country_id: Country
|
|
319
323
|
default: Default
|
|
320
324
|
fulfillable: Fulfillable
|
|
321
|
-
internal_name: Internal Name
|
|
322
325
|
name: Name
|
|
323
326
|
phone: Phone
|
|
324
327
|
propagate_all_variants: Propagate All Variants
|
|
@@ -332,6 +335,7 @@ en:
|
|
|
332
335
|
spree/store:
|
|
333
336
|
available_locales: Locales Available in the Storefront
|
|
334
337
|
cart_tax_country_iso: Tax Country for Empty Carts
|
|
338
|
+
code: Slug
|
|
335
339
|
default: Default
|
|
336
340
|
default_currency: Default Currency
|
|
337
341
|
mail_from_address: Mail From Address
|
|
@@ -487,7 +491,10 @@ en:
|
|
|
487
491
|
spree/wallet_payment_source:
|
|
488
492
|
attributes:
|
|
489
493
|
payment_source:
|
|
490
|
-
has_to_be_payment_source_class:
|
|
494
|
+
has_to_be_payment_source_class: is not a valid payment source
|
|
495
|
+
not_owned_by_user: does not belong to the user associated with the order
|
|
496
|
+
user_id:
|
|
497
|
+
payment_source_already_exists: already has this payment source in their wallet
|
|
491
498
|
models:
|
|
492
499
|
spree/address:
|
|
493
500
|
one: Address
|
|
@@ -723,49 +730,6 @@ en:
|
|
|
723
730
|
user:
|
|
724
731
|
one: User
|
|
725
732
|
other: Users
|
|
726
|
-
devise:
|
|
727
|
-
confirmations:
|
|
728
|
-
confirmed: Your account was successfully confirmed. You are now signed in.
|
|
729
|
-
send_instructions: You will receive an email with instructions about how to
|
|
730
|
-
confirm your account in a few minutes.
|
|
731
|
-
failure:
|
|
732
|
-
inactive: Your account was not activated yet.
|
|
733
|
-
invalid: Invalid email or password.
|
|
734
|
-
invalid_token: Invalid authentication token.
|
|
735
|
-
locked: Your account is locked.
|
|
736
|
-
timeout: Your session expired, please sign in again to continue.
|
|
737
|
-
unauthenticated: You need to sign in or sign up before continuing.
|
|
738
|
-
unconfirmed: You have to confirm your account before continuing.
|
|
739
|
-
mailer:
|
|
740
|
-
confirmation_instructions:
|
|
741
|
-
subject: Confirmation Instructions
|
|
742
|
-
reset_password_instructions:
|
|
743
|
-
subject: Reset Password Instructions
|
|
744
|
-
unlock_instructions:
|
|
745
|
-
subject: Unlock Instructions
|
|
746
|
-
oauth_callbacks:
|
|
747
|
-
failure: Could not authorize you from %{kind} because %{reason}.
|
|
748
|
-
success: Successfully authorized from %{kind} account.
|
|
749
|
-
unlocks:
|
|
750
|
-
send_instructions: You will receive an email with instructions about how to
|
|
751
|
-
unlock your account in a few minutes.
|
|
752
|
-
unlocked: Your account was successfully unlocked. You are now signed in.
|
|
753
|
-
user_passwords:
|
|
754
|
-
user:
|
|
755
|
-
cannot_be_blank: Your password cannot be blank.
|
|
756
|
-
send_instructions: You will receive an email with instructions about how to
|
|
757
|
-
reset your password in a few minutes.
|
|
758
|
-
updated: Your password was changed successfully. You are now signed in.
|
|
759
|
-
user_registrations:
|
|
760
|
-
destroyed: Bye! Your account was successfully cancelled. We hope to see you
|
|
761
|
-
again soon.
|
|
762
|
-
inactive_signed_up: You have signed up successfully. However, we could not sign
|
|
763
|
-
you in because your account is %{reason}.
|
|
764
|
-
signed_up: Welcome! You have signed up successfully.
|
|
765
|
-
updated: You updated your account successfully.
|
|
766
|
-
user_sessions:
|
|
767
|
-
signed_in: Signed in successfully.
|
|
768
|
-
signed_out: Signed out successfully.
|
|
769
733
|
errors:
|
|
770
734
|
messages:
|
|
771
735
|
already_confirmed: was already confirmed
|
|
@@ -846,6 +810,9 @@ en:
|
|
|
846
810
|
adjustment_type: Adjustment type
|
|
847
811
|
adjustments: Adjustments
|
|
848
812
|
admin:
|
|
813
|
+
api:
|
|
814
|
+
key_cleared: Key cleared
|
|
815
|
+
key_generated: Key generated
|
|
849
816
|
images:
|
|
850
817
|
index:
|
|
851
818
|
choose_files: Choose files to upload
|
|
@@ -883,6 +850,11 @@ en:
|
|
|
883
850
|
expires_at_placeholder: Never
|
|
884
851
|
general: General
|
|
885
852
|
starts_at_placeholder: Immediately
|
|
853
|
+
promotion_status:
|
|
854
|
+
active: Active
|
|
855
|
+
expired: Expired
|
|
856
|
+
inactive: Inactive
|
|
857
|
+
not_started: Not started
|
|
886
858
|
stock_locations:
|
|
887
859
|
form:
|
|
888
860
|
address: Address
|
|
@@ -1410,15 +1382,17 @@ en:
|
|
|
1410
1382
|
fulfillable: 'When unchecked, this indicates that items in this location don''t
|
|
1411
1383
|
require actual fulfilment. Stock will not be checked when shipping and emails
|
|
1412
1384
|
will not be sent.<br/> Default: Checked'
|
|
1413
|
-
propagate_all_variants: 'When checked, this will create a stock item for
|
|
1414
|
-
this stock location.<br/> Default: Checked'
|
|
1385
|
+
propagate_all_variants: 'When checked, this will create a stock item for each variant
|
|
1386
|
+
in this stock location.<br/> Default: Checked'
|
|
1415
1387
|
restock_inventory: 'When checked, returned inventory can be added back to
|
|
1416
1388
|
this location''s stock levels.<br/> Default: checked'
|
|
1417
1389
|
spree/store:
|
|
1418
1390
|
available_locales: This determines which locales are available for your customers
|
|
1419
1391
|
to choose from in the storefront.
|
|
1420
|
-
cart_tax_country_iso:
|
|
1421
|
-
|
|
1392
|
+
cart_tax_country_iso: "This determines which country is used for taxes on carts
|
|
1393
|
+
(orders which don't yet have an address).<br/> Default: None."
|
|
1394
|
+
code: 'An identifier for your store. Developers may need this value if you operate
|
|
1395
|
+
multiple storefronts.'
|
|
1422
1396
|
spree/tax_rate:
|
|
1423
1397
|
validity_period: This determines the validity period within which the tax
|
|
1424
1398
|
rate is valid and will be applied to eligible items. <br /> If no start
|
|
@@ -1470,7 +1444,6 @@ en:
|
|
|
1470
1444
|
quantity.
|
|
1471
1445
|
intercept_email_address: Intercept Email Address
|
|
1472
1446
|
intercept_email_instructions: Override email recipient and replace with this address.
|
|
1473
|
-
internal_name: Internal Name
|
|
1474
1447
|
invalid_exchange_variant: Invalid exchange variant.
|
|
1475
1448
|
invalid_payment_method_type: Invalid payment method type.
|
|
1476
1449
|
invalid_promotion_action: Invalid promotion action.
|
|
@@ -1800,6 +1773,8 @@ en:
|
|
|
1800
1773
|
product_source:
|
|
1801
1774
|
group: From product group
|
|
1802
1775
|
manual: Manually choose
|
|
1776
|
+
product_without_default_price_info: 'This Product has no price in the default currency (%{default_currency}).'
|
|
1777
|
+
product_without_default_price_cta: 'Please, create a Master Price!'
|
|
1803
1778
|
products: Products
|
|
1804
1779
|
promotion: Promotion
|
|
1805
1780
|
promotion_action: Promotion Action
|
|
@@ -1984,7 +1959,6 @@ en:
|
|
|
1984
1959
|
ready: Ready
|
|
1985
1960
|
shipped: Shipped
|
|
1986
1961
|
shipment_transfer_error: There was an error transferring variants
|
|
1987
|
-
shipment_transfer_success: Variants successfully transferred
|
|
1988
1962
|
shipments: Shipments
|
|
1989
1963
|
shipped: Shipped
|
|
1990
1964
|
shipped_at: Shipped At
|
|
@@ -2050,7 +2024,6 @@ en:
|
|
|
2050
2024
|
order to manage stock.
|
|
2051
2025
|
stock_movements: Stock Movements
|
|
2052
2026
|
stock_movements_for_stock_location: Stock Movements for %{stock_location_name}
|
|
2053
|
-
stock_not_below_zero: Stock must not be below zero.
|
|
2054
2027
|
stock_successfully_transferred: Stock was successfully transferred between locations.
|
|
2055
2028
|
stop: Stop
|
|
2056
2029
|
store: Store
|
|
@@ -2133,7 +2106,7 @@ en:
|
|
|
2133
2106
|
message: If you have received this email, then your email settings are correct.
|
|
2134
2107
|
subject: Test Mail
|
|
2135
2108
|
test_mode: Test Mode
|
|
2136
|
-
thank_you_for_your_order: Thank you for your business.
|
|
2109
|
+
thank_you_for_your_order: Thank you for your business. Please print out a copy
|
|
2137
2110
|
of this confirmation page for your records.
|
|
2138
2111
|
there_are_no_items_for_this_order: There are no items for this order. Please add
|
|
2139
2112
|
an item to the order to continue.
|
|
@@ -16,6 +16,7 @@ Spree::StoreCreditType.create_with(priority: 1).find_or_create_by!(name: Spree::
|
|
|
16
16
|
Spree::StoreCreditType.create_with(priority: 2).find_or_create_by!(name: Spree::StoreCreditType::NON_EXPIRING)
|
|
17
17
|
|
|
18
18
|
Spree::ReimbursementType.create_with(name: "Store Credit").find_or_create_by!(type: 'Spree::ReimbursementType::StoreCredit')
|
|
19
|
+
Spree::ReimbursementType.create_with(name: "Original").find_or_create_by!(type: 'Spree::ReimbursementType::OriginalPayment')
|
|
19
20
|
|
|
20
21
|
Spree::StoreCreditCategory.find_or_create_by!(name: 'Gift Card')
|
|
21
22
|
|
data/db/migrate/20161123154034_add_available_to_users_and_remove_display_on_from_shipping_methods.rb
CHANGED
|
@@ -13,7 +13,7 @@ class AddAvailableToUsersAndRemoveDisplayOnFromShippingMethods < ActiveRecord::M
|
|
|
13
13
|
add_column(:spree_shipping_methods, :display_on, :string)
|
|
14
14
|
execute("UPDATE spree_shipping_methods "\
|
|
15
15
|
"SET display_on='both' "\
|
|
16
|
-
"WHERE (available_to_users=#{quoted_true}")
|
|
16
|
+
"WHERE (available_to_users=#{quoted_true})")
|
|
17
17
|
execute("UPDATE spree_shipping_methods "\
|
|
18
18
|
"SET display_on='back_end' "\
|
|
19
19
|
"WHERE (available_to_users=#{quoted_false})")
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class RenameBogusGateways < ActiveRecord::Migration[5.0]
|
|
4
|
+
# This migration was only performing a data migration useful updating to
|
|
5
|
+
# Solidus v2.3.
|
|
6
|
+
# Once the update is done, this is no more required to run so we can clean
|
|
7
|
+
# this file to just be a noop.
|
|
8
|
+
# For more info on the original content see:
|
|
9
|
+
# https://github.com/solidusio/solidus/pull/2001
|
|
10
|
+
|
|
4
11
|
def up
|
|
5
|
-
|
|
6
|
-
say_with_time 'Renaming bogus gateways into payment methods' do
|
|
7
|
-
Solidus::Migrations::RenameGateways.new.up
|
|
8
|
-
end
|
|
12
|
+
# no-op
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
def down
|
|
12
|
-
|
|
13
|
-
say_with_time 'Renaming bogus payment methods into gateways' do
|
|
14
|
-
Solidus::Migrations::RenameGateways.new.down
|
|
15
|
-
end
|
|
16
|
+
# no-op
|
|
16
17
|
end
|
|
17
18
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class DropSpreeStoreCreditUpdateReasons < ActiveRecord::Migration[5.1]
|
|
4
|
+
# This migration should run in a subsequent deploy after 20180710170104
|
|
5
|
+
# has been already deployed. See also migration 20180710170104.
|
|
6
|
+
|
|
7
|
+
# We can't add back the table in a `down` method here: a previous version
|
|
8
|
+
# of migration 20180710170104 would fail with `table already exists` , as
|
|
9
|
+
# it handles itself the add/remove of this table and column.
|
|
10
|
+
def up
|
|
11
|
+
if table_exists? :spree_store_credit_update_reasons
|
|
12
|
+
drop_table :spree_store_credit_update_reasons
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if column_exists? :spree_store_credit_events, :update_reason_id
|
|
16
|
+
remove_column :spree_store_credit_events, :update_reason_id
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|