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
@@ -24,7 +24,7 @@ module Spree
24
24
  # Spree::Money (amount and currency) and convert it to the provider's own
25
25
  # unit. Methods that have not opted in receive an integer in hundredths of
26
26
  # the currency, which is wrong for yen and dinar; that bridge is removed in
27
- # Spree 6.1.
27
+ # Spree 6.5.
28
28
  class_attribute :accepts_money_amounts, default: false, instance_writer: false
29
29
 
30
30
  # Blank falls back to the store, so a method only overrides when a merchant
@@ -163,7 +163,8 @@ module Spree
163
163
  # longer take money against it. Called for the sessions left pending when
164
164
  # an order is placed. The default leaves the session untouched: a
165
165
  # gateway that cannot cancel at the provider must not report as canceled
166
- # a session that can still be paid.
166
+ # a session that can still be paid. Adyen is the one exception: it cancels
167
+ # locally, which is a real cancel only for a session never made payable.
167
168
  #
168
169
  # Raise Spree::Core::GatewayError only for a refusal, such as a session
169
170
  # that was already paid. A timeout, a rate limit, an outage, or rejected
@@ -183,15 +184,56 @@ module Spree
183
184
  #
184
185
  # @param raw_body [String] the raw request body
185
186
  # @param headers [Hash] the request headers
186
- # @return [Hash, nil] normalized result or nil for unsupported events
187
+ # @return [Hash, nil] normalized result or nil for unsupported events.
188
+ # A session outcome:
187
189
  # { action: :captured/:authorized/:failed/:canceled,
188
190
  # payment_session: <Spree::PaymentSession>,
189
191
  # metadata: {} }
192
+ # or the outcome of a capture, void or refund the gateway answered
193
+ # +requested?+ for, naming its record by the reference
194
+ # {#modification_record} finds it with:
195
+ # { action: :capture_succeeded/:capture_failed/:void_succeeded/:void_failed/
196
+ # :refund_succeeded/:refund_failed,
197
+ # reference: 'the provider reference',
198
+ # metadata: { 'reason' => ... } }
199
+ # The record is not looked up here: the outcome can arrive before the
200
+ # request that writes it has finished, so the job looks it up and waits.
201
+ # A capture outcome may also name the payment its capture was asked
202
+ # for (+payment:+) and the amount taken (metadata 'amount'), so a
203
+ # capture whose answer never reached Spree is still recorded.
204
+ # A gateway that answers +requested?+ must report those outcomes here.
205
+ # metadata crosses a background job, so it must be JSON-safe with
206
+ # string keys; a failure's reason goes under 'reason'.
190
207
  # @raise [Spree::PaymentMethod::WebhookSignatureError] if signature is invalid
191
208
  def parse_webhook_event(raw_body, headers)
192
209
  raise ::NotImplementedError, 'You must implement parse_webhook_event method for this gateway.'
193
210
  end
194
211
 
212
+ # The record a modification outcome settles, or nil while it is not
213
+ # written yet. Reads only this method's payments.
214
+ #
215
+ # The default matches the reference against what core records from a
216
+ # +requested?+ answer: a capture event's or refund's +transaction_id+, and
217
+ # for a void the response code of a payment waiting on it (or already
218
+ # void, for a repeated delivery). Override when the provider names
219
+ # records otherwise.
220
+ #
221
+ # @param action [Symbol] one of the six modification outcomes
222
+ # @param reference [String] the reference from #parse_webhook_event
223
+ # @return [Spree::PaymentCaptureEvent, Spree::Payment, Spree::Refund, nil]
224
+ def modification_record(action, reference)
225
+ own_payments = Spree::Payment.where(payment_method_id: id)
226
+
227
+ case action.to_sym
228
+ when :capture_succeeded, :capture_failed
229
+ Spree::PaymentCaptureEvent.where(payment_id: own_payments.select(:id)).find_by(transaction_id: reference)
230
+ when :void_succeeded, :void_failed
231
+ own_payments.where(status: %w[requested void]).find_by(response_code: reference)
232
+ when :refund_succeeded, :refund_failed
233
+ Spree::Refund.where(payment_id: own_payments.select(:id)).find_by(transaction_id: reference)
234
+ end
235
+ end
236
+
195
237
  # Returns the webhook URL for this payment method.
196
238
  # @return [String, nil]
197
239
  def webhook_url
@@ -286,7 +328,7 @@ module Spree
286
328
  store_preference(:capture_method).presence || Spree::CaptureMethod::DEFAULT_CAPTURE_METHOD
287
329
  end
288
330
 
