示例#1
0
文件: api.py 项目: Witia1/webpay
    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)
示例#2
0
文件: api.py 项目: tempbottle/webpay
    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)
示例#3
0
文件: api.py 项目: unghost/webpay
    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)
示例#4
0
文件: api.py 项目: lissyx/webpay
    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)
示例#5
0
文件: api.py 项目: kyoshino/webpay
    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)