Exemplo n.º 1
0
 def get_user(self, token):
     response = self.client.get('user', token=token)
     if response.status == 200:
         user_data = response.data
         email = user_data['data']['email']
         return User.lookup_or_create(email, email_confirmed=True)
     else:
         logger.warning("Error {}".format(response.data))
Exemplo n.º 2
0
 def get_user(self, token):
     response = self.client.get('user', token=token)
     # You need special access to get a users email from Twitter...
     if response.status == 200:
         user_data = response.data
         email = user_data['data']['email']
         return User.lookup_or_create(email, email_confirmed=True)
     else:
         logger.warning("Error {}".format(response.data))
Exemplo n.º 3
0
 def get_user(self, token):
     response = self.client.get('people/me')
     if response.status == 200:
         user_data = response.data
         if 'error' not in user_data and user_data.get('emails'):
             email = user_data['emails'][0]['value']
             return User.lookup_or_create(email, email_confirmed=True)
     else:
         logger.warning("Error {}".format(response.data))
Exemplo n.º 4
0
def payment():

    customer = stripe.Customer.create(email=request.form['stripeEmail'],
                                      source=request.form['stripeToken'])

    charge = stripe.Charge.create(customer=customer.id,
                                  amount=4999,
                                  currency='usd',
                                  description='Ingite Flask App Code')

    user = User.lookup_or_create(request.form['stripeEmail'])
    PurchaseReceipt(user).send()

    flash("Payment processed. You'll get an email shortly", 'success')

    return render_template('store/product.html')