Esempio n. 1
0
    def donate_now():
        """
        Page where customers can begin the donation process
        """
        if "token" not in session:
            return redirect(make_consent_url(**get_consent_params()))
        else:
            _check_if_token_expired()

        return "Donations"
Esempio n. 2
0
 def _handle_expired_tokens():
     """
     Attempt to obtain a new token using the refresh token. It that doesn't
     work, re-direct the user to the PayPal login
     """
     try:
         response = oauth.use_refresh_token(
             session["token"]["paypal_session"]["refresh_token"]
         )
     except StatusCodeError:
         redirect(make_consent_url(**get_consent_params()))
     else:
         session["token"] = make_secure_oauth_cookie(response)