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.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/app/jobs/spree/imports/create_rows_job.rb +4 -2
  3. data/app/jobs/spree/imports/process_rows_job.rb +4 -2
  4. data/app/jobs/spree/payments/handle_modification_webhook_job.rb +93 -0
  5. data/app/jobs/spree/payments/handle_webhook_job.rb +4 -2
  6. data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
  7. data/app/jobs/spree/search_provider/index_job.rb +8 -0
  8. data/app/jobs/spree/search_provider/remove_job.rb +3 -0
  9. data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
  10. data/app/mailers/spree/base_mailer.rb +1 -1
  11. data/app/maintenance_tasks/spree/maintenance_tasks/upgrade/backfill_settlement_statuses.rb +40 -0
  12. data/app/models/concerns/spree/acted_by.rb +2 -2
  13. data/app/models/concerns/spree/customer_methods.rb +7 -5
  14. data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
  15. data/app/models/concerns/spree/derived_number.rb +1 -1
  16. data/app/models/concerns/spree/has_custom_fields.rb +12 -10
  17. data/app/models/concerns/spree/integrations_concern.rb +5 -3
  18. data/app/models/concerns/spree/label_translatable.rb +4 -4
  19. data/app/models/concerns/spree/metadata.rb +3 -3
  20. data/app/models/concerns/spree/presentation_translatable.rb +1 -1
  21. data/app/models/concerns/spree/product_scopes.rb +5 -2
  22. data/app/models/concerns/spree/purchase/addresses.rb +8 -5
  23. data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
  24. data/app/models/concerns/spree/purchase/payment_processing.rb +11 -0
  25. data/app/models/concerns/spree/purchase/purchase_order.rb +21 -0
  26. data/app/models/concerns/spree/purchase/totals.rb +3 -2
  27. data/app/models/concerns/spree/ransackable_attributes.rb +81 -4
  28. data/app/models/concerns/spree/settlement_status.rb +29 -0
  29. data/app/models/concerns/spree/stores/markets.rb +4 -32
  30. data/app/models/concerns/spree/user_address.rb +5 -2
  31. data/app/models/concerns/spree/user_methods.rb +2 -2
  32. data/app/models/spree/address.rb +29 -14
  33. data/app/models/spree/asset.rb +3 -3
  34. data/app/models/spree/base.rb +4 -4
  35. data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
  36. data/app/models/spree/cart.rb +2 -2
  37. data/app/models/spree/category.rb +61 -38
  38. data/app/models/spree/classification.rb +2 -2
  39. data/app/models/spree/collection_rule.rb +5 -1
  40. data/app/models/spree/current.rb +19 -0
  41. data/app/models/spree/custom_field.rb +6 -6
  42. data/app/models/spree/custom_field_definition.rb +10 -7
  43. data/app/models/spree/delivery_method.rb +21 -15
  44. data/app/models/spree/delivery_rate.rb +1 -1
  45. data/app/models/spree/digital.rb +1 -1
  46. data/app/models/spree/digital_asset.rb +2 -2
  47. data/app/models/spree/digital_link.rb +4 -4
  48. data/app/models/spree/export.rb +32 -3
  49. data/app/models/spree/exports/products.rb +9 -1
  50. data/app/models/spree/fulfillment/custom_events.rb +18 -10
  51. data/app/models/spree/fulfillment.rb +53 -29
  52. data/app/models/spree/fulfillment_group.rb +2 -2
  53. data/app/models/spree/fulfillment_item.rb +3 -3
  54. data/app/models/spree/fulfilment_changer.rb +1 -1
  55. data/app/models/spree/gateway/bogus.rb +41 -2
  56. data/app/models/spree/gift_card.rb +26 -14
  57. data/app/models/spree/import.rb +23 -15
  58. data/app/models/spree/import_row.rb +6 -6
  59. data/app/models/spree/inventory_unit.rb +1 -1
  60. data/app/models/spree/invitation.rb +8 -4
  61. data/app/models/spree/line_item.rb +10 -8
  62. data/app/models/spree/media.rb +3 -3
  63. data/app/models/spree/metafield.rb +1 -1
  64. data/app/models/spree/metafield_definition.rb +1 -1
  65. data/app/models/spree/metafields.rb +2 -2
  66. data/app/models/spree/option_type.rb +27 -0
  67. data/app/models/spree/option_value.rb +3 -3
  68. data/app/models/spree/order.rb +97 -49
  69. data/app/models/spree/order_group.rb +2 -2
  70. data/app/models/spree/order_inventory.rb +2 -2
  71. data/app/models/spree/order_merger.rb +2 -2
  72. data/app/models/spree/order_updater.rb +34 -20
  73. data/app/models/spree/payment/custom_events.rb +2 -1
  74. data/app/models/spree/payment/processing.rb +20 -3
  75. data/app/models/spree/payment.rb +194 -15
  76. data/app/models/spree/payment_capture_event.rb +2 -0
  77. data/app/models/spree/payment_method/store_credit.rb +6 -0
  78. data/app/models/spree/payment_method.rb +65 -11
  79. data/app/models/spree/payment_response.rb +19 -0
  80. data/app/models/spree/payment_session.rb +15 -3
  81. data/app/models/spree/payment_split.rb +14 -2
  82. data/app/models/spree/price.rb +20 -8
  83. data/app/models/spree/price_list.rb +12 -6
  84. data/app/models/spree/price_rules/zone_rule.rb +1 -1
  85. data/app/models/spree/product.rb +30 -28
  86. data/app/models/spree/product_category.rb +3 -3
  87. data/app/models/spree/promotion/rules/category.rb +27 -10
  88. data/app/models/spree/promotion/rules/country.rb +1 -1
  89. data/app/models/spree/promotion/rules/taxon.rb +4 -2
  90. data/app/models/spree/promotion/rules/user.rb +1 -1
  91. data/app/models/spree/promotion_action.rb +1 -1
  92. data/app/models/spree/promotion_rule_category.rb +5 -5
  93. data/app/models/spree/promotion_rule_taxon.rb +2 -2
  94. data/app/models/spree/prototype.rb +4 -1
  95. data/app/models/spree/purchase_order.rb +20 -3
  96. data/app/models/spree/refund.rb +7 -1
  97. data/app/models/spree/return.rb +7 -1
  98. data/app/models/spree/return_authorization_reason.rb +3 -3
  99. data/app/models/spree/return_reason.rb +1 -1
  100. data/app/models/spree/search_provider/base.rb +12 -2
  101. data/app/models/spree/search_provider/database.rb +8 -5
  102. data/app/models/spree/search_provider.rb +7 -5
  103. data/app/models/spree/shipment.rb +4 -1
  104. data/app/models/spree/shipping_method.rb +4 -1
  105. data/app/models/spree/shipping_rate.rb +1 -1
  106. data/app/models/spree/stock/coordinator.rb +2 -2
  107. data/app/models/spree/stock/estimator.rb +7 -5
  108. data/app/models/spree/stock/package.rb +10 -8
  109. data/app/models/spree/stock_item.rb +1 -1
  110. data/app/models/spree/stock_level/custom_events.rb +1 -1
  111. data/app/models/spree/stock_level.rb +1 -1
  112. data/app/models/spree/stock_location.rb +12 -8
  113. data/app/models/spree/stock_movement.rb +6 -6
  114. data/app/models/spree/stock_reservation.rb +5 -5
  115. data/app/models/spree/store.rb +64 -16
  116. data/app/models/spree/store_credit.rb +3 -3
  117. data/app/models/spree/store_credit_category.rb +5 -5
  118. data/app/models/spree/store_credit_type.rb +2 -2
  119. data/app/models/spree/subscriber.rb +7 -7
  120. data/app/models/spree/tax_rate.rb +5 -5
  121. data/app/models/spree/taxon.rb +3 -3
  122. data/app/models/spree/taxon_rule.rb +2 -2
  123. data/app/models/spree/taxonomy.rb +1 -1
  124. data/app/models/spree/variant.rb +45 -10
  125. data/app/models/spree/variant_media.rb +1 -1
  126. data/app/models/spree/wished_item.rb +1 -1
  127. data/app/models/spree/wishlist.rb +2 -2
  128. data/app/models/spree/wishlist_item/custom_events.rb +2 -2
  129. data/app/models/spree/zone.rb +1 -1
  130. data/app/models/spree/zone_member.rb +1 -1
  131. data/app/presenters/spree/csv/product_variant_presenter.rb +17 -8
  132. data/app/serializers/spree/emails/store_serializer.rb +1 -1
  133. data/app/services/spree/carts/associate.rb +6 -2
  134. data/app/services/spree/carts/create.rb +1 -1
  135. data/app/services/spree/carts/destroy.rb +1 -1
  136. data/app/services/spree/carts/remove_item.rb +1 -1
  137. data/app/services/spree/carts/remove_line_item.rb +2 -2
  138. data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
  139. data/app/services/spree/carts/set_quantity.rb +2 -2
  140. data/app/services/spree/carts/split_by_seller.rb +4 -13
  141. data/app/services/spree/carts/update.rb +17 -0
  142. data/app/services/spree/checkout/add_store_credit.rb +3 -3
  143. data/app/services/spree/checkout/remove_store_credit.rb +2 -2
  144. data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
  145. data/app/services/spree/orders/approve.rb +3 -3
  146. data/app/services/spree/orders/create_from_cart.rb +2 -0
  147. data/app/services/spree/orders/create_user_account.rb +2 -2
  148. data/app/services/spree/orders/update_statuses.rb +4 -2
  149. data/app/services/spree/products/auto_match_taxons.rb +5 -2
  150. data/app/services/spree/shipments/update.rb +2 -2
  151. data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
  152. data/app/services/spree/stock_reservations/extend.rb +3 -1
  153. data/app/services/spree/stock_reservations/reserve.rb +3 -1
  154. data/app/services/spree/store_credits/apply.rb +1 -1
  155. data/app/services/spree/taxons/add_products.rb +4 -2
  156. data/app/services/spree/taxons/regenerate_products.rb +5 -2
  157. data/app/services/spree/taxons/remove_products.rb +4 -2
  158. data/app/subscribers/spree/order_status_subscriber.rb +4 -3
  159. data/app/subscribers/spree/payment_split_subscriber.rb +39 -21
  160. data/app/subscribers/spree/seller_transfer_reversal_subscriber.rb +19 -7
  161. data/app/tools/spree/agent_tools/query_report.rb +116 -14
  162. data/app/workflows/spree/carts/add_item.rb +1 -1
  163. data/app/workflows/spree/carts/complete.rb +1 -19
  164. data/app/workflows/spree/carts/recalculate.rb +1 -1
  165. data/app/workflows/spree/carts/recalculate_totals.rb +3 -3
  166. data/app/workflows/spree/fulfillments/update.rb +1 -1
  167. data/app/workflows/spree/orders/cancel.rb +22 -1
  168. data/app/workflows/spree/orders/complete.rb +7 -1
  169. data/app/workflows/spree/payments/capture.rb +101 -7
  170. data/app/workflows/spree/payments/handle_modification_webhook.rb +218 -0
  171. data/app/workflows/spree/payments/handle_webhook.rb +7 -1
  172. data/app/workflows/spree/payments/process.rb +47 -4
  173. data/app/workflows/spree/payments/void.rb +4 -1
  174. data/app/workflows/spree/products/approve.rb +17 -0
  175. data/app/workflows/spree/refunds/create.rb +10 -1
  176. data/app/workflows/spree/refunds/order_payments.rb +3 -1
  177. data/app/workflows/spree/seller_transfers/create.rb +1 -1
  178. data/config/locales/be.yml +2 -2
  179. data/config/locales/bg.yml +4 -4
  180. data/config/locales/en.yml +12 -0
  181. data/config/locales/ru.yml +3 -3
  182. data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
  183. data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
  184. data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
  185. data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
  186. data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
  187. data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
  188. data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
  189. data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
  190. data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
  191. data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
  192. data/db/migrate/20261116100001_add_status_to_spree_payment_capture_events_and_refunds.rb +17 -0
  193. data/lib/spree/agent_tool.rb +11 -4
  194. data/lib/spree/agent_tools/default_catalog.rb +2 -2
  195. data/lib/spree/agent_tools/legacy_tools.rb +1 -1
  196. data/lib/spree/core/dependencies.rb +11 -10
  197. data/lib/spree/core/engine.rb +4 -0
  198. data/lib/spree/core/number_generator.rb +4 -3
  199. data/lib/spree/core/preferences/preferable.rb +1 -1
  200. data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
  201. data/lib/spree/core/pricing/resolver.rb +2 -2
  202. data/lib/spree/core/version.rb +1 -1
  203. data/lib/spree/core.rb +37 -10
  204. data/lib/spree/i18n.rb +6 -2
  205. data/lib/spree/localized_number.rb +1 -1
  206. data/lib/spree/removed_apis.rb +274 -0
  207. data/lib/spree/reporting/adapters/live.rb +69 -8
  208. data/lib/spree/reporting/default_vocabulary.rb +11 -5
  209. data/lib/spree/reporting/query.rb +4 -1
  210. data/lib/spree/reporting/registry.rb +50 -3
  211. data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
  212. data/lib/spree/testing_support/factories/payment_capture_event_factory.rb +10 -0
  213. data/lib/spree/testing_support/factories/refund_factory.rb +10 -0
  214. data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
  215. data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
  216. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
  217. data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
  218. data/lib/spree/testing_support/i18n.rb +7 -2
  219. data/lib/spree/testing_support/order_walkthrough.rb +5 -2
  220. data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +71 -14
  221. data/lib/tasks/carts_migration.rake +1 -1
  222. data/lib/tasks/categories_and_collections.rake +1 -1
  223. data/lib/tasks/deliveries_migration.rake +1 -1
  224. data/lib/tasks/delivery_method_rules_migration.rake +1 -1
  225. data/lib/tasks/delivery_migration.rake +1 -1
  226. data/lib/tasks/delivery_profiles_migration.rake +2 -2
  227. data/lib/tasks/fold_store_credit_categories.rake +1 -1
  228. data/lib/tasks/migrate_country_state_codes.rake +1 -1
  229. data/lib/tasks/migrate_returns.rake +4 -4
  230. data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
  231. data/lib/tasks/store_settings.rake +1 -1
  232. data/lib/tasks/typed_stock_movements_migration.rake +1 -1
  233. metadata +26 -6
