Ejemplo n.º 1
0
def delete(account_from_auth: str, request: Request, account: str,) -> Response:
    if account_from_auth != account:
        return render_error_response(_("account not found"), status_code=404)
    try:
        make_memo(request.data.get("memo"), request.data.get("memo_type"))
    except ValueError:
        return render_error_response(_("invalid 'memo' for 'memo_type'"))
    try:
        rci.delete(account, request.data.get("memo"), request.data.get("memo_type"))
    except ObjectDoesNotExist:
        return render_error_response(_("account not found"), status_code=404)
    else:
        return Response({"status": "success"}, status=200)
def delete(account_from_auth: str, request: Request, account: str) -> Response:
    if account_from_auth != account:
        return render_error_response("account not found", status_code=404)
    try:
        memo = memo_str(request.data.get("memo"),
                        request.data.get("memo_type"))
    except ValueError as e:
        return render_error_response("invalid 'memo' for 'memo_type'")
    try:
        rci.delete(account, memo, request.data.get("memo_type"))
    except ValueError:
        return render_error_response("account not found", status_code=404)
    else:
        return Response({}, status=200)