2012-04-12 15 views

risposta

7

GetVerifiedStatus da PayPal's Adaptive Accounts piattaforma farà questo per voi.

PayPal non dispone di code samples o SDKs per Account adattivi in ​​Ruby, ma ho trovato qualcuno che ha scritto il code for GetVerifiedStatus in Ruby.

L'unico cambiamento che il codice si avrebbe bisogno di avere verificare il tipo di conto che hanno è di cambiare

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 

a

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 

Nota: PayPal a quanto pare non ha aggiornato la loro pagina di riferimento API, quindi utilizzare le informazioni contenute alle pagine 65-66 nel Adaptive Accounts guide per ora.

+1

che mi ha avuto un sacco di strada, grazie – macarthy

+0

@macarthy, ciao! Sto usando il tuo post, ma ottengo sempre "Gee! Sorry! Qualcosa è andato sul serio". Puoi guardare qui -> http://stackoverflow.com/questions/11491352/cant-verifycheck-paypal-account? – skrypalyk

4

Verificare il adaptiveaccounts-sdk-ruby gem. Ti permette di ottenere informazioni sugli account paypal.

Dai uno sguardo allo the sample apps per vedere cosa può fare l'API.

Ecco un esempio:

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 è la documentazione ufficiale di paypal per adattivo account

+2

Grazie @sam ....... funziona come un fascino !! – LHH

+0

amico mi hai salvato la vita lol –

Problemi correlati