Class: SpreeCmCommissioner::Integrations::Larryta::Inventory::HoldSeats
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::Larryta::Inventory::HoldSeats
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/inventory/hold_seats.rb
Instance Method Summary collapse
-
#call(integration:, order:, line_items:) ⇒ Object
Handles initial seat reservation (create passenger + select seat).
Instance Method Details
#call(integration:, order:, line_items:) ⇒ Object
Handles initial seat reservation (create passenger + select seat). We focus on: Single Responsibility, Idempotency, and Fail-fast validation.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/inventory/hold_seats.rb', line 9 def call(integration:, order:, line_items:) ApplicationRecord.transaction do line_items.each do |line_item| hold_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 |