def post_renewal_preview(renewal_id): advantage = AdvantageContracts( session, flask.session["authentication_token"], api_url=flask.current_app.config["CONTRACTS_API_URL"], ) try: preview = advantage.post_renewal_preview(renewal_id=renewal_id) except HTTPError as http_error: flask.current_app.extensions["sentry"].captureException() return ( http_error.response.content, 500, ) return flask.jsonify(preview), 200
def post_renewal_preview(renewal_id): is_test_backend = flask.request.args.get("test_backend", False) api_url = flask.current_app.config["CONTRACTS_LIVE_API_URL"] if is_test_backend: api_url = flask.current_app.config["CONTRACTS_TEST_API_URL"] advantage = AdvantageContracts( session, flask.session["authentication_token"], api_url=api_url, ) try: preview = advantage.post_renewal_preview(renewal_id=renewal_id) except HTTPError as http_error: flask.current_app.extensions["sentry"].captureException() return ( http_error.response.content, 500, ) return flask.jsonify(preview), 200