Sha256: 2a70242afa00469f84ce52bf4589b1918d5f0a122af56701e3c9fc89eaf711a9
Contents?: true
Size: 856 Bytes
Versions: 72
Compression:
Stored size: 856 Bytes
Contents
# frozen_string_literal: true module Spree class CouponCodesController < Spree::StoreController before_action :load_order, only: :create around_action :lock_order, only: :create def create authorize! :update, @order, cookies.signed[:guest_token] if params[:coupon_code].present? @order.coupon_code = params[:coupon_code] handler = PromotionHandler::Coupon.new(@order).apply respond_with(@order) do |format| format.html do if handler.successful? flash[:success] = handler.success redirect_to cart_path else flash.now[:error] = handler.error render 'spree/coupon_codes/new' end end end end end private def load_order @order = current_order end end end
Version data entries
72 entries across 72 versions & 1 rubygems