|
|
|
@ -72,7 +72,7 @@ def get_plans_json(id):
|
|
|
|
|
"""
|
|
|
|
|
This function returns the plans for a given product
|
|
|
|
|
"""
|
|
|
|
|
HEADER="Content-type:application/json"
|
|
|
|
|
HEADER={"Content-type":"application/json"}
|
|
|
|
|
try:
|
|
|
|
|
mystore = store.factory.instance(name=id)
|
|
|
|
|
return json.dumps(mystore.get.plans()),HEADER
|
|
|
|
@ -163,19 +163,22 @@ def me ():
|
|
|
|
|
# mystore = store.factory.instance(name = session['product']['name'])
|
|
|
|
|
# mystore.init(email=session['auth']['user']['uid'])
|
|
|
|
|
try:
|
|
|
|
|
email = session['auth']['user']['uid']
|
|
|
|
|
name = session['product']['name']
|
|
|
|
|
if 'auth' in session and 'product' in session :
|
|
|
|
|
email = session['auth']['user']['uid']
|
|
|
|
|
name = session['product']['name']
|
|
|
|
|
|
|
|
|
|
mystore = store.factory.instance(name=name,email=email)
|
|
|
|
|
payments = mystore.user.invoices()
|
|
|
|
|
mystore = store.factory.instance(name=name,email=email)
|
|
|
|
|
payments = mystore.user.invoices()
|
|
|
|
|
|
|
|
|
|
cards = mystore.user.card.html() if mystore.user.card.exists() else None
|
|
|
|
|
cards = mystore.user.card.html() if mystore.user.card.exists() else None
|
|
|
|
|
|
|
|
|
|
_args = {'context':CONTEXT,"user":session['auth']['user'],"product":session['product'],"plan":session['plan'],"payments":payments,"cards":cards}
|
|
|
|
|
return render_template('me.html',**_args)
|
|
|
|
|
_args = {'context':CONTEXT,"user":session['auth']['user'],"product":session['product'],"plan":session['plan'],"payments":payments,"cards":cards}
|
|
|
|
|
return render_template('me.html',**_args)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print (e)
|
|
|
|
|
pass
|
|
|
|
|
return redirect("https://the-phi.com")
|
|
|
|
|
return render_template("none.html",context=CONTEXT)
|
|
|
|
|
# return redirect("http://healthcareio.the-phi.com")
|
|
|
|
|
@app.route("/me/card",methods=['POST'])
|
|
|
|
|
def me_card ():
|
|
|
|
|
if 'auth' in session :
|
|
|
|
@ -338,7 +341,7 @@ def _payme(id) :
|
|
|
|
|
_args['metadata'] = {"payment":"charge","product":id}
|
|
|
|
|
_args['statement_descriptor'] = " ".join([str(info['amount']),id])
|
|
|
|
|
|
|
|
|
|
r = user.charge(**_args)
|
|
|
|
|
r = user.charge(**_args)
|
|
|
|
|
|
|
|
|
|
if not r :
|
|
|
|
|
msg,status = "Payment error enountered",403
|
|
|
|
@ -378,9 +381,12 @@ def init(product):
|
|
|
|
|
#
|
|
|
|
|
#@TODO: Log that uid, has initiated use of product
|
|
|
|
|
#
|
|
|
|
|
return json.dumps(features),200
|
|
|
|
|
|
|
|
|
|
HEADERS ={"content-type":"application/json"}
|
|
|
|
|
|
|
|
|
|
return features,HEADERS
|
|
|
|
|
@app.route("/<id>/init",methods=['POST','PUT'])
|
|
|
|
|
def _init(id):
|
|
|
|
|
return init(id)
|
|
|
|
|
# @app.route('/subscribe/<product>',methods=['POST'])
|
|
|
|
|
# def subscribe(product):
|
|
|
|
|
# """
|
|
|
|
|