@@ -0,0 +1,3812 @@
+import foauth.providers%0A%0A%0Aclass PayPal(foauth.providers.OAuth2):%0A    # General info about the provider%0A    provider_url = 'https://www.paypal.com/'%0A    docs_url = 'https://developer.paypal.com/webapps/developer/docs/api/'%0A    category = 'Money'%0A%0A    # URLs to interact with the API%0A    authorize_url = 'https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize'%0A    access_token_url = 'https://api.paypal.com/v1/identity/openidconnect/tokenservice'%0A    api_domain = 'api.paypal.com'%0A%0A    available_permissions = %5B%0A        (None, 'access your user ID'),%0A        ('profile', 'access your name, gender, date of birth and geographic region'),%0A        ('email', 'access your email address'),%0A        ('address', 'access your physical address information'),%0A        ('phone', 'access your phone number'),%0A        ('https://uri.paypal.com/services/paypalattributes', 'access your account information'),%0A%0A        # Permissions in all-caps are provided through PayPal's separate permissions API%0A        ('EXPRESS_CHECKOUT', 'use Express Checkout to process payments'),%0A        ('DIRECT_PAYMENT', 'process debit card payments'),%0A        ('SETTLEMENT_CONSOLIDATION', 'consolidate funds from child accounts into a master account'),%0A        ('SETTLEMENT_REPORTING', 'provide reporting for consolidated funds'),%0A        ('AUTH_CAPTURE', 'authorize and capture transactions'),%0A        ('MOBILE_CHECKOUT', 'use Express Checkout to process mobile payments'),%0A        ('AIR_TRAVEL', 'authorize transactions with Universal Air Travel Plans'),%0A        ('TRANSACTION_SEARCH', 'search through your transactions'),%0A        ('RECURRING_PAYMENTS', 'create and manage recurring payments'),%0A        ('REFUND', 'refund a transaction on your behalf'),%0A        ('BUTTON_MANAGER', 'create and manage payment buttons on your behalf'),%0A        ('MANAGE_PENDING_TRANSACTION_STATUS', 'accept or deny a pending transaction'),%0A        ('RECURRING_PAYMENT_REPORT', 'get reports for recurring payments'),%0A        ('EXTENDED_PRO_PROCESSING_REPORT', 'get reports for extended Pro processing'),%0A        ('EXCEPTION_PROCESSING_REPORT', 'get reports for exception processing'),%0A        ('ACCOUNT_MANAGEMENT_PERMISSION', 'manage your account'),%0A        ('INVOICING', 'manage your invoicing'),%0A%0A        # These additional permissions require separate approval from PayPal%0A        # ('BILLING_AGREEMENT', 'obtain authorization for pre-approved payments and initiate  pre-approved transactions'),%0A        # ('REFERENCE_TRANSACTION', 'process a payment based on a previous transaction'),%0A        # ('MASS_PAY', 'initiate transactions to multiple recipients in a single batch'),%0A        # ('TRANSACTION_DETAILS', 'obtain transaction specific information'),%0A        # ('ACCOUNT_BALANCE', 'obtain your account balance'),%0A        # ('ENCRYPTED_WEBSITE_PAYMENTS', 'dynamically encrypt PayPal payment buttons on your web site'),%0A        # ('NON_REFERENCED_CREDIT', 'issue a credit to a debit or credit card'),%0A        # ('ACCESS_BASIC_PERSONAL_DATA', 'obtain basic attributes for specified user, such as first name, last name, and payer ID'),%0A        # ('ACCESS_ADVANCED_PERSONAL_DATA', 'obtain advanced attributes for specified user, such as date of birth and phone'),%0A    %5D%0A%0A    def get_authorize_params(self, redirect_uri, scopes):%0A        # We always need to at least request something%0A        scopes.append('openid')%0A        params = super(PayPal, self).get_authorize_params(redirect_uri, scopes)%0A        return params%0A%0A    def parse_token(self, content):%0A        params = super(PayPal, self).parse_token(content)%0A        return params%0A%0A    def get_user_id(self, key):%0A        r = self.api(key, self.api_domain, u'/v1/identity/openidconnect/userinfo/',%0A                     params=%7B'schema': 'openid'%7D)%0A        return unicode(r.json()%5Bu'user_id'%5D)%0A

Add PayPal