fixed 'The totals of the cart item amounts do not match order amounts.' error with patch http://pastie.org/1731543

This commit is contained in:
Jörg Koch 2011-03-30 00:30:54 +02:00
parent 39a3b00602
commit 5b88f63f6e
1 changed files with 4 additions and 3 deletions

View File

@ -150,6 +150,7 @@ CheckoutController.class_eval do
#need to force checkout to complete state
until @order.state == "complete"
if @order.next!
@order.update!
state_callback(:after)
end
end
@ -226,7 +227,7 @@ CheckoutController.class_eval do
{ :name => item.variant.product.name,
:description => item.variant.product.description[0..120],
:sku => item.variant.sku,
:qty => item.quantity,
:quantity => item.quantity,
:amount => price,
:weight => item.variant.weight,
:height => item.variant.height,
@ -239,7 +240,7 @@ CheckoutController.class_eval do
{ :name => credit.label,
:description => credit.label,
:sku => credit.id,
:qty => 1,
:quantity => 1,
:amount => (credit.amount*100).to_i }
end
end
@ -248,7 +249,7 @@ CheckoutController.class_eval do
credits.compact!
if credits.present?
items.concat credits
credits_total = credits.map {|i| i[:amount] * i[:qty] }.sum
credits_total = credits.map {|i| i[:amount] * i[:quantity] }.sum
end
opts = { :return_url => request.protocol + request.host_with_port + "/orders/#{order.number}/checkout/paypal_confirm?payment_method_id=#{payment_method}",