Class: SpreeCmCommissioner::Stock::InventoryItemsAdjusterJob

Inherits:
ApplicationUniqueJob show all
Defined in:
app/jobs/spree_cm_commissioner/stock/inventory_items_adjuster_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/jobs/spree_cm_commissioner/stock/inventory_items_adjuster_job.rb', line 4

def perform(options = {})
  variant = Spree::Variant.find_by(id: options[:variant_id])

  # potentially the variant was deleted during the job wait time, we just skip in that case.
  return if variant.blank?

  SpreeCmCommissioner::Stock::InventoryItemsAdjuster.call(variant: variant, quantity: options[:quantity])
end