Fixed a bug where credits being nil would throw an error.

This commit is contained in:
reaper 2011-01-05 14:57:43 +09:00
parent 1cc9da2d68
commit 7b43b73f58
1 changed files with 6 additions and 2 deletions

View File

@ -237,8 +237,12 @@ module Spree::PaypalExpress
:amount => (credit.amount*100).to_i }
end
end
items.concat credits.compact!
credits_total = credits.map {|i| i[:amount] * i[:qty] }.sum
credits_total = 0
if credits.respond_to? :compact
items.concat credits.compact!
credits_total = credits.map {|i| i[:amount] * i[:qty] }.sum
end
opts = { :return_url => request.protocol + request.host_with_port + "/orders/#{order.number}/checkout/paypal_confirm?payment_method_id=#{payment_method}",
:cancel_return_url => "http://" + request.host_with_port + "/orders/#{order.number}/edit",