Make command "product order" rather than "order product"

This commit is contained in:
PCoder 2019-09-14 13:23:11 +05:30
parent 8945f557f9
commit ccde9d9f5b
2 changed files with 15 additions and 0 deletions

View file

View file

@ -47,3 +47,18 @@ def add(name, realm, seed, product_name, product_description, product_type,
r = requests.post("{}/product/add".format(config('UCLOUD_PAY_SERVER')), r = requests.post("{}/product/add".format(config('UCLOUD_PAY_SERVER')),
json=data) json=data)
print(load_dump_pretty(r.content)) print(load_dump_pretty(r.content))
@product.command("order")
@click.option("--name", envvar="OTP_NAME", required=True)
@click.option("--realm", envvar="OTP_REALM", required=True)
@click.option("--seed", envvar="OTP_SEED", required=True)
@click.option("--product-id", help="The uuid of the product", required=True)
def order(name, realm, seed, product_id):
data = {
**OTPCredentials(name, realm, seed).get_json(),
"product_id": product_id
}
r = requests.post("{}/order/product".format(config('UCLOUD_PAY_SERVER')),
json=data)
print(load_dump_pretty(r.content))