def bootcamp_lp(request): if request.method == 'POST': form = WaitingForm(request.POST) if form.is_valid(): source = request.GET.get('utm_source', default='unknown') data = form.cleaned_data session_id = request.session.session_key if request.user.is_authenticated: user_domain.subscribe_to_waiting_list(session_id, request.user, data['phone'], source) else: user_domain.subscribe_anonymous_user_to_waiting_list( session_id, data['email'], data['first_name'], data['phone'], source) return redirect(reverse('checkout:waiting_list_ty')) return render(request, 'checkout/bootcamp_lp_subscription_closed.html', {'form': form}) if not checkout_facade.is_launch_open(): if request.user.is_authenticated: user_domain.visit_member_landing_page(request.user, source=request.GET.get( 'utm_source', default='unknown')) form = checkout_forms.WaitingForm() return render(request, 'checkout/bootcamp_lp_subscription_closed.html', {'form': form}) return _redirect_to_bootcamp_lp(request)
def _render_with_webdev_and_first_day_discounts( request, client_discount_slug, first_day_discount_slug, promotion_end_date, template_name='checkout/bootcamp_lp_subscription_open.html'): user_domain.visit_member_landing_page(request.user, source=request.GET.get( 'utm_source', default='unknown')) has_client_discount = True data = {'name': request.user.first_name, 'email': request.user.email} form = facade.ContactForm(data) has_first_day_discount = True no_discount_item_config = facade.find_payment_item_config('bootcamp') first_day_discount_item_config = facade.find_payment_item_config( first_day_discount_slug) first_day_discount = no_discount_item_config.price - first_day_discount_item_config.price client_discount_item_config = facade.find_payment_item_config( client_discount_slug) payment_item_config = client_discount_item_config client_discount = no_discount_item_config.price - client_discount_item_config.price - first_day_discount return _render_bootcamp_lp(client_discount, first_day_discount, form, has_client_discount, has_first_day_discount, no_discount_item_config, payment_item_config, promotion_end_date, request, template_name)
def bootcamp_lp_d3_webdev(request): user = request.user has_discount = checkout_facade.has_35_percent_discount( ) or checkout_facade.has_50_percent_discount() is_debug = bool(request.GET.get('debug', False)) if not is_debug and (has_discount or not (checkout_facade.is_launch_open() and is_webdev(user))): return _redirect_to_bootcamp_lp(request) user_domain.visit_member_landing_page(request.user, source=request.GET.get( 'utm_source', default='unknown')) has_client_discount = True data = {'name': request.user.first_name, 'email': request.user.email} form = facade.ContactForm(data) has_first_day_discount = False no_discount_item_config = facade.find_payment_item_config('bootcamp') first_day_discount = 0 client_discount_item_config = facade.find_payment_item_config( 'bootcamp-webdev') promotion_end_date = checkout_facade.launch_datetime_finish payment_item_config = client_discount_item_config client_discount = no_discount_item_config.price - client_discount_item_config.price - first_day_discount return _render_bootcamp_lp(client_discount, first_day_discount, form, has_client_discount, has_first_day_discount, no_discount_item_config, payment_item_config, promotion_end_date, request, 'checkout/bootcamp_lp_d3.html')
def bootcamp_lp_d3(request): user = request.user has_discount = checkout_facade.has_35_percent_discount( ) or checkout_facade.has_50_percent_discount() or is_webdev(user) is_debug = bool(request.GET.get('debug', False)) if not is_debug and ((not checkout_facade.is_launch_open()) or has_discount): return _redirect_to_bootcamp_lp(request) if request.user.is_authenticated: user_domain.visit_member_landing_page(request.user, source=request.GET.get( 'utm_source', default='unknown')) form = facade.ContactForm() payment_item_config = no_discount_item_config = facade.find_payment_item_config( 'bootcamp') first_day_discount = 0 client_discount = 0 has_first_day_discount = False has_client_discount = False promotion_end_date = checkout_facade.launch_datetime_finish return _render_bootcamp_lp(client_discount, first_day_discount, form, has_client_discount, has_first_day_discount, no_discount_item_config, payment_item_config, promotion_end_date, request, 'checkout/bootcamp_lp_d3.html')
def _render_launch_page(is_launch_open, request, template_closed_launch, template_open_launch, redirect_path_name: str): user = request.user if user.is_authenticated: user_domain.visit_member_landing_page(request.user, source=request.GET.get( 'utm_source', default='unknown')) template = template_closed_launch return render(request, template, {})
def _no_wevdev_discount( request, discount_slug, promotion_end_date, template_name='checkout/bootcamp_lp_subscription_open.html'): if request.user.is_authenticated: user_domain.visit_member_landing_page(request.user, source=request.GET.get( 'utm_source', default='unknown')) form = facade.ContactForm() payment_item_config = facade.find_payment_item_config(discount_slug) no_discount_item_config = facade.find_payment_item_config('bootcamp') first_day_discount = no_discount_item_config.price - payment_item_config.price client_discount = 0 has_first_day_discount = True has_client_discount = False return _render_bootcamp_lp(client_discount, first_day_discount, form, has_client_discount, has_first_day_discount, no_discount_item_config, payment_item_config, promotion_end_date, request, template_name)