From eac0ed02365a6fccb268cb03352c86268ce64f44 Mon Sep 17 00:00:00 2001 From: paulcc Date: Tue, 11 Aug 2009 14:19:09 +0100 Subject: [PATCH] catch info-request failures, and capture phone where it is returned phone grab bypasses the AM library - which would otherwise blank it. --- lib/spree/paypal_express.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/spree/paypal_express.rb b/lib/spree/paypal_express.rb index 34fd29b..dd17e43 100644 --- a/lib/spree/paypal_express.rb +++ b/lib/spree/paypal_express.rb @@ -122,9 +122,11 @@ module Spree::PaypalExpress opts = { :token => params[:token], :payer_id => params[:PayerID] }.merge all_opts(order) gateway = paypal_gateway - info = gateway.details_for params[:token] - response = gateway.authorize(opts[:money], opts) + info = gateway.details_for params[:token] + gateway_error(info) unless info.success? + + response = gateway.authorize(opts[:money], opts) gateway_error(response) unless response.success? # now save info @@ -139,7 +141,8 @@ module Spree::PaypalExpress :city => ship_address["city"], :country => Country.find_by_iso(ship_address["country"]), :zipcode => ship_address["zip"], - :phone => ship_address["phone"] || "(not given)" + # phone is currently blanked in AM's PPX response lib + :phone => info.params["phone"] || "(not given)" if (state = State.find_by_name(ship_address["state"])) order_ship_address.state = state