2

ユーザーがサインアップするときに、PayPal アカウントを確認する必要があります。

関数があります(ソース - http://curry.byteally.com/finding-verification-status-of-a-paypal-account-ruby-on-rails-paypal-adaptive-accounts-getverifiedstatus/

資格情報を入力して変更しました。

私はそれを私の static_pages_controller に入れました(今のところ)。

   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

私のroutes.rbに行を追加しました

  post "static_pages/verify_paypal"

私の見解では:

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

しかし、それは常に私にテキストを与えます:

    "Gee! sorry! something went seriously wrong"

つまり、私のユーザーは PayPal に登録されていません (しかし登録されています!)。

Heroku ログからの EDTED :

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

この行への最初の質問:

    "emailAddress" => params[:paypal] 

に変更できますか

    current_user.email

2番目の質問 - どこに問題があり、何が間違っているのですか?

4

2 に答える 2

0

API 呼び出し構造は健全です。

ただし、資格情報を入力したと言うとき、適切な環境に適切な資格情報を使用していることを確認しましたか? ライブ資格情報とライブ アカウントはサンドボックス内に存在しません。サンドボックスの「ユニバース」に存在しないため、チェックボックスに対してライブアカウントのステータスを確認することはできません。

それは最初に見るものでしょう。環境が正しいと思われる場合は、コンテンツを投稿してres.content、HTTP 呼び出しから返されたものを確認できますか?

于 2012-07-15T20:15:54.840 に答える