2012-04-12 5 views

Respuesta

7

GetVerifiedStatus de PayPal's Adaptive Accounts plataforma se hará por usted.

PayPal no tiene ningún code samples o SDKs para cuentas adaptables en Ruby, pero encontré a alguien que ha escrito el code for GetVerifiedStatus in Ruby.

El único cambio de que el código que se necesita para que se compruebe qué tipo de cuenta que tienen es para cambiar

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 aparentemente no ha actualizado su página de referencia de API, por lo tanto, utilice la información contenida en las páginas 65-66 en el Adaptive Accounts guide por el momento.

+1

que me ha conseguido una gran parte del camino, gracias – macarthy

+0

@macarthy, hola! Estoy usando tu publicación, pero siempre recibo "¡Lo siento, algo salió muy mal". ¿Puedes mirar aquí -> http://stackoverflow.com/questions/11491352/cant-verifycheck-paypal-account? – skrypalyk

4

Echa un vistazo a adaptiveaccounts-sdk-ruby gem. Le permite obtener información sobre las cuentas de PayPal.

Eche un vistazo a the sample apps para ver lo que la API puede hacer.

He aquí un ejemplo:

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 es la documentación oficial de PayPal para adaptativa representa

+2

Gracias @sam ... ¡¡está funcionando como un encanto !! – LHH

+0

tio que salvaste mi vida jaja –

Cuestiones relacionadas