无法验证(检查)贝宝账户 [英] Can't verify(check) paypal account

查看:135
本文介绍了无法验证(检查)贝宝账户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户注册后,我需要验证PayPal帐户.

我有功能(来源-

I need to verify PayPal account, when user sign_up.

I have function(source - http://curry.byteally.com/finding-verification-status-of-a-paypal-account-ruby-on-rails-paypal-adaptive-accounts-getverifiedstatus/)

I entered my credentials and changed.

I put it i my static_pages_controller(for now).

   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

在我的路线中添加了一行.

Added line in my routes.rb

  post "static_pages/verify_paypal"

在我看来:

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

但是它不断给我发短信:

But it constantly gives me text:

    "Gee! sorry! something went seriously wrong"

这意味着我的用户未在PayPal中注册(但!).

what mean, that my user isn't registered in PayPal(but it is!).

EDTED 从Heroku日志中:

EDTED From Heroku logs:

←[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)

此行的第一个问题:

First question to this line:

    "emailAddress" => params[:paypal] 

我可以将其更改为

    current_user.email

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

Second question - Where is problem and what I'm doing wrong ?

推荐答案

API调用结构是合理的.

The API call structure is sound.

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

However, when you say you entered your credentials, did you make sure that you are using the right credentials for the right environment? Live credentials, and live accounts do not exist within the sandbox and viceversa. You can't check a live account's status against the checkbox because it simply does not exists in the sandbox "universe".

那是第一件事.如果您认为环境正确,是否可以发布res.content的内容以查看HTTP调用返回了什么内容?

That would be the first thing to look at. If you feel your environments are correct, can you post the contents of res.content to see what came back from the HTTP call?

这篇关于无法验证(检查)贝宝账户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