<s> import braintree <EOL> from braintree . paypal_account import PayPalAccount <EOL> from braintree . error_result import ErrorResult <EOL> from braintree . exceptions . not_found_error import NotFoundError <EOL> from braintree . resource import Resource <EOL> from braintree . successful_result import SuccessfulResult <EOL> class PayPalAccountGateway ( object ) : <EOL> def __init__ ( self , gateway ) : <EOL> self . gateway = gateway <EOL> self . config = gateway . config <EOL> def find ( self , paypal_account_token ) : <EOL> try : <EOL> if paypal_account_token is None or paypal_account_token . strip ( ) == "<STR_LIT>" : <EOL> raise NotFoundError ( ) <EOL> response = self . config . http ( ) . get ( self . config . base_merchant_path ( ) + "<STR_LIT>" + paypal_account_token ) <EOL> if "<STR_LIT>" in response : <EOL> return PayPalAccount ( self . gateway , response [ "<STR_LIT>" ] ) <EOL> except NotFoundError : <EOL> raise NotFoundError ( "<STR_LIT>" + repr ( paypal_account_token ) + "<STR_LIT>" ) <EOL> def delete ( self , paypal_account_token ) : <EOL> self . config . http ( ) . delete ( self . config . base_merchant_path ( ) + "<STR_LIT>" + paypal_account_token ) <EOL> return SuccessfulResult ( ) <EOL> def update ( self , paypal_account_token , params = { } ) : <EOL> Resource . verify_keys ( params , PayPalAccount . signature ( ) ) <EOL> response = self . config . http ( ) . put ( self . config . base_merchant_path ( ) + "<STR_LIT>" + paypal_account_token , { "<STR_LIT>" : params } ) <EOL> if "<STR_LIT>" in response : <EOL> return SuccessfulResult ( { "<STR_LIT>" : PayPalAccount ( self . gateway , response [ "<STR_LIT>" ] ) } ) <EOL> elif "<STR_LIT>" in response : <EOL> return ErrorResult ( self . gateway , response [ "<STR_LIT>" ] ) </s>
