def getArticleParameters(request, parameters={}, version="0"): defaultValue = 0 articleID = request.GET.get("articleID", "") if articleID != "" and articleID != None: parameters["articlesArr"] = getArrFromString(articleID) showOnline = request.GET.get("show_online", None) if validate_bool(showOnline): parameters["show_online"] = int(showOnline) articleDetails = request.GET.get("article_details", None) if validate_bool(articleDetails): parameters["article_details"] = int(articleDetails) else: parameters["article_details"] = defaultValue internalUserDetails = request.GET.get("internal_user_details", None) if validate_bool(internalUserDetails): parameters["internal_user_details"] = int(internalUserDetails) else: parameters["internal_user_details"] = defaultValue parameters = populateInternalUserIDParameters(request, parameters) parameters = getPaginationParameters(request, parameters) return parameters
def populateLogisticsParameters(request, parameters={}, version="0"): parameters = getPaginationParameters(request, parameters, 10, version) parameters = populateAllUserIDParameters(request, parameters, version) pincodeCode = request.GET.get("pincode_code", "") if pincodeCode != "" and pincodeCode != None: parameters["pincodesCodesArr"] = getArrFromString(pincodeCode) pincodeID = request.GET.get("pincodeID", "") if pincodeID != "" and pincodeID != None: parameters["pincodesArr"] = getArrFromString(pincodeID) logisticsPartnerID = request.GET.get("logisticspartnerID", "") if logisticsPartnerID != "" and logisticsPartnerID != None: parameters["logisticsPartnersArr"] = getArrFromString( logisticsPartnerID) regularDeliveryAvailable = request.GET.get("regular_delivery_available", "") if validate_bool(regularDeliveryAvailable): parameters["regular_delivery_available"] = int( regularDeliveryAvailable) regularPickupAvailable = request.GET.get("regular_pickup_available", "") if validate_bool(regularPickupAvailable): parameters["regular_pickup_available"] = int(regularPickupAvailable) codAvailable = request.GET.get("cod_available", "") if validate_bool(codAvailable): parameters["cod_available"] = int(codAvailable) return parameters
def populateProductParameters(request, parameters={}, version="0"): parameters = getPaginationParameters(request, parameters, 10) parameters = populateProductFilterParameters(request, parameters, version) parameters = populateAllUserIDParameters(request, parameters, version) parameters = populateProductDetailsParameters(request, parameters, version) return parameters
def populateMarketingContactsParameters(request, parameters={}, version="0"): parameters = populateInternalUserIDParameters(request, parameters, version) parameters = getPaginationParameters(request, parameters, 200) newContacts = request.GET.get("new_contacts", "") if newContacts != "" and validate_bool(newContacts): parameters["new_contacts"] = int(newContacts) else: parameters["new_contacts"] = 1 marketingContactID = request.GET.get("marketingcontactID", "") if marketingContactID != "" and marketingContactID != None: parameters["marketingContactsArr"] = getArrFromString( marketingContactID) return parameters
def populateCartParameters(request, parameters = {}, version = "0"): defaultValue = 1 if version == "1": defaultValue = 0 parameters = populateAllUserIDParameters(request, parameters, version) productID = request.GET.get("productID", "") if productID != "" and productID != None: parameters["productsArr"] = getArrFromString(productID) cartItemID = request.GET.get("cartitemID", "") if cartItemID != "" and cartItemID != None: parameters["cartItemsArr"] = getArrFromString(cartItemID) cartItemStatus = request.GET.get("cart_item_status", "") if cartItemStatus != "": parameters["cartItemStatusArr"] = getArrFromString(cartItemStatus) parameters = populateBuyerDetailsParameters(request, parameters, version) parameters = populateSellerDetailsParameters(request, parameters, version) parameters = populateProductDetailsParameters(request, parameters, version) parameters = getPaginationParameters(request, parameters, 10, version) cartItemDetails = request.GET.get("cart_item_details", None) if validate_bool(cartItemDetails): parameters["cart_item_details"] = int(cartItemDetails) else: parameters["cart_item_details"] = defaultValue subCartDetails = request.GET.get("sub_cart_details", None) if validate_bool(subCartDetails): parameters["sub_cart_details"] = int(subCartDetails) else: parameters["sub_cart_details"] = defaultValue return parameters
def populateBuyerProductParameters(request, parameters = {}, version = "0"): parameters = populateBuyerParameters(request, parameters, version) isActive = request.GET.get("is_active", None) responded = request.GET.get("responded", None) buyerProductID = request.GET.get("buyerproductID", "") buyerInterestID = request.GET.get("buyerinterestID", "") productID = request.GET.get("productID", "") landing = request.GET.get("landing", "") if validate_bool(isActive): parameters["buyer_product_is_active"] = int(isActive) if validate_bool(landing): parameters["buyer_product_landing"] = int(landing) if validate_integer(responded): parameters["responded"] = int(responded) if buyerProductID != "": parameters["buyerProductsArr"] = getArrFromString(buyerProductID) if buyerInterestID != "": parameters["buyerInterestArr"] = getArrFromString(buyerInterestID) from .catalog_handler import populateProductFilterParameters parameters = populateProductFilterParameters(request, parameters, version) parameters = getPaginationParameters(request, parameters, 10, version) from .catalog_handler import populateProductDetailsParameters parameters = populateProductDetailsParameters(request, parameters, version) return parameters
def populateOrderParameters(request, parameters = {}, version = "0"): parameters = populateAllUserIDParameters(request, parameters, version) orderID = request.GET.get("orderID", "") orderStatus = request.GET.get("order_status", "") orderPaymentStatus = request.GET.get("order_payment_status", "") if orderID != "": parameters["orderArr"] = getArrFromString(orderID) if orderStatus != "": parameters["orderStatusArr"] = getArrFromString(orderStatus) if orderPaymentStatus != "": parameters["orderPaymentStatusArr"] = getArrFromString(orderPaymentStatus) subOrderID = request.GET.get("suborderID", "") subOrderStatus = request.GET.get("sub_order_status", "") subOrderPaymentStatus = request.GET.get("sub_order_payment_status", "") if subOrderID != "": parameters["subOrderArr"] = getArrFromString(subOrderID) if subOrderStatus != "": parameters["subOrderStatusArr"] = getArrFromString(subOrderStatus) if subOrderPaymentStatus != "": parameters["subOrderPaymentStatusArr"] = getArrFromString(subOrderPaymentStatus) orderShipmentID = request.GET.get("ordershipmentID", "") orderShipmentStatus = request.GET.get("order_shipment_status", "") if orderShipmentID != "": parameters["orderShipmentArr"] = getArrFromString(orderShipmentID) if orderShipmentStatus != "": parameters["orderShipmentStatusArr"] = getArrFromString(orderShipmentStatus) orderItemID = request.GET.get("orderitemID", "") orderItemStatus = request.GET.get("order_item_status", "") if orderItemID != "": parameters["orderItemArr"] = getArrFromString(orderItemID) if orderItemStatus != "": parameters["orderItemStatusArr"] = getArrFromString(orderItemStatus) buyerPaymentID = request.GET.get("buyerpaymentID", "") buyerPaymentStatus = request.GET.get("buyer_payment_status", "") if buyerPaymentID != "": parameters["buyerPaymentArr"] = getArrFromString(buyerPaymentID) if buyerPaymentStatus != "": parameters["buyerPaymentStatusArr"] = getArrFromString(buyerPaymentStatus) sellerPaymentID = request.GET.get("sellerpaymentID", "") sellerPaymentStatus = request.GET.get("seller_payment_status", "") if sellerPaymentID != "": parameters["sellerPaymentArr"] = getArrFromString(sellerPaymentID) if sellerPaymentStatus != "": parameters["sellerPaymentStatusArr"] = getArrFromString(sellerPaymentStatus) parameters = getPaginationParameters(request, parameters, 10, version) parameters = populateOrderDetailsParameters(request, parameters, version) return parameters