289
- # @deprecated Use #capture_at_checkout?; removed in 6.1. Deliberately does
331
+ # @deprecated Use #capture_at_checkout?; removed in 6.3. Deliberately does
290
332
  # not warn — it runs on every payment and would flood the logs.
291
333
  def auto_capture?
292
334
  capture_at_checkout?
@@ -309,6 +351,16 @@ module Spree
309
351
  raise ::NotImplementedError, 'You must implement cancel method for this payment method.'
310
352
  end
311
353
 
354
+ # Whether #cancel voids the payment. A gateway that cannot void a
355
+ # captured charge refunds it through Refunds::Create instead, or leaves it
356
+ # standing when `refund:` is false, so the payment stays completed with
357
+ # any refund recorded against it.
358
+ #
359
+ # @param payment [Spree::Payment]
360
+ def cancel_voids?(payment)
361
+ can_void?(payment)
362
+ end
363
+
312
364
  # Whether the payment can be voided in its current state. Gateways that
313
365
  # cannot void a captured payment override this.
314
366
  # @param _payment [Spree::Payment]
@@ -342,21 +394,23 @@ module Spree
342
394
  public_preference_keys.index_with { |key| get_preference(key) }
343
395
  end
344
396
 
345
- # @deprecated Use {#storefront_visible?}; removed in 6.1.
397
+ # @deprecated Use {#storefront_visible?}; removed in 6.3.
346
398
  def available_on_front_end?
347
- Spree::Deprecation.warn('Spree::PaymentMethod#available_on_front_end? is deprecated and will be removed in Spree 6.1. Use #storefront_visible? instead.')
399
+ Spree::Deprecation.warn(
400
+ 'Spree::PaymentMethod#available_on_front_end? is deprecated and will be removed in Spree 6.3. Use #storefront_visible? instead.'
401
+ )
348
402
  storefront_visible?
349
403
  end
350
404
 
351
- # @deprecated Use {#storefront_visible}; removed in 6.1.
405
+ # @deprecated Use {#storefront_visible}; removed in 6.3.
352
406
  def display_on
353
- Spree::Deprecation.warn('Spree::PaymentMethod#display_on is deprecated and will be removed in Spree 6.1. Use #storefront_visible instead.')
407
+ Spree::Deprecation.warn('Spree::PaymentMethod#display_on is deprecated and will be removed in Spree 6.3. Use #storefront_visible instead.')
354
408
  storefront_visible? ? 'both' : 'back_end'
355
409
  end
356
410
 
357
- # @deprecated Use {#storefront_visible=}; removed in 6.1.
411
+ # @deprecated Use {#storefront_visible=}; removed in 6.3.
358
412
  def display_on=(value)
359
- Spree::Deprecation.warn('Spree::PaymentMethod#display_on= is deprecated and will be removed in Spree 6.1. Use #storefront_visible= instead.')
413
+ Spree::Deprecation.warn('Spree::PaymentMethod#display_on= is deprecated and will be removed in Spree 6.3. Use #storefront_visible= instead.')
360
414
  self.storefront_visible = value.to_s != 'back_end'
361
415
  end
362
416
 
@@ -398,7 +452,7 @@ module Spree
398
452
  Spree::Deprecation.warn(
399
453
  "#{self.class.name} receives amounts as an integer in hundredths, which is wrong for currencies " \
400
454
  'without two decimals. Set `self.accepts_money_amounts = true` and take a Spree::Money ' \
401
- '(amount and currency); hundredths are removed in Spree 6.1.'
455
+ '(amount and currency); hundredths are removed in Spree 6.5.'
402
456
  )
403
457
  end
404
458
  end
@@ -35,6 +35,11 @@ module Spree
35
35
  # @return [Hash] CVV result with +"code"+ and +"message"+ keys
36
36
  attr_reader :cvv_result
37
37
 
38
+ # @return [String, nil] the provider's id for a capture it accepted but has
39
+ # not answered yet; a capture's authorization becomes the payment's
40
+ # response_code, so it cannot travel there
41
+ attr_reader :reference
42
+
38
43
  # @param success [Boolean] whether the gateway action succeeded
39
44
  # @param message [String] human-readable result message
40
45
  # @param params [Hash] raw key/value pairs returned by the gateway
@@ -43,12 +48,17 @@ module Spree
43
48
  # @option options [Hash] :avs_result must contain +:code+
44
49
  # @option options [Hash] :cvv_result may contain +:code+ and +:message+
45
50
  # @option options [Boolean] :test sandbox/test flag
