diff --git a/src/api/index.py b/src/api/index.py index aa9bf18..a5fa9e0 100644 --- a/src/api/index.py +++ b/src/api/index.py @@ -179,6 +179,9 @@ def is_customer (app_name): uid = request.args.get('uid') pid = request.args.get('pid') couchdb = CouchdbReader(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=uid,create=False) + r = couchdb.view('federation/uid_map',key=uid) + id = r[0]['value'] + couchdb = CouchdbReader(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=id,create=False) info = couchdb.read() lsub = info['subscriptions'] @@ -190,39 +193,13 @@ def is_customer (app_name): # @TODO Improve this process later on by allowing user's to pay for what they can (not everything) # session['plans'] = plans - - - # bill = {"amount":0,"count":0} - # key = "" - # if 'user-plans' in session : - # plans = session['user-plans'] ; - # amount = [plan['amount'] for plan in plans if plan['amount'] > 0] - # if len(amount) > 0: - # key = CONFIG['stripe']['pub'].strip() - # bill['count'] = len(amount) - # bill['amount']= sum(amount) - html = """ -
- -
- """ session['plans'] amount = sum([item['amount'] for item in plans]) apikey = CONFIG['stripe']['pub'].strip() - html = html.replace(":email",uid).replace(":amount",str(amount)).replace(":key",apikey).replace(":app_name",app_name) + amount = amount / 100 - return render_template('bill.html',apikey=apikey,app_name=app_name.replace('-',' '),plans=plans,total_amount=amount,html=html) + return render_template('bill.html',apikey=apikey,app_name=app_name.replace('-',' '),plans=plans,total_amount=amount) if __name__ == '__main__' : app.debug = True ; diff --git a/src/api/templates/bill.html b/src/api/templates/bill.html index 713bae4..bc4d272 100644 --- a/src/api/templates/bill.html +++ b/src/api/templates/bill.html @@ -1,6 +1,8 @@ + +