def submit_store_cart_card(params, agent, profile, cookie_file, request, store_id="-1", auth_code='000'): json = futils.get_api_response( request, agent, 'user/', cookie_file, 'post', {}, { 'action': 'submit_store_cart', 'data': { 'paymentMode': params.get('payment_mode', ''), 'currentPriceList': params.get('current_price_list', ''), 'orderAmount': params.get('order_amount', ''), 'pgResponse': params.get('pg_response', {}), 'profileId': profile, 'action': 'Booked', 'orderAmount': params.get('order_amount', ''), 'storeId': store_id, 'dateTime': str(datetime.datetime.now()), 'bookAgentId': agent, 'authCode': auth_code, 'orderId': params.get('order_id', ''), } }) return json
def submit_cart(params, agent, profile, cookie_file, request): params = simplejson.loads(simplejson.dumps(params)) json = futils.get_api_response( request, agent, "user/", cookie_file, "post", {}, { "action": "submit_cart", "data": { "profileId": profile, "orderNote": params.get("order_note", ""), "paymentMode": params.get("payment_mode", ""), "receivedBy": params.get("received_by", ""), "emiDetails": params.get("emi_details", {}), "subPayType": params.get("sub_pay_type", ""), "currentPriceList": params.get("current_price_list", ""), "orderAmount": params.get("order_amount", ""), "transactionAmount": params.get("order_amount", ""), "pointsTransactionId": "%s" % params.get("sessionid", ""), "terminalId": "%s" % params.get("loyaltyTerminalid"), "status": params.get("status"), "pinCode": "%s" % params.get("pincode", ""), "pgResponse": params.get("pg_response", {}), "shippingPostalCode": "%s" % params.get("shipping_postal_code", ""), "freeOrder": params.get("free_order", ""), "loyaltyCardNumber": params.get("payback_id", ""), "Status": params.get("Status", ""), }, }, ) return json
def update_user(shipping_address, billing_address, agent, profile, cookie_file, request): json = futils.get_api_response( request, agent, 'user/', cookie_file, 'post', {}, { 'action': 'update_user', 'data': { 'profileId': profile, 'shippingAddress': { 'firstName': shipping_address['first_name'], 'lastName': shipping_address['last_name'], 'address1': shipping_address['address'], 'city': shipping_address['city'], 'state': shipping_address['state'], 'country': shipping_address['country'], 'postalCode': shipping_address['postal_code'], 'phoneNumber': shipping_address['phone_number'], }, 'billingAddress': { 'firstName': billing_address['first_name'], 'lastName': billing_address['last_name'], 'address1': billing_address['address'], 'city': billing_address['city'], 'state': billing_address['state'], 'country': billing_address['country'], 'postalCode': billing_address['postal_code'], 'phoneNumber': billing_address['phone_number'], } } }) return json
def submit_cart(params, agent, profile, cookie_file, request): params = simplejson.loads(simplejson.dumps(params)) json = futils.get_api_response( request, agent, 'user/', cookie_file, 'post', {}, { 'action': 'submit_cart', 'data': { 'profileId': profile, 'orderNote': params.get('order_note', ''), 'paymentMode': params.get('payment_mode', ''), 'receivedBy': params.get('received_by', ''), 'emiDetails': params.get('emi_details', {}), 'subPayType': params.get('sub_pay_type', ''), 'currentPriceList': params.get('current_price_list', ''), 'orderAmount': params.get('order_amount', ''), 'transactionAmount': params.get('order_amount', ''), 'pointsTransactionId': "%s" % params.get('sessionid', ''), 'terminalId': "%s" % params.get('loyaltyTerminalid'), 'status': params.get('status'), 'pinCode': "%s" % params.get('pincode', ''), 'pgResponse': params.get('pg_response', {}), 'shippingPostalCode': "%s" % params.get('shipping_postal_code', ''), 'freeOrder': params.get('free_order', ''), 'loyaltyCardNumber': params.get('payback_id', ''), 'Status': params.get('Status', ''), } }) return json
def submit_store_cart_card(params, agent, profile, cookie_file, request, store_id="-1", auth_code="000"): json = futils.get_api_response( request, agent, "user/", cookie_file, "post", {}, { "action": "submit_store_cart", "data": { "paymentMode": params.get("payment_mode", ""), "currentPriceList": params.get("current_price_list", ""), "orderAmount": params.get("order_amount", ""), "pgResponse": params.get("pg_response", {}), "profileId": profile, "action": "Booked", "orderAmount": params.get("order_amount", ""), "storeId": store_id, "dateTime": str(datetime.datetime.now()), "bookAgentId": agent, "authCode": auth_code, "orderId": params.get("order_id", ""), }, }, ) return json
def get_order_by_user(profile_id, agent, cookie_file, request, startOrderIndex=0, numoforders=1, enableSecurity="false"): #get_user = users.get_user_by_login(login, agent, cookie_file, request) json = futils.get_api_response(request, agent, 'order/', cookie_file, 'get', {'startOrderIndex':startOrderIndex, 'profileId':profile_id, 'numberOfOrders':numoforders, 'enableSecurity':enableSecurity}) return json
def issue_coupon(email_id, agent, cookie_file, store, request): json = futils.get_api_response(request, agent, 'order/', cookie_file, 'post',{}, {'action':'ASSIGN_COUPON', 'data':{ 'login':email_id, 'store':store, } }) return json
def apply_coupon(agent,coupon_code, profile, cookie_file, request): json = futils.get_api_response(request, agent,'order/', cookie_file, 'post', {}, { 'action': 'APPLY_COUPON', 'data': { 'profileId': profile, 'couponCode': coupon_code } }) return json
def authenticate_user(login, password, agent, cookie_file, request): json = futils.get_api_response(request, agent, 'user/', cookie_file, 'post', {}, { 'action': 'login_pwd', 'data': { 'login': login, 'password': password } }) return json
def apply_order_discount(agent, discount_amount, profile, cookie_file, request, description=None): json = futils.get_api_response(request, agent,'order/', cookie_file, 'post', {}, { 'action': 'APPLY_ORDER_DISCOUNT', 'data': { "profileId": profile, "discountAmount": str(discount_amount), "discountDescription":"Applying Discount for Top10", } }) return json
def logoff(profile, agent, cookie_file, request): # logs off the current user json = futils.get_api_response(request, agent, 'user/', cookie_file, 'post', {}, { 'action': 'logout', 'data': { 'profileId': profile } }) return json
def authenticate_user(login, password, agent, cookie_file, request): json = futils.get_api_response( request, agent, "user/", cookie_file, "post", {}, {"action": "login_pwd", "data": {"login": login, "password": password}}, ) return json
def remove_from_cart(commerceItemId, productId, agent, profile, cookie_file, request): json = futils.get_api_response(request, agent,'order/', cookie_file, 'post', {}, { 'action': 'REMOVE_ITEM', 'data': { 'profileId': profile, 'skuId': commerceItemId, 'commerceItemId': commerceItemId, 'productId': productId, } }) return json
def add_to_cart(skuId, productId, quantity,agent,profile,cookie_file, request): json = futils.get_api_response(request, agent,'order/', cookie_file, 'post', {}, { 'action': 'ADD_TO_CART', 'data': { 'profileId': profile, 'skuId': skuId, 'productId': productId, 'quantity': quantity, } }) return json
def auth_order(orderId, agent, action, request, orderAmount, store_id = "-1", auth_code = '000'): json = futils.get_api_response(request, agent,'order/', '', 'post', {}, { 'action': "ORDER_MODIFY", 'data' : { 'action' : action, 'storeId' : store_id, 'orderId' : orderId, 'authCode' : auth_code, 'orderAmount' : orderAmount, 'conformAgentId' : agent, } }) return json
def create_user(phone, email, agent, cookie_file, request, password="******", confirm_password="******"): json = futils.get_api_response( request, agent, "user/", cookie_file, "post", {}, { "action": "create_user", "data": {"mobileNumber": phone, "email": email, "password": password, "confirmPassword": confirm_password}, }, ) return json
def create_user(phone, email, agent, cookie_file, request, password='******', confirm_password='******'): json = futils.get_api_response(request, agent, 'user/', cookie_file, 'post', {}, { 'action': 'create_user', 'data': { 'mobileNumber': phone, 'email': email, 'password': password, 'confirmPassword': confirm_password, } }) return json
def update_user(shipping_address, billing_address, agent, profile, cookie_file, request): json = futils.get_api_response( request, agent, "user/", cookie_file, "post", {}, { "action": "update_user", "data": { "profileId": profile, "shippingAddress": { "firstName": shipping_address["first_name"], "lastName": shipping_address["last_name"], "address1": shipping_address["address"], "city": shipping_address["city"], "state": shipping_address["state"], "country": shipping_address["country"], "postalCode": shipping_address["postal_code"], "phoneNumber": shipping_address["phone_number"], }, "billingAddress": { "firstName": billing_address["first_name"], "lastName": billing_address["last_name"], "address1": billing_address["address"], "city": billing_address["city"], "state": billing_address["state"], "country": billing_address["country"], "postalCode": billing_address["postal_code"], "phoneNumber": billing_address["phone_number"], }, }, }, ) return json
def get_user_by_email(email, agent, cookie_file, request): json = futils.get_api_response(request, agent, "user/", cookie_file, "get", {"phone": email}) return json
def get_user_by_login(login, agent, cookie_file, request): json = futils.get_api_response(request, agent, "user/", cookie_file, "get", {"phone": login}) return json
def get_user_by_mobile(mobile, agent, cookie_file, request): json = futils.get_api_response(request, agent, "user/", cookie_file, "get", {"phone": mobile}) return json
def get_user_by_login(login, agent, cookie_file, request): json = futils.get_api_response(request, agent, 'user/', cookie_file, 'get', {'phone': login}) return json
def get_user_by_email(email, agent, cookie_file, request): json = futils.get_api_response(request, agent, 'user/', cookie_file, 'get', {'phone': email}) return json
def logoff(profile, agent, cookie_file, request): # logs off the current user json = futils.get_api_response( request, agent, "user/", cookie_file, "post", {}, {"action": "logout", "data": {"profileId": profile}} ) return json
def get_order_by_orderid(order_id, agent, cookie_file, request, enableSecurity="false"): json = futils.get_api_response(request, agent, 'order/', cookie_file, 'get', {'orderId':order_id,"enableSecurity":enableSecurity}) return json
def get_cart(agent,cookie_file,mobile,profile, request): json = futils.get_api_response(request, agent,'order/', cookie_file , 'get', {'phone':mobile,'currentProfileId':profile}) return json
def get_user_by_mobile(mobile, agent, cookie_file, request): json = futils.get_api_response(request, agent, 'user/', cookie_file, 'get', {'phone': mobile}) return json