-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathclickwrap.py
30 lines (24 loc) · 893 Bytes
/
clickwrap.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
from docusign_esign import ApiException
from flask import Blueprint, jsonify, request, session
from flask_cors import cross_origin
from app.api.utils import process_error, check_token
from app.clickwrap import Clickwrap
clickwrap = Blueprint('clickwrap', __name__)
@clickwrap.route('/clickwraps/renewal', methods=['POST'])
@cross_origin()
@check_token
def insurance_renewal():
"""Create a clickwrap for submitting insurance policy renewal"""
try:
req_json = request.get_json(force=True)
except TypeError:
return jsonify(message='Invalid JSON input'), 400
clickwrap_args = {
'terms_name': req_json['terms-name'],
'display_name': req_json['display-name'],
}
try:
clickwrap_ = Clickwrap.create(clickwrap_args, session)
except ApiException as exc:
return process_error(exc)
return jsonify(clickwrap=clickwrap_)