Sha256: 25e8b82dc03d8a2631e7bbd3e7c341e2338ae5580cda709fa47e96f536550bf3

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

Spree::CheckoutController.class_eval do

  #TODO 90% of this method is duplicated code. DRY
  def update
    if @order.update_attributes(object_params)

      fire_event('spree.checkout.update')
      unless apply_coupon_code
        respond_with(@order) { |format| format.html { render :edit } }
        return
      end

      if @order.next
        state_callback(:after)
      else
        flash[:error] = t(:payment_processing_failed)
        respond_with(@order, :location => checkout_state_path(@order.state))
        return
      end

      if @order.state == 'complete' || @order.completed?
        flash.notice = t(:order_processed_successfully)
        flash[:commerce_tracking] = 'nothing special'
        respond_with(@order, :location => completion_route)
      else
        respond_with(@order, :location => checkout_state_path(@order.state))
      end
    else
      respond_with(@order) { |format| format.html { render :edit } }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_promo-1.3.4 app/controllers/spree/checkout_controller_decorator.rb
spree_promo-1.3.3 app/controllers/spree/checkout_controller_decorator.rb
spree_promo-1.3.2 app/controllers/spree/checkout_controller_decorator.rb
spree_promo-1.3.1 app/controllers/spree/checkout_controller_decorator.rb