Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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
Exemplo n.º 11
0
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
Exemplo n.º 12
0
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
Exemplo n.º 13
0
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
Exemplo n.º 14
0
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
Exemplo n.º 15
0
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
Exemplo n.º 16
0
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
Exemplo n.º 17
0
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
Exemplo n.º 18
0
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
Exemplo n.º 19
0
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
Exemplo n.º 20
0
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
Exemplo n.º 21
0
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
Exemplo n.º 22
0
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
Exemplo n.º 23
0
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
Exemplo n.º 24
0
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
Exemplo n.º 25
0
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
Exemplo n.º 26
0
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
Exemplo n.º 27
0
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