예제 #1
0
def index(request, team_id):
    team = get_team(team_id)
    get_or_create_recipient(team, request.user)

    return render(request, 'old/dashboard/recipients/index.html', {
        'team': team,
        'cbui_url': get_recipient_cbui_url(team_id),
        'spudder_url': '%s/dashboard/teams' % settings.SPUDDER_BASE_URL
    })
예제 #2
0
def index(request, team_id):
    team = get_team(team_id)
    get_or_create_recipient(team, request.user)

    return render(
        request, 'old/dashboard/recipients/index.html', {
            'team': team,
            'cbui_url': get_recipient_cbui_url(team_id),
            'spudder_url': '%s/dashboard/teams' % settings.SPUDDER_BASE_URL
        })
예제 #3
0
def complete(request, team_id):
    team = get_team(team_id)
    recipient = get_or_create_recipient(team, request.user)
    recipient.status_code = AmazonActionStatus.get_from_code(
        request.GET.get('status'))
    recipient.max_fee = 10

    if recipient.status_code is AmazonActionStatus.SUCCESS:
        result = save_team_is_recipient(team_id)

        if not result:
            state = RecipientRegistrationState.TERMINATED
            recipient.status_code = AmazonActionStatus.SPUDDER_SAVE_FAILED
            redirect_to = '/dashboard/recipient/%s/error' % team_id
        else:
            state = RecipientRegistrationState.FINISHED
            recipient.recipient_token_id = request.GET.get('tokenID')
            recipient.refund_token_id = request.GET.get('refundTokenID')
            redirect_to = '/dashboard/recipient/%s/thanks' % team_id
    else:
        state = RecipientRegistrationState.TERMINATED
        redirect_to = '/dashboard/recipient/%s/error' % team_id

    recipient.state = state
    recipient.save()

    return HttpResponseRedirect(redirect_to)
예제 #4
0
def complete(request, team_id):
    team = get_team(team_id)
    recipient = get_or_create_recipient(team, request.user)
    recipient.status_code = AmazonActionStatus.get_from_code(request.GET.get('status'))
    recipient.max_fee = 10

    if recipient.status_code is AmazonActionStatus.SUCCESS:
        result = save_team_is_recipient(team_id)

        if not result:
            state = RecipientRegistrationState.TERMINATED
            recipient.status_code = AmazonActionStatus.SPUDDER_SAVE_FAILED
            redirect_to = '/dashboard/recipient/%s/error' % team_id
        else:
            state = RecipientRegistrationState.FINISHED
            recipient.recipient_token_id=request.GET.get('tokenID')
            recipient.refund_token_id=request.GET.get('refundTokenID')
            redirect_to = '/dashboard/recipient/%s/thanks' % team_id
    else:
        state = RecipientRegistrationState.TERMINATED
        redirect_to = '/dashboard/recipient/%s/error' % team_id

    recipient.state = state
    recipient.save()

    return HttpResponseRedirect(redirect_to)
예제 #5
0
def error(request, team_id):
    team = get_team(team_id)
    recipient = get_or_create_recipient(team, request.user)
    status_message = AmazonActionStatus.get_status_message(recipient.status_code)

    return render(request, 'old/dashboard/recipients/error.html', {
        'spudder_url': '%s/dashboard/teams/%s/offers' % (settings.SPUDDER_BASE_URL, team_id),
        'status': status_message
    })
예제 #6
0
def error(request, team_id):
    team = get_team(team_id)
    recipient = get_or_create_recipient(team, request.user)
    status_message = AmazonActionStatus.get_status_message(
        recipient.status_code)

    return render(
        request, 'old/dashboard/recipients/error.html', {
            'spudder_url':
            '%s/dashboard/teams/%s/offers' %
            (settings.SPUDDER_BASE_URL, team_id),
            'status':
            status_message
        })