Não é possível verificar (cheque) conta paypal
Eu preciso verificar a conta do PayPal, quando o usuário sign_up.
Tenho função (fonte -http://curry.byteally.com/finding-verification-status-of-a-paypal-account-ruby-on-rails-paypal-adaptive-accounts-getverifiedstatus/)
Eu entrei minhas credenciais e mudei.
Eu coloquei no meu static_pages_controller (por enquanto).
def verify_paypal
...
//change:
if res.status == 200
@xml = XmlSimple.xml_in(res.content)
#check if the status node exists in the xml
if @xml['accountType']!=nil
account_type = @xml['accountType'][0]
if account_type.to_s() == "Business"
render :text => "Business account!"
elseif account_type.to_s() == "Premier"
render :text => "Premier Account!"
elseif account_type.to_s() == "Personal"
render :text => "Personal account!"
else
render :text => "Account type not null but not a valid PayPal account type."
end
end
Linha adicionada em minhas rotas.rb
post "static_pages/verify_paypal"
Na minha opinião:
<%= link_to "verify", static_pages_verify_paypal_path, :method => :post %>
Mas constantemente me dá texto:
"Gee! sorry! something went seriously wrong"
o que significa que meu usuário não está registrado no PayPal (mas é!).
EDITADO De logs de Heroku:
←[33m2012-07-15T17:22:56+00:00 app[web.1]:←[0m Started POST "/static_pages/verify_paypal" for 46.119.153.97 at 2012-07-15 17:22:56 +0000
←[33m2012-07-15T17:22:56+00:00 app[web.1]:←[0m Processing by StaticPagesController#verify_paypal as HTML
←[33m2012-07-15T17:22:56+00:00 app[web.1]:←[0m Parameters: {"authenticity_token"=>"xnW29ekJqp7qBNrvIZJjPSh05AMdiHWNQMvLZhevCig="}
←[36m2012-07-15T17:22:57+00:00 heroku[router]:←[0m POST sharp-cloud-3895.herokuapp.com/static_pages/verify_paypal dyno=web.1 queue=0 wait=0ms service=1058ms status=200 bytes=42
←[33m2012-07-15T17:22:57+00:00 app[web.1]:←[0m Rendered text template (0.0ms)
←[33m2012-07-15T17:22:57+00:00 app[web.1]:←[0m Completed 200 OK in 1046ms (Views: 6.7ms | ActiveRecord: 2.7ms)
Primeira pergunta para esta linha:
"emailAddress" => params[:paypal]
Posso mudá-lo para
current_user.email
Segunda pergunta - Onde está o problema e o que estou fazendo errado?