Class: SpreeCmCommissioner::Integrations::VireakBuntham::Inventory::UnstockInventory
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::VireakBuntham::Inventory::UnstockInventory
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/integrations/vireak_buntham/inventory/unstock_inventory.rb
Instance Method Summary collapse
-
#call(integration:, order:, line_items:) ⇒ Object
Unstock step for VireakBuntham (VET).
Instance Method Details
#call(integration:, order:, line_items:) ⇒ Object
Unstock step for VireakBuntham (VET).
VET has no separate “hold” endpoint. This service implements the full booking lifecycle in one step:
1. Call POST /booking/confirm to create the booking (get transactionId)
2. Call POST /booking/complete to finalize payment processing
Idempotent: skips line items whose mapping is already marked seat_status: ‘reserved’.
15 16 17 18 19 20 21 22 23 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/inventory/unstock_inventory.rb', line 15 def call(integration:, order:, line_items:) ApplicationRecord.transaction do line_items.each { |li| unstock_line_item!(integration, order, li) } end success(order: order, line_items: line_items) rescue SpreeCmCommissioner::Integrations::SyncError, SpreeCmCommissioner::Integrations::ExternalClientError => e failure(nil, e.) end |