51
+ # @option options [Boolean] :requested the provider accepted the request and
52
+ # reports its outcome later, by webhook
53
+ # @option options [String] :reference the provider's id for a requested capture
46
54
  def initialize(success, message, params = {}, options = {})
47
55
  @success = success
48
56
  @message = message
49
57
  @params = params.with_indifferent_access
50
58
  @test = options[:test] || false
51
59
  @authorization = options[:authorization]
60
+ @requested = options[:requested] || false
61
+ @reference = options[:reference]
52
62
  @avs_result = options[:avs_result] ? { 'code' => options[:avs_result][:code] } : { 'code' => nil }
53
63
  @cvv_result = if options[:cvv_result]
54
64
  { 'code' => options[:cvv_result][:code], 'message' => options[:cvv_result][:message] }
@@ -62,6 +72,15 @@ module Spree
62
72
  @success
63
73
  end
64
74
 
75
+ # Whether the provider accepted the request and will report its outcome by
76
+ # webhook. Only a gateway that returns that outcome from
77
+ # +parse_webhook_event+ may answer this.
78
+ #
79
+ # @return [Boolean]
80
+ def requested?
81
+ @requested
82
+ end
83
+
65
84
  # @return [Boolean] whether the response came from a test/sandbox environment
66
85
  def test?
67
86
  @test
@@ -115,6 +115,16 @@ module Spree
115
115
  payment.metadata.merge!(metadata.stringify_keys) if metadata.present?
116
116
  end
117
117
 
118
+ # The provider's id for the capture when the payment settles as captured,
119
+ # written on its capture event so a late capture failure can find it.
120
+ # Called inside the settlement lock, so it must not perform provider I/O.
121
+ #
122
+ # @param payment [Spree::Payment] the payment being settled
123
+ # @return [String, nil]
124
+ def capture_reference_for_settlement(_payment)
125
+ nil
126
+ end
127
+
118
128
  # Fetches whatever settlement will need from the provider, so a caller
119
129
  # that settles inside a lock (the webhook path) holds it across no
120
130
  # provider I/O. Gateway session subclasses override; no-op by default.
@@ -149,10 +159,12 @@ module Spree
149
159
  # been cached on this instance before the lock (a concurrent
150
160
  # settlement could have completed it), but reload would discard
151
161
  # in-memory state like skip_source_requirement.
152
- already_completed = settled_payment.completed? ||
153
- Spree::Payment.where(id: settled_payment.id, status: 'completed').exists?
162
+ # A requested payment waits on its provider's answer to a capture or
163
+ # void, so a redelivered authorization must not move it.
164
+ already_settled = settled_payment.status.in?(Spree::Payment::SETTLED_OR_WAITING_STATUSES) ||
165
+ Spree::Payment.exists?(id: settled_payment.id, status: Spree::Payment::SETTLED_OR_WAITING_STATUSES)
154
166
 
155
- settled_payment.confirm!(captured: captured) unless already_completed
167
+ settled_payment.confirm!(captured: captured, capture_reference: capture_reference_for_settlement(settled_payment)) unless already_settled
156
168
  end
157
169
 
158
170
  settled_payment
@@ -68,11 +68,12 @@ module Spree
68
68
  # instead of the denormalized column, because that column is written by a
69
69
  # subscriber after the fact: two refunds landing together would each read a
70
70
  # share that still looked unrefunded. {Spree::Refunds::Create} bounds every
71
- # refund by this under the payment's lock.
71
+ # refund by this under the payment's lock. A refund still waiting on its
72
+ # provider counts, so its amount cannot be refunded twice.
72
73
  #
73
74
  # @return [BigDecimal]
74
75
  def refundable_amount
75
- already_refunded = Spree::Refund.where(payment_id: payment_id, order_id: order_id).sum(:amount)
76
+ already_refunded = Spree::Refund.not_failed.where(payment_id: payment_id, order_id: order_id).sum(:amount)
76
77
  captured_amount - already_refunded
77
78
  end
78
79
 
@@ -87,6 +88,17 @@ module Spree
87
88
  authorized_amount - captured_amount - claimed_amount
88
89
  end
89
90
 
91
+ # Turns a claim into what it turned out to be: money the gateway took, or
92
+ # nothing at all.
93
+ #
94
+ # @param amount [BigDecimal] how much of the claim settles
95
+ # @param captured [Boolean] whether the gateway took it
96
+ def settle_claim!(amount, captured:)
97
+ attributes = { claimed_amount: claimed_amount - amount }
98
+ attributes[:captured_amount] = captured_amount + amount if captured
99
+ update!(attributes)
100
+ end
101
+
90
102
  # @return [Boolean] whether a charge for this share is still in flight —
