From 5b88f63f6e98dab10a97d113115f6a44596aa013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Koch?= Date: Wed, 30 Mar 2011 00:30:54 +0200 Subject: [PATCH] fixed 'The totals of the cart item amounts do not match order amounts.' error with patch http://pastie.org/1731543 --- app/controllers/checkout_controller_decorator.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/checkout_controller_decorator.rb b/app/controllers/checkout_controller_decorator.rb index cc78b68..b412c1c 100644 --- a/app/controllers/checkout_controller_decorator.rb +++ b/app/controllers/checkout_controller_decorator.rb @@ -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}",