The Spree version is 2.0.3.
To make this work I had to override two files, creating them at:
app/controllers/checkout_controller_decorator.rb
app/models/order_decorator.rb
The checkout_controller_decorator.rb
code:
module Spree
CheckoutController.class_eval do
def update
if @order.update_attributes(object_params)
fire_event('spree.checkout.update')
return if after_update_attributes
unless @order.next
flash[:error] = @order.errors[:base].join("\n")
redirect_to checkout_state_path(@order.state) and return
end
if @order.completed?
session[:order_id] = nil
flash.notice = Spree.t(:order_processed_successfully)
flash[:commerce_tracking] = "nothing special"
redirect_to completion_route
else
redirect_to checkout_state_path(@order.state)
end
else
render :edit
end
end
end
end
And the order_decorator.rb
code:
module Spree
Order.class_eval do
def process_payments!
if pending_payments.empty?
raise Core::GatewayError.new Spree.t(:no_pending_payments)
else
pending_payments.each do |payment|
break if payment_total >= total
payment.process!
if payment.completed?
self.payment_total += payment.amount
end
end
end
rescue Core::GatewayError => e
result = !!Spree::Config[:allow_checkout_on_gateway_error]
errors.add(:base, e.message) and return result
end
end
end
end
The problem is with the version 2.0.3
so I had to update those two files with the ones from the version 2.0.4
and the problem is solved =)