def construct_enterprise_course_consent_url(request, course_id, enterprise_customer_uuid): """ Construct the URL that should be used for redirecting the user to the Enterprise service for collecting consent. """ site = request.site failure_url = '{base}?{params}'.format( base=get_lms_dashboard_url(), params=urlencode({ 'enterprise_customer': enterprise_customer_uuid, CONSENT_FAILED_PARAM: course_id }), ) request_params = { 'course_id': course_id, 'enterprise_customer_uuid': enterprise_customer_uuid, 'next': absolute_url(request, 'checkout:free-checkout'), 'failure_url': failure_url, } redirect_url = '{base}?{params}'.format( base=site.siteconfiguration.enterprise_grant_data_sharing_url, params=urlencode(request_params)) return redirect_url
def construct_enterprise_course_consent_url(request, course_id, enterprise_customer_uuid, consent_url_param_dict=None): """ Construct the URL that should be used for redirecting the user to the Enterprise service for collecting consent. """ site = request.site failure_url = '{base}?{params}'.format( base=get_lms_dashboard_url(), params=urlencode({ 'enterprise_customer': enterprise_customer_uuid, CONSENT_FAILED_PARAM: course_id }), ) request_params = { 'course_id': course_id, 'enterprise_customer_uuid': enterprise_customer_uuid, 'next': absolute_url(request, 'checkout:free-checkout'), 'failure_url': failure_url, 'source': 'ecommerce-free-checkout', } # Insert any extra forwarded params from the original request: request_params.update(consent_url_param_dict or {}) redirect_url = '{base}?{params}'.format( base=site.siteconfiguration.enterprise_grant_data_sharing_url, params=urlencode(request_params) ) return redirect_url
def get_payment_microfrontend_or_basket_url(request): url = get_payment_microfrontend_url_if_configured(request) if not url: url = absolute_url(request, 'basket:summary') return url