Class: Spree::LineItems::Create
- Inherits:
-
Object
- Object
- Spree::LineItems::Create
- Includes:
- Helper, ServiceModule::Base
- Defined in:
- app/services/spree/line_items/create.rb
Instance Method Summary collapse
Methods included from ServiceModule::Base
Instance Method Details
#call(order:, line_item_attributes: {}, options: {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/services/spree/line_items/create.rb', line 7 def call(order:, line_item_attributes: {}, options: {}) line_item = order.line_items.new(line_item_attributes) ActiveRecord::Base.transaction do return failure(line_item) unless line_item.save recalculate_service.call(order: order, line_item: line_item, options: ) end success(line_item) end |