ruby-on-rails – 无法验证(检查)paypal帐户

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 无法验证(检查)paypal帐户前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
用户sign_up时,我需要验证PayPal帐户.
我有功能(来源 – http://curry.byteally.com/finding-verification-status-of-a-paypal-account-ruby-on-rails-paypal-adaptive-accounts-getverifiedstatus/)
我输入了我的凭证并改变了.
我把它作为我的static_pages_controller(现在).
  1. def verify_paypal
  2. ...
  3. //change:
  4. if res.status == 200
  5. @xml = XmlSimple.xml_in(res.content)
  6. #check if the status node exists in the xml
  7. if @xml['accountType']!=nil
  8. account_type = @xml['accountType'][0]
  9. if account_type.to_s() == "Business"
  10. render :text => "Business account!"
  11. elseif account_type.to_s() == "Premier"
  12. render :text => "Premier Account!"
  13. elseif account_type.to_s() == "Personal"
  14. render :text => "Personal account!"
  15. else
  16. render :text => "Account type not null but not a valid PayPal account type."
  17. end
  18. end

在我的routes.rb中添加了一行

  1. post "static_pages/verify_paypal"

在我看来:

  1. <%= link_to "verify",static_pages_verify_paypal_path,:method => :post %>

但它不断给我文字

  1. "Gee! sorry! something went serIoUsly wrong"

是什么意思,我的用户没有在PayPal中注册(但它是!).

EDTED
来自Heroku日志:

  1. ←[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
  2. ←[33m2012-07-15T17:22:56+00:00 app[web.1]:←[0m Processing by StaticPagesController#verify_paypal as HTML
  3. ←[33m2012-07-15T17:22:56+00:00 app[web.1]:←[0m Parameters: {"authenticity_token"=>"xnW29ekJqp7qBNrvIZJjPSh05AMdiHWNQMvLZhevCig="}
  4. ←[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
  5. ←[33m2012-07-15T17:22:57+00:00 app[web.1]:←[0m Rendered text template (0.0ms)
  6. ←[33m2012-07-15T17:22:57+00:00 app[web.1]:←[0m Completed 200 OK in 1046ms (Views: 6.7ms | ActiveRecord: 2.7ms)

这一行的第一个问题:

  1. "emailAddress" => params[:paypal]

我可以把它改成吗?

  1. current_user.email

第二个问题 – 问题出在哪里,我做错了什么?

解决方法

API调用结构是健全的.

但是,当您说您输入了凭据时,是否确保在正确的环境中使用正确的凭据?
沙箱中不存在实时凭证和实时帐户,反之亦然.您无法根据复选框检查真实帐户的状态,因为它在沙箱“universe”中根本不存在.

这将是第一件要看的事情.如果您觉得您的环境是正确的,您是否可以发布res.content的内容以查看HTTP调用返回内容

猜你在找的Ruby相关文章