Skip to content

Instantly share code, notes, and snippets.

@scaint
Last active August 2, 2016 12:35
Show Gist options
  • Save scaint/8e1c708bf0bf413bb5e44f32bbfe0715 to your computer and use it in GitHub Desktop.
Save scaint/8e1c708bf0bf413bb5e44f32bbfe0715 to your computer and use it in GitHub Desktop.
class Cart::Checkout < Operation::Base
call do
Order.create(...)
end
before do
cancel! if cart.empty?
end
around do
...
yield
...
end
after(:success) do
send_customer_email_notification
send_admin_email_notification
...
end
end
Cart::Checkout.(cart_instance, customer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment