|
|
|
@ -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']
|
|
|
|
|
|
|
|
|
@ -191,38 +194,12 @@ def is_customer (app_name):
|
|
|
|
|
#
|
|
|
|
|
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 = """
|
|
|
|
|
<form action="/pay/:app_name" method="POST">
|
|
|
|
|
<script
|
|
|
|
|
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
|
|
|
|
|
data-key=":key"
|
|
|
|
|
data-email=":email"
|
|
|
|
|
data-amount=":amount"
|
|
|
|
|
data-name="The Phi Technology LLC"
|
|
|
|
|
data-description=""
|
|
|
|
|
|
|
|
|
|
data-image="https://s3.amazonaws.com/stripe-uploads/acct_15kiA1EUWsmgY81Amerchant-icon-1443577505909-the-phi-logo.png"
|
|
|
|
|
data-locale="auto">
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</form>
|
|
|
|
|
"""
|
|
|
|
|
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 ;
|
|
|
|
|