|
|
|
@ -36,18 +36,23 @@ COUCHDB = Server(uri=CONFIG['couchdb']['uri']) ;
|
|
|
|
|
"""
|
|
|
|
|
@app.route("/init/<app_name>",methods=['POST'])
|
|
|
|
|
def init(app_name):
|
|
|
|
|
|
|
|
|
|
plans = []
|
|
|
|
|
if 'uid' in request.headers:
|
|
|
|
|
uid = request.headers['uid']
|
|
|
|
|
plan= request.headers['pid']
|
|
|
|
|
couchdb = Couchdb(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=None)
|
|
|
|
|
DB = couchdb.dbase
|
|
|
|
|
handler = Domain.User(DB,stripe) ;
|
|
|
|
|
handler.init(uid,None)
|
|
|
|
|
|
|
|
|
|
id=handler.getId(uid)
|
|
|
|
|
session['customer.id'] = id
|
|
|
|
|
|
|
|
|
|
return ('',204)
|
|
|
|
|
if 'customer.id' not in session :
|
|
|
|
|
handler.init(uid,plan)
|
|
|
|
|
id=handler.getId(uid)
|
|
|
|
|
session['customer.id'] = id
|
|
|
|
|
else:
|
|
|
|
|
id = session['customer.id']
|
|
|
|
|
handler.initialize(uid)
|
|
|
|
|
handler.update_user(id,uid=uid)
|
|
|
|
|
plans = handler.plans()
|
|
|
|
|
return (plans,204)
|
|
|
|
|
"""
|
|
|
|
|
This function will update the user's email
|
|
|
|
|
"""
|
|
|
|
|