Class: ShoppingCart::CartsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/shopping_cart/carts_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



5
# File 'app/controllers/shopping_cart/carts_controller.rb', line 5

def show; end

#updateObject



7
8
9
10
11
12
# File 'app/controllers/shopping_cart/carts_controller.rb', line 7

def update
  AddCoupon.call(code: params[:coupon_code], order: current_order) do
    on(:ok) { redirect_to cart_path, notice: I18n.t('notice.coupon_added') }
    on(:invalid) { redirect_to cart_path, alert: I18n.t('notice.coupon_invalid') }
  end
end