Product test
This commit is contained in:
@@ -734,14 +734,32 @@ def myproduct(current_user):
|
|||||||
def subscription_start(current_user):
|
def subscription_start(current_user):
|
||||||
data = request.json
|
data = request.json
|
||||||
product_id = data.get('product_id')
|
product_id = data.get('product_id')
|
||||||
#request.args.get('product_id')
|
|
||||||
print(product_id)
|
|
||||||
if not product_id:
|
if not product_id:
|
||||||
return {
|
return {
|
||||||
"message": "Please provide product_id",
|
"message": "Please provide product_id",
|
||||||
"data": None,
|
"data": None,
|
||||||
"error": "Bad request"
|
"error": "Bad request"
|
||||||
}, 400
|
}, 400
|
||||||
|
|
||||||
|
#request.args.get('product_id')
|
||||||
|
FIND_PRODUCT= "SELECT uid,product_id,name,description,banner,status FROM products WHERE product_id='"+product_id+"'"
|
||||||
|
with connection:
|
||||||
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
|
cursor.execute(FIND_PRODUCT)
|
||||||
|
product = cursor.fetchall()
|
||||||
|
print(product[0]["uid"])
|
||||||
|
|
||||||
|
product_found = count = len( product )
|
||||||
|
if product_found == 0 :
|
||||||
|
return jsonify({'status': "INVALID",'message': 'Error - Invalid product'}), 403
|
||||||
|
|
||||||
|
|
||||||
|
# if not product_id:
|
||||||
|
# return {
|
||||||
|
# "message": "Please provide product_id",
|
||||||
|
# "data": None,
|
||||||
|
# "error": "Bad request"
|
||||||
|
# }, 400
|
||||||
|
|
||||||
print(product_id)
|
print(product_id)
|
||||||
myproduct_data = []
|
myproduct_data = []
|
||||||
|
|||||||
Reference in New Issue
Block a user