@@ -0,0 +1,274 @@
1
+ module Spree
2
+ # Names the replacement when code calls a Ruby API that Spree removed.
3
+ #
4
+ # Spree is old enough that coding agents, older tutorials and extensions
5
+ # still reach for 4.x and 5.x APIs: the checkout state machine,
6
+ # adjustments, single-currency prices, return authorizations. Without help,
7
+ # those calls fail with a bare NoMethodError or NameError, and the reader
8
+ # has to work out what replaced them. This module adds one paragraph to
9
+ # those errors naming what to use instead.
10
+ #
11
+ # The hint is added to Exception#detailed_message, the text Ruby, IRB and
12
+ # RSpec print for an error. The Rails log prints #message instead, so
13
+ # ErrorSubscriber logs the hint for errors Rails reports (unhandled request
14
+ # and job errors). The error keeps its class, its #message and its
15
+ # #respond_to? answers, so rescues and duck typing behave exactly as they
16
+ # did. Removed names are never defined, so nothing that still exists can be
17
+ # shadowed.
18
+ #
19
+ # docs/developer/upgrades/removed-apis.mdx lists every entry; regenerate it
20
+ # with UPDATE_DOCS=1 pnpm test:rspec core spec/lib/spree/removed_apis_spec.rb.
21
+ #
22
+ # Keys: 'Spree::Order#next' is an instance method, 'Spree::Order.checkout_flow'
23
+ # a class method (also matched when called on a relation), 'Spree::Adjustment'
24
+ # a constant. A key matches subclasses too.
25
+ #
26
+ # When you remove a public Ruby API, add it under the release that removed
27
+ # it (see spree/AGENTS.md).
28
+ module RemovedApis
29
+ UPGRADE_GUIDES = {
30
+ '6.0' => 'https://spreecommerce.org/docs/developer/upgrades/5.6-to-6.0'
31
+ }.freeze
32
+
33
+ # @return [Hash{String => String}] each name in +entries+, prefixed with each owner
34
+ def self.expand(owners, separator, entries)
35
+ owners.product(entries.to_a).to_h { |owner, (name, hint)| ["#{owner}#{separator}#{name}", hint] }
36
+ end
37
+
38
+ CHECKOUT = 'Checkout has no state machine. Write cart fields in any order (Spree::Carts::Update, ' \
39
+ 'or the Store API cart endpoints), read cart.current_checkout_step and the cart ' \
40
+ 'requirements to see what is missing, and place the order with ' \
41
+ 'Spree::Dependencies.carts_complete_workflow.constantize.call(cart: cart).'.freeze
42
+ CHECKOUT_CUSTOMIZATION = 'Checkout has no state machine. Add a checkout requirement with ' \
43
+ 'Spree::Checkout::Registry.add_requirement, or a step with Spree::Checkout::Registry.register_step, ' \
44
+ 'and run side effects of placing an order in an order.placed subscriber (Spree::Subscriber).'.freeze
45
+ ADJUSTMENTS = 'Adjustments are typed rows: tax_lines, discounts and fees.'.freeze
46
+ RETURNS = 'Returns, exchanges and claims are their own records on the order: returns, exchanges, claims.'.freeze
47
+ STATE_CHANGES = 'Status history is no longer stored. Subscribe to events instead (Spree::Subscriber).'.freeze
48
+ PRIMARY_MEDIA = 'Use primary_media.'.freeze
49
+ CUSTOMER_PRICE = 'Use price_in(currency).display_amount for the base price, or, on a variant (product.default_variant), ' \
50
+ 'price_for(context).display_amount for the price a customer pays including price lists.'.freeze
51
+ SEARCH = 'Use search, or q[search] in the Admin API.'.freeze
52
+
53
+ ORDER_AND_CART = {
54
+ 'next' => CHECKOUT,
55
+ 'next!' => CHECKOUT,
56
+ 'state' => 'Orders have status (draft, placed, canceled). Carts have no status: completed_at marks completion, ' \
57
+ 'and current_checkout_step says where checkout stands.',
58
+ 'state=' => 'Status changes through workflows, for example Spree::Orders::Cancel. Carts have no status.',
59
+ 'can_go_to_state?' => CHECKOUT,
60
+ 'restart_checkout_flow' => CHECKOUT,
61
+ 'contents' => 'Change cart items with Spree.cart_add_item_workflow or Spree::Dependencies.cart_upsert_items_workflow.',
62
+ 'adjustments' => ADJUSTMENTS,
63
+ 'all_adjustments' => ADJUSTMENTS,
64
+ 'state_changes' => STATE_CHANGES
65
+ }.freeze
66
+
67
+ ORDER_AND_CART_CLASS = {
68
+ 'checkout_flow' => CHECKOUT_CUSTOMIZATION,
69
+ 'checkout_steps' => CHECKOUT_CUSTOMIZATION,
70
+ 'insert_checkout_step' => CHECKOUT_CUSTOMIZATION,
71
+ 'remove_checkout_step' => CHECKOUT_CUSTOMIZATION,
72
+ 'remove_transition' => CHECKOUT_CUSTOMIZATION,
73
+ 'go_to_state' => CHECKOUT_CUSTOMIZATION,
74
+ 'state_machine' => 'Spree 6 has no state machines. Records move between statuses through workflows.',
75
+ 'multi_search' => SEARCH
76
+ }.freeze
77
+
78
+ VARIANT_AND_PRODUCT = {
79
+ 'price' => 'Prices are per currency: price_in(currency).amount or amount_in(currency).',
80
+ 'default_price' => 'Use price_in(currency).',
81
+ 'currency' => 'Pass the currency you mean to price_in(currency).',
82
+ 'display_price' => CUSTOMER_PRICE,
83
+ 'display_amount' => CUSTOMER_PRICE,
84
+ 'display_compare_at_price' => 'Use price_in(currency).display_compare_at_amount.',
85
+ 'price_including_vat_for' => 'Use price_in(currency).amount: prices are charged as entered.',
86
+ 'has_default_price?' => 'Use prices.base_prices.exists?(currency: currency).',
87
+ 'default_image' => PRIMARY_MEDIA,
88
+ 'primary_image' => PRIMARY_MEDIA
89
+ }.freeze
90
+
91
+ REPORTS = 'Use reporting queries for aggregates, or a Spree::Export subclass for CSV rows.'.freeze
92
+
93
+ # Removed APIs by the release that removed them.
94
+ REMOVED = {
95
+ '6.0' => {
96
+ # Checkout, orders and carts
97
+ **expand(%w[Spree::Order Spree::Cart], '#', ORDER_AND_CART),
98
+ **expand(%w[Spree::Order Spree::Cart], '.', ORDER_AND_CART_CLASS),
99
+ 'Spree::Order#line_item_adjustments' => 'Use line_item_tax_lines and line_item_discounts.',
100
+ 'Spree::Order#shipment_adjustments' => 'Use fulfillment_tax_lines and fulfillment_discounts.',
101
+ **expand(%w[Spree::Order], '#', %w[return_authorizations customer_returns reimbursements].index_with(RETURNS)),
102
+ 'Spree::Order::Checkout' => CHECKOUT_CUSTOMIZATION,
103
+ 'Spree::OrderContents' => 'Change cart items with Spree.cart_add_item_workflow or Spree::Dependencies.cart_upsert_items_workflow.',
104
+ 'Spree::Adjustment' => 'Adjustments are typed rows: Spree::TaxLine, Spree::Discount and Spree::Fee.',
105
+ 'Spree::LineItem#adjustments' => ADJUSTMENTS,
106
+ 'Spree::Fulfillment#adjustments' => ADJUSTMENTS,
107
+ 'Spree::StateChange' => STATE_CHANGES,
108
+ 'Spree::LogEntry' => STATE_CHANGES,
109
+ 'Spree::Payment#state_changes' => STATE_CHANGES,
110
+ 'Spree::Payment#log_entries' => STATE_CHANGES,
111
+ 'Spree::Fulfillment#state_changes' => STATE_CHANGES,
112
+
113
+ # Returns
114
+ 'Spree::ReturnAuthorization' => 'Use Spree::Return, or Spree::Exchange when different items go out.',
115
+ 'Spree::CustomerReturn' => 'Use Spree::Return: receiving is a status on the same record.',
116
+ 'Spree::Reimbursement' => 'Refund a return with the Spree::Returns::Refund workflow.',
117
+ 'Spree::ReimbursementType' => 'Refund a return with the Spree::Returns::Refund workflow.',
118
+ 'Spree::ReturnItem' => 'Use Spree::ReturnLineItem, Spree::ExchangeLineItem or Spree::ClaimLineItem.',
119
+
120
+ # Catalog and prices
121
+ **expand(%w[Spree::Variant Spree::Product], '#', VARIANT_AND_PRODUCT),
122
+ 'Spree::Variant#price=' => 'Use set_price(currency, amount).',
123
+ 'Spree::Variant#compare_at_price=' => 'Use set_price(currency, amount, compare_at_amount).',
124
+ 'Spree::Product#price=' => 'Set prices on a variant: default_variant.set_price(currency, amount).',
125
+ 'Spree::Product#compare_at_price=' => 'Set prices on a variant: default_variant.set_price(currency, amount, compare_at_amount).',
126
+ 'Spree::Product#featured_image' => PRIMARY_MEDIA,
127
+ 'Spree::DefaultPrice' => 'Use variant.price_in(currency) and variant.set_price(currency, amount).',
128
+ 'Spree::VatPriceCalculation' => 'Use price_in(currency).amount: prices include tax per market.',
129
+ 'Spree::Product.with_option' => 'Use with_option_value(option, value).',
130
+ **expand(%w[Spree::Product], '.', %w[in_name in_name_or_keywords in_name_or_description].index_with(SEARCH)),
131
+ 'Spree::Product.with_ids' => 'Use where(id: ids).',
132
+ 'Spree::Product.add_search_scope' => 'Declare a plain Active Record scope. To filter by it through the Admin API (q[...]), ' \
133
+ 'also register it with Spree.ransack.add_scope(Spree::Product, :scope_name).',
134
+ **expand(%w[Spree::Product Spree::Variant], '.', { 'multi_search' => SEARCH }),
135
+ 'Spree::OptionType#color?' => 'Use color_swatch?.',
136
+ 'Spree::Category#set_store' => 'Nothing to call: a new category gets its store from its parent or the current store when it is saved.',
137
+ 'Spree::Category.for_taxonomy' => 'Use for_store(taxonomy.store). It returns every category in that store, not one taxonomy.',
138
+
139
+ # Stores, addresses, users and permissions
140
+ 'Spree::Store#admin_users' => 'Use users.',
141
+ 'Spree::Store#supported_shipping_zones' => 'Use countries_with_shipping_coverage.',
142
+ 'Spree::Address#user_default_billing?' => 'Use is_default_billing?.',
143
+ 'Spree::Address#user_default_shipping?' => 'Use is_default_shipping?.',
144
+ 'Spree.searcher_class' => 'Use Spree.search_provider.',
145
+ 'Spree::PermittedAttributes' => 'Add writable API attributes with Spree::Product.additional_permitted_attributes += [...] ' \
146
+ 'inside Rails.application.config.to_prepare (any model; always +=).',
147
+ 'Spree::Preference' => 'Preferences live on each model in a JSON preferences column.',
148
+ 'Spree::User' => 'Use Spree.customer_class for customers and Spree.admin_user_class for staff.',
149
+
150
+ # Services and screens that are gone
151
+ 'Spree::PromotionHandler::Page' => 'Apply the promotion with a coupon code, or make it automatic.',
152
+ 'Spree::Carts::Empty' => 'Remove items through the Store API cart items endpoints, or delete the cart with Spree.cart_destroy_service.',
153
+ 'Spree::Payments::Create' => 'Use the Store API payments endpoint, Spree::StoreCredits::Apply or Spree.gift_card_apply_workflow.',
154
+ 'Spree::Report' => REPORTS,
155
+ 'Spree::ReportLineItem' => REPORTS,
156
+ 'Spree::ImageMethods' => 'Use Active Storage variants with cdn_image_url.',
157
+ 'Spree::Frontend' => 'The Rails storefront is gone. Build the storefront on the Store API (/api/v3/store), ' \
158
+ 'for example with the Next.js storefront and @spree/sdk.',
159
+ 'Spree::Backend' => 'The Rails admin is gone. The back office is the React Admin Dashboard on the Admin API (/api/v3/admin); ' \
160
+ 'extend it with dashboard plugins.',
161
+ 'Spree::Api::V2' => 'API v2 is gone. Use the Store API (/api/v3/store) or the Admin API (/api/v3/admin).'
162
+ }.freeze
163
+ }.freeze
164
+
165
+ module_function
166
+
167
+ # @param error [NameError]
168
+ # @return [String, nil] the hint for a removed Spree API, or nil
169
+ def hint_for(error)
170
+ key = lookup(error)
171
+ return unless key
172
+
173
+ version, entries = REMOVED.find { |_release, removed| removed.key?(key) }
174
+ "Spree #{version} removed #{key}. #{entries[key]}\nUpgrade guide: #{UPGRADE_GUIDES.fetch(version)}"
175
+ rescue StandardError
176
+ nil
177
+ end
178
+
179
+ def known?(key)
180
+ REMOVED.each_value.any? { |entries| entries.key?(key) }
181
+ end
182
+
183
+ # A receiverless call (`state` inside an Order decorator) raises a plain
184
+ # NameError, so only a capitalized name is treated as a constant.
185
+ def lookup(error)
186
+ name = error.name.to_s
187
+ receiver = error.receiver
188
+
189
+ if error.is_a?(NoMethodError) || !name.match?(/\A[A-Z]/)
190
+ method_lookup(receiver, name)
191
+ elsif receiver.is_a?(Module)
192
+ constant_lookup(receiver, name)
193
+ end
194
+ end
195
+
196
+ def method_lookup(receiver, name)
197
+ if receiver.is_a?(Module)
198
+ ancestor_lookup(receiver, ".#{name}")
199
+ elsif defined?(ActiveRecord::Relation) && receiver.is_a?(ActiveRecord::Relation)
200
+ ancestor_lookup(receiver.klass, ".#{name}")
201
+ else
202
+ ancestor_lookup(receiver.class, "##{name}")
203
+ end
204
+ end
205
+
206
+ def ancestor_lookup(klass, suffix)
207
+ klass.ancestors.each do |ancestor|
208
+ key = "#{ancestor.name}#{suffix}"
209
+ return key if known?(key)
210
+ end
211
+ nil
212
+ end
213
+
214
+ # Code written directly inside the Spree namespace (`module Spree; module
215
+ # OrderDecorator`) reports its own module as the receiver of a missing
216
+ # constant, so 'Spree::OrderDecorator::Adjustment' also tries 'Spree::Adjustment'.
217
+ # Deeper namespaces don't, so a missing Spree::Reporting::Report is not
218
+ # mistaken for the removed Spree::Report.
219
+ def constant_lookup(receiver, name)
220
+ candidates = receiver == Object ? [name] : ["#{receiver.name}::#{name}"]
221
+ candidates << "Spree::#{name}" if receiver.name.to_s.match?(/\ASpree::\w+\z/)
222
+ candidates.find { |candidate| known?(candidate) }
223
+ end
224
+
225
+ # @return [String] the documentation page listing every removed API
226
+ def to_mdx
227
+ sections = REMOVED.map do |version, entries|
228
+ rows = entries.map { |key, replacement| "| `#{key}` | #{replacement} |" }
229
+ <<~MARKDOWN
230
+ ## Removed in Spree #{version}
231
+
232
+ See the [upgrade guide](#{UPGRADE_GUIDES.fetch(version)}) for the reasons behind each change.
233
+
234
+ | Removed | Use instead |
235
+ | --- | --- |
236
+ #{rows.join("\n")}
237
+ MARKDOWN
238
+ end
239
+
240
+ <<~MARKDOWN
241
+ ---
242
+ title: Removed Ruby APIs
243
+ description: Ruby classes and methods removed from Spree, and what replaced each one.
244
+ ---
245
+
246
+ Code written for an older Spree release, or by a coding agent working from old examples, may call one of these APIs. It fails with a `NoMethodError` or `NameError`, and Ruby, the Rails console, RSpec and the Rails log add the replacement below to that error.
247
+
248
+ APIs that still work but print a deprecation warning are not listed here. They are in the upgrade guide for the release that deprecated them.
249
+
250
+ #{sections.join("\n")}
251
+ MARKDOWN
252
+ end
253
+
254
+ # Logs the hint for an error Rails reports, such as an unhandled error in
255
+ # a request or a job, so it appears in the Rails log next to the error.
256
+ class ErrorSubscriber
257
+ def report(error, **)
258
+ hint = Spree::RemovedApis.hint_for(error) if error.is_a?(NameError)
259
+ Rails.logger&.warn(hint) if hint
260
+ end
261
+ end
262
+
263
+ # Prepended to NameError (and so NoMethodError).
264
+ module ErrorHint
265
+ def detailed_message(**)
266
+ message = super
267
+ hint = Spree::RemovedApis.hint_for(self)
268
+ hint ? "#{message}\n\n#{hint}" : message
269
+ end
270
+ end
271
+ end
272
+ end
273
+
274
+ NameError.prepend(Spree::RemovedApis::ErrorHint)
@@ -65,7 +65,7 @@ module Spree
65
65
 
66
66
  query.aggregated_metrics.group_by(&:base).each do |base, metrics|
67
67
  scope = base_scope(base, range, grouped: grouped)
68
- selects = metrics.map { |m| "#{resolve_sql(m.sql_for(grouped: grouped))} AS #{metric_alias(m)}" }
68
+ selects = metrics.map { |m| "#{metric_sql(m, scope: scope, grouped: grouped)} AS #{metric_alias(m)}" }
69
69
 
70
70
  if grouped
71
71
  dimension_selects = query.dimensions.map do |d|
@@ -111,6 +111,49 @@ module Spree
111
111
  scope.reorder(nil)
112
112
  end
113
113
 
114
+ # A metric's aggregate for this query, resolved against the scope it
115
+ # runs on. A metric reading a joined row (grouped_sql) only reads it
116
+ # when the scope actually carries that join — grouping by product
117
+ # never joins discounts, so it falls back to the per-line subquery.
118
+ #
119
+ # The subquery form receives the filters on the dimensions that read
120
+ # the same joined rows (%{dimension_filters}): filtered to one
121
+ # promotion, a line also carrying another must contribute only the
122
+ # filtered promotion's money, not the line's combined discount.
123
+ def metric_sql(metric, scope:, grouped:)
124
+ joins = grouped ? carried_joins(scope) : []
125
+ format(metric.sql_for(grouped: grouped, joins: joins),
126
+ placeholders.merge(dimension_filters: joined_row_filters(metric)))
127
+ end
128
+
129
+ # The joins the scope carries, in ActiveRecord's joins format. Compared
130
+ # by full association path (Reporting.join_paths): a join reached
131
+ # through another base's path (`{ order: :ship_address }`) is not the
132
+ # base's own `:ship_address`, and `{ variant: :product }` does not
133
+ # bring in `{ variant: { product: :product_categories } }`.
134
+ def carried_joins(scope)
135
+ scope.joins_values + scope.left_outer_joins_values
136
+ end
137
+
138
+ # Extra subquery conditions for the filters on dimensions that read
139
+ # the rows this metric's grouped_joins would join. Values bind through
140
+ # Arel quoting and the column is a validated identifier.
141
+ def joined_row_filters(metric)
142
+ return '' if metric.grouped_joins.blank?
143
+
144
+ query.filters.filter_map do |filter|
145
+ dimension = filter[:dimension]
146
+ next unless dimension.base == metric.base
147
+ # The dimension's column must live on rows the subquery itself
148
+ # reads: one joining past them (`{ promotion_discounts: :promotion }`)
149
+ # would name a table the subquery has no FROM entry for.
150
+ next if dimension.joins.blank?
151
+ next unless Reporting.joins_cover?(metric.grouped_joins, dimension.joins)
152
+
153
+ " AND #{in_predicate(qualified_column(dimension), filter[:values]).to_sql}"
154
+ end.join
155
+ end
156
+
114
157
  # Dimension joins are declared from their own base; they only apply
115
158
  # when the executing scope is that base (an :orders-based metric never
116
159
  # joins line-item tables — validate_bases! guarantees compatibility).
@@ -141,13 +184,18 @@ module Spree
141
184
  metric = filter[:metric]
142
185
  next unless names.include?(metric.name)
143
186
 
144
- # The value rides as a bind rather than an interpolation: it is
145
- # the only piece of request data that reaches the statement, and
146
- # the aggregate beside it is registered SQL.
187
+ # The value is quoted by Arel rather than interpolated: it is the
188
+ # only piece of request data that reaches the comparison, and the
189
+ # aggregate beside it is registered SQL. Not a `?` bind: the
190
+ # aggregate can carry quoted filter values of its own (a coupon
191
+ # code containing `?`), and ActiveRecord would count those as
192
+ # placeholders too and refuse the statement.
147
193
  scope = scope.having(
148
- Arel.sql("#{resolve_sql(metric.sql_for(grouped: true))} " \
149
- "#{COMPARISONS.fetch(filter[:op]).first} ?"),
150
- filter[:value]
194
+ Arel::Nodes::InfixOperation.new(
195
+ COMPARISONS.fetch(filter[:op]).first,
196
+ Arel::Nodes::Grouping.new(Arel.sql(metric_sql(metric, scope: scope, grouped: true))),
197
+ Arel::Nodes.build_quoted(filter[:value])
198
+ )
151
199
  )
152
200
  end
153
201
 
@@ -170,11 +218,24 @@ module Spree
170
218
  table = scope.klass.arel_table
171
219
  ids = join_for(base_relation(base, range), dimension, base).where(predicate).select(table[:id])
172
220
  scope = scope.where(table[:id].in(ids.arel))
221
+ # When the grouped query already joins the rows this filter
222
+ # reads, the id subquery alone keeps every joined row of a
223
+ # matching line: filtered to one promotion and grouped by
224
+ # promotion, a line carrying two would still report the other
225
+ # one's group. Narrow the joined rows themselves as well.
226
+ scope = scope.where(predicate) if joins_rows_of?(scope, dimension, base)
173
227
  end
174
228
  end
175
229
  scope
176
230
  end
177
231
 
232
+ # Only when the scope carries the dimension's whole join path: grouped
233
+ # by product, a category filter's product_categories table is not in
234
+ # the FROM clause even though its first hop (variant) is.
235
+ def joins_rows_of?(scope, dimension, base)
236
+ dimension.base == base && Reporting.joins_cover?(carried_joins(scope), dimension.joins)
237
+ end
238
+
178
239
  # `column IN (values)` as an Arel node. The column is a validated
179
240
  # identifier (see #qualified_column) and the values bind as parameters,
180
241
  # so no request data reaches the statement as text.
@@ -236,7 +297,7 @@ module Spree
236
297
  def apply_sql_sort(scope, metrics)
237
298
  return scope unless metrics.any? { |m| m.name == sort_metric.name }
238
299
 
239
- scope.order(Arel.sql("#{resolve_sql(sort_metric.sql_for(grouped: true))} " \
300
+ scope.order(Arel.sql("#{metric_sql(sort_metric, scope: scope, grouped: true)} " \
240
301
  "#{query.sort[:direction] == :desc ? 'DESC' : 'ASC'}"))
241
302
  .limit(query.limit)
242
303
  end
@@ -84,13 +84,18 @@ module Spree
84
84
  # off: a subquery over the line gives both rows the combined figure, and
85
85
  # the breakdown then adds up to double what the store discounted.
86
86
  #
87
- # The grouped query is the only one that carries the join (Decision 13),
88
- # so the dimensionless total uses the subquery form below instead.
87
+ # Only a query grouped by a promotion dimension carries the join
88
+ # (Decision 13), so the dimensionless total and breakdowns by any other
89
+ # dimension use the subquery form below instead (see grouped_joins).
89
90
  PROMOTION_DISCOUNTS_JOINED = 'SUM(-COALESCE(%{discounts}.amount, 0))'.freeze
90
91
 
92
+ # Unaliased so a promotion or coupon filter (%{dimension_filters}, which
93
+ # names %{discounts}.promotion_id) narrows these rows: filtered to one
94
+ # promotion, a line carrying two must count only that promotion's money.
91
95
  PROMOTION_DISCOUNTS_SUBQUERY = <<~SQL.squish.freeze
92
- SUM(COALESCE((SELECT -SUM(d.amount) FROM %{discounts} d
93
- WHERE d.line_item_id = %{line_items}.id AND d.kind = 'promotion'), 0))
96
+ SUM(COALESCE((SELECT -SUM(%{discounts}.amount) FROM %{discounts}
97
+ WHERE %{discounts}.line_item_id = %{line_items}.id AND %{discounts}.kind = 'promotion'
98
+ %{dimension_filters}), 0))
94
99
  SQL
95
100
 
96
101
  # Checkouts that used a promotion. Counted in checkouts rather than
@@ -406,6 +411,7 @@ module Spree
406
411
 
407
412
  metric :promotion_discounts, sql: PROMOTION_DISCOUNTS_SUBQUERY,
408
413
  grouped_sql: PROMOTION_DISCOUNTS_JOINED,
414
+ grouped_joins: [:promotion_discounts],
409
415
  base: :line_items, format: :money,
410
416
  subject: -> { Spree::Promotion }, key_scope: 'read_promotions'
411
417
  # Counted in checkouts, not orders: a basket spanning several sellers
@@ -443,7 +449,7 @@ module Spree
443
449
  dimension :payment_status, base: :orders, column: :payment_status,
444
450
  values: -> { Spree::Order::PAYMENT_STATUSES }
445
451
  # The rollup values Orders::UpdateStatuses writes today; the model
446
- # constant still carries the legacy machine states until 6.1.
452
+ # constant still carries the legacy machine states until 6.3.
447
453
  dimension :fulfillment_status, base: :orders, column: :fulfillment_status,
448
454
  values: -> { %w[backorder canceled partial unfulfilled fulfilled delivered] }
449
455
 
@@ -201,7 +201,10 @@ module Spree
201
201
  dimension = registry.dimension!(member_name(name, 'dimension'))
202
202
 
203
203
  if dimension.time?
204
- grain = (grain || dimension.grains.first).to_sym
204
+ grain = dimension.grains.first if ['', nil].include?(grain)
205
+ raise InvalidQuery, "grain for #{dimension.name} must be a string" unless grain.is_a?(String) || grain.is_a?(Symbol)
206
+
207
+ grain = grain.to_sym
205
208
  unless dimension.grains.include?(grain)
206
209
  raise InvalidQuery, "invalid grain #{grain} for #{dimension.name}. Valid grains: #{dimension.grains.join(', ')}"
207
210
  end
@@ -1,5 +1,29 @@
1
1
  module Spree
2
2
  module Reporting
3
+ # Every association path a joins spec reaches, in ActiveRecord's joins
4
+ # format: `[{ variant: { product: :product_categories } }]` reaches
5
+ # [:variant], [:variant, :product] and [:variant, :product, :product_categories].
6
+ # Comparing paths rather than top-level names keeps a nested join from
7
+ # passing for its first hop alone.
8
+ #
9
+ # @param joins [Symbol, String, Hash, Array, nil]
10
+ # @return [Array<Array<Symbol>>]
11
+ def self.join_paths(joins, prefix = [])
12
+ case joins
13
+ when Hash
14
+ joins.flat_map { |name, nested| [prefix + [name.to_sym]] + join_paths(nested, prefix + [name.to_sym]) }
15
+ when Array then joins.flat_map { |join| join_paths(join, prefix) }
16
+ when Symbol, String then [prefix + [joins.to_sym]]
17
+ else []
18
+ end.uniq
19
+ end
20
+
21
+ # Whether the joins carried cover every association path the required
22
+ # joins reach.
23
+ def self.joins_cover?(carried, required)
24
+ (join_paths(required) - join_paths(carried)).empty?
25
+ end
26
+
3
27
  # A metric aggregates rows into one number.
4
28
  #
5
29
  # @!attribute sql
@@ -26,16 +50,35 @@ module Spree
26
50
  # @!attribute grouped_sql
27
51
  # Optional aggregate used only for the grouped query, where dimension
28
52
  # joins are present. See #sql_for.
53
+ # @!attribute grouped_joins
54
+ # The dimension joins grouped_sql reads from. The grouped query carries
55
+ # only the joins of the dimensions it groups by, so grouped_sql applies
56
+ # only when one of them brought these in; any other grouping falls back
57
+ # to `sql`. Required with grouped_sql. A `sql` that reads the same rows
58
+ # through a subquery may embed `%{dimension_filters}`, which receives the
59
+ # filters on dimensions joining those rows as extra AND conditions.
29
60
  # @!attribute suggests
30
61
  # Metric to reach for instead when this one is refused for a breakdown
31
62
  # it cannot answer — named in the error so a caller learns the
32
63
  # vocabulary from the refusal rather than by trial.
33
64
  Metric = Struct.new(:name, :sql, :base, :format, :ratio, :subject, :key_scope,
34
- :requires_grouping, :suggests, :grouped_sql, keyword_init: true) do
65
+ :requires_grouping, :suggests, :grouped_sql, :grouped_joins, keyword_init: true) do
35
66
  # The aggregate to use when the query carries its dimension joins. A
36
67
  # metric whose money lives on a joined row reads it directly there, and
37
- # falls back to `sql` for the dimensionless total, which has no joins.
38
- def sql_for(grouped:) = (grouped && grouped_sql.presence) || sql
68
+ # falls back to `sql` when that row is not joined: for the dimensionless
69
+ # total, which has no joins, and for a breakdown by a dimension that does
70
+ # not join it (promotion discounts by seller), where the joined table is
71
+ # not in the FROM clause at all.
72
+ #
73
+ # @param grouped [Boolean] whether this is the grouped query
74
+ # @param joins [Array<Symbol, Hash>] the joins the grouped query carries,
75
+ # in ActiveRecord's joins format
76
+ # @return [String]
77
+ def sql_for(grouped:, joins: [])
78
+ return sql unless grouped && grouped_sql.present? && grouped_joins.present?
79
+
80
+ Reporting.joins_cover?(joins, grouped_joins) ? grouped_sql : sql
81
+ end
39
82
 
40
83
  def derived? = ratio.present?
41
84
 
@@ -230,6 +273,10 @@ module Spree
230
273
  raise ArgumentError, "metric #{name} declares a subject and must also declare its key_scope"
231
274
  end
232
275
 
276
+ if opts[:grouped_sql].present? && opts[:grouped_joins].blank?
277
+ raise ArgumentError, "metric #{name} declares grouped_sql and must also declare the grouped_joins it reads"
278
+ end
279
+
233
280
  opts[:format] ||= :integer
234
281
  @metrics[name] = Metric.new(name: name, **opts)
235
282
  end
@@ -8,6 +8,6 @@ FactoryBot.define do
8
8
  variant
9
9
  end
10
10
 
11
- # @deprecated Use :digital_asset; removed in 6.1.
11
+ # @deprecated Use :digital_asset; removed in 6.3.
12
12
  factory :digital, parent: :digital_asset
13
13
  end
@@ -2,5 +2,15 @@ FactoryBot.define do
2
2
  factory :payment_capture_event, class: Spree::PaymentCaptureEvent do
3
3
  payment
4
4
  amount { 10.0 }
5
+ status { 'completed' }
6
+
7
+ trait :requested do
8
+ status { 'requested' }
9
+ transaction_id { "capture-#{SecureRandom.hex(6)}" }
10
+ end
11
+
12
+ trait :failed do
13
+ status { 'failed' }
14
+ end
5
15
  end
6
16
  end
@@ -6,6 +6,16 @@ FactoryBot.define do
6
6
  transaction_id { generate(:refund_transaction_id) }
7
7
  association(:payment, status: 'completed')
8
8
  association(:reason, factory: :refund_reason)
9
+ status { 'completed' }
10
+
11
+ trait :requested do
12
+ status { 'requested' }
13
+ end
14
+
15
+ trait :failed do
16
+ status { 'failed' }
17
+ failure_reason { 'Refused by the provider' }
18
+ end
9
19
  end
10
20
 
11
21
  factory :default_refund_reason, class: Spree::RefundReason do
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- # :stock_item is the pre-6.0 name, kept for one release so host-app factories
2
+ # :stock_item is the pre-6.0 name, kept until 6.3 so host-app factories
3
3
  # and specs written against it keep working.
4
4
  factory :stock_level, class: Spree::StockLevel, aliases: [:stock_item] do
5
5
  backorderable { true }
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  # @deprecated Use :category. Kept so existing extension and application suites
3
- # keep passing through the 6.0 rename; removed in 6.1 with Spree::Taxon.
3
+ # keep passing through the 6.0 rename; removed in 6.3 with Spree::Taxon.
4
4
  #
5
5
  # A category is store-owned via store_id, so this creates no taxonomy. Callers
6
6
  # that need a legacy taxonomy-backed row pass `taxonomy:` explicitly.
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- # @deprecated Taxonomy is data-only in 6.0 and dropped in 6.1. Retained for the
2
+ # @deprecated Taxonomy is data-only in 6.0 and dropped in 6.3. Retained for the
3
3
  # upgrade-path specs. The root category is created here because the model no
4
4
  # longer manages one.
5
5
  factory :taxonomy, class: Spree::Taxonomy do
@@ -4,7 +4,7 @@ FactoryBot.define do
4
4
  wishlist
5
5
  end
6
6
 
7
- # Renamed in 6.0; the old name is kept for one release so extension suites
7
+ # Renamed in 6.0; the old name is kept until 6.3 so extension suites
8
8
  # keep building.
9
9
  factory :wished_item, parent: :wishlist_item
10
10
  end
@@ -1,3 +1,8 @@
1
1
  # Deprecated: Spree's specs now catch missing keys through Rails'
2
- # config.i18n.raise_on_missing_translations. Removed in Spree 6.1.
3
- Spree::Deprecation.warn("spree/testing_support/i18n is deprecated and does nothing; set config.i18n.raise_on_missing_translations = true in your test environment instead. It will be removed in Spree 6.1.") if defined?(Spree::Deprecation)
2
+ # config.i18n.raise_on_missing_translations. Removed in Spree 6.3.
3
+ if defined?(Spree::Deprecation)
4
+ Spree::Deprecation.warn(
5
+ 'spree/testing_support/i18n is deprecated and does nothing; set config.i18n.raise_on_missing_translations = true in your test environment ' \
6
+ 'instead. It will be removed in Spree 6.3.'
7
+ )
8
+ end
@@ -2,13 +2,16 @@
2
2
  # every step BEFORE the given one satisfied (matching the legacy contract
3
3
  # where `up_to(:delivery)` had completed the address step). `up_to(:complete)`
4
4
  # runs the real completion pipeline and returns the resulting Spree::Order.
5
- # @deprecated Removed in Spree 6.1 — build checkout state with the factories
5
+ # @deprecated Removed in Spree 6.3 — build checkout state with the factories
6
6
  # instead: create(:cart_ready_for_delivery) (address + delivery proposals),
7
7
  # create(:cart_ready_to_complete) (payment-covered), or
8
8
  # create(:completed_order_with_totals) for a placed order.
9
9
  class OrderWalkthrough
10
10
  def self.up_to(state, store = nil)
11
- Spree::Deprecation.warn('OrderWalkthrough is deprecated and will be removed in Spree 6.1. Use the cart factories instead: :cart_ready_for_delivery, :cart_ready_to_complete, or :completed_order_with_totals.')
11
+ Spree::Deprecation.warn(
12
+ 'OrderWalkthrough is deprecated and will be removed in Spree 6.3. ' \
13
+ 'Use the cart factories instead: :cart_ready_for_delivery, :cart_ready_to_complete, or :completed_order_with_totals.'
14
+ )
12
15
  store ||= Spree::Store.default
13
16
 
14
17
  # A payment method must exist for checkout to proceed