Implement validate product
This commit is contained in:
parent
77dd6cb14e
commit
a7ba9669f8
|
@ -226,6 +226,15 @@ class ProductOrder(Resource):
|
|||
return {"message": "Wrong Credentials"}, 403
|
||||
|
||||
# Validate the given product is ok
|
||||
product_id = data["product_id"]
|
||||
product = client.get_prefix(
|
||||
"/v1/products/{}/".format(product_id), value_in_json=True
|
||||
)
|
||||
if not product:
|
||||
logging.debug("User chose invalid product {}".format(product))
|
||||
return {"message": "Invalid product"}, 400
|
||||
|
||||
logging.debug("Got product {}".format(str(product)))
|
||||
|
||||
# Check the user has a payment source added
|
||||
|
||||
|
|
Loading…
Reference in New Issue