Subversion Repositories SmartDukaan

Rev

Rev 4439 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

'''
Created on 13-Sep-2010

@author: rajveer
'''

from shop2020.clients.LogisticsClient import LogisticsClient
from shop2020.thriftpy.logistics.ttypes import *
import datetime
from shop2020.logistics.service.impl.DataService import DeliveryEstimate


client = LogisticsClient().get_client()

"""
now = datetime.datetime.now()
test = now.hour
print test, now.hour
itemlogistics = client.getLogisticsEstimation(1, "332301")
print itemlogistics.warehouseId
print itemlogistics.availability
print itemlogistics.shippingTime
"""


"""
The following test cases are to test if correct provider is being returned. For a destination pincode and a warehouse,
the provider mapping is defined in PyProj/src/samplesheets/Courier_Logic.xls
To check the output make modifications in the following function to print provider on the console.
PyProj/src/shop2020/logistics/service/impl/DataAccessor/get_logistics_estimation
"""

# Item = 14 (<5000) Pincode = 125005 (Non-Local) serviced by Both, Provider = 1
# Item = 02 (>5000) Pincode = 125005 (Non-Local) serviced by Both, Provider = 1
# Item = 19 (=5000) Pincode = 123106 (Non-Local) serviced by AFL,  Provider = 2
# Item = 01 (>5000) Pincode = 123106 (Non-Local) serviced by AFL,  Provider = 2
# Item = 14 (<5000) Pincode = 834011 (Non-Local) serviced by AFL,  Provider = 2
# Item = 14 (<5000) Pincode = 854305 (Non-Local) serviced by BlueDart,  Provider = 1
# Item = 01 (>5000) Pincode = 854305 (Non-Local) serviced by BlueDart,  Provider = 1

# Item = 03 (>5000) Pincode = 201301 (Local) serviced by Both, Provider = 1
# Item = 15 (<5000) Pincode = 201301 (Local) serviced by Both, Provider = 2
# Item = 04 (>5000) Pincode = 201307 (Local) serviced by Both,  Provider = 1
# Item = 19 (=5000) Pincode = 201307 (Local) serviced by Both,  Provider = 2


print client.getLogisticsEstimation(14, "201301", DeliveryType.PREPAID) #Provider = 1
print client.getLogisticsEstimation(15, "201301", DeliveryType.PREPAID) #Provider = 1
print client.isCodAllowed("201301")
print client.isCodAllowed("3")
print client.getDestinationCode(1, "201301")
print client.getDestinationCode(1, "332001")

#client.getLogisticsEstimation(02, "125005") #Provider = 1
#client.getLogisticsEstimation(19, "123106") #Provider = 2
#client.getLogisticsEstimation(01, "123106") #Provider = 2
#client.getLogisticsEstimation(14, "834011") #Provider = 2
#client.getLogisticsEstimation(14, "854305") #Provider = 1
#client.getLogisticsEstimation(1, "854305") #Provider = 1
#
#client.getLogisticsEstimation(03, "201301") #Provider = 1
#client.getLogisticsEstimation(15, "201301") #Provider = 2
#client.getLogisticsEstimation(04, "201307") #Provider = 1
#client.getLogisticsEstimation(19, "201307") #Provider = 2