Sha256: 4798e82dcbf1508dd50b73653a87286160d39e9ae990de1904d16e8ab8e2a5a3
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
module Gemgento class Checkout::GiftCardController < CheckoutController skip_before_filter :validate_quote_user respond_to :json, :html def create result = @quote.apply_gift_card(params[:gift_card_code]) respond_to do |format| if result == true format.html { redirect_to :back, notice: 'The Gift Card was successfully applied.' } format.json { render json: { result: true, order: @quote, totals: @quote.totals } } else format.html { redirect_to :back, alert: @quote.errors[:base].to_sentence } format.json { render json: { result: false, errors: @quote.errors[:base] }, status: 422 } end end rescue ActionController::RedirectBackError redirect_to cart_path end def destroy result = @quote.remove_gift_card(params[:gift_card_code]) if result == true format.html { redirect_to :back, notice: 'The Gift Card was removed from the order.' } format.json { render json: { result: true, order: @quote, totals: @quote.totals } } else format.html { redirect_to :back, alert: @quote.errors[:base].to_sentence } format.json { render json: { result: false, errors: @quote.errors[:base] }, status: 422 } end rescue ActionController::RedirectBackError redirect_to cart_path end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gemgento-2.8.0 | app/controllers/gemgento/checkout/gift_card_controller.rb |