|
|
@ -72,7 +72,7 @@ def get_plans_json(id):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This function returns the plans for a given product
|
|
|
|
This function returns the plans for a given product
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
HEADER="Content-type:application/json"
|
|
|
|
HEADER={"Content-type":"application/json"}
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
mystore = store.factory.instance(name=id)
|
|
|
|
mystore = store.factory.instance(name=id)
|
|
|
|
return json.dumps(mystore.get.plans()),HEADER
|
|
|
|
return json.dumps(mystore.get.plans()),HEADER
|
|
|
@ -163,19 +163,22 @@ def me ():
|
|
|
|
# mystore = store.factory.instance(name = session['product']['name'])
|
|
|
|
# mystore = store.factory.instance(name = session['product']['name'])
|
|
|
|
# mystore.init(email=session['auth']['user']['uid'])
|
|
|
|
# mystore.init(email=session['auth']['user']['uid'])
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
email = session['auth']['user']['uid']
|
|
|
|
if 'auth' in session and 'product' in session :
|
|
|
|
name = session['product']['name']
|
|
|
|
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:
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
print (e)
|
|
|
|
pass
|
|
|
|
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'])
|
|
|
|
@app.route("/me/card",methods=['POST'])
|
|
|
|
def me_card ():
|
|
|
|
def me_card ():
|
|
|
|
if 'auth' in session :
|
|
|
|
if 'auth' in session :
|
|
|
@ -244,7 +247,7 @@ def redirect(id ) :
|
|
|
|
This function will redirect to a given product page given a payload. The payload is intended to set the a session
|
|
|
|
This function will redirect to a given product page given a payload. The payload is intended to set the a session
|
|
|
|
:info
|
|
|
|
:info
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
mystore = store.factory.instance(name=id)
|
|
|
|
mystore = store.factory.instance(name=id)
|
|
|
|
args = {"context":CONTEXT,"product":mystore.product}
|
|
|
|
args = {"context":CONTEXT,"product":mystore.product}
|
|
|
|
HEADER = {"Location":mystore.product['metadata']['uri']}
|
|
|
|
HEADER = {"Location":mystore.product['metadata']['uri']}
|
|
|
@ -338,7 +341,7 @@ def _payme(id) :
|
|
|
|
_args['metadata'] = {"payment":"charge","product":id}
|
|
|
|
_args['metadata'] = {"payment":"charge","product":id}
|
|
|
|
_args['statement_descriptor'] = " ".join([str(info['amount']),id])
|
|
|
|
_args['statement_descriptor'] = " ".join([str(info['amount']),id])
|
|
|
|
|
|
|
|
|
|
|
|
r = user.charge(**_args)
|
|
|
|
r = user.charge(**_args)
|
|
|
|
|
|
|
|
|
|
|
|
if not r :
|
|
|
|
if not r :
|
|
|
|
msg,status = "Payment error enountered",403
|
|
|
|
msg,status = "Payment error enountered",403
|
|
|
@ -378,9 +381,12 @@ def init(product):
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#@TODO: Log that uid, has initiated use of 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'])
|
|
|
|
# @app.route('/subscribe/<product>',methods=['POST'])
|
|
|
|
# def subscribe(product):
|
|
|
|
# def subscribe(product):
|
|
|
|
# """
|
|
|
|
# """
|
|
|
|