예제 #1
0
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')
예제 #2
0
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')
예제 #3
0
def bootcamp_lp_d1(request):
    user = request.user
    is_debug = bool(request.GET.get('debug', False))
    if not is_debug and ((not checkout_facade.has_50_percent_discount()) or is_webdev(user)):
        return _redirect_to_bootcamp_lp(request)

    return _no_wevdev_discount(request, 'bootcamp-50-discount', checkout_facade.discount_50_percent_datetime_limit)
예제 #4
0
def _redirect_to_bootcamp_lp(request):
    if checkout_facade.has_50_percent_discount():
        path_name = 'checkout:bootcamp_lp_d1'
    elif checkout_facade.has_35_percent_discount():
        path_name = 'checkout:bootcamp_lp_d2'
    else:
        path_name = 'checkout:bootcamp_lp_d3'
    if is_webdev(request.user):
        path_name = f'{path_name}_webdev'
    if not checkout_facade.is_launch_open():
        path_name = 'checkout:bootcamp_lp'
    return HttpResponseRedirect(reverse(path_name) + '?' + request.META['QUERY_STRING'])
예제 #5
0
def bootcamp_lp_d1_webdev(request):
    user = request.user
    is_debug = bool(request.GET.get('debug', False))
    if not is_debug and not (checkout_facade.has_50_percent_discount() and is_webdev(user)):
        return _redirect_to_bootcamp_lp(request)

    client_discount_slug = 'bootcamp-webdev-50-discount'
    first_day_discount_slug = 'bootcamp-50-discount'
    promotion_end_date = checkout_facade.discount_50_percent_datetime_limit

    return _render_with_webdev_and_first_day_discounts(request, client_discount_slug, first_day_discount_slug,
                                                       promotion_end_date)