2012-04-12 3 views

Odpowiedz

7

GetVerifiedStatus z PayPal's Adaptive Accounts platforma zrobi to za Ciebie.

PayPal nie ma żadnego konta code samples lub SDKs dla Kont Adaptacyjnych w Ruby, ale znalazłem kogoś, kto napisał code for GetVerifiedStatus in Ruby.

Jedyna zmiana tego kodu trzeba by mieć go sprawdzić, jaki typ konta mają to zmienić

if @xml['accountStatus']!=nil 
    account_status = @xml['accountStatus'][0] 
    #its pretty obvious from here init? 
    if account_status.to_s() == "VERIFIED" 
     render :text => "Account verified" 
    else 
     render :text => "Oopsy! Yet to be verified" 
    end 
else 
    render :text => "Gee! sorry! something went seriously wrong" 
end 

do

if @xml['accountType']!=nil 
    account_type = @xml['accountType'][0] 
    #its pretty obvious from here init? 
    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 
else 
    render :text => "Gee! sorry! something went seriously wrong" 
end 

Uwaga: PayPal najwyraźniej nie uaktualnili ich stronę odniesienia API, więc na razie skorzystaj z informacji zawartych na stronach 65-66 na stronie Adaptive Accounts guide.

+1

To nie dostał mi wiele okazji, dzięki – macarthy

+0

@macarthy, hello! Używam Twojego posta, ale dostaję "Gee! Sorry! Coś poszło poważnie nie tak". Czy możesz zajrzeć tutaj -> http://stackoverflow.com/questions/11491352/cant-verifycheck-paypal-account? – skrypalyk

4

Zapoznaj się z adaptiveaccounts-sdk-ruby gem. Pozwala na uzyskanie informacji o kontach PayPal.

Aby zobaczyć, co może zrobić api, spójrz na numer the sample apps.

Oto przykład:

require 'paypal-sdk-adaptiveaccounts' 
@api = PayPal::SDK::AdaptiveAccounts::API.new(:device_ipaddress => "127.0.0.1") 

# Build request object 
@get_verified_status = @api.build_get_verified_status({ 
    :emailAddress => "[email protected]", 
    :matchCriteria => "NONE" }) 

# Make API call & get response 
@get_verified_status_response = @api.get_verified_status(@get_verified_status) 

# Access Response 
if @get_verified_status_response.success? 
    @get_verified_status_response.accountStatus 
    @get_verified_status_response.countryCode 
    @get_verified_status_response.userInfo 
else 
    @get_verified_status_response.error 
end 

here jest oficjalna dokumentacja PayPal dla adaptacyjnych kont

+2

Dziękuję @sam ....... działa jak urok! – LHH

+0

dude uratowałeś mi życie lol –