Make cc a flag and use post

This commit is contained in:
PCoder 2019-09-14 00:36:55 +05:30
parent 48c852ce73
commit 22c6c23120

View file

@ -36,7 +36,7 @@ def list_vms(name, realm, seed):
@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("--cc", required=True)
@click.option("--cc", required=True, is_flag=True)
@click.option("--number", required=True)
@click.option("--cvc", required=True)
@click.option("--expiry-month", required=True, help="MM", type=str)
@ -45,7 +45,7 @@ def list_vms(name, realm, seed):
help="The name as printed on the card", type=str)
@click.option("--email", required=True, help="Email address", type=str)
def register_payment(name, realm, seed, number, cvc, expiry_year, expiry_month,
card_holder_name, email):
card_holder_name, email, cc):
data = {
**OTPCredentials(name, realm, seed).get_json(),
"card_number": number,
@ -55,7 +55,7 @@ def register_payment(name, realm, seed, number, cvc, expiry_year, expiry_month,
"card_holder_name": card_holder_name,
"email": email
}
r = requests.get(
r = requests.post(
"{}/user/register_payment".format(config('UCLOUD_PAY_SERVER')),
json=data)
print(load_dump_pretty(r.content))