| Line 25... |
Line 25... |
| 25 |
|
25 |
|
| 26 |
def __init__(self, dbname='logistics', db_hostname='localhost'):
|
26 |
def __init__(self, dbname='logistics', db_hostname='localhost'):
|
| 27 |
initialize(dbname, db_hostname)
|
27 |
initialize(dbname, db_hostname)
|
| 28 |
try:
|
28 |
try:
|
| 29 |
config_client = ConfigClient()
|
29 |
config_client = ConfigClient()
|
| - |
|
30 |
self.sourceId = int(config_client.get_property("sourceid"))
|
| 30 |
self.cutoff_time = int(config_client.get_property('delivery_cutoff_time'))
|
31 |
self.cutoff_time = int(config_client.get_property('delivery_cutoff_time'))
|
| 31 |
self.cod_cutoff_time = 24 #int(config_client.get_property('delivery_cutoff_time'))
|
32 |
self.cod_cutoff_time = 24 #int(config_client.get_property('delivery_cutoff_time'))
|
| 32 |
self.default_pincode = int(config_client.get_property('default_pincode'))
|
33 |
self.default_pincode = int(config_client.get_property('default_pincode'))
|
| 33 |
except Exception as ex:
|
34 |
except Exception as ex:
|
| 34 |
print "[ERROR] Unexpected config error:", sys.exc_info()[0]
|
35 |
print "[ERROR] Unexpected config error:", sys.exc_info()[0]
|
| - |
|
36 |
self.sourceId = 1
|
| 35 |
self.cutoff_time = 15
|
37 |
self.cutoff_time = 15
|
| 36 |
self.cod_cutoff_time = 24
|
38 |
self.cod_cutoff_time = 24
|
| 37 |
self.default_pincode = "110001"
|
39 |
self.default_pincode = "110001"
|
| - |
|
40 |
|
| 38 |
|
41 |
|
| 39 |
def getProvider(self, providerId):
|
42 |
def getProvider(self, providerId):
|
| 40 |
"""
|
43 |
"""
|
| 41 |
Returns a provider for a given provider ID. Throws an exception if none found.
|
44 |
Returns a provider for a given provider ID. Throws an exception if none found.
|
| 42 |
|
45 |
|
| Line 117... |
Line 120... |
| 117 |
|
120 |
|
| 118 |
def get_logistics_estimation_with_type(self, itemId, destination_pin, type):
|
121 |
def get_logistics_estimation_with_type(self, itemId, destination_pin, type):
|
| 119 |
try:
|
122 |
try:
|
| 120 |
#Get the id and location of actual warehouse that'll be used to fulfil this order.
|
123 |
#Get the id and location of actual warehouse that'll be used to fulfil this order.
|
| 121 |
client = InventoryClient().get_client()
|
124 |
client = InventoryClient().get_client()
|
| 122 |
fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability = client.getItemAvailabilityAtLocation(itemId)
|
125 |
fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability = client.getItemAvailabilityAtLocation(itemId, sourceId)
|
| 123 |
except Exception as ex:
|
126 |
except Exception as ex:
|
| 124 |
raise LogisticsServiceException(103, "Unable to fetch inventory information about this item.")
|
127 |
raise LogisticsServiceException(103, "Unable to fetch inventory information about this item.")
|
| 125 |
|
128 |
|
| 126 |
delivery_estimate = get_logistics_estimation(destination_pin, sellingPrice, type)
|
129 |
delivery_estimate = get_logistics_estimation(destination_pin, sellingPrice, type)
|
| 127 |
if delivery_estimate is None:
|
130 |
if delivery_estimate is None:
|