Class: Cart::UpdateItemWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/gemgento/cart/update_item_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(line_item_id, old_quantity) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/workers/gemgento/cart/update_item_worker.rb', line 5

def perform(line_item_id, old_quantity)
  line_item = Gemgento::LineItem.find(line_item_id)
  quote = line_item.itemizable

  response = API::SOAP::Checkout::Product.update(quote, [line_item])

  if !response.success?
    line_item.qty_ordered = old_quantity
    line_item.save
  end
end