예제 #1
0
def buyer_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerProductParameters(request, {}, version)

	if request.method == "GET":

		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0 and parameters["isBuyerStore"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.get_buyer_details(request,parameters)
	elif request.method == "POST":
		if parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.post_new_buyer(request)
	elif request.method == "PUT":

		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.update_buyer(request, parameters)
	elif request.method == "DELETE":

		if parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.delete_buyer(request, parameters)

	return customResponse(404, error_code = 7)
예제 #2
0
def buyer_interest_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerParameters(request, {}, version )

	if request.method == "GET":

		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.get_buyer_interest_details(request,parameters)
	elif request.method == "POST":
		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.post_new_buyer_interest(request, parameters)
	elif request.method == "PUT":
		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.update_buyer_interest(request, parameters)
	#elif request.method == "DELETE":
	#	if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
	#		return customResponse("4XX", {"error": "Authentication failure"})
	#	return buyer.delete_buyer_interest(request, parameters)

	return customResponse(404, error_code = 7)
예제 #3
0
def seller_login(request, version = "0"):

	version = getApiVersion(request)

	response = {}
	if request.method == 'POST':
		email = request.POST.get('email', '')
		password = request.POST.get('password', '')

		if not email or not password:
			return customResponse(400, error_code=5, error_details= "Either email or password was empty")

		# if check_token(request)
		try:
			seller = Seller.objects.get(email=email, delete_status=False)
		except Seller.DoesNotExist:
			return customResponse(401, error_code=9, error_details="Invalid seller credentials")

		if password == seller.password:
			response = {
				"token": getSellerToken(seller),
				"seller": serialize_seller(seller)
			}
			return customResponse(200, response)
		else:
			return customResponse(401, error_code=9, error_details="Invalid seller credentials")

	return customResponse(404, error_code = 7)
예제 #4
0
def offline_deleted_product_details(request, version="0"):
    version = getApiVersion(request)
    parameters = populateProductParameters(request, {}, version)

    if request.method == "GET":
        return product.get_deleted_offline_products(request, parameters)

    return customResponse(404, error_code=7)
예제 #5
0
def buyer_product_landing_details(request, version = "0"):

	version = getApiVersion(request)
	
	if request.method == "POST":
		return buyer.post_buyer_product_landing(request)

	return customResponse(404, error_code = 7)
예제 #6
0
def pincode_details(request, version="0"):

    version = getApiVersion(request)

    if request.method == "GET":

        return state.get_state_details(request, parameters)

    return customResponse(404, error_code=7)
예제 #7
0
def product_fabric_details(request, version="0"):

    version = getApiVersion(request)

    if request.method == "GET":

        return product.get_product_fabric_details(request)

    return customResponse(404, error_code=7)
예제 #8
0
def buyer_firebase_token_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerParameters(request, {}, version)

	if request.method == "PUT":
		return buyer.put_buyer_firebase_token_details(request, parameters)

	return customResponse(404, error_code = 7)
예제 #9
0
def article_cover_photo_details(request, version="0"):
    version = getApiVersion(request)

    if request.method == 'POST':
        parameters = getArticleParameters(request, {}, version)
        if parameters["isInternalUser"] == 0:
            return customResponse(403, error_code=8)
        return article.upload_article_file(request)

    return customResponse(404, error_code=7)
예제 #10
0
def state_details(request, version="0"):

    version = getApiVersion(request)

    parameters = populateAddressParameters(request, {}, version)

    if request.method == "GET":

        return state.get_state_details(request, parameters)

    return customResponse(404, error_code=7)
예제 #11
0
def buyer_forgot_password_verify(request, version = "0"):

	version = getApiVersion(request)

	parameters = {}

	if request.method == 'POST':

		return buyer.post_buyer_forgot_password_verify(request,parameters)

	return customResponse(404, error_code = 7)
예제 #12
0
def buyer_renew_access_token(request, version = "0"):

	version = getApiVersion(request)

	parameters = {}

	if request.method == 'GET':

		return buyer.get_buyer_renew_access_token(request,parameters)

	return customResponse(404, error_code = 7)
예제 #13
0
def buyer_registration_verify(request, version = "0"):

	version = getApiVersion(request)

	parameters = {}

	if request.method == "POST":

		return buyer.post_buyer_registration_verify(request,parameters)

	return customResponse(404, error_code = 7)
예제 #14
0
def buyer_access_token_details(request, version = "0"):

	version = getApiVersion(request)
	"""
	if request.method == "GET":
		parameters = {}
		parameters["buyer_panel_url"] = request.GET.get("buyer_panel_url", "")

		return buyer.get_buyer_access_token_details(request, parameters)
	"""

	return customResponse(404, error_code = 7)
예제 #15
0
def buyer_product_master_update(request,version = "0"):

	version = getApiVersion(request)

	parameters = populateInternalUserIDParameters(request, {}, version)

	if request.method == "POST":
		if parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.master_update_buyer_product(request)

	return customResponse(404, error_code = 7)
예제 #16
0
def checkout_payment_method_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateCheckoutParameters(request, {}, version)

	if request.method == "GET":
		if parameters["isBuyer"] == 0:
			return customResponse(403, error_code = 8)
		return checkout.get_payment_method(request, parameters)

	return customResponse(404, error_code = 7)
예제 #17
0
def cart_details(request, version = "0"):

	version = getApiVersion(request)

	cartParameters = populateCartParameters(request, {}, version)

	if request.method == "GET":
		if cartParameters["isBuyer"] == 0 and cartParameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return cart.get_cart_details(request,cartParameters)

	return customResponse(404, error_code = 7)
예제 #18
0
def buyer_product_whatsapp_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerProductParameters(request, {}, version )
	
	if request.method == "PUT":
		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.update_buyer_product_whatsapp(request, parameters)

	return customResponse(404, error_code = 7)
예제 #19
0
def buyer_panel_tracking_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerParameters(request, {}, version)

	if request.method == "POST":
		if parameters["isBuyer"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.post_new_buyer_panel_tracking(request, parameters)

	return customResponse(404, error_code = 7)
예제 #20
0
def user_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateAllUserIDParameters(request, {}, version)

	if request.method == "GET":
		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0 and parameters["isSeller"]:
			return customResponse(403, error_code = 8)

		return user.get_user_details(request)

	return customResponse(404, error_code = 7)
예제 #21
0
def product_catalog(request, version="0"):

    version = getApiVersion(request)

    parameters = populateProductParameters(request, {}, version)

    if request.method == "GET":

        if parameters["isInternalUser"] == 0:
            return customResponse(403, error_code=8)

        return product.get_product_catalog(request, parameters)

    return customResponse(404, error_code=7)
예제 #22
0
def buyer_change_password(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerIDParameters(request, {}, version)

	if request.method == 'POST':

		if  parameters["isBuyer"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.post_buyer_change_password(request,parameters)

	return customResponse(404, error_code = 7)
예제 #23
0
def internal_user_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateInternalUserIDParameters(request, {}, version)

	if request.method == "GET":

		if  parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)

		return internaluser.get_internal_user_details(request,parameters)

	return customResponse(404, error_code = 7)
예제 #24
0
def business_type_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBusinessTypeParameters(request, {}, version)

	if request.method == "GET":

		if parameters["isSeller"] == 0 and parameters["isInternalUser"] == 0 and parameters["isBuyer"] == 0 and parameters["isBuyerStore"] == 0:
			return customResponse(403, error_code = 8)
		
		return businesstype.get_business_type_details(request,parameters)

	return customResponse(404, error_code = 7)
예제 #25
0
def buyer_product_response_count_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerIDParameters(request, {}, version)

	if request.method == "GET":

		if parameters["isBuyer"] == 0 and parameters["isBuyerStore"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.get_buyer_product_response_count_details(request,parameters)

	return customResponse(404, error_code = 7)
예제 #26
0
def pincode_serviceability_details(request, version="0"):

    version = getApiVersion(request)

    parameters = populateLogisticsParameters(request, {}, version)

    if request.method == "GET":

        if parameters["isSeller"] == 0 and parameters[
                "isInternalUser"] == 0 and parameters["isBuyer"] == 0:
            return customResponse(403, error_code=8)

        return pincodeserviceability.get_pincode_serviceability_details(
            request, parameters)

    return customResponse(404, error_code=7)
예제 #27
0
def populateCategoryParameters(request, parameters={}, version="0"):
    version = getApiVersion(request)
    categoryID = request.GET.get("categoryID", "")
    if categoryID != "":
        parameters["categoriesArr"] = getArrFromString(categoryID)

    categoryShowOnline = request.GET.get("category_show_online", "")
    if categoryShowOnline != "" and validate_bool(categoryShowOnline):
        parameters["category_show_online"] = int(categoryShowOnline)

    parameters = populateAllUserIDParameters(request, parameters, version)

    parameters = populateCategorytDetailsParameters(request, parameters,
                                                    version)

    return parameters
예제 #28
0
def order_item_details(request, version = "0"):

	version = getApiVersion(request)

	orderItemParameters = populateOrderParameters(request, {}, version)

	if request.method == "GET":

		if orderItemParameters["isSeller"] == 0 and orderItemParameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return orderItem.get_order_item_details(request,orderItemParameters)
	elif request.method == "DELETE":
		if orderItemParameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)
		return orderItem.cancel_order_item(request)

	return customResponse(404, error_code = 7)
예제 #29
0
def buyer_store_url_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerParameters(request, {}, version)

	if request.method == "GET":

		if parameters["isBuyer"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.get_buyer_store_url_exists_details(request,parameters)
	elif request.method == "PUT":

		if parameters["isBuyer"] == 0:
			return customResponse(403, error_code = 8)
		return buyer.update_buyer_store_url(request,parameters)

	return customResponse(404, error_code = 7)
예제 #30
0
def buyer_shared_product_id_details(request, version = "0"):

	version = getApiVersion(request)

	parameters = populateBuyerParameters(request, {}, version)

	if request.method == "GET":

		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.get_buyer_shared_product_id_details(request,parameters)
	elif request.method == "DELETE":

		if parameters["isBuyer"] == 0 and parameters["isInternalUser"] == 0:
			return customResponse(403, error_code = 8)

		return buyer.delete_buyer_shared_product_id(request, parameters)

	return customResponse(404, error_code = 7)