Exemple #1
0
    def create(self, request):
        form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA)
        if form.is_valid():
            res = client.change_pin(form.uuid,
                                    form.cleaned_data['pin'],
                                    etag=form.buyer_etag,
                                    pin_confirmed=True,
                                    clear_was_locked=True)

            if form.client_response_is_valid(res):
                set_user_has_pin(request, True)
                return response.Response(status=204)

        return api_error(form, request)
Exemple #2
0
    def create(self, request):
        form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA)
        if form.is_valid():
            res = client.change_pin(form.uuid,
                                    form.cleaned_data['pin'],
                                    etag=form.buyer_etag,
                                    pin_confirmed=True,
                                    clear_was_locked=True)

            if form.client_response_is_valid(res):
                set_user_has_pin(request, True)
                return response.Response(status=204)

        return api_error(form, request)
Exemple #3
0
    def create(self, request):
        form = CreatePinForm(uuid=request.session["uuid"], data=request.DATA)
        if form.is_valid():
            if getattr(form, "buyer_exists", None):
                res = client.change_pin(form.uuid, form.cleaned_data["pin"], etag=form.buyer_etag)
            else:
                res = client.create_buyer(form.uuid, form.cleaned_data["pin"])

            if form.handle_client_errors(res):
                set_user_has_pin(request, True)
                return response.Response(status=201)

            return response.Response(status=201)

        return app_error(request)
Exemple #4
0
    def create(self, request):
        form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA)
        if form.is_valid():
            if getattr(form, 'buyer_exists', None):
                res = client.change_pin(form.uuid,
                                        form.cleaned_data['pin'],
                                        etag=form.buyer_etag)
            else:
                res = client.create_buyer(form.uuid, form.cleaned_data['pin'])

            if form.handle_client_errors(res):
                set_user_has_pin(request, True)
                return response.Response(status=201)

            return response.Response(status=201)

        return app_error(request)
Exemple #5
0
    def create(self, request):
        form = CreatePinForm(uuid=request.session['uuid'], data=request.DATA)
        if form.is_valid():
            if getattr(form, 'buyer_exists', None):
                res = client.change_pin(form.uuid,
                                        form.cleaned_data['pin'],
                                        etag=form.buyer_etag,
                                        pin_confirmed=True,
                                        clear_was_locked=True)
            else:
                res = client.create_buyer(form.uuid,
                                          pin=form.cleaned_data['pin'],
                                          pin_confirmed=True,
                                          email=request.session[
                                              'logged_in_user'])

            if form.handle_client_errors(res):
                set_user_has_pin(request, True)

            return response.Response(status=204)

        return app_error(request)