Remove email dependency for product

This commit is contained in:
PCoder 2019-09-19 15:50:14 +05:30
parent ed74b2ecb3
commit 22ac971db8

View file

@ -1,7 +1,7 @@
import click import click
import requests import requests
from decouple import config from decouple import config
from .helper import OTPCredentials, load_dump_pretty from .helper import OTPCredentials, load_dump_pretty
@ -28,11 +28,10 @@ def list():
@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-period", 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)
@click.option("--product-minimum-subscription-period", required=False, @click.option("--product-minimum-subscription-period", required=False,
type=int, help="Minimum period for which a user needs to " help="Minimum period for which a user needs to "
"subscribe the product for", default=0) "subscribe the product for")
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_period, product_price, product_recurring_period,
product_minimum_subscription_period): product_minimum_subscription_period):
@ -55,14 +54,12 @@ def add(name, realm, seed, product_name, product_description, product_type,
@click.option("--name", envvar="OTP_NAME", required=True) @click.option("--name", envvar="OTP_NAME", required=True)
@click.option("--realm", envvar="OTP_REALM", required=True) @click.option("--realm", envvar="OTP_REALM", required=True)
@click.option("--seed", envvar="OTP_SEED", required=True) @click.option("--seed", envvar="OTP_SEED", required=True)
@click.option("--email", required=True)
@click.option("--product-id", help="The uuid of the product", required=True) @click.option("--product-id", help="The uuid of the product", required=True)
def order(name, realm, seed, product_id, email): def order(name, realm, seed, product_id):
data = { data = {
**OTPCredentials(name, realm, seed).get_json(), **OTPCredentials(name, realm, seed).get_json(),
"product_id": product_id, "product_id": product_id
"email": email
} }
r = requests.post("{}/product/order".format(config('UCLOUD_PAY_SERVER')), r = requests.post("{}/product/order".format(config('UCLOUD_PAY_SERVER')),
json=data) json=data)
print(load_dump_pretty(r.content)) print(load_dump_pretty(r.content))