Sha256: 1f3bbcf040df17fac49f31041750ddfa939aac316b378eff641569bd4e650caa

Contents?: true

Size: 431 Bytes

Versions: 1

Compression:

Stored size: 431 Bytes

Contents

require_dependency "shopping_cart/application_controller"

module ShoppingCart
  class CartsController < ApplicationController
    def show; end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loker-shopping-cart-0.1.3 app/controllers/shopping_cart/carts_controller.rb