6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/services/spree/cart/update.rb', line 6
def call(order:, params:)
return failure(order) unless order.update(filter_order_items(order, params))
order.line_items = order.line_items.select { |li| li.quantity > 0 }
ActiveRecord::Base.transaction do
order.update_with_updater!
::Spree::PromotionHandler::Cart.new(order).activate
order.ensure_updated_shipments
order.payments.store_credits.checkout.destroy_all
order.update_with_updater!
end
success(order)
end
|