-
-
Save gma/2dcc96d14d0fd4cb94c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.agileplannerapp.com/blog/building-agile-planner/refactoring-with-hexagonal-rails | |
def checkout | |
cart = CartCheckout.new(many, params) | |
cart.save! | |
rescue OutOfStock => e | |
OutOfStockNotification.new(e.line_item).deliver | |
redirect_to cart_path, notice: t('.failure', reason: cart.error_message) | |
rescue CartError | |
redirect_to cart_path, notice: t('.failure', reason: cart.error_message) | |
else | |
redirect_to cart_path, notice: t('.success') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment