Browse Source

Implement validate product

master
PCoder 3 years ago
parent
commit
a7ba9669f8
  1. 9
      ucloud-pay.py

9
ucloud-pay.py

@ -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…
Cancel
Save