91
103
  # reserved by a parcel, and not yet confirmed by the gateway
92
104
  def capture_in_flight?
@@ -88,6 +88,7 @@ module Spree
88
88
  self.whitelisted_ransackable_attributes = %w[amount compare_at_amount currency min_quantity price_list_id variant_id]
89
89
  self.whitelisted_ransackable_associations = %w[variant price_list]
90
90
  self.whitelisted_ransackable_scopes = %i[search]
91
+ self.ransackable_scope_types = { 'search' => 'text' }
91
92
 
92
93
  # Free-text search delegated to `Spree::Variant.search` (SKU + product
93
94
  # name + option-value presentation), wrapped in a subquery so that
@@ -137,27 +138,38 @@ module Spree
137
138
  alias_attribute :price, :amount
138
139
  alias_attribute :compare_at_price, :compare_at_amount
139
140
 
140
- # @deprecated Prices are charged as entered for every buyer since 6.0. Use {#price}; removed in 6.1.
141
+ # @deprecated Prices are charged as entered for every buyer since 6.0. Use {#price}; removed in 6.3.
141
142
  def price_including_vat_for(_price_options = {})
142
- Spree::Deprecation.warn('Spree::Price#price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #price instead.')
143
+ Spree::Deprecation.warn(
144
+ 'Spree::Price#price_including_vat_for is deprecated and will be removed in Spree 6.3. Prices are charged as entered; use #price instead.'
145
+ )
143
146
  price
144
147
  end
145
148
 
146
- # @deprecated Use {#compare_at_price}; removed in 6.1.
149
+ # @deprecated Use {#compare_at_price}; removed in 6.3.
147
150
  def compare_at_price_including_vat_for(_price_options = {})
148
- Spree::Deprecation.warn('Spree::Price#compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #compare_at_price instead.')
151
+ Spree::Deprecation.warn(
152
+ 'Spree::Price#compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.3. ' \
153
+ 'Prices are charged as entered; use #compare_at_price instead.'
154
+ )
149
155
  compare_at_price
150
156
  end
151
157
 
152
- # @deprecated Use {#display_price}; removed in 6.1.
158
+ # @deprecated Use {#display_price}; removed in 6.3.
153
159
  def display_price_including_vat_for(_price_options = {})
154
- Spree::Deprecation.warn('Spree::Price#display_price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #display_price instead.')
160
+ Spree::Deprecation.warn(
161
+ 'Spree::Price#display_price_including_vat_for is deprecated and will be removed in Spree 6.3. ' \
162
+ 'Prices are charged as entered; use #display_price instead.'
163
+ )
155
164
  display_price
156
165
  end
157
166
 
158
- # @deprecated Use {#display_compare_at_price}; removed in 6.1.
167
+ # @deprecated Use {#display_compare_at_price}; removed in 6.3.
159
168
  def display_compare_at_price_including_vat_for(_price_options = {})
160
- Spree::Deprecation.warn('Spree::Price#display_compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.1. Prices are charged as entered; use #display_compare_at_price instead.')
169
+ Spree::Deprecation.warn(
170
+ 'Spree::Price#display_compare_at_price_including_vat_for is deprecated and will be removed in Spree 6.3. ' \
171
+ 'Prices are charged as entered; use #display_compare_at_price instead.'
172
+ )
161
173
  display_compare_at_price
162
174
  end
163
175
 
@@ -130,25 +130,31 @@ module Spree
130
130
  include Spree::HasStatus
131
131
  has_status :draft, :active, :inactive, :scheduled, default: :draft
132
132
 
133
- # @deprecated Call Spree.price_list_activate_workflow — removed in 6.1.
133
+ # @deprecated Call Spree.price_list_activate_workflow — removed in 6.3.
134
134
  # Kept literal: the old event always went straight to active, and the
135
135
  # workflow schedules a future-dated list instead. A caller relying on
136
136
  # this shell gets what it always got.
137
137
  def activate
138
- Spree::Deprecation.warn('Spree::PriceList#activate is deprecated and will be removed in Spree 6.1. Call Spree.price_list_activate_workflow instead.')
138
+ Spree::Deprecation.warn(
139
+ 'Spree::PriceList#activate is deprecated and will be removed in Spree 6.3. Call Spree.price_list_activate_workflow instead.'
140
+ )
139
141
  update(status: 'active')
140
142
  end
141
143
 
142
- # @deprecated Call Spree.price_list_deactivate_workflow — removed in 6.1.
144
+ # @deprecated Call Spree.price_list_deactivate_workflow — removed in 6.3.
143
145
  def deactivate
