Don't ask product-recurring-duration-units, change duration -> period

This commit is contained in:
PCoder 2019-09-19 11:26:10 +05:30
parent a8a53ff28f
commit c17d9b9059
2 changed files with 14 additions and 17 deletions

View file

@ -20,14 +20,15 @@
### Adding new products ### Adding new products
``` ```
(ucloud-cli) [test@ungleich ucloud-cli]$ UCLOUD_PAY_SERVER=http://127.0.0.1:5000 python ucloud.py product add \ (ucloud-cli) [test@ungleich ucloud-cli]$ UCLOUD_PAY_SERVER=http://127.0.0.1:5000 python ucloud.py product add \
--name mravi \ --name xxxxxxxxxxxx \
--realm test \ --realm xxxxxxxxxxxx \
--seed stest \ --seed xxxxxxxxxxxx \
--product-name "IPV6 VPN" \ --product-name "IPV6 VPN" \
--product-description="YEARLY IPV6 subscription" \ --product-description="YEARLY IPV6 subscription" \
--product-type=recurring \ --product-type=recurring \
--product-recurring-duration=31536000 \ --product-recurring-period=year \
--product-price=12000 --product-price=12000 \
--product-minimum-subscription-period=year
``` ```

View file

@ -27,28 +27,24 @@ def list():
type=click.Choice(['one-time', 'recurring'])) type=click.Choice(['one-time', 'recurring']))
@click.option("--product-price", required=True, help="Price in CHF cents", @click.option("--product-price", required=True, help="Price in CHF cents",
type=int) type=int)
@click.option("--product-recurring-duration", required=False, @click.option("--product-recurring-period", required=False,
help="Only used for products with recurring costs", help="Only used for products with recurring costs",
type=int) type=int)
@click.option("--product-recurring-duration-units", required=False, type=int, @click.option("--product-minimum-subscription-period", required=False,
help="Unit of the recurring costs", default=0) type=int, help="Minimum period for which a user needs to "
@click.option("--product-minimum-subscription-duration", required=False,
type=int, help="Minimum duration for which a user needs to "
"subscribe the product for", default=0) "subscribe the product for", default=0)
def add(name, realm, seed, product_name, product_description, product_type, def add(name, realm, seed, product_name, product_description, product_type,
product_price, product_recurring_duration, product_price, product_recurring_period,
product_recurring_duration_units, product_minimum_subscription_period):
product_minimum_subscription_duration):
data = { data = {
**OTPCredentials(name, realm, seed).get_json(), **OTPCredentials(name, realm, seed).get_json(),
"product_name": product_name, "product_name": product_name,
"product_description": product_description, "product_description": product_description,
"product_type": product_type, "product_type": product_type,
"product_price": product_price, "product_price": product_price,
"product_recurring_duration": product_recurring_duration, "product_recurring_period": product_recurring_period,
"product_recurring_duration_units": product_recurring_duration_units, "product_minimum_subscription_period":
"product_minimum_subscription_duration": product_minimum_subscription_period
product_minimum_subscription_duration
} }
r = requests.post("{}/product/add".format(config('UCLOUD_PAY_SERVER')), r = requests.post("{}/product/add".format(config('UCLOUD_PAY_SERVER')),
json=data) json=data)