spree_core 6.0.4 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/spree/imports/create_rows_job.rb +4 -2
- data/app/jobs/spree/imports/process_rows_job.rb +4 -2
- data/app/jobs/spree/payments/handle_modification_webhook_job.rb +93 -0
- data/app/jobs/spree/payments/handle_webhook_job.rb +4 -2
- data/app/jobs/spree/products/auto_match_taxons_job.rb +5 -2
- data/app/jobs/spree/search_provider/index_job.rb +8 -0
- data/app/jobs/spree/search_provider/remove_job.rb +3 -0
- data/app/jobs/spree/stock_locations/stock_items/create_job.rb +5 -2
- data/app/mailers/spree/base_mailer.rb +1 -1
- data/app/maintenance_tasks/spree/maintenance_tasks/upgrade/backfill_settlement_statuses.rb +40 -0
- data/app/models/concerns/spree/acted_by.rb +2 -2
- data/app/models/concerns/spree/customer_methods.rb +7 -5
- data/app/models/concerns/spree/deprecated_customer_alias.rb +11 -3
- data/app/models/concerns/spree/derived_number.rb +1 -1
- data/app/models/concerns/spree/has_custom_fields.rb +12 -10
- data/app/models/concerns/spree/integrations_concern.rb +5 -3
- data/app/models/concerns/spree/label_translatable.rb +4 -4
- data/app/models/concerns/spree/metadata.rb +3 -3
- data/app/models/concerns/spree/presentation_translatable.rb +1 -1
- data/app/models/concerns/spree/product_scopes.rb +5 -2
- data/app/models/concerns/spree/purchase/addresses.rb +8 -5
- data/app/models/concerns/spree/purchase/deprecated_aliases.rb +2 -2
- data/app/models/concerns/spree/purchase/payment_processing.rb +11 -0
- data/app/models/concerns/spree/purchase/purchase_order.rb +21 -0
- data/app/models/concerns/spree/purchase/totals.rb +3 -2
- data/app/models/concerns/spree/ransackable_attributes.rb +81 -4
- data/app/models/concerns/spree/settlement_status.rb +29 -0
- data/app/models/concerns/spree/stores/markets.rb +4 -32
- data/app/models/concerns/spree/user_address.rb +5 -2
- data/app/models/concerns/spree/user_methods.rb +2 -2
- data/app/models/spree/address.rb +29 -14
- data/app/models/spree/asset.rb +3 -3
- data/app/models/spree/base.rb +4 -4
- data/app/models/spree/calculator/shipping/flat_rate.rb +6 -4
- data/app/models/spree/cart.rb +2 -2
- data/app/models/spree/category.rb +61 -38
- data/app/models/spree/classification.rb +2 -2
- data/app/models/spree/collection_rule.rb +5 -1
- data/app/models/spree/current.rb +19 -0
- data/app/models/spree/custom_field.rb +6 -6
- data/app/models/spree/custom_field_definition.rb +10 -7
- data/app/models/spree/delivery_method.rb +21 -15
- data/app/models/spree/delivery_rate.rb +1 -1
- data/app/models/spree/digital.rb +1 -1
- data/app/models/spree/digital_asset.rb +2 -2
- data/app/models/spree/digital_link.rb +4 -4
- data/app/models/spree/export.rb +32 -3
- data/app/models/spree/exports/products.rb +9 -1
- data/app/models/spree/fulfillment/custom_events.rb +18 -10
- data/app/models/spree/fulfillment.rb +53 -29
- data/app/models/spree/fulfillment_group.rb +2 -2
- data/app/models/spree/fulfillment_item.rb +3 -3
- data/app/models/spree/fulfilment_changer.rb +1 -1
- data/app/models/spree/gateway/bogus.rb +41 -2
- data/app/models/spree/gift_card.rb +26 -14
- data/app/models/spree/import.rb +23 -15
- data/app/models/spree/import_row.rb +6 -6
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/invitation.rb +8 -4
- data/app/models/spree/line_item.rb +10 -8
- data/app/models/spree/media.rb +3 -3
- data/app/models/spree/metafield.rb +1 -1
- data/app/models/spree/metafield_definition.rb +1 -1
- data/app/models/spree/metafields.rb +2 -2
- data/app/models/spree/option_type.rb +27 -0
- data/app/models/spree/option_value.rb +3 -3
- data/app/models/spree/order.rb +97 -49
- data/app/models/spree/order_group.rb +2 -2
- data/app/models/spree/order_inventory.rb +2 -2
- data/app/models/spree/order_merger.rb +2 -2
- data/app/models/spree/order_updater.rb +34 -20
- data/app/models/spree/payment/custom_events.rb +2 -1
- data/app/models/spree/payment/processing.rb +20 -3
- data/app/models/spree/payment.rb +194 -15
- data/app/models/spree/payment_capture_event.rb +2 -0
- data/app/models/spree/payment_method/store_credit.rb +6 -0
- data/app/models/spree/payment_method.rb +65 -11
- data/app/models/spree/payment_response.rb +19 -0
- data/app/models/spree/payment_session.rb +15 -3
- data/app/models/spree/payment_split.rb +14 -2
- data/app/models/spree/price.rb +20 -8
- data/app/models/spree/price_list.rb +12 -6
- data/app/models/spree/price_rules/zone_rule.rb +1 -1
- data/app/models/spree/product.rb +30 -28
- data/app/models/spree/product_category.rb +3 -3
- data/app/models/spree/promotion/rules/category.rb +27 -10
- data/app/models/spree/promotion/rules/country.rb +1 -1
- data/app/models/spree/promotion/rules/taxon.rb +4 -2
- data/app/models/spree/promotion/rules/user.rb +1 -1
- data/app/models/spree/promotion_action.rb +1 -1
- data/app/models/spree/promotion_rule_category.rb +5 -5
- data/app/models/spree/promotion_rule_taxon.rb +2 -2
- data/app/models/spree/prototype.rb +4 -1
- data/app/models/spree/purchase_order.rb +20 -3
- data/app/models/spree/refund.rb +7 -1
- data/app/models/spree/return.rb +7 -1
- data/app/models/spree/return_authorization_reason.rb +3 -3
- data/app/models/spree/return_reason.rb +1 -1
- data/app/models/spree/search_provider/base.rb +12 -2
- data/app/models/spree/search_provider/database.rb +8 -5
- data/app/models/spree/search_provider.rb +7 -5
- data/app/models/spree/shipment.rb +4 -1
- data/app/models/spree/shipping_method.rb +4 -1
- data/app/models/spree/shipping_rate.rb +1 -1
- data/app/models/spree/stock/coordinator.rb +2 -2
- data/app/models/spree/stock/estimator.rb +7 -5
- data/app/models/spree/stock/package.rb +10 -8
- data/app/models/spree/stock_item.rb +1 -1
- data/app/models/spree/stock_level/custom_events.rb +1 -1
- data/app/models/spree/stock_level.rb +1 -1
- data/app/models/spree/stock_location.rb +12 -8
- data/app/models/spree/stock_movement.rb +6 -6
- data/app/models/spree/stock_reservation.rb +5 -5
- data/app/models/spree/store.rb +64 -16
- data/app/models/spree/store_credit.rb +3 -3
- data/app/models/spree/store_credit_category.rb +5 -5
- data/app/models/spree/store_credit_type.rb +2 -2
- data/app/models/spree/subscriber.rb +7 -7
- data/app/models/spree/tax_rate.rb +5 -5
- data/app/models/spree/taxon.rb +3 -3
- data/app/models/spree/taxon_rule.rb +2 -2
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/variant.rb +45 -10
- data/app/models/spree/variant_media.rb +1 -1
- data/app/models/spree/wished_item.rb +1 -1
- data/app/models/spree/wishlist.rb +2 -2
- data/app/models/spree/wishlist_item/custom_events.rb +2 -2
- data/app/models/spree/zone.rb +1 -1
- data/app/models/spree/zone_member.rb +1 -1
- data/app/presenters/spree/csv/product_variant_presenter.rb +17 -8
- data/app/serializers/spree/emails/store_serializer.rb +1 -1
- data/app/services/spree/carts/associate.rb +6 -2
- data/app/services/spree/carts/create.rb +1 -1
- data/app/services/spree/carts/destroy.rb +1 -1
- data/app/services/spree/carts/remove_item.rb +1 -1
- data/app/services/spree/carts/remove_line_item.rb +2 -2
- data/app/services/spree/carts/remove_out_of_stock_items.rb +3 -1
- data/app/services/spree/carts/set_quantity.rb +2 -2
- data/app/services/spree/carts/split_by_seller.rb +4 -13
- data/app/services/spree/carts/update.rb +17 -0
- data/app/services/spree/checkout/add_store_credit.rb +3 -3
- data/app/services/spree/checkout/remove_store_credit.rb +2 -2
- data/app/services/spree/imports/row_processors/product_variant.rb +19 -0
- data/app/services/spree/orders/approve.rb +3 -3
- data/app/services/spree/orders/create_from_cart.rb +2 -0
- data/app/services/spree/orders/create_user_account.rb +2 -2
- data/app/services/spree/orders/update_statuses.rb +4 -2
- data/app/services/spree/products/auto_match_taxons.rb +5 -2
- data/app/services/spree/shipments/update.rb +2 -2
- data/app/services/spree/stock_locations/stock_items/create.rb +5 -2
- data/app/services/spree/stock_reservations/extend.rb +3 -1
- data/app/services/spree/stock_reservations/reserve.rb +3 -1
- data/app/services/spree/store_credits/apply.rb +1 -1
- data/app/services/spree/taxons/add_products.rb +4 -2
- data/app/services/spree/taxons/regenerate_products.rb +5 -2
- data/app/services/spree/taxons/remove_products.rb +4 -2
- data/app/subscribers/spree/order_status_subscriber.rb +4 -3
- data/app/subscribers/spree/payment_split_subscriber.rb +39 -21
- data/app/subscribers/spree/seller_transfer_reversal_subscriber.rb +19 -7
- data/app/tools/spree/agent_tools/query_report.rb +116 -14
- data/app/workflows/spree/carts/add_item.rb +1 -1
- data/app/workflows/spree/carts/complete.rb +1 -19
- data/app/workflows/spree/carts/recalculate.rb +1 -1
- data/app/workflows/spree/carts/recalculate_totals.rb +3 -3
- data/app/workflows/spree/fulfillments/update.rb +1 -1
- data/app/workflows/spree/orders/cancel.rb +22 -1
- data/app/workflows/spree/orders/complete.rb +7 -1
- data/app/workflows/spree/payments/capture.rb +101 -7
- data/app/workflows/spree/payments/handle_modification_webhook.rb +218 -0
- data/app/workflows/spree/payments/handle_webhook.rb +7 -1
- data/app/workflows/spree/payments/process.rb +47 -4
- data/app/workflows/spree/payments/void.rb +4 -1
- data/app/workflows/spree/products/approve.rb +17 -0
- data/app/workflows/spree/refunds/create.rb +10 -1
- data/app/workflows/spree/refunds/order_payments.rb +3 -1
- data/app/workflows/spree/seller_transfers/create.rb +1 -1
- data/config/locales/be.yml +2 -2
- data/config/locales/bg.yml +4 -4
- data/config/locales/en.yml +12 -0
- data/config/locales/ru.yml +3 -3
- data/db/migrate/20260710000001_rename_taxons_to_categories.rb +1 -1
- data/db/migrate/20260728000004_rename_shipping_to_fulfillment_and_delivery.rb +1 -1
- data/db/migrate/20260806000001_add_store_id_to_spree_tax_rates_and_categories.rb +1 -1
- data/db/migrate/20260807130001_add_country_state_codes_to_consumers.rb +1 -1
- data/db/migrate/20260809000001_rename_metafields_to_custom_fields.rb +1 -1
- data/db/migrate/20260809150001_promote_shipping_categories_to_delivery_profiles.rb +1 -1
- data/db/migrate/20260811000001_add_delivery_tracking_to_fulfillments.rb +1 -1
- data/db/migrate/20260824000001_add_store_to_spree_media.rb +1 -1
- data/db/migrate/20260828100001_unify_import_and_export_tenancy.rb +1 -1
- data/db/migrate/20261016000001_remove_default_from_spree_tax_rates_included_in_price.rb +1 -1
- data/db/migrate/20261116100001_add_status_to_spree_payment_capture_events_and_refunds.rb +17 -0
- data/lib/spree/agent_tool.rb +11 -4
- data/lib/spree/agent_tools/default_catalog.rb +2 -2
- data/lib/spree/agent_tools/legacy_tools.rb +1 -1
- data/lib/spree/core/dependencies.rb +11 -10
- data/lib/spree/core/engine.rb +4 -0
- data/lib/spree/core/number_generator.rb +4 -3
- data/lib/spree/core/preferences/preferable.rb +1 -1
- data/lib/spree/core/preferences/preferable_class_methods.rb +5 -1
- data/lib/spree/core/pricing/resolver.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +37 -10
- data/lib/spree/i18n.rb +6 -2
- data/lib/spree/localized_number.rb +1 -1
- data/lib/spree/removed_apis.rb +274 -0
- data/lib/spree/reporting/adapters/live.rb +69 -8
- data/lib/spree/reporting/default_vocabulary.rb +11 -5
- data/lib/spree/reporting/query.rb +4 -1
- data/lib/spree/reporting/registry.rb +50 -3
- data/lib/spree/testing_support/factories/digital_asset_factory.rb +1 -1
- data/lib/spree/testing_support/factories/payment_capture_event_factory.rb +10 -0
- data/lib/spree/testing_support/factories/refund_factory.rb +10 -0
- data/lib/spree/testing_support/factories/stock_level_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
- data/lib/spree/testing_support/factories/wishlist_item_factory.rb +1 -1
- data/lib/spree/testing_support/i18n.rb +7 -2
- data/lib/spree/testing_support/order_walkthrough.rb +5 -2
- data/lib/spree/upgrades/5_6_to_6_0/manifest.yml +71 -14
- data/lib/tasks/carts_migration.rake +1 -1
- data/lib/tasks/categories_and_collections.rake +1 -1
- data/lib/tasks/deliveries_migration.rake +1 -1
- data/lib/tasks/delivery_method_rules_migration.rake +1 -1
- data/lib/tasks/delivery_migration.rake +1 -1
- data/lib/tasks/delivery_profiles_migration.rake +2 -2
- data/lib/tasks/fold_store_credit_categories.rake +1 -1
- data/lib/tasks/migrate_country_state_codes.rake +1 -1
- data/lib/tasks/migrate_returns.rake +4 -4
- data/lib/tasks/migrate_rich_text_to_columns.rake +1 -1
- data/lib/tasks/store_settings.rake +1 -1
- data/lib/tasks/typed_stock_movements_migration.rake +1 -1
- metadata +26 -6
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
# - fulfillment.canceled: Fulfillment was canceled
|
|
13
13
|
#
|
|
14
14
|
# The legacy shipment.* / order.shipped events are dual-emitted for one
|
|
15
|
-
# release (webhook contract bridge — removed in 6.
|
|
15
|
+
# release (webhook contract bridge — removed in 6.5).
|
|
16
16
|
#
|
|
17
17
|
# NOTE: These methods are called from the Spree::Fulfillments workflows,
|
|
18
18
|
# never from ActiveRecord callbacks — publishing is part of the transition
|
|
@@ -20,9 +20,11 @@ module Spree
|
|
|
20
20
|
module CustomEvents
|
|
21
21
|
extend ActiveSupport::Concern
|
|
22
22
|
|
|
23
|
-
# @deprecated `ready` is not a status since 6.0; removed in 6.
|
|
23
|
+
# @deprecated `ready` is not a status since 6.0; removed in 6.3.
|
|
24
24
|
def publish_fulfillment_ready_event
|
|
25
|
-
Spree::Deprecation.warn(
|
|
25
|
+
Spree::Deprecation.warn(
|
|
26
|
+
'Spree::Fulfillment#publish_fulfillment_ready_event is deprecated and will be removed in Spree 6.3. The ready status no longer exists.'
|
|
27
|
+
)
|
|
26
28
|
nil
|
|
27
29
|
end
|
|
28
30
|
|
|
@@ -45,7 +47,7 @@ module Spree
|
|
|
45
47
|
metadata = { notify_customer: notify_customer? }
|
|
46
48
|
|
|
47
49
|
publish_event('fulfillment.fulfilled', nil, metadata)
|
|
48
|
-
# Legacy name — removed in 6.
|
|
50
|
+
# Legacy name — removed in 6.5
|
|
49
51
|
publish_event('shipment.shipped', nil, metadata)
|
|
50
52
|
|
|
51
53
|
# Force reload of fulfillments association to see the new status
|
|
@@ -68,19 +70,25 @@ module Spree
|
|
|
68
70
|
return unless Spree::Events.enabled?
|
|
69
71
|
|
|
70
72
|
publish_event('fulfillment.canceled')
|
|
71
|
-
# Legacy name — removed in 6.
|
|
73
|
+
# Legacy name — removed in 6.5
|
|
72
74
|
publish_event('shipment.canceled')
|
|
73
75
|
end
|
|
74
76
|
|
|
75
|
-
# @deprecated Use {#publish_fulfillment_fulfilled_event}; removed in 6.
|
|
77
|
+
# @deprecated Use {#publish_fulfillment_fulfilled_event}; removed in 6.3.
|
|
76
78
|
def publish_shipment_shipped_event
|
|
77
|
-
Spree::Deprecation.warn(
|
|
79
|
+
Spree::Deprecation.warn(
|
|
80
|
+
'Spree::Fulfillment#publish_shipment_shipped_event is deprecated and will be removed in Spree 6.3. ' \
|
|
81
|
+
'Use #publish_fulfillment_fulfilled_event instead.'
|
|
82
|
+
)
|
|
78
83
|
publish_fulfillment_fulfilled_event
|
|
79
84
|
end
|
|
80
85
|
|
|
81
|
-
# @deprecated Use {#publish_fulfillment_canceled_event}; removed in 6.
|
|
86
|
+
# @deprecated Use {#publish_fulfillment_canceled_event}; removed in 6.3.
|
|
82
87
|
def publish_shipment_canceled_event
|
|
83
|
-
Spree::Deprecation.warn(
|
|
88
|
+
Spree::Deprecation.warn(
|
|
89
|
+
'Spree::Fulfillment#publish_shipment_canceled_event is deprecated and will be removed in Spree 6.3. ' \
|
|
90
|
+
'Use #publish_fulfillment_canceled_event instead.'
|
|
91
|
+
)
|
|
84
92
|
publish_fulfillment_canceled_event
|
|
85
93
|
end
|
|
86
94
|
|
|
@@ -88,7 +96,7 @@ module Spree
|
|
|
88
96
|
|
|
89
97
|
def publish_order_fulfilled_event
|
|
90
98
|
order.publish_event('order.fulfilled')
|
|
91
|
-
# Legacy name — removed in 6.
|
|
99
|
+
# Legacy name — removed in 6.5
|
|
92
100
|
order.publish_event('order.shipped')
|
|
93
101
|
end
|
|
94
102
|
end
|
|
@@ -68,7 +68,7 @@ module Spree
|
|
|
68
68
|
# unfulfilled/fulfilled/delivered/canceled scopes + predicates come from
|
|
69
69
|
# has_status below. These are the ones it cannot generate.
|
|
70
70
|
#
|
|
71
|
-
# @deprecated legacy names — removed in 6.
|
|
71
|
+
# @deprecated legacy names — removed in 6.3
|
|
72
72
|
scope :shipped, -> { fulfilled }
|
|
73
73
|
scope :pending, -> { unfulfilled }
|
|
74
74
|
scope :ready, -> { unfulfilled }
|
|
@@ -151,22 +151,22 @@ module Spree
|
|
|
151
151
|
include Spree::HasStatus
|
|
152
152
|
has_status :unfulfilled, :fulfilled, :delivered, :canceled, default: :unfulfilled
|
|
153
153
|
|
|
154
|
-
# @deprecated Use {Spree::Fulfillments::Fulfill}; removed in 6.
|
|
154
|
+
# @deprecated Use {Spree::Fulfillments::Fulfill}; removed in 6.3.
|
|
155
155
|
def ship(*args)
|
|
156
|
-
Spree::Deprecation.warn('Spree::Fulfillment#ship is deprecated and will be removed in Spree 6.
|
|
156
|
+
Spree::Deprecation.warn('Spree::Fulfillment#ship is deprecated and will be removed in Spree 6.3. Use Spree::Fulfillments::Fulfill instead.')
|
|
157
157
|
Spree.fulfillment_fulfill_workflow.call(fulfillment: self, **args.first.to_h)
|
|
158
158
|
end
|
|
159
159
|
alias ship! ship
|
|
160
160
|
|
|
161
|
-
# @deprecated Use {#can_fulfill?}; removed in 6.
|
|
161
|
+
# @deprecated Use {#can_fulfill?}; removed in 6.3.
|
|
162
162
|
def can_ship?
|
|
163
|
-
Spree::Deprecation.warn('Spree::Fulfillment#can_ship? is deprecated and will be removed in Spree 6.
|
|
163
|
+
Spree::Deprecation.warn('Spree::Fulfillment#can_ship? is deprecated and will be removed in Spree 6.3. Use #can_fulfill? instead.')
|
|
164
164
|
can_fulfill?
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
-
# @deprecated Use {#fulfilled?}; removed in 6.
|
|
167
|
+
# @deprecated Use {#fulfilled?}; removed in 6.3.
|
|
168
168
|
def shipped?
|
|
169
|
-
Spree::Deprecation.warn('Spree::Fulfillment#shipped? is deprecated and will be removed in Spree 6.
|
|
169
|
+
Spree::Deprecation.warn('Spree::Fulfillment#shipped? is deprecated and will be removed in Spree 6.3. Use #fulfilled? instead.')
|
|
170
170
|
fulfilled?
|
|
171
171
|
end
|
|
172
172
|
|
|
@@ -209,7 +209,7 @@ module Spree
|
|
|
209
209
|
# @deprecated the column is +status+ since 6.0
|
|
210
210
|
alias_attribute :state, :status
|
|
211
211
|
alias_attribute :shipped_at, :fulfilled_at
|
|
212
|
-
# Legacy association names — removed in 6.
|
|
212
|
+
# Legacy association names — removed in 6.3.
|
|
213
213
|
has_many :inventory_units, class_name: 'Spree::FulfillmentItem', foreign_key: :fulfillment_id, inverse_of: :fulfillment, deprecated: true
|
|
214
214
|
has_many :shipping_rates, -> { order(:cost) }, class_name: 'Spree::DeliveryRate', foreign_key: :fulfillment_id, deprecated: true
|
|
215
215
|
has_one :selected_shipping_rate, -> { where(selected: true).order(:cost) }, class_name: 'Spree::DeliveryRate', foreign_key: :fulfillment_id, deprecated: true
|
|
@@ -271,9 +271,9 @@ module Spree
|
|
|
271
271
|
delivery_method&.digital? || false
|
|
272
272
|
end
|
|
273
273
|
|
|
274
|
-
# @deprecated Use {#delivery_method}; removed in 6.
|
|
274
|
+
# @deprecated Use {#delivery_method}; removed in 6.3.
|
|
275
275
|
def shipping_method
|
|
276
|
-
Spree::Deprecation.warn('Spree::Fulfillment#shipping_method is deprecated and will be removed in Spree 6.
|
|
276
|
+
Spree::Deprecation.warn('Spree::Fulfillment#shipping_method is deprecated and will be removed in Spree 6.3. Use #delivery_method instead.')
|
|
277
277
|
delivery_method
|
|
278
278
|
end
|
|
279
279
|
|
|
@@ -281,18 +281,22 @@ module Spree
|
|
|
281
281
|
delivery_rates.create(delivery_method: delivery_method, selected: selected, cost: cost)
|
|
282
282
|
end
|
|
283
283
|
|
|
284
|
-
# @deprecated Use {#add_delivery_method}; removed in 6.
|
|
284
|
+
# @deprecated Use {#add_delivery_method}; removed in 6.3.
|
|
285
285
|
def add_shipping_method(delivery_method, selected = false)
|
|
286
|
-
Spree::Deprecation.warn(
|
|
286
|
+
Spree::Deprecation.warn(
|
|
287
|
+
'Spree::Fulfillment#add_shipping_method is deprecated and will be removed in Spree 6.3. Use #add_delivery_method instead.'
|
|
288
|
+
)
|
|
287
289
|
add_delivery_method(delivery_method, selected)
|
|
288
290
|
end
|
|
289
291
|
|
|
290
|
-
# @deprecated Cancel through {Spree::Fulfillments::Cancel}; removed in 6.
|
|
292
|
+
# @deprecated Cancel through {Spree::Fulfillments::Cancel}; removed in 6.3.
|
|
291
293
|
# Restocking and the provider call are workflow steps now, so this no
|
|
292
294
|
# longer runs as a transition callback. Kept only so a host app that
|
|
293
|
-
# called it directly keeps working
|
|
295
|
+
# called it directly keeps working until 6.3.
|
|
294
296
|
def after_cancel
|
|
295
|
-
Spree::Deprecation.warn(
|
|
297
|
+
Spree::Deprecation.warn(
|
|
298
|
+
'Spree::Fulfillment#after_cancel is deprecated and will be removed in Spree 6.3. Cancel through Spree::Fulfillments::Cancel instead.'
|
|
299
|
+
)
|
|
296
300
|
manifest.each { |item| manifest_restock(item) }
|
|
297
301
|
provider.cancel_fulfillment(self)
|
|
298
302
|
end
|
|
@@ -470,7 +474,17 @@ module Spree
|
|
|
470
474
|
fulfillment_items.includes(:line_item).map(&:line_item).uniq
|
|
471
475
|
end
|
|
472
476
|
|
|
473
|
-
ManifestItem = Struct.new(:line_item, :variant, :quantity, :states)
|
|
477
|
+
ManifestItem = Struct.new(:line_item, :variant, :quantity, :states) do
|
|
478
|
+
# An exchange replacement rides on the original line item, so it is priced
|
|
479
|
+
# as its own variant rather than at the line's price.
|
|
480
|
+
#
|
|
481
|
+
# @return [BigDecimal]
|
|
482
|
+
def price
|
|
483
|
+
return line_item.price if variant.nil? || variant.id == line_item.variant_id
|
|
484
|
+
|
|
485
|
+
variant.price_in(line_item.currency).amount || line_item.price
|
|
486
|
+
end
|
|
487
|
+
end
|
|
474
488
|
|
|
475
489
|
def manifest
|
|
476
490
|
# Grouping by the ID means that we don't have to call out to the association accessor
|
|
@@ -517,6 +531,14 @@ module Spree
|
|
|
517
531
|
sort_by(&:uncaptured_amount).reverse
|
|
518
532
|
|
|
519
533
|
shipment_to_pay = final_price_with_items
|
|
534
|
+
# The capture workflow refuses an amount above what the order still
|
|
535
|
+
# owes, so a parcel priced above it (the total came down after
|
|
536
|
+
# authorization) takes the balance rather than failing the dispatch. A
|
|
537
|
+
# shared payment is bounded by this order's share instead, in #capture_from.
|
|
538
|
+
# Read from the payment rows, as the workflow does: an owner loaded
|
|
539
|
+
# before an earlier parcel captured still carries that parcel's balance.
|
|
540
|
+
owed = pending_payments.first&.amount_owed_by_order(including_in_flight: false) unless grouped_owner?
|
|
541
|
+
shipment_to_pay = [shipment_to_pay, owed].min if owed
|
|
520
542
|
payments_amount = 0
|
|
521
543
|
|
|
522
544
|
payments_pool = pending_payments.each_with_object([]) do |payment, pool|
|
|
@@ -538,23 +560,23 @@ module Spree
|
|
|
538
560
|
end
|
|
539
561
|
end
|
|
540
562
|
|
|
541
|
-
# @deprecated Use {#unfulfilled?}; removed in 6.
|
|
563
|
+
# @deprecated Use {#unfulfilled?}; removed in 6.3.
|
|
542
564
|
def ready_or_pending?
|
|
543
565
|
unfulfilled?
|
|
544
566
|
end
|
|
545
567
|
|
|
546
|
-
# @deprecated Use {#unfulfilled?}; removed in 6.
|
|
568
|
+
# @deprecated Use {#unfulfilled?}; removed in 6.3.
|
|
547
569
|
def pending?
|
|
548
570
|
unfulfilled?
|
|
549
571
|
end
|
|
550
572
|
|
|
551
|
-
# @deprecated Use {#unfulfilled?}; removed in 6.
|
|
573
|
+
# @deprecated Use {#unfulfilled?}; removed in 6.3.
|
|
552
574
|
def ready?
|
|
553
575
|
unfulfilled?
|
|
554
576
|
end
|
|
555
577
|
|
|
556
578
|
# @deprecated `ready_for_pickup` is not a status since 6.0 — for pickup
|
|
557
|
-
# fulfillments `fulfilled` means "waiting at the counter". Removed in 6.
|
|
579
|
+
# fulfillments `fulfilled` means "waiting at the counter". Removed in 6.3.
|
|
558
580
|
def ready_for_pickup?
|
|
559
581
|
fulfilled? && provider.class.pickup?
|
|
560
582
|
end
|
|
@@ -733,11 +755,11 @@ module Spree
|
|
|
733
755
|
end
|
|
734
756
|
|
|
735
757
|
# @deprecated Assigning tracking writes a delivery on save; removed in
|
|
736
|
-
# 6.
|
|
758
|
+
# 6.3. Use Spree::Deliveries::Create or the +tracking:+ keyword on
|
|
737
759
|
# Spree::Fulfillments::Fulfill / Update instead.
|
|
738
760
|
def tracking=(value)
|
|
739
761
|
Spree::Deprecation.warn(
|
|
740
|
-
'Spree::Fulfillment#tracking= is deprecated and will be removed in Spree 6.
|
|
762
|
+
'Spree::Fulfillment#tracking= is deprecated and will be removed in Spree 6.3. ' \
|
|
741
763
|
'Tracking is a Spree::Delivery — use Spree::Deliveries::Create or the tracking: keyword ' \
|
|
742
764
|
'on Spree::Fulfillments::Fulfill / Update.'
|
|
743
765
|
)
|
|
@@ -785,7 +807,7 @@ module Spree
|
|
|
785
807
|
self.cost = choice&.cost || 0
|
|
786
808
|
end
|
|
787
809
|
|
|
788
|
-
# @deprecated No-op since 6.0; removed in 6.
|
|
810
|
+
# @deprecated No-op since 6.0; removed in 6.3.
|
|
789
811
|
#
|
|
790
812
|
# This re-derived the status from the order's payment state on every order
|
|
791
813
|
# recalculation, which is what made a fulfillment move backwards when a
|
|
@@ -797,7 +819,10 @@ module Spree
|
|
|
797
819
|
# rely on to write the status.
|
|
798
820
|
return super unless args.one? && (args.first.is_a?(Spree::Order) || args.first.is_a?(Spree::Cart))
|
|
799
821
|
|
|
800
|
-
Spree::Deprecation.warn(
|
|
822
|
+
Spree::Deprecation.warn(
|
|
823
|
+
'Spree::Fulfillment#update!(order) is a no-op since Spree 6.0 and will be removed in 6.3. ' \
|
|
824
|
+
'Fulfillment statuses change through Spree::Fulfillments workflows.'
|
|
825
|
+
)
|
|
801
826
|
true
|
|
802
827
|
end
|
|
803
828
|
|
|
@@ -867,6 +892,9 @@ module Spree
|
|
|
867
892
|
|
|
868
893
|
begin
|
|
869
894
|
capture_at_gateway(payment, bounded)
|
|
895
|
+
# The provider answers by webhook: the claim stays until then, which
|
|
896
|
+
# records the share as captured or releases it.
|
|
897
|
+
return bounded if payment.reload.requested?
|
|
870
898
|
rescue StandardError
|
|
871
899
|
# Released only when the money truly never moved. The capture workflow
|
|
872
900
|
# keeps working after the charge commits — it authorizes the remainder
|
|
@@ -886,11 +914,7 @@ module Spree
|
|
|
886
914
|
# caller in the rescue path is already raising the reason the capture
|
|
887
915
|
# failed, and losing that to a bookkeeping error would hide it.
|
|
888
916
|
def settle_share(split, amount, captured:)
|
|
889
|
-
split.with_lock
|
|
890
|
-
attributes = { claimed_amount: split.claimed_amount - amount }
|
|
891
|
-
attributes[:captured_amount] = split.captured_amount + amount if captured
|
|
892
|
-
split.update!(attributes)
|
|
893
|
-
end
|
|
917
|
+
split.with_lock { split.settle_claim!(amount, captured: captured) }
|
|
894
918
|
rescue StandardError => e
|
|
895
919
|
Rails.error.report(e, handled: true, context: { payment_split_id: split.id }, source: 'spree.core')
|
|
896
920
|
end
|
|
@@ -103,8 +103,8 @@ module Spree
|
|
|
103
103
|
#
|
|
104
104
|
# @return [Array<Spree::Fulfillment::ManifestItem>]
|
|
105
105
|
def manifest
|
|
106
|
-
fulfillments.flat_map(&:manifest).group_by
|
|
107
|
-
Spree::Fulfillment::ManifestItem.new(line_item,
|
|
106
|
+
fulfillments.flat_map(&:manifest).group_by { |item| [item.line_item, item.variant] }.map do |(line_item, variant), items|
|
|
107
|
+
Spree::Fulfillment::ManifestItem.new(line_item, variant, items.sum(&:quantity), nil)
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
@@ -24,7 +24,7 @@ module Spree
|
|
|
24
24
|
backordered.order('spree_orders.completed_at ASC')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# Legacy names — removed in 6.
|
|
27
|
+
# Legacy names — removed in 6.3.
|
|
28
28
|
belongs_to :shipment, class_name: 'Spree::Fulfillment', foreign_key: :fulfillment_id, optional: true, touch: true, deprecated: true
|
|
29
29
|
alias_attribute :shipment_id, :fulfillment_id
|
|
30
30
|
# @deprecated the column is +status+ since 6.0
|
|
@@ -69,11 +69,11 @@ module Spree
|
|
|
69
69
|
end
|
|
70
70
|
alias fill_backorder fill_backorder!
|
|
71
71
|
|
|
72
|
-
# @deprecated Write the status — removed in 6.
|
|
72
|
+
# @deprecated Write the status — removed in 6.3. `return` was a state
|
|
73
73
|
# machine event name and could never be called as written (it parses as
|
|
74
74
|
# the keyword), so this exists only for `send(:return!)`-style callers.
|
|
75
75
|
def return!
|
|
76
|
-
Spree::Deprecation.warn('Spree::FulfillmentItem#return! is deprecated and will be removed in Spree 6.
|
|
76
|
+
Spree::Deprecation.warn('Spree::FulfillmentItem#return! is deprecated and will be removed in Spree 6.3. Write the status instead.')
|
|
77
77
|
return false unless shipped?
|
|
78
78
|
|
|
79
79
|
update!(status: 'returned')
|
|
@@ -13,6 +13,9 @@ module Spree
|
|
|
13
13
|
|
|
14
14
|
preference :dummy_key, :string, default: 'PUBLICKEY123'
|
|
15
15
|
preference :dummy_secret_key, :password, default: 'SECRETKEY123'
|
|
16
|
+
# Answers captures, voids and refunds the way a provider that reports
|
|
17
|
+
# their outcome by webhook does, so core can test that path without one.
|
|
18
|
+
preference :requested_mode, :boolean, default: false
|
|
16
19
|
|
|
17
20
|
def provider_class
|
|
18
21
|
self.class
|
|
@@ -50,23 +53,39 @@ module Spree
|
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
def credit(_money, _credit_card, _response_code, _options = {})
|
|
56
|
+
if preferred_requested_mode
|
|
57
|
+
return Spree::PaymentResponse.new(true, 'Bogus Gateway: Refund requested', {},
|
|
58
|
+
test: true, requested: true, authorization: "BGS-refund-#{SecureRandom.hex(6)}")
|
|
59
|
+
end
|
|
60
|
+
|
|
53
61
|
Spree::PaymentResponse.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: generate_authorization)
|
|
54
62
|
end
|
|
55
63
|
|
|
56
64
|
def capture(_money, authorization, _gateway_options)
|
|
57
65
|
if authorization&.start_with?('BGS-')
|
|
58
|
-
Spree::PaymentResponse.new(true, 'Bogus Gateway: Forced success', {}, test: true)
|
|
66
|
+
return Spree::PaymentResponse.new(true, 'Bogus Gateway: Forced success', {}, test: true) unless preferred_requested_mode
|
|
67
|
+
|
|
68
|
+
Spree::PaymentResponse.new(true, 'Bogus Gateway: Capture requested', {},
|
|
69
|
+
test: true, requested: true, reference: "BGS-capture-#{SecureRandom.hex(6)}")
|
|
59
70
|
else
|
|
60
71
|
Spree::PaymentResponse.new(false, 'Bogus Gateway: Forced failure', error: 'Bogus Gateway: Forced failure', test: true)
|
|
61
72
|
end
|
|
62
73
|
end
|
|
63
74
|
|
|
64
75
|
def void(_response_code, _credit_card, _options = {})
|
|
76
|
+
return Spree::PaymentResponse.new(true, 'Bogus Gateway: Void requested', {}, test: true, requested: true) if preferred_requested_mode
|
|
77
|
+
|
|
65
78
|
Spree::PaymentResponse.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: "void-#{generate_authorization}")
|
|
66
79
|
end
|
|
67
80
|
|
|
68
81
|
# Voids outright, so there is no captured charge for `refund:` to govern.
|
|
69
|
-
|
|
82
|
+
# In requested mode only an uncaptured payment waits: a captured one has no
|
|
83
|
+
# refund recorded for an outcome to settle.
|
|
84
|
+
def cancel(_response_code, payment = nil, refund: true)
|
|
85
|
+
if preferred_requested_mode && !payment&.completed?
|
|
86
|
+
return Spree::PaymentResponse.new(true, 'Bogus Gateway: Cancel requested', {}, test: true, requested: true)
|
|
87
|
+
end
|
|
88
|
+
|
|
70
89
|
Spree::PaymentResponse.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: generate_authorization)
|
|
71
90
|
end
|
|
72
91
|
|
|
@@ -167,6 +186,26 @@ module Spree
|
|
|
167
186
|
%w(capture void credit)
|
|
168
187
|
end
|
|
169
188
|
|
|
189
|
+
# In requested mode, accepts a plain JSON outcome naming the action and the
|
|
190
|
+
# record's reference, so specs and the dashboard's end-to-end test can
|
|
191
|
+
# answer a requested capture, void or refund through the webhook endpoint:
|
|
192
|
+
# { "action": "capture_succeeded", "reference": "<capture event transaction id>" }
|
|
193
|
+
# { "action": "void_failed", "reference": "<payment response code>", "reason": "..." }
|
|
194
|
+
# { "action": "refund_succeeded", "reference": "<refund transaction id>" }
|
|
195
|
+
def parse_webhook_event(raw_body, headers)
|
|
196
|
+
return super unless preferred_requested_mode
|
|
197
|
+
|
|
198
|
+
body = JSON.parse(raw_body)
|
|
199
|
+
action = body['action'].to_s
|
|
200
|
+
reference = body['reference'].to_s
|
|
201
|
+
return if reference.blank? || Spree::Payments::HandleModificationWebhook::OUTCOME_RECORDS.keys.map(&:to_s).exclude?(action)
|
|
202
|
+
|
|
203
|
+
metadata = body['reason'].present? ? { 'reason' => body['reason'].to_s } : {}
|
|
204
|
+
{ action: action.to_sym, reference: reference, metadata: metadata }
|
|
205
|
+
rescue JSON::ParserError
|
|
206
|
+
raise WebhookSignatureError
|
|
207
|
+
end
|
|
208
|
+
|
|
170
209
|
private
|
|
171
210
|
|
|
172
211
|
def generate_authorization
|
|
@@ -35,6 +35,7 @@ module Spree
|
|
|
35
35
|
validates :currency, presence: true
|
|
36
36
|
validates :amount, presence: true, numericality: { greater_than: 0 }
|
|
37
37
|
validates :amount_used, :amount_authorized, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
|
38
|
+
validate :amount_and_currency_unchanged_once_used, on: :update
|
|
38
39
|
|
|
39
40
|
#
|
|
40
41
|
# Associations
|
|
@@ -64,10 +65,10 @@ module Spree
|
|
|
64
65
|
#
|
|
65
66
|
# Ransack
|
|
66
67
|
#
|
|
67
|
-
ransack_alias :state, :status # @deprecated filter alias — removed in 6.
|
|
68
|
+
ransack_alias :state, :status # @deprecated filter alias — removed in 6.5
|
|
68
69
|
self.whitelisted_ransackable_attributes = %w[code customer_id status state gift_card_batch_id created_by_id currency expires_at]
|
|
69
70
|
search_by :code
|
|
70
|
-
# `users` is the pre-6.0 name for `customers` — removed in 6.
|
|
71
|
+
# `users` is the pre-6.0 name for `customers` — removed in 6.3.
|
|
71
72
|
self.whitelisted_ransackable_associations = %w[customers users orders batch]
|
|
72
73
|
self.whitelisted_ransackable_scopes = %w[active expired redeemed partially_redeemed]
|
|
73
74
|
self.ransackable_scope_types = %w[active expired redeemed partially_redeemed].index_with('boolean')
|
|
@@ -94,8 +95,7 @@ module Spree
|
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
# What the card can still give towards an order: nothing once it has
|
|
97
|
-
# expired, been redeemed or been cancelled, and never less than zero
|
|
98
|
-
# since an admin can lower the amount below what is already in use.
|
|
98
|
+
# expired, been redeemed or been cancelled, and never less than zero.
|
|
99
99
|
#
|
|
100
100
|
# @return [BigDecimal]
|
|
101
101
|
def spendable_amount
|
|
@@ -189,36 +189,36 @@ module Spree
|
|
|
189
189
|
end.to_s
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
-
# @deprecated use +display_status+ — removed in 6.
|
|
192
|
+
# @deprecated use +display_status+ — removed in 6.3
|
|
193
193
|
def display_state
|
|
194
|
-
Spree::Deprecation.warn('Spree::GiftCard#display_state is deprecated and will be removed in Spree 6.
|
|
194
|
+
Spree::Deprecation.warn('Spree::GiftCard#display_state is deprecated and will be removed in Spree 6.3. Use #display_status instead.')
|
|
195
195
|
display_status
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
# @deprecated read +status+ — removed in 6.
|
|
198
|
+
# @deprecated read +status+ — removed in 6.3
|
|
199
199
|
def state
|
|
200
|
-
Spree::Deprecation.warn('Spree::GiftCard#state is deprecated and will be removed in Spree 6.
|
|
200
|
+
Spree::Deprecation.warn('Spree::GiftCard#state is deprecated and will be removed in Spree 6.3. Use #status instead.')
|
|
201
201
|
status
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
-
# @deprecated write +status+ — removed in 6.
|
|
204
|
+
# @deprecated write +status+ — removed in 6.3
|
|
205
205
|
def state=(value)
|
|
206
|
-
Spree::Deprecation.warn('Spree::GiftCard#state= is deprecated and will be removed in Spree 6.
|
|
206
|
+
Spree::Deprecation.warn('Spree::GiftCard#state= is deprecated and will be removed in Spree 6.3. Use #status= instead.')
|
|
207
207
|
self.status = value
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
# @deprecated Call Spree.gift_card_redeem_workflow — removed in 6.
|
|
210
|
+
# @deprecated Call Spree.gift_card_redeem_workflow — removed in 6.3.
|
|
211
211
|
# The workflow decides full versus partial redemption from the balance,
|
|
212
212
|
# so both old verbs land on it.
|
|
213
213
|
def redeem!
|
|
214
|
-
Spree::Deprecation.warn('Spree::GiftCard#redeem! is deprecated and will be removed in Spree 6.
|
|
214
|
+
Spree::Deprecation.warn('Spree::GiftCard#redeem! is deprecated and will be removed in Spree 6.3. Call Spree.gift_card_redeem_workflow instead.')
|
|
215
215
|
run_gift_card_workflow(Spree.gift_card_redeem_workflow)
|
|
216
216
|
end
|
|
217
217
|
alias partial_redeem! redeem!
|
|
218
218
|
|
|
219
|
-
# @deprecated Call Spree.gift_card_cancel_workflow — removed in 6.
|
|
219
|
+
# @deprecated Call Spree.gift_card_cancel_workflow — removed in 6.3.
|
|
220
220
|
def cancel!
|
|
221
|
-
Spree::Deprecation.warn('Spree::GiftCard#cancel! is deprecated and will be removed in Spree 6.
|
|
221
|
+
Spree::Deprecation.warn('Spree::GiftCard#cancel! is deprecated and will be removed in Spree 6.3. Call Spree.gift_card_cancel_workflow instead.')
|
|
222
222
|
run_gift_card_workflow(Spree.gift_card_cancel_workflow)
|
|
223
223
|
end
|
|
224
224
|
|
|
@@ -291,5 +291,17 @@ module Spree
|
|
|
291
291
|
def set_currency
|
|
292
292
|
self.currency ||= store&.default_currency
|
|
293
293
|
end
|
|
294
|
+
|
|
295
|
+
# Once part of the card has been spent, its amount and currency are what
|
|
296
|
+
# that spending was measured against: changing either would invent a
|
|
297
|
+
# balance or leave a negative one. Keyed on the stored +amount_used+ and
|
|
298
|
+
# +amount_authorized+, so a workflow drawing the card down in the same
|
|
299
|
+
# save is unaffected.
|
|
300
|
+
def amount_and_currency_unchanged_once_used
|
|
301
|
+
return unless (amount_used_in_database.to_d + amount_authorized_in_database.to_d).positive?
|
|
302
|
+
|
|
303
|
+
errors.add(:amount, :cannot_change_once_used) if will_save_change_to_amount?
|
|
304
|
+
errors.add(:currency, :cannot_change_once_used) if will_save_change_to_currency?
|
|
305
|
+
end
|
|
294
306
|
end
|
|
295
307
|
end
|
data/app/models/spree/import.rb
CHANGED
|
@@ -157,41 +157,49 @@ module Spree
|
|
|
157
157
|
nil
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
-
# @deprecated Call the Spree::Imports workflows — removed in 6.
|
|
160
|
+
# @deprecated Call the Spree::Imports workflows — removed in 6.3.
|
|
161
161
|
def start_mapping!
|
|
162
|
-
Spree::Deprecation.warn(
|
|
162
|
+
Spree::Deprecation.warn(
|
|
163
|
+
'Spree::Import#start_mapping! is deprecated and will be removed in Spree 6.3. Call Spree.import_start_mapping_workflow instead.'
|
|
164
|
+
)
|
|
163
165
|
run_pipeline_workflow(Spree.import_start_mapping_workflow)
|
|
164
166
|
end
|
|
165
167
|
|
|
166
|
-
# @deprecated Call Spree.import_complete_mapping_workflow — removed in 6.
|
|
168
|
+
# @deprecated Call Spree.import_complete_mapping_workflow — removed in 6.3.
|
|
167
169
|
def complete_mapping!
|
|
168
|
-
Spree::Deprecation.warn(
|
|
170
|
+
Spree::Deprecation.warn(
|
|
171
|
+
'Spree::Import#complete_mapping! is deprecated and will be removed in Spree 6.3. Call Spree.import_complete_mapping_workflow instead.'
|
|
172
|
+
)
|
|
169
173
|
run_pipeline_workflow(Spree.import_complete_mapping_workflow)
|
|
170
174
|
end
|
|
171
175
|
|
|
172
|
-
# @deprecated Call Spree.import_start_processing_workflow — removed in 6.
|
|
176
|
+
# @deprecated Call Spree.import_start_processing_workflow — removed in 6.3.
|
|
173
177
|
def start_processing!
|
|
174
|
-
Spree::Deprecation.warn(
|
|
178
|
+
Spree::Deprecation.warn(
|
|
179
|
+
'Spree::Import#start_processing! is deprecated and will be removed in Spree 6.3. Call Spree.import_start_processing_workflow instead.'
|
|
180
|
+
)
|
|
175
181
|
run_pipeline_workflow(Spree.import_start_processing_workflow)
|
|
176
182
|
end
|
|
177
183
|
|
|
178
|
-
# @deprecated Call Spree.import_complete_workflow — removed in 6.
|
|
184
|
+
# @deprecated Call Spree.import_complete_workflow — removed in 6.3.
|
|
179
185
|
def complete!
|
|
180
|
-
Spree::Deprecation.warn('Spree::Import#complete! is deprecated and will be removed in Spree 6.
|
|
186
|
+
Spree::Deprecation.warn('Spree::Import#complete! is deprecated and will be removed in Spree 6.3. Call Spree.import_complete_workflow instead.')
|
|
181
187
|
run_pipeline_workflow(Spree.import_complete_workflow)
|
|
182
188
|
end
|
|
183
189
|
|
|
184
|
-
# @deprecated Set the status — removed in 6.
|
|
190
|
+
# @deprecated Set the status — removed in 6.3. Failure was never a step of
|
|
185
191
|
# its own; the controller records the parse error directly.
|
|
186
192
|
def fail!
|
|
187
|
-
Spree::Deprecation.warn('Spree::Import#fail! is deprecated and will be removed in Spree 6.
|
|
193
|
+
Spree::Deprecation.warn('Spree::Import#fail! is deprecated and will be removed in Spree 6.3. Write the status instead.')
|
|
188
194
|
update!(status: 'failed')
|
|
189
195
|
end
|
|
190
196
|
|
|
191
|
-
# @deprecated Call Spree.import_retry_failed_rows_workflow — removed in 6.
|
|
197
|
+
# @deprecated Call Spree.import_retry_failed_rows_workflow — removed in 6.3.
|
|
192
198
|
# Returns false when there is nothing to retry, as the guarded event did.
|
|
193
199
|
def retry_failed_rows
|
|
194
|
-
Spree::Deprecation.warn(
|
|
200
|
+
Spree::Deprecation.warn(
|
|
201
|
+
'Spree::Import#retry_failed_rows is deprecated and will be removed in Spree 6.3. Call Spree.import_retry_failed_rows_workflow instead.'
|
|
202
|
+
)
|
|
195
203
|
Spree.import_retry_failed_rows_workflow.call(import: self).success?
|
|
196
204
|
end
|
|
197
205
|
|
|
@@ -363,7 +371,7 @@ module Spree
|
|
|
363
371
|
|
|
364
372
|
# Who ran this import — the seller when one did, otherwise the store.
|
|
365
373
|
#
|
|
366
|
-
# @deprecated Read `seller` and `store` — removed in 6.
|
|
374
|
+
# @deprecated Read `seller` and `store` — removed in 6.3. Kept because the
|
|
367
375
|
# polymorphic `owner` shipped in 5.6 and the v3 serializer still emits
|
|
368
376
|
# `owner_type`/`owner_id` from it.
|
|
369
377
|
# @return [Spree::Seller, Spree::Store]
|
|
@@ -371,9 +379,9 @@ module Spree
|
|
|
371
379
|
seller || store
|
|
372
380
|
end
|
|
373
381
|
|
|
374
|
-
# @deprecated Assign `seller:` or `store:` — removed in 6.
|
|
382
|
+
# @deprecated Assign `seller:` or `store:` — removed in 6.3.
|
|
375
383
|
def owner=(record)
|
|
376
|
-
Spree::Deprecation.warn('Spree::Import#owner= is deprecated and will be removed in Spree 6.
|
|
384
|
+
Spree::Deprecation.warn('Spree::Import#owner= is deprecated and will be removed in Spree 6.3. Assign seller: or store: instead.')
|
|
377
385
|
|
|
378
386
|
case record
|
|
379
387
|
when Spree::Seller
|
|
@@ -80,24 +80,24 @@ module Spree
|
|
|
80
80
|
data_json[mapping.file_column]
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
# @deprecated Write the status — removed in 6.
|
|
83
|
+
# @deprecated Write the status — removed in 6.3. A row's lifecycle belongs
|
|
84
84
|
# to +process!+, which is the only thing that should move it.
|
|
85
85
|
def start_processing!
|
|
86
|
-
Spree::Deprecation.warn('Spree::ImportRow#start_processing! is deprecated and will be removed in Spree 6.
|
|
86
|
+
Spree::Deprecation.warn('Spree::ImportRow#start_processing! is deprecated and will be removed in Spree 6.3. Use #process! instead.')
|
|
87
87
|
update!(status: 'processing')
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
# @deprecated Write the status — removed in 6.
|
|
90
|
+
# @deprecated Write the status — removed in 6.3.
|
|
91
91
|
def complete!
|
|
92
|
-
Spree::Deprecation.warn('Spree::ImportRow#complete! is deprecated and will be removed in Spree 6.
|
|
92
|
+
Spree::Deprecation.warn('Spree::ImportRow#complete! is deprecated and will be removed in Spree 6.3. Use #process! instead.')
|
|
93
93
|
update!(status: 'completed')
|
|
94
94
|
publish_event('import_row.completed')
|
|
95
95
|
true
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
# @deprecated Write the status — removed in 6.
|
|
98
|
+
# @deprecated Write the status — removed in 6.3.
|
|
99
99
|
def fail!
|
|
100
|
-
Spree::Deprecation.warn('Spree::ImportRow#fail! is deprecated and will be removed in Spree 6.
|
|
100
|
+
Spree::Deprecation.warn('Spree::ImportRow#fail! is deprecated and will be removed in Spree 6.3. Use #process! instead.')
|
|
101
101
|
update!(status: 'failed')
|
|
102
102
|
publish_event('import_row.failed')
|
|
103
103
|
true
|
|
@@ -76,15 +76,19 @@ module Spree
|
|
|
76
76
|
expires_at < Time.current
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.
|
|
79
|
+
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.3.
|
|
80
80
|
def accept
|
|
81
|
-
Spree::Deprecation.warn(
|
|
81
|
+
Spree::Deprecation.warn(
|
|
82
|
+
'Spree::Invitation#accept is deprecated and will be removed in Spree 6.3. Call Spree.invitation_accept_workflow instead.'
|
|
83
|
+
)
|
|
82
84
|
Spree.invitation_accept_workflow.call(invitation: self).success?
|
|
83
85
|
end
|
|
84
86
|
|
|
85
|
-
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.
|
|
87
|
+
# @deprecated Call Spree.invitation_accept_workflow — removed in 6.3.
|
|
86
88
|
def accept!
|
|
87
|
-
Spree::Deprecation.warn(
|
|
89
|
+
Spree::Deprecation.warn(
|
|
90
|
+
'Spree::Invitation#accept! is deprecated and will be removed in Spree 6.3. Call Spree.invitation_accept_workflow instead.'
|
|
91
|
+
)
|
|
88
92
|
result = Spree.invitation_accept_workflow.call(invitation: self)
|
|
89
93
|
|
|
90
94
|
if result.failure?
|