144
- Spree::Deprecation.warn('Spree::PriceList#deactivate is deprecated and will be removed in Spree 6.1. Call Spree.price_list_deactivate_workflow instead.')
146
+ Spree::Deprecation.warn(
147
+ 'Spree::PriceList#deactivate is deprecated and will be removed in Spree 6.3. Call Spree.price_list_deactivate_workflow instead.'
148
+ )
145
149
  Spree.price_list_deactivate_workflow.call(price_list: self).success?
146
150
  end
147
151
 
148
- # @deprecated Call Spree.price_list_activate_workflow — removed in 6.1.
152
+ # @deprecated Call Spree.price_list_activate_workflow — removed in 6.3.
149
153
  # It picks scheduled or active from the dates itself.
150
154
  def schedule
151
- Spree::Deprecation.warn('Spree::PriceList#schedule is deprecated and will be removed in Spree 6.1. Call Spree.price_list_activate_workflow instead.')
155
+ Spree::Deprecation.warn(
156
+ 'Spree::PriceList#schedule is deprecated and will be removed in Spree 6.3. Call Spree.price_list_activate_workflow instead.'
157
+ )
152
158
  update(status: 'scheduled')
153
159
  end
154
160
 
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module PriceRules
3
- # Deprecated STI shell, removed in Spree 6.1. Exists only so price-rule
3
+ # Deprecated STI shell, removed in Spree 6.3. Exists only so price-rule
4
4
  # rows created before `spree:migrate_tax_zones` runs still load — the task
5
5
  # converts each row to a {MarketRule} where the zone's countries match a
6
6
  # market exactly, and otherwise deactivates the price list and removes the
@@ -89,7 +89,7 @@ module Spree
89
89
  # @deprecated The classification_count column was renamed to categories_count in 6.0.
90
90
  alias_attribute :classification_count, :categories_count
91
91
 
92
- # @deprecated Use #product_categories; removed in 6.1.
92
+ # @deprecated Use #product_categories; removed in 6.3.
93
93
  # The live row in the review trail, or nil for a product nobody submitted.
94
94
  #
95
95
  # @return [Spree::ProductSubmission, nil]
@@ -116,28 +116,28 @@ module Spree
116
116
  end
117
117
 
118
118
  def classifications
119
- Spree::Deprecation.warn('Spree::Product#classifications is deprecated and will be removed in Spree 6.1. Use #product_categories instead.')
119
+ Spree::Deprecation.warn('Spree::Product#classifications is deprecated and will be removed in Spree 6.3. Use #product_categories instead.')
120
120
  product_categories
121
121
  end
122
122
 
123
- # @deprecated Use #categories / #category_ids; removed in 6.1.
123
+ # @deprecated Use #categories / #category_ids; removed in 6.3.
124
124
  def taxons
125
- Spree::Deprecation.warn('Spree::Product#taxons is deprecated and will be removed in Spree 6.1. Use #categories instead.')
125
+ Spree::Deprecation.warn('Spree::Product#taxons is deprecated and will be removed in Spree 6.3. Use #categories instead.')
126
126
  categories
127
127
  end
128
128
 
129
129
  def taxons=(value)
130
- Spree::Deprecation.warn('Spree::Product#taxons= is deprecated and will be removed in Spree 6.1. Use #categories= instead.')
130
+ Spree::Deprecation.warn('Spree::Product#taxons= is deprecated and will be removed in Spree 6.3. Use #categories= instead.')
131
131
  self.categories = value
132
132
  end
133
133
 
134
134
  def taxon_ids
135
- Spree::Deprecation.warn('Spree::Product#taxon_ids is deprecated and will be removed in Spree 6.1. Use #category_ids instead.')
135
+ Spree::Deprecation.warn('Spree::Product#taxon_ids is deprecated and will be removed in Spree 6.3. Use #category_ids instead.')
136
136
  category_ids
137
137
  end
138
138
 
139
139
  def taxon_ids=(ids)
140
- Spree::Deprecation.warn('Spree::Product#taxon_ids= is deprecated and will be removed in Spree 6.1. Use #category_ids= instead.')
140
+ Spree::Deprecation.warn('Spree::Product#taxon_ids= is deprecated and will be removed in Spree 6.3. Use #category_ids= instead.')
141
141
  self.category_ids = ids
142
142
  end
143
143
 
@@ -396,7 +396,7 @@ module Spree
396
396
  'in_taxon' => 'id', 'in_category' => 'id', 'in_collection' => 'id',
397
397
  'in_categories' => { list: 'id' }, 'with_option_value_ids' => { list: 'id' },
398
398
  'price_between' => %w[decimal decimal], 'price_lte' => 'decimal', 'price_gte' => 'decimal',
399
- 'ascend_by_price' => 'boolean', 'descend_by_price' => 'boolean'
399
+ 'ascend_by_price' => 'boolean', 'descend_by_price' => 'boolean', 'search' => 'text'
400
400
  }
401
401
 
402
402
  # All product-level convenience attributes delegate to the default variant —
@@ -424,21 +424,23 @@ module Spree
424
424
  include Spree::HasStatus
425
425
  has_status(*ALL_STATUSES, default: :draft)
426
426
 
427
- # @deprecated Call Spree.product_activate_workflow — removed in 6.1.
427
+ # @deprecated Call Spree.product_activate_workflow — removed in 6.3.
428
428
  def activate!
429
- Spree::Deprecation.warn('Spree::Product#activate! is deprecated and will be removed in Spree 6.1. Call Spree.product_activate_workflow instead.')
429
+ Spree::Deprecation.warn(
430
+ 'Spree::Product#activate! is deprecated and will be removed in Spree 6.3. Call Spree.product_activate_workflow instead.'
431
+ )
430
432
  run_status_workflow(Spree.product_activate_workflow)
431
433
  end
432
434
 
433
- # @deprecated Call Spree.product_archive_workflow — removed in 6.1.
435
+ # @deprecated Call Spree.product_archive_workflow — removed in 6.3.
434
436
  def archive!
435
- Spree::Deprecation.warn('Spree::Product#archive! is deprecated and will be removed in Spree 6.1. Call Spree.product_archive_workflow instead.')
437
+ Spree::Deprecation.warn('Spree::Product#archive! is deprecated and will be removed in Spree 6.3. Call Spree.product_archive_workflow instead.')
436
438
  run_status_workflow(Spree.product_archive_workflow)
437
439
  end
438
440
 
439
- # @deprecated Call Spree.product_draft_workflow — removed in 6.1.
441
+ # @deprecated Call Spree.product_draft_workflow — removed in 6.3.
440
442
  def draft!
441
- Spree::Deprecation.warn('Spree::Product#draft! is deprecated and will be removed in Spree 6.1. Call Spree.product_draft_workflow instead.')
443
+ Spree::Deprecation.warn('Spree::Product#draft! is deprecated and will be removed in Spree 6.3. Call Spree.product_draft_workflow instead.')
442
444
  run_status_workflow(Spree.product_draft_workflow)
443
445
  end
444
446
 
@@ -550,7 +552,7 @@ module Spree
550
552
 
551
553
  variant_count > 1
552
554
  end
553
- # @deprecated Use #has_multiple_variants? — will be removed in Spree 6.1.
555
+ # @deprecated Use #has_multiple_variants? — will be removed in Spree 6.3.
554
556
  alias has_variants? has_multiple_variants?
555
557
 
556
558
  # Returns the product's media gallery.
@@ -581,12 +583,12 @@ module Spree
581
583
  @variant_for_images ||= find_variant_for_images
582
584
  end
583
585
 
584
- # @deprecated Read #gallery_media directly; removed in 6.1. Nothing in
586
+ # @deprecated Read #gallery_media directly; removed in 6.3. Nothing in
585
587
  # Spree calls this — a hover image is a storefront presentation choice,
586
588
  # not something core should name.
587
589
  # @return [Spree::Media, nil]
588
590
  def secondary_image
589
- Spree::Deprecation.warn('Spree::Product#secondary_image is deprecated and will be removed in Spree 6.1. Use #gallery_media instead.')
591
+ Spree::Deprecation.warn('Spree::Product#secondary_image is deprecated and will be removed in Spree 6.3. Use #gallery_media instead.')
590
592
  gallery_media.second
591
593
  end
592
594
 
@@ -647,9 +649,9 @@ module Spree
647
649
  # seller check: a variant from a seller who is suspended, still onboarding
648
650
  # or away is not for sale, so it cannot be what the product displays.
649
651
  def first_available_variant(currency)
650
- sellable_variants.find do |variant|
651
- variant.purchasable? && variant.price_in(currency).amount.present?
652
- end
652
+ variants_to_check = sellable_variants
653
+ Spree::Stock::Quantifier.preload(variants_to_check)
654
+ variants_to_check.find { |variant| variant.purchasable_in?(currency) }
653
655
  end
654
656
 
655
657
  # Whether the shop price differs between this product's variants. Reads
@@ -770,25 +772,25 @@ module Spree
770
772
  end
