예제 #1
0
def _pay_phone(phone, amount, note, audience='public'):
    #makes payment and returns response
    access_token = session.get('access_token')
    if not access_token:
        return logout()
    client = VenmoClient(access_token)

    try:
        response = client.make_payment(amount=amount, note=note, audience=audience, phone=phone)
    except VenmoExpiredToken:
        return logout()
    
    return response
예제 #2
0
def _login_with_token_or_code():
    if ENVIRONMENT == 'PRODUCTION':
        code = request.args.get('code')
        if code:
            access_token = VenmoClient.get_access_token_from_code(code, CLIENT_ID, CLIENT_SECRET)
            if access_token:
                _login_user(access_token)

    else:
        access_token = request.args.get('access_token')
        if access_token:
            _login_user(access_token)
예제 #3
0
def main():
    _login_with_token_or_code()        
    response_type = "code" if ENVIRONMENT == 'PRODUCTION' else "token"
    authorization_url = VenmoClient.get_authorization_url(CLIENT_ID, SCOPES, response_type=response_type)
    return render_template('index.html', authorization_url=authorization_url)