Class: SpreeCmCommissioner::Integrations::Larryta::Inventory::ReleaseSeats
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::Larryta::Inventory::ReleaseSeats
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/inventory/release_seats.rb
Instance Method Summary collapse
-
#call(integration:, order:, line_items:) ⇒ Object
Handles releasing seats when a user cancels or a hold expires.
Instance Method Details
#call(integration:, order:, line_items:) ⇒ Object
Handles releasing seats when a user cancels or a hold expires. Process:
-
Scope active mappings to avoid redundant DB calls.
-
Communicate with Larryta API.
-
Transition internal mapping states to :archived.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/inventory/release_seats.rb', line 12 def call(integration:, order:, line_items:) ApplicationRecord.transaction do line_items.each do |line_item| release_line_item!(integration, order, line_item) end end success(order: order, line_items: line_items) rescue SpreeCmCommissioner::Integrations::SyncError, SpreeCmCommissioner::Integrations::ExternalClientError => e failure(nil, e.) end |