spree_core 6.0.4 → 6.0.6
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/jobs/spree/imports/create_rows_job.rb +4 -2
- data/app/jobs/spree/imports/process_rows_job.rb +4 -2
- data/app/jobs/spree/payments/handle_modification_webhook_job.rb +93 -0
- data/app/jobs/spree/payments/handle_webhook_job.rb +4 -2
- data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
- data/app/jobs/spree/search_provider/index_job.rb +8 -0
- data/app/jobs/spree/search_provider/remove_job.rb +3 -0
- data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
- data/app/mailers/spree/base_mailer.rb +1 -1
- data/app/maintenance_tasks/spree/maintenance_tasks/upgrade/backfill_settlement_statuses.rb +40 -0
- data/app/models/concerns/spree/acted_by.rb +2 -2
- data/app/models/concerns/spree/customer_methods.rb +7 -5
- data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
- data/app/models/concerns/spree/derived_number.rb +1 -1
- data/app/models/concerns/spree/has_custom_fields.rb +12 -10
- data/app/models/concerns/spree/integrations_concern.rb +5 -3
- data/app/models/concerns/spree/label_translatable.rb +4 -4
- data/app/models/concerns/spree/metadata.rb +3 -3
- data/app/models/concerns/spree/presentation_translatable.rb +1 -1
- data/app/models/concerns/spree/product_scopes.rb +5 -2
- data/app/models/concerns/spree/purchase/addresses.rb +8 -5
- data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
- data/app/models/concerns/spree/purchase/payment_processing.rb +11 -0
- data/app/models/concerns/spree/purchase/purchase_order.rb +21 -0
- data/app/models/concerns/spree/purchase/totals.rb +3 -2
- data/app/models/concerns/spree/ransackable_attributes.rb +81 -4
- data/app/models/concerns/spree/settlement_status.rb +29 -0
- data/app/models/concerns/spree/stores/markets.rb +4 -32
- data/app/models/concerns/spree/user_address.rb +5 -2
- data/app/models/concerns/spree/user_methods.rb +2 -2
- data/app/models/spree/address.rb +29 -14
- data/app/models/spree/asset.rb +3 -3
- data/app/models/spree/base.rb +4 -4
- data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
- data/app/models/spree/cart.rb +2 -2
- data/app/models/spree/category.rb +61 -38
- data/app/models/spree/classification.rb +2 -2
- data/app/models/spree/collection_rule.rb +5 -1
- data/app/models/spree/current.rb +19 -0
- data/app/models/spree/custom_field.rb +6 -6
- data/app/models/spree/custom_field_definition.rb +10 -7
- data/app/models/spree/delivery_method.rb +21 -15
- data/app/models/spree/delivery_rate.rb +1 -1
- data/app/models/spree/digital.rb +1 -1
- data/app/models/spree/digital_asset.rb +2 -2
- data/app/models/spree/digital_link.rb +4 -4
- data/app/models/spree/export.rb +32 -3
- data/app/models/spree/exports/products.rb +9 -1
- data/app/models/spree/fulfillment/custom_events.rb +18 -10
- data/app/models/spree/fulfillment.rb +53 -29
- data/app/models/spree/fulfillment_group.rb +2 -2
- data/app/models/spree/fulfillment_item.rb +3 -3
- data/app/models/spree/fulfilment_changer.rb +1 -1
- data/app/models/spree/gateway/bogus.rb +41 -2
- data/app/models/spree/gift_card.rb +26 -14
- data/app/models/spree/import.rb +23 -15
- data/app/models/spree/import_row.rb +6 -6
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/invitation.rb +8 -4
- data/app/models/spree/line_item.rb +10 -8
- data/app/models/spree/media.rb +3 -3
- data/app/models/spree/metafield.rb +1 -1
- data/app/models/spree/metafield_definition.rb +1 -1
- data/app/models/spree/metafields.rb +2 -2
- data/app/models/spree/option_type.rb +27 -0
- data/app/models/spree/option_value.rb +3 -3
- data/app/models/spree/order.rb +97 -49
- data/app/models/spree/order_group.rb +2 -2
- data/app/models/spree/order_inventory.rb +2 -2
- data/app/models/spree/order_merger.rb +2 -2
- data/app/models/spree/order_updater.rb +34 -20
- data/app/models/spree/payment/custom_events.rb +2 -1
- data/app/models/spree/payment/processing.rb +20 -3
- data/app/models/spree/payment.rb +194 -15
- data/app/models/spree/payment_capture_event.rb +2 -0
- data/app/models/spree/payment_method/store_credit.rb +6 -0
- data/app/models/spree/payment_method.rb +65 -11
- data/app/models/spree/payment_response.rb +19 -0
- data/app/models/spree/payment_session.rb +15 -3
- data/app/models/spree/payment_split.rb +14 -2
- data/app/models/spree/price.rb +20 -8
- data/app/models/spree/price_list.rb +12 -6
- data/app/models/spree/price_rules/zone_rule.rb +1 -1
- data/app/models/spree/product.rb +30 -28
- data/app/models/spree/product_category.rb +3 -3
- data/app/models/spree/promotion/rules/category.rb +27 -10
- data/app/models/spree/promotion/rules/country.rb +1 -1
- data/app/models/spree/promotion/rules/taxon.rb +4 -2
- data/app/models/spree/promotion/rules/user.rb +1 -1
- data/app/models/spree/promotion_action.rb +1 -1
- data/app/models/spree/promotion_rule_category.rb +5 -5
- data/app/models/spree/promotion_rule_taxon.rb +2 -2
- data/app/models/spree/prototype.rb +4 -1
- data/app/models/spree/purchase_order.rb +20 -3
- data/app/models/spree/refund.rb +7 -1
- data/app/models/spree/return.rb +7 -1
- data/app/models/spree/return_authorization_reason.rb +3 -3
- data/app/models/spree/return_reason.rb +1 -1
- data/app/models/spree/search_provider/base.rb +12 -2
- data/app/models/spree/search_provider/database.rb +8 -5
- data/app/models/spree/search_provider.rb +7 -5
- data/app/models/spree/shipment.rb +4 -1
- data/app/models/spree/shipping_method.rb +4 -1
- data/app/models/spree/shipping_rate.rb +1 -1
- data/app/models/spree/stock/coordinator.rb +2 -2
- data/app/models/spree/stock/estimator.rb +7 -5
- data/app/models/spree/stock/package.rb +10 -8
- data/app/models/spree/stock_item.rb +1 -1
- data/app/models/spree/stock_level/custom_events.rb +1 -1
- data/app/models/spree/stock_level.rb +1 -1
- data/app/models/spree/stock_location.rb +12 -8
- data/app/models/spree/stock_movement.rb +6 -6
- data/app/models/spree/stock_reservation.rb +5 -5
- data/app/models/spree/store.rb +64 -16
- data/app/models/spree/store_credit.rb +3 -3
- data/app/models/spree/store_credit_category.rb +5 -5
- data/app/models/spree/store_credit_type.rb +2 -2
- data/app/models/spree/subscriber.rb +7 -7
- data/app/models/spree/tax_rate.rb +5 -5
- data/app/models/spree/taxon.rb +3 -3
- data/app/models/spree/taxon_rule.rb +2 -2
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/variant.rb +45 -10
- data/app/models/spree/variant_media.rb +1 -1
- data/app/models/spree/wished_item.rb +1 -1
- data/app/models/spree/wishlist.rb +2 -2
- data/app/models/spree/wishlist_item/custom_events.rb +2 -2
- data/app/models/spree/zone.rb +1 -1
- data/app/models/spree/zone_member.rb +1 -1
- data/app/presenters/spree/csv/product_variant_presenter.rb +17 -8
- data/app/serializers/spree/emails/store_serializer.rb +1 -1
- data/app/services/spree/carts/associate.rb +6 -2
- data/app/services/spree/carts/create.rb +1 -1
- data/app/services/spree/carts/destroy.rb +1 -1
- data/app/services/spree/carts/remove_item.rb +1 -1
- data/app/services/spree/carts/remove_line_item.rb +2 -2
- data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
- data/app/services/spree/carts/set_quantity.rb +2 -2
- data/app/services/spree/carts/split_by_seller.rb +4 -13
- data/app/services/spree/carts/update.rb +17 -0
- data/app/services/spree/checkout/add_store_credit.rb +3 -3
- data/app/services/spree/checkout/remove_store_credit.rb +2 -2
- data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
- data/app/services/spree/orders/approve.rb +3 -3
- data/app/services/spree/orders/create_from_cart.rb +2 -0
- data/app/services/spree/orders/create_user_account.rb +2 -2
- data/app/services/spree/orders/update_statuses.rb +4 -2
- data/app/services/spree/products/auto_match_taxons.rb +5 -2
- data/app/services/spree/shipments/update.rb +2 -2
- data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
- data/app/services/spree/stock_reservations/extend.rb +3 -1
- data/app/services/spree/stock_reservations/reserve.rb +3 -1
- data/app/services/spree/store_credits/apply.rb +1 -1
- data/app/services/spree/taxons/add_products.rb +4 -2
- data/app/services/spree/taxons/regenerate_products.rb +5 -2
- data/app/services/spree/taxons/remove_products.rb +4 -2
- data/app/subscribers/spree/order_status_subscriber.rb +4 -3
- data/app/subscribers/spree/payment_split_subscriber.rb +39 -21
- data/app/subscribers/spree/seller_transfer_reversal_subscriber.rb +19 -7
- data/app/tools/spree/agent_tools/query_report.rb +116 -14
- data/app/workflows/spree/carts/add_item.rb +1 -1
- data/app/workflows/spree/carts/complete.rb +1 -19
- data/app/workflows/spree/carts/recalculate.rb +1 -1
- data/app/workflows/spree/carts/recalculate_totals.rb +3 -3
- data/app/workflows/spree/fulfillments/update.rb +1 -1
- data/app/workflows/spree/orders/cancel.rb +22 -1
- data/app/workflows/spree/orders/complete.rb +7 -1
- data/app/workflows/spree/payments/capture.rb +101 -7
- data/app/workflows/spree/payments/handle_modification_webhook.rb +218 -0
- data/app/workflows/spree/payments/handle_webhook.rb +7 -1
- data/app/workflows/spree/payments/process.rb +47 -4
- data/app/workflows/spree/payments/void.rb +4 -1
- data/app/workflows/spree/products/approve.rb +17 -0
- data/app/workflows/spree/refunds/create.rb +10 -1
- data/app/workflows/spree/refunds/order_payments.rb +3 -1
- data/app/workflows/spree/seller_transfers/create.rb +1 -1
- data/config/locales/be.yml +2 -2
- data/config/locales/bg.yml +4 -4
- data/config/locales/en.yml +12 -0
- data/config/locales/ru.yml +3 -3
- data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
- data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
- data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
- data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
- data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
- data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
- data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
- data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
- data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
- data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
- data/db/migrate/20261116100001_add_status_to_spree_payment_capture_events_and_refunds.rb +17 -0
- data/lib/spree/agent_tool.rb +11 -4
- data/lib/spree/agent_tools/default_catalog.rb +2 -2
- data/lib/spree/agent_tools/legacy_tools.rb +1 -1
- data/lib/spree/core/dependencies.rb +11 -10
- data/lib/spree/core/engine.rb +4 -0
- data/lib/spree/core/number_generator.rb +4 -3
- data/lib/spree/core/preferences/preferable.rb +1 -1
- data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
- data/lib/spree/core/pricing/resolver.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +37 -10
- data/lib/spree/i18n.rb +6 -2
- data/lib/spree/localized_number.rb +1 -1
- data/lib/spree/removed_apis.rb +274 -0
- data/lib/spree/reporting/adapters/live.rb +69 -8
- data/lib/spree/reporting/default_vocabulary.rb +11 -5
- data/lib/spree/reporting/query.rb +4 -1
- data/lib/spree/reporting/registry.rb +50 -3
- data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
- data/lib/spree/testing_support/factories/payment_capture_event_factory.rb +10 -0
- data/lib/spree/testing_support/factories/refund_factory.rb +10 -0
- data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
- data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
- data/lib/spree/testing_support/i18n.rb +7 -2
- data/lib/spree/testing_support/order_walkthrough.rb +5 -2
- data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +71 -14
- data/lib/tasks/carts_migration.rake +1 -1
- data/lib/tasks/categories_and_collections.rake +1 -1
- data/lib/tasks/deliveries_migration.rake +1 -1
- data/lib/tasks/delivery_method_rules_migration.rake +1 -1
- data/lib/tasks/delivery_migration.rake +1 -1
- data/lib/tasks/delivery_profiles_migration.rake +2 -2
- data/lib/tasks/fold_store_credit_categories.rake +1 -1
- data/lib/tasks/migrate_country_state_codes.rake +1 -1
- data/lib/tasks/migrate_returns.rake +4 -4
- data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
- data/lib/tasks/store_settings.rake +1 -1
- data/lib/tasks/typed_stock_movements_migration.rake +1 -1
- metadata +26 -6
data/app/models/spree/store.rb
CHANGED
|
@@ -32,6 +32,11 @@ module Spree
|
|
|
32
32
|
acts_as_paranoid
|
|
33
33
|
friendly_id :code, use: [:slugged], slug_column: :code, routes: :normal
|
|
34
34
|
|
|
35
|
+
# Headless storefronts cache the store's name, SEO fields and logo, and
|
|
36
|
+
# expire them on `store.updated`. An installation runs one store, which is
|
|
37
|
+
# never created or deleted while live, so those events are left out.
|
|
38
|
+
publishes_lifecycle_events only: [:update]
|
|
39
|
+
|
|
35
40
|
#
|
|
36
41
|
# Translations
|
|
37
42
|
#
|
|
@@ -262,7 +267,7 @@ module Spree
|
|
|
262
267
|
has_many :store_credits, class_name: 'Spree::StoreCredit'
|
|
263
268
|
has_many :store_credit_events, through: :store_credits, class_name: 'Spree::StoreCreditEvent'
|
|
264
269
|
|
|
265
|
-
# @deprecated Taxonomy is data-only in 6.0 and dropped in 6.
|
|
270
|
+
# @deprecated Taxonomy is data-only in 6.0 and dropped in 6.3; use #categories.
|
|
266
271
|
has_many :taxonomies, class_name: 'Spree::Taxonomy', deprecated: true
|
|
267
272
|
has_many :categories, class_name: 'Spree::Category'
|
|
268
273
|
has_many :collections, class_name: 'Spree::Collection', dependent: :destroy_async
|
|
@@ -276,20 +281,20 @@ module Spree
|
|
|
276
281
|
has_many :custom_field_definitions, class_name: 'Spree::CustomFieldDefinition',
|
|
277
282
|
inverse_of: :store, dependent: :destroy_async
|
|
278
283
|
|
|
279
|
-
# @deprecated Use #categories; removed in 6.
|
|
284
|
+
# @deprecated Use #categories; removed in 6.3.
|
|
280
285
|
def taxons
|
|
281
|
-
Spree::Deprecation.warn('Spree::Store#taxons is deprecated and will be removed in Spree 6.
|
|
286
|
+
Spree::Deprecation.warn('Spree::Store#taxons is deprecated and will be removed in Spree 6.3. Use #categories instead.')
|
|
282
287
|
categories
|
|
283
288
|
end
|
|
284
289
|
|
|
285
290
|
def taxons=(value)
|
|
286
|
-
Spree::Deprecation.warn('Spree::Store#taxons= is deprecated and will be removed in Spree 6.
|
|
291
|
+
Spree::Deprecation.warn('Spree::Store#taxons= is deprecated and will be removed in Spree 6.3. Use #categories= instead.')
|
|
287
292
|
self.categories = value
|
|
288
293
|
end
|
|
289
294
|
|
|
290
|
-
# @deprecated Use {#stock_levels}; removed in 6.
|
|
295
|
+
# @deprecated Use {#stock_levels}; removed in 6.3.
|
|
291
296
|
def stock_items
|
|
292
|
-
Spree::Deprecation.warn('Spree::Store#stock_items is deprecated and will be removed in Spree 6.
|
|
297
|
+
Spree::Deprecation.warn('Spree::Store#stock_items is deprecated and will be removed in Spree 6.3. Use #stock_levels instead.')
|
|
293
298
|
stock_levels
|
|
294
299
|
end
|
|
295
300
|
|
|
@@ -414,6 +419,26 @@ module Spree
|
|
|
414
419
|
validate :order_number_sequence_start_unchanged_after_first_number, on: :update
|
|
415
420
|
validates :mail_from_address, email: { allow_blank: false }
|
|
416
421
|
validates :customer_support_email, email: { allow_blank: true }
|
|
422
|
+
# Storefronts render these as links, so only a handle, a scheme-less address
|
|
423
|
+
# or an http(s) URL is accepted, never another scheme, a space or an invisible
|
|
424
|
+
# character. Ruby's \s is ASCII-only, hence the Unicode classes.
|
|
425
|
+
# Checked only when the value changes, so a value saved before this rule
|
|
426
|
+
# does not block saving the store's other settings.
|
|
427
|
+
SOCIAL_FIELDS = %i[facebook twitter instagram].freeze
|
|
428
|
+
SOCIAL_FIELD_FORMAT = %r{
|
|
429
|
+
\A(?!(?:.*/)?\.\.(?:/|\z)) # no ".." path segment
|
|
430
|
+
(?:
|
|
431
|
+
https?://[\p{L}\p{N}.-]+(?::\d{1,5})? # a web address: a host (no userinfo) and an optional port
|
|
432
|
+
(?:[/?\#][^[:space:][:cntrl:]\p{Cf}]*)? # then a path, query or fragment
|
|
433
|
+
| (?://[\p{L}\p{N}.-]+(?::\d{1,5})? # a protocol-relative host, where a port is unambiguous
|
|
434
|
+
| @?[\p{L}\p{N}_.-]*[\p{L}\p{N}_][\p{L}\p{N}_.-]*) # or a handle or bare host, never "name:"
|
|
435
|
+
(?:/[^[:space:][:cntrl:]\p{Cf}]*)? # and an optional path
|
|
436
|
+
)\z
|
|
437
|
+
}xi
|
|
438
|
+
normalizes(*SOCIAL_FIELDS, with: ->(value) { value.strip.presence })
|
|
439
|
+
SOCIAL_FIELDS.each do |field|
|
|
440
|
+
validates field, format: { with: SOCIAL_FIELD_FORMAT }, allow_blank: true, if: :"will_save_change_to_#{field}?"
|
|
441
|
+
end
|
|
417
442
|
# FIXME: we should remove this condition in v5
|
|
418
443
|
if !ENV['SPREE_DISABLE_DB_CONNECTION'] &&
|
|
419
444
|
connected? &&
|
|
@@ -499,9 +524,11 @@ module Spree
|
|
|
499
524
|
@default_country_for_market = country
|
|
500
525
|
end
|
|
501
526
|
|
|
502
|
-
# @deprecated Use +default_country_code=+. Removed in 6.
|
|
527
|
+
# @deprecated Use +default_country_code=+. Removed in 6.3.
|
|
503
528
|
def default_country_iso=(code)
|
|
504
|
-
Spree::Deprecation.warn(
|
|
529
|
+
Spree::Deprecation.warn(
|
|
530
|
+
'Spree::Store#default_country_iso= is deprecated and will be removed in Spree 6.3. Use #default_country_code= instead.'
|
|
531
|
+
)
|
|
505
532
|
self.default_country_code = code
|
|
506
533
|
end
|
|
507
534
|
|
|
@@ -713,15 +740,15 @@ module Spree
|
|
|
713
740
|
preferred_capture_method.presence || Spree::CaptureMethod::DEFAULT_CAPTURE_METHOD
|
|
714
741
|
end
|
|
715
742
|
|
|
716
|
-
# @deprecated Use #preferred_capture_method; removed in 6.
|
|
743
|
+
# @deprecated Use #preferred_capture_method; removed in 6.3.
|
|
717
744
|
def preferred_auto_capture
|
|
718
|
-
Spree::Deprecation.warn('Store#preferred_auto_capture is deprecated and will be removed in Spree 6.
|
|
745
|
+
Spree::Deprecation.warn('Store#preferred_auto_capture is deprecated and will be removed in Spree 6.3. Use #preferred_capture_method instead.')
|
|
719
746
|
capture_at_checkout?
|
|
720
747
|
end
|
|
721
748
|
|
|
722
|
-
# @deprecated Use #preferred_capture_method=; removed in 6.
|
|
749
|
+
# @deprecated Use #preferred_capture_method=; removed in 6.3.
|
|
723
750
|
def preferred_auto_capture=(value)
|
|
724
|
-
Spree::Deprecation.warn('Store#preferred_auto_capture= is deprecated and will be removed in Spree 6.
|
|
751
|
+
Spree::Deprecation.warn('Store#preferred_auto_capture= is deprecated and will be removed in Spree 6.3. Use #preferred_capture_method= instead.')
|
|
725
752
|
# Turning it off only says "not at checkout" — it cannot distinguish
|
|
726
753
|
# dispatch from manual, so an existing on_dispatch choice is preserved.
|
|
727
754
|
self.preferred_capture_method = if value.to_b
|
|
@@ -733,15 +760,19 @@ module Spree
|
|
|
733
760
|
end
|
|
734
761
|
end
|
|
735
762
|
|
|
736
|
-
# @deprecated Use #preferred_capture_method; removed in 6.
|
|
763
|
+
# @deprecated Use #preferred_capture_method; removed in 6.3.
|
|
737
764
|
def preferred_auto_capture_on_dispatch
|
|
738
|
-
Spree::Deprecation.warn(
|
|
765
|
+
Spree::Deprecation.warn(
|
|
766
|
+
'Store#preferred_auto_capture_on_dispatch is deprecated and will be removed in Spree 6.3. Use #preferred_capture_method instead.'
|
|
767
|
+
)
|
|
739
768
|
capture_on_dispatch?
|
|
740
769
|
end
|
|
741
770
|
|
|
742
|
-
# @deprecated Use #preferred_capture_method=; removed in 6.
|
|
771
|
+
# @deprecated Use #preferred_capture_method=; removed in 6.3.
|
|
743
772
|
def preferred_auto_capture_on_dispatch=(value)
|
|
744
|
-
Spree::Deprecation.warn(
|
|
773
|
+
Spree::Deprecation.warn(
|
|
774
|
+
'Store#preferred_auto_capture_on_dispatch= is deprecated and will be removed in Spree 6.3. Use #preferred_capture_method= instead.'
|
|
775
|
+
)
|
|
745
776
|
self.preferred_capture_method = if value.to_b
|
|
746
777
|
'on_dispatch'
|
|
747
778
|
elsif capture_on_dispatch?
|
|
@@ -751,8 +782,25 @@ module Spree
|
|
|
751
782
|
end
|
|
752
783
|
end
|
|
753
784
|
|
|
785
|
+
# The payload is the store in its default language, whichever language
|
|
786
|
+
# the change was written in: a translation saved under `de` still
|
|
787
|
+
# announces the store as storefronts show it by default.
|
|
788
|
+
def event_payload_for(event_name, **params)
|
|
789
|
+
Spree::Current.with_content_locale(default_locale) do
|
|
790
|
+
::Mobility.with_locale(default_locale) { super }
|
|
791
|
+
end
|
|
792
|
+
end
|
|
793
|
+
|
|
754
794
|
private
|
|
755
795
|
|
|
796
|
+
# A store's events belong to it, whichever store the caller is working in,
|
|
797
|
+
# so they reach this store's webhook endpoints.
|
|
798
|
+
def in_event_store(&block)
|
|
799
|
+
return block.call if Spree::Current.store == self
|
|
800
|
+
|
|
801
|
+
Spree::Current.with_store(self, &block)
|
|
802
|
+
end
|
|
803
|
+
|
|
756
804
|
# Products without a profile fall back to this one, so it must exist
|
|
757
805
|
# from the store's first moment.
|
|
758
806
|
def create_default_delivery_profile
|
|
@@ -43,9 +43,9 @@ module Spree
|
|
|
43
43
|
|
|
44
44
|
# Redemption order: the oldest credit is spent first.
|
|
45
45
|
scope :oldest_first, -> { order(:created_at, :id) }
|
|
46
|
-
# @deprecated Removed in Spree 6.
|
|
46
|
+
# @deprecated Removed in Spree 6.3 — store credit types are gone; use {.oldest_first}.
|
|
47
47
|
scope :order_by_priority, lambda {
|
|
48
|
-
Spree::Deprecation.warn('Spree::StoreCredit.order_by_priority is deprecated and will be removed in Spree 6.
|
|
48
|
+
Spree::Deprecation.warn('Spree::StoreCredit.order_by_priority is deprecated and will be removed in Spree 6.3. Use .oldest_first instead.')
|
|
49
49
|
oldest_first
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -118,7 +118,7 @@ module Spree
|
|
|
118
118
|
# Two-state scopes: see Spree::Base.ransack_flag? for why the cast is
|
|
119
119
|
# opted out of here and done inside each scope instead.
|
|
120
120
|
def self.ransackable_scopes_skip_sanitize_args
|
|
121
|
-
%
|
|
121
|
+
super | %w[outstanding from_gift_card]
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
def amount_remaining
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Spree
|
|
2
|
-
# @deprecated Removed in Spree 6.
|
|
2
|
+
# @deprecated Removed in Spree 6.3 together with its table. Store credit no
|
|
3
3
|
# longer carries a category — the reason a credit exists lives in
|
|
4
4
|
# {Spree::StoreCredit#originator} (the return, exchange, claim or gift
|
|
5
5
|
# card that issued it) and in its free-text +memo+. The class stays only
|
|
@@ -12,22 +12,22 @@ module Spree
|
|
|
12
12
|
DEFAULT_NON_EXPIRING_TYPES = [GIFT_CARD_CATEGORY_NAME]
|
|
13
13
|
|
|
14
14
|
after_initialize do
|
|
15
|
-
Spree::Deprecation.warn('Spree::StoreCreditCategory is deprecated and will be removed in Spree 6.
|
|
15
|
+
Spree::Deprecation.warn('Spree::StoreCreditCategory is deprecated and will be removed in Spree 6.3. ' \
|
|
16
16
|
'Store credits no longer carry a category — use StoreCredit#originator and #memo instead.')
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
class << self
|
|
20
|
-
# @deprecated Removed in Spree 6.
|
|
20
|
+
# @deprecated Removed in Spree 6.3. Refund workflows no longer set a
|
|
21
21
|
# category on the store credit they issue.
|
|
22
22
|
def default_refund_category(_options = {})
|
|
23
|
-
Spree::Deprecation.warn('Spree::StoreCreditCategory.default_refund_category is deprecated and will be removed in Spree 6.
|
|
23
|
+
Spree::Deprecation.warn('Spree::StoreCreditCategory.default_refund_category is deprecated and will be removed in Spree 6.3. ' \
|
|
24
24
|
'Store credits no longer carry a category.')
|
|
25
25
|
first
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# @deprecated use {.default_refund_category}
|
|
29
29
|
def default_reimbursement_category(options = {})
|
|
30
|
-
Spree::Deprecation.warn('Spree::StoreCreditCategory.default_reimbursement_category is deprecated and will be removed in Spree 6.
|
|
30
|
+
Spree::Deprecation.warn('Spree::StoreCreditCategory.default_reimbursement_category is deprecated and will be removed in Spree 6.3. ' \
|
|
31
31
|
'Store credits no longer carry a category.')
|
|
32
32
|
default_refund_category(options)
|
|
33
33
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Spree
|
|
2
|
-
# @deprecated Removed in Spree 6.
|
|
2
|
+
# @deprecated Removed in Spree 6.3 together with its table. Nothing in Spree
|
|
3
3
|
# ever created a store credit type, so the +priority+ it was meant to
|
|
4
4
|
# provide never drove redemption order; store credits are now spent
|
|
5
5
|
# oldest first ({Spree::StoreCredit.oldest_first}). The class stays only so
|
|
@@ -11,7 +11,7 @@ module Spree
|
|
|
11
11
|
DEFAULT_TYPE_NAME = 'Expiring'.freeze
|
|
12
12
|
|
|
13
13
|
after_initialize do
|
|
14
|
-
Spree::Deprecation.warn('Spree::StoreCreditType is deprecated and will be removed in Spree 6.
|
|
14
|
+
Spree::Deprecation.warn('Spree::StoreCreditType is deprecated and will be removed in Spree 6.3. ' \
|
|
15
15
|
'Store credits are spent oldest first — see Spree::StoreCredit.oldest_first.')
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -11,7 +11,7 @@ module Spree
|
|
|
11
11
|
# class OrderCompletedNotifier < Spree::Subscriber
|
|
12
12
|
# subscribes_to 'order.placed'
|
|
13
13
|
#
|
|
14
|
-
# def
|
|
14
|
+
# def handle(event)
|
|
15
15
|
# order_id = event.payload['id']
|
|
16
16
|
# Spree::OrderMailer.confirm_email(order_id).deliver_later
|
|
17
17
|
# end
|
|
@@ -21,7 +21,7 @@ module Spree
|
|
|
21
21
|
# class OrderAuditLogger < Spree::Subscriber
|
|
22
22
|
# subscribes_to 'order.placed', 'order.canceled'
|
|
23
23
|
#
|
|
24
|
-
# def
|
|
24
|
+
# def handle(event)
|
|
25
25
|
# AuditLog.create!(
|
|
26
26
|
# event_name: event.name,
|
|
27
27
|
# payload: event.payload,
|
|
@@ -34,7 +34,7 @@ module Spree
|
|
|
34
34
|
# class OrderEventLogger < Spree::Subscriber
|
|
35
35
|
# subscribes_to 'order.*'
|
|
36
36
|
#
|
|
37
|
-
# def
|
|
37
|
+
# def handle(event)
|
|
38
38
|
# Rails.logger.info("Order event: #{event.name}")
|
|
39
39
|
# end
|
|
40
40
|
# end
|
|
@@ -66,7 +66,7 @@ module Spree
|
|
|
66
66
|
# class CriticalOrderHandler < Spree::Subscriber
|
|
67
67
|
# subscribes_to 'order.placed', async: false
|
|
68
68
|
#
|
|
69
|
-
# def
|
|
69
|
+
# def handle(event)
|
|
70
70
|
# # This runs synchronously
|
|
71
71
|
# end
|
|
72
72
|
# end
|
|
@@ -141,9 +141,9 @@ module Spree
|
|
|
141
141
|
|
|
142
142
|
# Handle an event
|
|
143
143
|
#
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
144
|
+
# Routes the event to the handler named with `on`, or to #handle.
|
|
145
|
+
# Subclasses implement #handle; overriding this method skips the
|
|
146
|
+
# `on` routing.
|
|
147
147
|
#
|
|
148
148
|
# @param event [Spree::Event] The event to handle
|
|
149
149
|
# @return [void]
|
|
@@ -8,7 +8,7 @@ module Spree
|
|
|
8
8
|
# Rates name their country and state directly since 6.0. No code reads
|
|
9
9
|
# zone_id any more, but the column stays in the database through 6.0: it is
|
|
10
10
|
# what `spree:migrate_tax_zones` converts from, and that task runs after
|
|
11
|
-
# db:migrate. The physical drop lands in 6.
|
|
11
|
+
# db:migrate. The physical drop lands in 6.3.
|
|
12
12
|
#
|
|
13
13
|
# The same goes for included_in_price: whether tax sits inside a price is
|
|
14
14
|
# the market's choice (Spree::Market#tax_inclusive), and the column is read
|
|
@@ -79,15 +79,15 @@ module Spree
|
|
|
79
79
|
self.amount = parsed && parsed / 100
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
# @deprecated Use {#rate_percent}; removed in 6.
|
|
82
|
+
# @deprecated Use {#rate_percent}; removed in 6.3.
|
|
83
83
|
def amount_percentage
|
|
84
|
-
Spree::Deprecation.warn('Spree::TaxRate#amount_percentage is deprecated and will be removed in Spree 6.
|
|
84
|
+
Spree::Deprecation.warn('Spree::TaxRate#amount_percentage is deprecated and will be removed in Spree 6.3. Use #rate_percent instead.')
|
|
85
85
|
rate_percent
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
# @deprecated Use {#rate_percent=}; removed in 6.
|
|
88
|
+
# @deprecated Use {#rate_percent=}; removed in 6.3.
|
|
89
89
|
def amount_percentage=(value)
|
|
90
|
-
Spree::Deprecation.warn('Spree::TaxRate#amount_percentage= is deprecated and will be removed in Spree 6.
|
|
90
|
+
Spree::Deprecation.warn('Spree::TaxRate#amount_percentage= is deprecated and will be removed in Spree 6.3. Use #rate_percent= instead.')
|
|
91
91
|
self.rate_percent = value
|
|
92
92
|
end
|
|
93
93
|
|
data/app/models/spree/taxon.rb
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
4
|
# Deprecation alias for Spree::Category, renamed from Spree::Taxon in 6.0.
|
|
5
|
-
# Retained
|
|
5
|
+
# Retained until 6.3 so existing code and extensions that reference
|
|
6
6
|
# Spree::Taxon keep working; the canonical class is Spree::Category. Removed
|
|
7
|
-
# in 6.
|
|
7
|
+
# in 6.3 (along with the spree_taxonomies table and the automatic-taxon columns).
|
|
8
8
|
#
|
|
9
9
|
# This is a true constant alias — the underlying class, table (spree_categories),
|
|
10
10
|
# prefix (ctg), and model_name are all Spree::Category. Only the constant differs,
|
|
@@ -13,5 +13,5 @@ module Spree
|
|
|
13
13
|
# when this file loads (on first reference; it is kept out of eager loading).
|
|
14
14
|
Taxon = Category
|
|
15
15
|
|
|
16
|
-
Spree::Deprecation.warn('Spree::Taxon is deprecated and will be removed in Spree 6.
|
|
16
|
+
Spree::Deprecation.warn('Spree::Taxon is deprecated and will be removed in Spree 6.3. Use Spree::Category instead.')
|
|
17
17
|
end
|
|
@@ -10,7 +10,7 @@ module Spree
|
|
|
10
10
|
].freeze
|
|
11
11
|
|
|
12
12
|
# Category no longer declares the has_many :taxon_rules inverse (categories are
|
|
13
|
-
# manual in 6.0), so this is a plain belongs_to. Data-only until 6.
|
|
13
|
+
# manual in 6.0), so this is a plain belongs_to. Data-only until 6.3.
|
|
14
14
|
belongs_to :taxon, class_name: 'Spree::Category', touch: true
|
|
15
15
|
|
|
16
16
|
validates :type, :value, presence: true
|
|
@@ -19,7 +19,7 @@ module Spree
|
|
|
19
19
|
delegate :store, to: :taxon
|
|
20
20
|
|
|
21
21
|
# Retained as a data-only model in 6.0 so the taxons -> collections data
|
|
22
|
-
# migration can read existing automatic-taxon rules; dropped in 6.
|
|
22
|
+
# migration can read existing automatic-taxon rules; dropped in 6.3 along
|
|
23
23
|
# with the spree_taxon_rules table. Automatic membership now lives on
|
|
24
24
|
# Spree::Collection (rule matching + regeneration moved there).
|
|
25
25
|
end
|
|
@@ -4,7 +4,7 @@ module Spree
|
|
|
4
4
|
# spree_taxonomies table are retained solely so the 5.6 -> 6.0 upgrade task
|
|
5
5
|
# (spree:migrate_categories_and_collections) can read existing rows to
|
|
6
6
|
# backfill category store_id, and so an interrupted upgrade can be rolled
|
|
7
|
-
# back. Both drop in 6.
|
|
7
|
+
# back. Both drop in 6.3.
|
|
8
8
|
class Taxonomy < Spree.base_class
|
|
9
9
|
has_prefix_id :txnmy # Spree-specific: taxonomy
|
|
10
10
|
|
data/app/models/spree/variant.rb
CHANGED
|
@@ -176,6 +176,28 @@ module Spree
|
|
|
176
176
|
scope :backorderable, -> { left_joins(:stock_levels).where(Spree::StockLevel.table_name => { backorderable: true }) }
|
|
177
177
|
scope :in_stock_or_backorderable, -> { in_stock.or(backorderable) }
|
|
178
178
|
|
|
179
|
+
# The variants a storefront option filter matches and counts. The rules
|
|
180
|
+
# +Product.available+ (a base price, unless the store lists products
|
|
181
|
+
# without one) and +Product.in_stock+ apply to a product as a whole, so a
|
|
182
|
+
# value carried only by an unpriced, sold-out or discontinued variant
|
|
183
|
+
# would otherwise offer the shopper a product they cannot buy in it.
|
|
184
|
+
#
|
|
185
|
+
# @param currency [String, nil] defaults to the current currency
|
|
186
|
+
# @param in_stock [Boolean] whether the shopper asked for in-stock products
|
|
187
|
+
# @param store [Spree::Store, nil] whose price setting applies
|
|
188
|
+
# @return [ActiveRecord::Relation<Spree::Variant>]
|
|
189
|
+
def self.for_option_filters(currency = nil, in_stock: false, store: Spree::Current.store)
|
|
190
|
+
scope = not_discontinued
|
|
191
|
+
|
|
192
|
+
unless Spree::StorePreferences.read(store, :show_products_without_price)
|
|
193
|
+
priced = for_currency_and_available_price_amount(currency || Spree::Current.currency)
|
|
194
|
+
scope = scope.where(id: priced.select(:id))
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
scope = scope.where(id: in_stock_or_backorderable.select(:id)) if in_stock
|
|
198
|
+
scope
|
|
199
|
+
end
|
|
200
|
+
|
|
179
201
|
# Variants one warehouse could actually send: it holds a level for them
|
|
180
202
|
# with something available on it. Written for the transfer form's picker,
|
|
181
203
|
# which would otherwise offer SKUs the source has none of — and
|
|
@@ -546,21 +568,21 @@ module Spree
|
|
|
546
568
|
update_column(:primary_media_id, first_media&.id)
|
|
547
569
|
end
|
|
548
570
|
|
|
549
|
-
# @deprecated Read #gallery_media directly; removed in 6.
|
|
571
|
+
# @deprecated Read #gallery_media directly; removed in 6.3. Nothing in
|
|
550
572
|
# Spree calls this — a hover image is a storefront presentation choice,
|
|
551
573
|
# not something core should name.
|
|
552
574
|
# @return [Spree::Media, nil]
|
|
553
575
|
def secondary_image
|
|
554
|
-
Spree::Deprecation.warn('Spree::Variant#secondary_image is deprecated and will be removed in Spree 6.
|
|
576
|
+
Spree::Deprecation.warn('Spree::Variant#secondary_image is deprecated and will be removed in Spree 6.3. Use #gallery_media instead.')
|
|
555
577
|
gallery_media.second
|
|
556
578
|
end
|
|
557
579
|
|
|
558
|
-
# @deprecated Read #gallery_media directly; removed in 6.
|
|
580
|
+
# @deprecated Read #gallery_media directly; removed in 6.3. Nothing in
|
|
559
581
|
# Spree calls this, and which images to show beside the main one is a
|
|
560
582
|
# storefront presentation choice.
|
|
561
583
|
# @return [Array<Spree::Media>]
|
|
562
584
|
def additional_images
|
|
563
|
-
Spree::Deprecation.warn('Spree::Variant#additional_images is deprecated and will be removed in Spree 6.
|
|
585
|
+
Spree::Deprecation.warn('Spree::Variant#additional_images is deprecated and will be removed in Spree 6.3. Use #gallery_media instead.')
|
|
564
586
|
gallery_media.reject { |media| media.id == primary_media&.id }
|
|
565
587
|
end
|
|
566
588
|
|
|
@@ -752,15 +774,15 @@ module Spree
|
|
|
752
774
|
stock_levels.where.not(stock_location_id: location_ids_in_payload).destroy_all if persisted?
|
|
753
775
|
end
|
|
754
776
|
|
|
755
|
-
# @deprecated Use {#stock_levels}; removed in 6.
|
|
777
|
+
# @deprecated Use {#stock_levels}; removed in 6.3.
|
|
756
778
|
def stock_items
|
|
757
|
-
Spree::Deprecation.warn('Spree::Variant#stock_items is deprecated and will be removed in Spree 6.
|
|
779
|
+
Spree::Deprecation.warn('Spree::Variant#stock_items is deprecated and will be removed in Spree 6.3. Use #stock_levels instead.')
|
|
758
780
|
stock_levels
|
|
759
781
|
end
|
|
760
782
|
|
|
761
|
-
# @deprecated Use {#stock_levels=}; removed in 6.
|
|
783
|
+
# @deprecated Use {#stock_levels=}; removed in 6.3.
|
|
762
784
|
def stock_items=(value)
|
|
763
|
-
Spree::Deprecation.warn('Spree::Variant#stock_items= is deprecated and will be removed in Spree 6.
|
|
785
|
+
Spree::Deprecation.warn('Spree::Variant#stock_items= is deprecated and will be removed in Spree 6.3. Use #stock_levels= instead.')
|
|
764
786
|
self.stock_levels = value
|
|
765
787
|
end
|
|
766
788
|
|
|
@@ -788,9 +810,11 @@ module Spree
|
|
|
788
810
|
end
|
|
789
811
|
end
|
|
790
812
|
|
|
791
|
-
# @deprecated Use +stock_levels_attributes=+; removed in 6.
|
|
813
|
+
# @deprecated Use +stock_levels_attributes=+; removed in 6.3.
|
|
792
814
|
def stock_items_attributes=(value)
|
|
793
|
-
Spree::Deprecation.warn(
|
|
815
|
+
Spree::Deprecation.warn(
|
|
816
|
+
'Spree::Variant#stock_items_attributes= is deprecated and will be removed in Spree 6.3. Use #stock_levels_attributes= instead.'
|
|
817
|
+
)
|
|
794
818
|
self.stock_levels_attributes = value
|
|
795
819
|
end
|
|
796
820
|
|
|
@@ -958,6 +982,17 @@ module Spree
|
|
|
958
982
|
in_stock? || oversellable_now?
|
|
959
983
|
end
|
|
960
984
|
|
|
985
|
+
# Whether a shopper could put this in a cart in the currency. Stock alone
|
|
986
|
+
# is not enough: the cart refuses a variant unless it has a base price
|
|
987
|
+
# there or a price list or pricing provider quoted one for the shopper.
|
|
988
|
+
#
|
|
989
|
+
# @param currency [String]
|
|
990
|
+
# @param quote [Spree::Price, nil] the price resolved for the shopper, when known
|
|
991
|
+
# @return [Boolean]
|
|
992
|
+
def purchasable_in?(currency, quote: nil)
|
|
993
|
+
purchasable? && (quote&.amount.present? || amount_in(currency).present?)
|
|
994
|
+
end
|
|
995
|
+
|
|
961
996
|
# Whether the variant can currently be bought by overselling — via
|
|
962
997
|
# backorder or pre-order. Unlimited when +backorder_limit+ is nil (empty =
|
|
963
998
|
# no cap); with a limit, purchasable only while the oversell allowance
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
# FK column is `media_id`, matching Spree::Media and its table. The `:asset`
|
|
3
|
-
# association name stays readable
|
|
3
|
+
# association name stays readable until 6.3.
|
|
4
4
|
class VariantMedia < Spree.base_class
|
|
5
5
|
self.table_name = 'spree_variant_media'
|
|
6
6
|
|
|
@@ -30,9 +30,9 @@ module Spree
|
|
|
30
30
|
@wishlist_items_count ||= variant_ids.count
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
# @deprecated Use {#wishlist_items_count}; removed in 6.
|
|
33
|
+
# @deprecated Use {#wishlist_items_count}; removed in 6.3.
|
|
34
34
|
def wished_items_count
|
|
35
|
-
Spree::Deprecation.warn('Spree::Wishlist#wished_items_count is deprecated and will be removed in Spree 6.
|
|
35
|
+
Spree::Deprecation.warn('Spree::Wishlist#wished_items_count is deprecated and will be removed in Spree 6.3. Use #wishlist_items_count instead.')
|
|
36
36
|
wishlist_items_count
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -4,8 +4,8 @@ module Spree
|
|
|
4
4
|
class WishlistItem < Spree.base_class
|
|
5
5
|
# Dual-emits the pre-6.0 `wished_item.*` lifecycle events beside the
|
|
6
6
|
# `wishlist_item.*` ones, so a webhook endpoint a merchant configured
|
|
7
|
-
# against the old names keeps receiving deliveries
|
|
8
|
-
# Removed in 6.
|
|
7
|
+
# against the old names keeps receiving deliveries until 6.5.
|
|
8
|
+
# Removed in 6.5, the same way {Spree::StockLevel::CustomEvents} carries
|
|
9
9
|
# `stock_item.*`.
|
|
10
10
|
module CustomEvents
|
|
11
11
|
LEGACY_EVENT_PREFIX = 'wished_item'
|
data/app/models/spree/zone.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Spree
|
|
2
|
-
# Migration-only shell, removed in Spree 6.
|
|
2
|
+
# Migration-only shell, removed in Spree 6.3: rows survive solely as source
|
|
3
3
|
# data for the 5.6→6.0 zone, market and tax migrations. Countries and states
|
|
4
4
|
# are reference data in 6.0, so member ids resolve against the legacy tables
|
|
5
5
|
# rather than through associations.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Spree
|
|
2
|
-
# Migration-only shell, removed in Spree 6.
|
|
2
|
+
# Migration-only shell, removed in Spree 6.3 with {Spree::Zone}.
|
|
3
3
|
class ZoneMember < Spree.base_class
|
|
4
4
|
# No zoneable association: countries and states are reference data in 6.0,
|
|
5
5
|
# so the type and id columns are plain values resolved against the legacy
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
module Spree
|
|
2
2
|
module CSV
|
|
3
3
|
class ProductVariantPresenter
|
|
4
|
-
include Spree::ImagesHelper
|
|
5
|
-
|
|
6
4
|
CSV_HEADERS = [
|
|
7
5
|
'product_id',
|
|
8
6
|
'sku',
|
|
@@ -76,7 +74,7 @@ module Spree
|
|
|
76
74
|
# For the primary variant row (when the index is zero), product-level details such as name,
|
|
77
75
|
# slug, status, seller name, description, meta tags, and tag/label lists are included.
|
|
78
76
|
# In all cases, variant-specific attributes (e.g., id, SKU, pricing, dimensions, weight,
|
|
79
|
-
# availability dates, inventory count, shipping category, tax category, image URLs
|
|
77
|
+
# availability dates, inventory count, shipping category, tax category, original image URLs,
|
|
80
78
|
# and the first three option types and corresponding option values) are appended.
|
|
81
79
|
# Additionally, when the index is zero, associated categories and properties are added.
|
|
82
80
|
#
|
|
@@ -121,9 +119,9 @@ module Spree
|
|
|
121
119
|
nil,
|
|
122
120
|
variant.tax_category&.name,
|
|
123
121
|
product.product_type&.name,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
image_urls[0],
|
|
123
|
+
image_urls[1],
|
|
124
|
+
image_urls[2],
|
|
127
125
|
option_type(0)&.label,
|
|
128
126
|
option_value(option_type(0)),
|
|
129
127
|
option_type(1)&.label,
|
|
@@ -207,8 +205,19 @@ module Spree
|
|
|
207
205
|
@default_stock_level = variant.stock_levels.find { |level| level.stock_location_id == location.id }
|
|
208
206
|
end
|
|
209
207
|
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
# The original files, which the import downloads back onto the row's
|
|
209
|
+
# variant: the media linked to that variant, or on the product's first
|
|
210
|
+
# row, when it has none, the product's own gallery so unlinked uploads
|
|
211
|
+
# survive. Videos are left out — the import saves every URL as an image.
|
|
212
|
+
def image_urls
|
|
213
|
+
@image_urls ||= begin
|
|
214
|
+
media = variant.gallery_media.to_a
|
|
215
|
+
media = product.media.to_a if media.empty? && index.zero?
|
|
216
|
+
|
|
217
|
+
media.select { |image| image.image? && image.attached? }.first(3).map do |image|
|
|
218
|
+
Rails.application.routes.url_helpers.cdn_image_url(image.attachment)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
212
221
|
end
|
|
213
222
|
end
|
|
214
223
|
end
|
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
attribute :support_email, &:support_email_address
|
|
13
13
|
|
|
14
14
|
attribute :logo_url do |store|
|
|
15
|
-
spree_image_url(store.email_logo, height: LOGO_HEIGHT)
|
|
15
|
+
spree_image_url(store.email_logo, height: LOGO_HEIGHT, format: 'png')
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# The width the logo shows at, from its proportions. Nil until the file
|
|
@@ -5,11 +5,15 @@ module Spree
|
|
|
5
5
|
|
|
6
6
|
def call(guest_cart: nil, guest_order: nil, customer: nil, user: nil, override_email: true, guest_only: false)
|
|
7
7
|
if guest_order
|
|
8
|
-
Spree::Deprecation.warn(
|
|
8
|
+
Spree::Deprecation.warn(
|
|
9
|
+
'Calling Spree::Carts::Associate with guest_order: is deprecated and will be removed in Spree 6.3. Pass guest_cart: instead.'
|
|
10
|
+
)
|
|
9
11
|
guest_cart ||= guest_order
|
|
10
12
|
end
|
|
11
13
|
if user && customer.nil?
|
|
12
|
-
Spree::Deprecation.warn(
|
|
14
|
+
Spree::Deprecation.warn(
|
|
15
|
+
'Calling Spree::Carts::Associate with user: is deprecated and will be removed in Spree 6.3. Pass customer: instead.'
|
|
16
|
+
)
|
|
13
17
|
customer = user
|
|
14
18
|
end
|
|
15
19
|
return failure(guest_cart, 'Already assigned to a customer') if guest_only && guest_cart.customer.present? && guest_cart.customer != customer
|
|
@@ -11,7 +11,7 @@ module Spree
|
|
|
11
11
|
|
|
12
12
|
customer = @params.delete(:customer)
|
|
13
13
|
if @params.key?(:user)
|
|
14
|
-
Spree::Deprecation.warn('Passing user: to Spree::Carts::Create is deprecated and will be removed in Spree 6.
|
|
14
|
+
Spree::Deprecation.warn('Passing user: to Spree::Carts::Create is deprecated and will be removed in Spree 6.3. Pass customer: instead.')
|
|
15
15
|
customer ||= @params.delete(:user)
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -11,7 +11,7 @@ module Spree
|
|
|
11
11
|
# @return [Spree::ServiceModule::Result] deletion outcome
|
|
12
12
|
def call(cart: nil, order: nil)
|
|
13
13
|
if order
|
|
14
|
-
Spree::Deprecation.warn('Calling Spree::Carts::Destroy with order: is deprecated and will be removed in Spree 6.
|
|
14
|
+
Spree::Deprecation.warn('Calling Spree::Carts::Destroy with order: is deprecated and will be removed in Spree 6.3. Pass cart: instead.')
|
|
15
15
|
cart ||= order
|
|
16
16
|
end
|
|
17
17
|
rewrite_input!(remove: [:order], cart: cart)
|
|
@@ -5,7 +5,7 @@ module Spree
|
|
|
5
5
|
|
|
6
6
|
def call(cart: nil, order: nil, variant: nil, quantity: nil, options: nil)
|
|
7
7
|
if order
|
|
8
|
-
Spree::Deprecation.warn('Calling Spree::Carts::RemoveItem with order: is deprecated and will be removed in Spree 6.
|
|
8
|
+
Spree::Deprecation.warn('Calling Spree::Carts::RemoveItem with order: is deprecated and will be removed in Spree 6.3. Pass cart: instead.')
|
|
9
9
|
cart ||= order
|
|
10
10
|
end
|
|
11
11
|
options ||= {}
|