forked from isacben/rpyd
-
Notifications
You must be signed in to change notification settings - Fork 3
/
get-pmt-required-fields.py
executable file
·44 lines (35 loc) · 1.21 KB
/
get-pmt-required-fields.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
from utilities import make_request
import json
import argparse
parser = argparse.ArgumentParser(description="Get Payment Method Required Fields")
parser.add_argument("pmt", help="the payment method type")
parser.add_argument("env", help="the rapyd environment")
parser.add_argument("-a", "--all", help="outputs all rapyd's api response", action="store_true")
args = parser.parse_args()
path = f'/v1/payment_methods/required_fields/{args.pmt}'
response = make_request(env=args.env, method='get', path=path)
if args.all:
print(json.dumps(response, indent=4))
exit(0)
print('> fields:')
for r in response['data']['fields']:
s = f"{r['name']}, " \
f"{r['type']}, " \
f"is required {r['is_required']}, " \
f"{r['regex']}"
print(s)
print('\n> payment_method_options:')
for r in response['data']['payment_method_options']:
s = f"{r['name']}, " \
f"{r['type']}, " \
f"is required {r['is_required']}, " \
f"{r['regex']}"
print(s)
print('\n> payment_options:')
for r in response['data']['payment_options']:
s = f"{r['name']}, " \
f"{r['type']}, " \
f"is required {r['is_required']}, " \
f"{r['regex']}"
print(s)