771
773
  end
772
774
 
773
- # @deprecated Use {#stock_levels}; removed in 6.1.
775
+ # @deprecated Use {#stock_levels}; removed in 6.3.
774
776
  def stock_items
775
- Spree::Deprecation.warn('Spree::Product#stock_items is deprecated and will be removed in Spree 6.1. Use #stock_levels instead.')
777
+ Spree::Deprecation.warn('Spree::Product#stock_items is deprecated and will be removed in Spree 6.3. Use #stock_levels instead.')
776
778
  stock_levels
777
779
  end
778
780
 
779
- # @deprecated Use #default_variant — the master variant is being removed in Spree 6.1.
781
+ # @deprecated Use #default_variant — the master variant is being removed in Spree 6.3.
780
782
  def master
781
- Spree::Deprecation.warn('Spree::Product#master is deprecated and will be removed in Spree 6.1. Use #default_variant instead.')
783
+ Spree::Deprecation.warn('Spree::Product#master is deprecated and will be removed in Spree 6.3. Use #default_variant instead.')
782
784
  default_variant
783
785
  end
784
786
 
785
- # @deprecated Use #variants — will be removed in Spree 6.1.
787
+ # @deprecated Use #variants — will be removed in Spree 6.3.
786
788
  def variants_including_master
787
- Spree::Deprecation.warn('Spree::Product#variants_including_master is deprecated and will be removed in Spree 6.1. Use #variants instead.')
789
+ Spree::Deprecation.warn('Spree::Product#variants_including_master is deprecated and will be removed in Spree 6.3. Use #variants instead.')
788
790
  variants
789
791
  end
790
792
 
791
- # @deprecated Use #default_variant_id — will be removed in Spree 6.1.
793
+ # @deprecated Use #default_variant_id — will be removed in Spree 6.3.
792
794
  def master_id
793
795
  default_variant_id
794
796
  end
@@ -803,7 +805,7 @@ module Spree
803
805
 
804
806
  # @deprecated Use {#primary_category}.
805
807
  def main_taxon
806
- Spree::Deprecation.warn('Spree::Product#main_taxon is deprecated and will be removed in Spree 6.1. Use #primary_category instead.')
808
+ Spree::Deprecation.warn('Spree::Product#main_taxon is deprecated and will be removed in Spree 6.3. Use #primary_category instead.')
807
809
  primary_category
808
810
  end
809
811
 
@@ -51,14 +51,14 @@ module Spree
51
51
  end
52
52
  }
53
53
 
54
- # @deprecated Use #category / #category=; removed in 6.1.
54
+ # @deprecated Use #category / #category=; removed in 6.3.
55
55
  def taxon
56
- Spree::Deprecation.warn('Spree::ProductCategory#taxon is deprecated and will be removed in Spree 6.1. Use #category instead.')
56
+ Spree::Deprecation.warn('Spree::ProductCategory#taxon is deprecated and will be removed in Spree 6.3. Use #category instead.')
57
57
  category
58
58
  end
59
59
 
60
60
  def taxon=(value)
61
- Spree::Deprecation.warn('Spree::ProductCategory#taxon= is deprecated and will be removed in Spree 6.1. Use #category= instead.')
61
+ Spree::Deprecation.warn('Spree::ProductCategory#taxon= is deprecated and will be removed in Spree 6.3. Use #category= instead.')
62
62
  self.category = value
63
63
  end
64
64
 
@@ -74,56 +74,73 @@ module Spree
74
74
  end
75
75
 
76
76
  #
77
- # Deprecated aliases (removed in 6.1)
77
+ # Deprecated aliases (removed in 6.3)
78
78
  #
79
79
  # @deprecated Use #categories.
80
80
  def taxons
81
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxons is deprecated and will be removed in Spree 6.1. Use #categories instead.')
81
+ Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxons is deprecated and will be removed in Spree 6.3. Use #categories instead.')
82
82
  categories
83
83
  end
84
84
 
85
85
  # @deprecated Use #categories=.
86
86
  def taxons=(value)
87
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxons= is deprecated and will be removed in Spree 6.1. Use #categories= instead.')
87
+ Spree::Deprecation.warn(
88
+ 'Spree::Promotion::Rules::Category#taxons= is deprecated and will be removed in Spree 6.3. Use #categories= instead.'
89
+ )
88
90
  self.categories = value
89
91
  end
90
92
 
91
93
  # @deprecated Use #category_ids.
92
94
  def taxon_ids
