| Line 163... |
Line 163... |
| 163 |
def get_logistics_estimation_with_type(self, itemId, destination_pin, type, pickUp=PickUpType.COURIER, stateId=-1):
|
163 |
def get_logistics_estimation_with_type(self, itemId, destination_pin, type, pickUp=PickUpType.COURIER, stateId=-1):
|
| 164 |
try:
|
164 |
try:
|
| 165 |
#Get the id and location of actual warehouse that'll be used to fulfil this order.
|
165 |
#Get the id and location of actual warehouse that'll be used to fulfil this order.
|
| 166 |
client = InventoryClient().get_client()
|
166 |
client = InventoryClient().get_client()
|
| 167 |
fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability, weight = client.getItemAvailabilityAtLocation(itemId, self.sourceId, stateId)
|
167 |
fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability, weight = client.getItemAvailabilityAtLocation(itemId, self.sourceId, stateId)
|
| 168 |
#We assume that if totalAvailability 0 then its the case of hotspot billing where itemAvailabilityCache is sort of bypassed
|
- |
|
| 169 |
if totalAvailability <= 0:
|
168 |
if totalAvailability <= 0:
|
| 170 |
expected_delay = 0
|
169 |
expected_delay = 0
|
| 171 |
|
170 |
|
| 172 |
except Exception as ex:
|
171 |
except Exception as ex:
|
| 173 |
raise LogisticsServiceException(103, "Unable to fetch inventory information about this item.")
|
172 |
raise LogisticsServiceException(103, "Unable to fetch inventory information about this item.")
|
| Line 177... |
Line 176... |
| 177 |
else:
|
176 |
else:
|
| 178 |
delivery_estimate = _DeliveryEstimateObject(0, 0, get_provider_for_pickup_type(pickUp), False, False)
|
177 |
delivery_estimate = _DeliveryEstimateObject(0, 0, get_provider_for_pickup_type(pickUp), False, False)
|
| 179 |
if delivery_estimate is None:
|
178 |
if delivery_estimate is None:
|
| 180 |
raise LogisticsServiceException(104, "Unable to fetch delivery estimate for this pincode.")
|
179 |
raise LogisticsServiceException(104, "Unable to fetch delivery estimate for this pincode.")
|
| 181 |
|
180 |
|
| - |
|
181 |
if stateId != -1:
|
| - |
|
182 |
if destination_pin in [132001,136027,132114,131001,132103]:
|
| - |
|
183 |
delivery_estimate.provider_id = 48
|
| 182 |
|
184 |
|
| 183 |
## Commented below part as we have only Delhi as warehouse city. If we will add some more warehouses in different cities, this could be useful.
|
185 |
## Commented below part as we have only Delhi as warehouse city. If we will add some more warehouses in different cities, this could be useful.
|
| 184 |
# We are revising the estimates based on the actual warehouse that this order will be assigned to.
|
186 |
# We are revising the estimates based on the actual warehouse that this order will be assigned to.
|
| 185 |
# This warehouse may be located in a zone which is different from the one we allocated for this pincode.
|
187 |
# This warehouse may be located in a zone which is different from the one we allocated for this pincode.
|
| 186 |
#delivery_estimate = get_logistics_estimation(destination_pin, item.sellingPrice, warehouse_loc, type)
|
188 |
#delivery_estimate = get_logistics_estimation(destination_pin, item.sellingPrice, warehouse_loc, type)
|