spree_core 5.4.0.beta → 5.4.0.beta2
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/finders/spree/products/find.rb +1 -28
- data/app/helpers/spree/base_helper.rb +1 -54
- data/app/mailers/spree/base_mailer.rb +4 -3
- data/app/models/concerns/spree/adjustment_source.rb +0 -8
- data/app/models/concerns/spree/admin_user_methods.rb +0 -2
- data/app/models/concerns/spree/image_methods.rb +4 -0
- data/app/models/concerns/spree/metadata.rb +10 -0
- data/app/models/concerns/spree/product_scopes.rb +2 -47
- data/app/models/concerns/spree/stores/markets.rb +7 -7
- data/app/models/concerns/spree/vat_price_calculation.rb +2 -2
- data/app/models/spree/ability.rb +5 -5
- data/app/models/spree/address.rb +3 -2
- data/app/models/spree/adjustable/promotion_accumulator.rb +1 -1
- data/app/models/spree/adjustment.rb +1 -20
- data/app/models/spree/api_key.rb +57 -2
- data/app/models/spree/country.rb +7 -3
- data/app/models/spree/credit_card.rb +0 -27
- data/app/models/spree/current.rb +38 -2
- data/app/models/spree/exports/products.rb +0 -6
- data/app/models/spree/gateway/bogus.rb +9 -9
- data/app/models/spree/gateway.rb +0 -3
- data/app/models/spree/gift_card_batch.rb +4 -0
- data/app/models/spree/image/configuration/active_storage.rb +0 -2
- data/app/models/spree/image.rb +7 -31
- data/app/models/spree/log_entry.rb +8 -5
- data/app/models/spree/order/checkout.rb +0 -18
- data/app/models/spree/order.rb +20 -11
- data/app/models/spree/payment/gateway_options.rb +2 -2
- data/app/models/spree/payment/processing.rb +5 -5
- data/app/models/spree/payment.rb +1 -1
- data/app/models/spree/payment_connection_error.rb +3 -0
- data/app/models/spree/payment_method/check.rb +1 -1
- data/app/models/spree/payment_method/store_credit.rb +5 -5
- data/app/models/spree/payment_response.rb +70 -0
- data/app/models/spree/permission_sets/default_customer.rb +0 -5
- data/app/models/spree/permission_sets/product_display.rb +0 -2
- data/app/models/spree/permission_sets/product_management.rb +0 -2
- data/app/models/spree/product.rb +4 -72
- data/app/models/spree/promotion.rb +2 -14
- data/app/models/spree/promotion_handler/coupon.rb +3 -3
- data/app/models/spree/prototype.rb +0 -3
- data/app/models/spree/refund.rb +6 -2
- data/app/models/spree/shipment/emails.rb +1 -0
- data/app/models/spree/shipping_category.rb +3 -3
- data/app/models/spree/store.rb +10 -49
- data/app/models/spree/store_credit.rb +4 -0
- data/app/models/spree/tax_category.rb +1 -11
- data/app/models/spree/taxon.rb +0 -16
- data/app/models/spree/variant.rb +2 -40
- data/app/models/spree/zone.rb +1 -4
- data/app/services/spree/cart/add_item.rb +8 -4
- data/app/services/spree/cart/create.rb +13 -2
- data/app/services/spree/products/duplicator.rb +0 -12
- data/app/services/spree/products/prepare_nested_attributes.rb +0 -12
- data/config/locales/en.yml +3 -20
- data/db/migrate/20210914000000_spree_four_three.rb +0 -38
- data/db/migrate/20210915064329_add_metadata_to_spree_multiple_tables.rb +0 -1
- data/db/migrate/20260226000000_add_locale_to_spree_orders.rb +5 -0
- data/db/migrate/20260226100000_add_token_digest_to_spree_api_keys.rb +21 -0
- data/lib/generators/spree/cursor_rules/templates/spree_rules.mdc +1 -3
- data/lib/spree/core/configuration.rb +0 -3
- data/lib/spree/core/controller_helpers/strong_parameters.rb +1 -2
- data/lib/spree/core/dependencies.rb +2 -10
- data/lib/spree/core/engine.rb +0 -13
- data/lib/spree/core/pricing/resolver.rb +1 -9
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +10 -25
- data/lib/spree/permitted_attributes.rb +2 -14
- data/lib/spree/testing_support/factories/order_factory.rb +1 -0
- data/lib/spree/testing_support/factories/payment_method_factory.rb +1 -6
- data/lib/spree/testing_support/factories/product_factory.rb +0 -7
- data/lib/spree/testing_support/factories/prototype_factory.rb +0 -2
- data/lib/tasks/core.rake +0 -265
- metadata +8 -101
- data/app/finders/spree/posts/find.rb +0 -137
- data/app/finders/spree/product_properties/find_available.rb +0 -20
- data/app/helpers/spree/mail_helper.rb +0 -27
- data/app/jobs/spree/api_key_touch_job.rb +0 -9
- data/app/mailers/spree/test_mailer.rb +0 -8
- data/app/models/action_text/video_embed.rb +0 -13
- data/app/models/concerns/spree/has_one_link.rb +0 -42
- data/app/models/concerns/spree/linkable.rb +0 -9
- data/app/models/concerns/spree/previewable.rb +0 -17
- data/app/models/spree/data_feed/google.rb +0 -15
- data/app/models/spree/data_feed.rb +0 -42
- data/app/models/spree/gateway/bogus_simple.rb +0 -24
- data/app/models/spree/post.rb +0 -108
- data/app/models/spree/post_category.rb +0 -46
- data/app/models/spree/product_property.rb +0 -51
- data/app/models/spree/property.rb +0 -86
- data/app/models/spree/property_prototype.rb +0 -9
- data/app/models/spree/store_favicon_image.rb +0 -20
- data/app/models/spree/store_logo.rb +0 -4
- data/app/models/spree/store_mailer_logo.rb +0 -7
- data/app/models/spree/taxon_image/configuration/active_storage.rb +0 -26
- data/app/models/spree/taxon_image.rb +0 -28
- data/app/presenters/spree/filters/properties_presenter.rb +0 -23
- data/app/presenters/spree/filters/property_presenter.rb +0 -42
- data/app/services/spree/data_feeds/google/optional_attributes.rb +0 -23
- data/app/services/spree/data_feeds/google/optional_sub_attributes.rb +0 -21
- data/app/services/spree/data_feeds/google/products_list.rb +0 -14
- data/app/services/spree/data_feeds/google/required_attributes.rb +0 -68
- data/app/services/spree/data_feeds/google/rss.rb +0 -109
- data/app/sorters/spree/posts/sort.rb +0 -40
- data/app/views/action_text/video_embeds/_thumbnail.html.erb +0 -1
- data/app/views/action_text/video_embeds/_video_embed.html.erb +0 -3
- data/app/views/layouts/action_text/contents/_content.html.erb +0 -3
- data/app/views/spree/test_mailer/test_email.html.erb +0 -40
- data/app/views/spree/test_mailer/test_email.text.erb +0 -4
- data/config/initializers/oembed.rb +0 -1
- data/db/migrate/20221229132350_create_spree_data_feed_settings.rb +0 -14
- data/db/migrate/20230109084253_create_product_property_translations.rb +0 -24
- data/db/migrate/20230109105943_create_property_translations.rb +0 -24
- data/db/migrate/20230415155958_rename_data_feed_settings_table.rb +0 -5
- data/db/migrate/20230415160828_rename_data_feed_table_columns.rb +0 -7
- data/db/migrate/20230415161226_add_indexes_to_data_feeds_table.rb +0 -5
- data/db/migrate/20230512094803_rename_data_feeds_column_provider_to_type.rb +0 -5
- data/db/migrate/20240914153106_add_display_on_to_spree_properties.rb +0 -5
- data/db/migrate/20240915144935_add_position_to_spree_properties.rb +0 -6
- data/db/migrate/20250121160028_create_spree_posts_and_spree_post_categories.rb +0 -33
- data/db/migrate/20250127083740_add_kind_to_spree_properties.rb +0 -5
- data/db/migrate/20250217171018_create_action_text_video_embeds.rb +0 -11
- data/db/migrate/20250305121657_remove_spree_posts_indices.rb +0 -7
- data/db/migrate/20250730154601_add_unique_index_on_spree_properties_name.rb +0 -24
- data/db/sample_data/posts.rb +0 -7
- data/lib/spree/core/controller_helpers/search.rb +0 -17
- data/lib/spree/core/product_filters.rb +0 -218
- data/lib/spree/core/query_filters/comparable.rb +0 -50
- data/lib/spree/core/query_filters/date.rb +0 -8
- data/lib/spree/core/query_filters/number.rb +0 -8
- data/lib/spree/core/query_filters/text.rb +0 -36
- data/lib/spree/core/query_filters.rb +0 -11
- data/lib/spree/core/search/base.rb +0 -144
- data/lib/spree/testing_support/factories/favicon_image_factory.rb +0 -9
- data/lib/spree/testing_support/factories/google_data_feed_factory.rb +0 -7
- data/lib/spree/testing_support/factories/post_category_factory.rb +0 -7
- data/lib/spree/testing_support/factories/post_factory.rb +0 -22
- data/lib/spree/testing_support/factories/product_property_factory.rb +0 -7
- data/lib/spree/testing_support/factories/property_factory.rb +0 -28
- data/lib/spree/testing_support/factories/taxon_image_factory.rb +0 -9
- data/lib/spree/testing_support/flash.rb +0 -25
- data/lib/spree/testing_support/flatpickr_capybara.rb +0 -124
- data/lib/tasks/exchanges.rake +0 -66
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module TestingSupport
|
|
3
|
-
module FlatpickrCapybara
|
|
4
|
-
def fill_in_date_manually(label_text, options = {})
|
|
5
|
-
with_open_flatpickr(label_text) do |field|
|
|
6
|
-
fill_in field[:id], with: string_date(options)
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def fill_in_date_picker(label_text, options = {})
|
|
11
|
-
if options[:hour].blank? && options[:minute].blank?
|
|
12
|
-
flatpickr_date_only(label_text, options)
|
|
13
|
-
else
|
|
14
|
-
flatpickr_date_time(label_text, options)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def fill_in_date_with_js(label_text, options = {})
|
|
19
|
-
date_field = find("input[id='#{label_text}']")
|
|
20
|
-
script = "document.querySelector('#{date_field}').flatpickr().setDate('#{string_date(options)}');"
|
|
21
|
-
|
|
22
|
-
page.execute_script(script)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def flatpickr_date_only(label_text, options = {})
|
|
28
|
-
within_open_flatpickr(label_text) do
|
|
29
|
-
within_flatpickr_months do
|
|
30
|
-
fill_in_flatpickr_year(options[:year].to_i)
|
|
31
|
-
sleep(0.25) # Pause to let JavaScript adjust the month selector in the flatpickr cal in relation to any related FROM...TO cal.
|
|
32
|
-
|
|
33
|
-
select_flatpickr_month(options[:month].to_i)
|
|
34
|
-
sleep(0.25) # Pause to let JavaScript adjust the day selection area in the flatpickr cal in relation to any related FROM...TO cal.
|
|
35
|
-
|
|
36
|
-
click_on_flatpickr_day(options[:day].to_i)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def flatpickr_date_time(label_text, options = {})
|
|
42
|
-
within_open_flatpickr(label_text) do
|
|
43
|
-
within_flatpickr_months do
|
|
44
|
-
fill_in_flatpickr_year(options[:year].to_i)
|
|
45
|
-
sleep(0.25) # Pause to let JavaScript adjust the month selector in the flatpickr cal in relation to any related FROM...TO cal.
|
|
46
|
-
|
|
47
|
-
select_flatpickr_month(options[:month].to_i)
|
|
48
|
-
sleep(0.25) # Pause to let JavaScript adjust the day selection area in the flatpickr cal in relation to any related FROM...TO cal.
|
|
49
|
-
|
|
50
|
-
click_on_flatpickr_day(options[:day].to_i)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
within_flatpickr_time do
|
|
54
|
-
select_flatpickr_hour(options[:hour].to_i)
|
|
55
|
-
select_flatpickr_min(options[:minute].to_i)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def with_open_flatpickr(label_text)
|
|
61
|
-
field_label = find_field(id: label_text, type: :hidden)
|
|
62
|
-
|
|
63
|
-
date_field = field_label.sibling('.flatpickr-alt-input')
|
|
64
|
-
date_field.click # Open the flatpickr cal.
|
|
65
|
-
sleep(0.25) # Pause to let JavaScript populate DOM with an open flatpickr cal.
|
|
66
|
-
|
|
67
|
-
yield(date_field) # Complete required action within the open flatpickr cal.
|
|
68
|
-
|
|
69
|
-
date_field.send_keys :tab # Close the date flatpickr cal.
|
|
70
|
-
sleep(0.25) # Pause to let JavaScript adjust any DOM values in relation to any related FROM...TO cal.
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def within_open_flatpickr(label_text, &block)
|
|
74
|
-
with_open_flatpickr(label_text) do
|
|
75
|
-
within find('.flatpickr-calendar.open', &block)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def within_flatpickr_months(&block)
|
|
80
|
-
within find('.flatpickr-months > .flatpickr-month > .flatpickr-current-month', &block)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def within_flatpickr_time(&block)
|
|
84
|
-
within find('.flatpickr-time', &block)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def select_flatpickr_month(month)
|
|
88
|
-
accurate_month = (month.to_i - 1)
|
|
89
|
-
|
|
90
|
-
find("select.flatpickr-monthDropdown-months > option[value='#{accurate_month}']").select_option
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def fill_in_flatpickr_year(year)
|
|
94
|
-
find('input.cur-year').set(year)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def click_on_flatpickr_day(day)
|
|
98
|
-
within_flatpickr_days do
|
|
99
|
-
find('.flatpickr-day:not(.prevMonthDay):not(.nextMonthDay)', text: day, exact_text: true).click
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def within_flatpickr_days(&block)
|
|
104
|
-
within find('.flatpickr-innerContainer > .flatpickr-rContainer > .flatpickr-days > .dayContainer', &block)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def select_flatpickr_hour(hour)
|
|
108
|
-
find('input.flatpickr-hour').set(hour)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def select_flatpickr_min(min)
|
|
112
|
-
find('input.flatpickr-minute').set(min)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def string_date(options)
|
|
116
|
-
if options[:hour].present? && options[:minute].present?
|
|
117
|
-
"#{options[:year]}-#{options[:month]}-#{options[:day]}-#{options[:hour]}-#{options[:minute]}"
|
|
118
|
-
else
|
|
119
|
-
"#{options[:year]}-#{options[:month]}-#{options[:day]}"
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
end
|
data/lib/tasks/exchanges.rake
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
namespace :exchanges do
|
|
2
|
-
desc %q{Takes unreturned exchanged items and creates a new order to charge
|
|
3
|
-
the customer for not returning them}
|
|
4
|
-
task charge_unreturned_items: :environment do
|
|
5
|
-
unreturned_return_items_scope = Spree::ReturnItem.awaiting_return.exchange_processed
|
|
6
|
-
unreturned_return_items = unreturned_return_items_scope.joins(:exchange_inventory_units).where([
|
|
7
|
-
'spree_inventory_units.created_at < :days_ago AND spree_inventory_units.state = :iu_state',
|
|
8
|
-
days_ago: Spree::Config[:expedited_exchanges_days_window].days.ago, iu_state: 'shipped'
|
|
9
|
-
]).distinct.to_a
|
|
10
|
-
|
|
11
|
-
# Determine that a return item has already been deemed unreturned and therefore charged
|
|
12
|
-
# by the fact that its exchange inventory unit has popped off to a different order
|
|
13
|
-
unreturned_return_items.select! { |ri| ri.exchange_inventory_units.exists?(order_id: ri.inventory_unit.order_id) }
|
|
14
|
-
|
|
15
|
-
failed_orders = []
|
|
16
|
-
|
|
17
|
-
unreturned_return_items.group_by(&:exchange_shipments).each do |shipments, return_items|
|
|
18
|
-
original_order = shipments.first.order
|
|
19
|
-
order_attributes = {
|
|
20
|
-
bill_address: original_order.bill_address,
|
|
21
|
-
ship_address: original_order.ship_address,
|
|
22
|
-
email: original_order.email
|
|
23
|
-
}
|
|
24
|
-
order_attributes[:store_id] = original_order.store_id
|
|
25
|
-
order = Spree::Order.create!(order_attributes)
|
|
26
|
-
|
|
27
|
-
order.associate_user!(original_order.user) if original_order.user
|
|
28
|
-
|
|
29
|
-
return_items.group_by(&:exchange_variant).map do |variant, variant_return_items|
|
|
30
|
-
variant_inventory_units = variant_return_items.map(&:exchange_inventory_units).flatten
|
|
31
|
-
line_item = Spree::LineItem.create!(variant: variant, quantity: variant_return_items.count, order: order)
|
|
32
|
-
variant_inventory_units.each { |i| i.update!(line_item_id: line_item.id, order_id: order.id) }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
order.reload.update_with_updater!
|
|
36
|
-
while order.state != order.checkout_steps[-2] && order.next; end
|
|
37
|
-
|
|
38
|
-
unless order.payments.present?
|
|
39
|
-
card_to_reuse = original_order.valid_credit_cards.first
|
|
40
|
-
card_to_reuse = original_order.user.credit_cards.default.first if !card_to_reuse && original_order.user
|
|
41
|
-
Spree::Payment.create!(order: order,
|
|
42
|
-
payment_method_id: card_to_reuse.try(:payment_method_id),
|
|
43
|
-
source: card_to_reuse,
|
|
44
|
-
amount: order.total)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# the order builds a shipment on its own on transition to delivery, but we want
|
|
48
|
-
# the original exchange shipment, not the built one
|
|
49
|
-
order.shipments.destroy_all
|
|
50
|
-
shipments.each { |shipment| shipment.update(order_id: order.id) }
|
|
51
|
-
order.update!(state: 'confirm')
|
|
52
|
-
|
|
53
|
-
order.reload.next!
|
|
54
|
-
order.update_with_updater!
|
|
55
|
-
order.finalize!
|
|
56
|
-
|
|
57
|
-
failed_orders << order unless order.completed? && order.valid?
|
|
58
|
-
rescue StandardError
|
|
59
|
-
failed_orders << order
|
|
60
|
-
end
|
|
61
|
-
failure_message = failed_orders.map { |o| "#{o.number} - #{o.errors.full_messages}" }.join(', ')
|
|
62
|
-
raise UnableToChargeForUnreturnedItems, failure_message if failed_orders.present?
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
class UnableToChargeForUnreturnedItems < StandardError; end
|