93
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids is deprecated and will be removed in Spree 6.1. Use #category_ids instead.')
95
+ Spree::Deprecation.warn(
96
+ 'Spree::Promotion::Rules::Category#taxon_ids is deprecated and will be removed in Spree 6.3. Use #category_ids instead.'
97
+ )
94
98
  category_ids
95
99
  end
96
100
 
97
101
  # @deprecated Use #category_ids=.
98
102
  def taxon_ids=(ids)
99
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids= is deprecated and will be removed in Spree 6.1. Use #category_ids= instead.')
103
+ Spree::Deprecation.warn(
104
+ 'Spree::Promotion::Rules::Category#taxon_ids= is deprecated and will be removed in Spree 6.3. Use #category_ids= instead.'
105
+ )
100
106
  self.category_ids = ids
101
107
  end
102
108
 
103
109
  # @deprecated Use #eligible_category_ids.
104
110
  def eligible_taxon_ids
105
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#eligible_taxon_ids is deprecated and will be removed in Spree 6.1. Use #eligible_category_ids instead.')
111
+ Spree::Deprecation.warn(
112
+ 'Spree::Promotion::Rules::Category#eligible_taxon_ids is deprecated and will be removed in Spree 6.3. ' \
113
+ 'Use #eligible_category_ids instead.'
114
+ )
106
115
  eligible_category_ids
107
116
  end
108
117
 
109
118
  # @deprecated Use #category_ids_to_add.
110
119
  def taxon_ids_to_add
111
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_to_add is deprecated and will be removed in Spree 6.1. Use #category_ids_to_add instead.')
120
+ Spree::Deprecation.warn(
121
+ 'Spree::Promotion::Rules::Category#taxon_ids_to_add is deprecated and will be removed in Spree 6.3. Use #category_ids_to_add instead.'
122
+ )
112
123
  category_ids_to_add
113
124
  end
114
125
 
115
126
  def taxon_ids_to_add=(ids)
116
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_to_add= is deprecated and will be removed in Spree 6.1. Use #category_ids_to_add= instead.')
127
+ Spree::Deprecation.warn(
128
+ 'Spree::Promotion::Rules::Category#taxon_ids_to_add= is deprecated and will be removed in Spree 6.3. Use #category_ids_to_add= instead.'
129
+ )
117
130
  self.category_ids_to_add = ids
118
131
  end
119
132
 
120
133
  def taxon_ids_string
121
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_string is deprecated and will be removed in Spree 6.1. Use #category_ids instead.')
134
+ Spree::Deprecation.warn(
135
+ 'Spree::Promotion::Rules::Category#taxon_ids_string is deprecated and will be removed in Spree 6.3. Use #category_ids instead.'
136
+ )
122
137
  categories.pluck(:id).join(',')
123
138
  end
124
139
 
125
140
  def taxon_ids_string=(s)
126
- Spree::Deprecation.warn('Spree::Promotion::Rules::Category#taxon_ids_string= is deprecated and will be removed in Spree 6.1. Use #category_ids= instead.')
141
+ Spree::Deprecation.warn(
142
+ 'Spree::Promotion::Rules::Category#taxon_ids_string= is deprecated and will be removed in Spree 6.3. Use #category_ids= instead.'
143
+ )
127
144
  ids = s.to_s.split(',').map(&:strip)
128
145
  self.categories = Spree::Category.for_stores(stores).find(ids)
129
146
  end
@@ -69,7 +69,7 @@ module Spree
69
69
 
70
70
  # Countries stopped being records in 6.0, so a rule still configured
71
71
  # with the legacy row id is resolved by reading the table the upgrade
72
- # keeps until 6.1. Rules saved since store the ISO code directly.
72
+ # keeps until 6.3. Rules saved since store the ISO code directly.
73
73
  def legacy_country_code(country_id)
74
74
  connection = ActiveRecord::Base.connection
75
75
  return nil unless connection.table_exists?('spree_countries')
@@ -7,10 +7,12 @@ module Spree
7
7
  # Spree::Promotion::Rules::Taxon in 6.0. A true constant alias, so old STI type
8
8
  # strings (`'Spree::Promotion::Rules::Taxon'`) still instantiate correctly until
9
9
  # the Phase 4 migration rewrites them. The warning fires when this file loads.
10
- # Removed in 6.1.
10
+ # Removed in 6.3.
11
11
  Taxon = Category
12
12
 
13
- Spree::Deprecation.warn('Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.1. Use Spree::Promotion::Rules::Category instead.')
13
+ Spree::Deprecation.warn(
14
+ 'Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.3. Use Spree::Promotion::Rules::Category instead.'
15
+ )
14
16
  end
15
17
  end
16
18
  end