Skip to content

Instantly share code, notes, and snippets.

@xdite
Forked from rocodev-tech/order_placing_service.rb
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xdite/faae86e993e3df28c3de to your computer and use it in GitHub Desktop.
Save xdite/faae86e993e3df28c3de to your computer and use it in GitHub Desktop.
class OrderPlacingService
def initialize(cart,order)
@order = order
@cart = cart
end
def place_order!
@order.build_item_cache_from_cart(@cart)
@order.calculate_total!(@cart)
@cart.clear!
OrderMailer.notify_order_placed(@order).deliver
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment