From c17d9b9059d90b10500cf9e21bbbb0a977110d38 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 19 Sep 2019 11:26:10 +0530 Subject: [PATCH] Don't ask product-recurring-duration-units, change duration -> period --- README.md | 11 ++++++----- commands/product.py | 20 ++++++++------------ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index af32172..c9a8e11 100755 --- a/README.md +++ b/README.md @@ -20,14 +20,15 @@ ### Adding new products ``` (ucloud-cli) [test@ungleich ucloud-cli]$ UCLOUD_PAY_SERVER=http://127.0.0.1:5000 python ucloud.py product add \ ---name mravi \ ---realm test \ ---seed stest \ +--name xxxxxxxxxxxx \ +--realm xxxxxxxxxxxx \ +--seed xxxxxxxxxxxx \ --product-name "IPV6 VPN" \ --product-description="YEARLY IPV6 subscription" \ --product-type=recurring \ ---product-recurring-duration=31536000 \ ---product-price=12000 +--product-recurring-period=year \ +--product-price=12000 \ +--product-minimum-subscription-period=year ``` diff --git a/commands/product.py b/commands/product.py index 9ae4b72..6afd10e 100755 --- a/commands/product.py +++ b/commands/product.py @@ -27,28 +27,24 @@ def list(): type=click.Choice(['one-time', 'recurring'])) @click.option("--product-price", required=True, help="Price in CHF cents", type=int) -@click.option("--product-recurring-duration", required=False, +@click.option("--product-recurring-period", required=False, help="Only used for products with recurring costs", type=int) -@click.option("--product-recurring-duration-units", required=False, type=int, - help="Unit of the recurring costs", default=0) -@click.option("--product-minimum-subscription-duration", required=False, - type=int, help="Minimum duration for which a user needs to " +@click.option("--product-minimum-subscription-period", required=False, + type=int, help="Minimum period for which a user needs to " "subscribe the product for", default=0) def add(name, realm, seed, product_name, product_description, product_type, - product_price, product_recurring_duration, - product_recurring_duration_units, - product_minimum_subscription_duration): + product_price, product_recurring_period, + product_minimum_subscription_period): data = { **OTPCredentials(name, realm, seed).get_json(), "product_name": product_name, "product_description": product_description, "product_type": product_type, "product_price": product_price, - "product_recurring_duration": product_recurring_duration, - "product_recurring_duration_units": product_recurring_duration_units, - "product_minimum_subscription_duration": - product_minimum_subscription_duration + "product_recurring_period": product_recurring_period, + "product_minimum_subscription_period": + product_minimum_subscription_period } r = requests.post("{}/product/add".format(config('UCLOUD_PAY_SERVER')), json=data)