Skip to content

Commit

Permalink
Fixed a bug where credits being nil would throw an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
reaper committed Jan 5, 2011
1 parent 1cc9da2 commit 7b43b73
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/spree/paypal_express.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,12 @@ def order_opts(order, payment_method, stage)
: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",
Expand Down

0 comments on commit 7b43b73

Please sign in to comment.