| Line 126... |
Line 126... |
| 126 |
client = InventoryClient().get_client()
|
126 |
client = InventoryClient().get_client()
|
| 127 |
fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability = client.getItemAvailabilityAtLocation(itemId, self.sourceId)
|
127 |
fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability = client.getItemAvailabilityAtLocation(itemId, self.sourceId)
|
| 128 |
except Exception as ex:
|
128 |
except Exception as ex:
|
| 129 |
raise LogisticsServiceException(103, "Unable to fetch inventory information about this item.")
|
129 |
raise LogisticsServiceException(103, "Unable to fetch inventory information about this item.")
|
| 130 |
|
130 |
|
| 131 |
delivery_estimate = get_logistics_estimation(destination_pin, sellingPrice, type)
|
131 |
delivery_estimate = get_logistics_estimation(destination_pin, sellingPrice)
|
| 132 |
if delivery_estimate is None:
|
132 |
if delivery_estimate is None:
|
| 133 |
raise LogisticsServiceException(104, "Unable to fetch delivery estimate for this pincode.")
|
133 |
raise LogisticsServiceException(104, "Unable to fetch delivery estimate for this pincode.")
|
| 134 |
|
134 |
|
| 135 |
|
135 |
|
| 136 |
## 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.
|
136 |
## 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.
|
| Line 160... |
Line 160... |
| 160 |
shipping_delay = shipping_delay + 24
|
160 |
shipping_delay = shipping_delay + 24
|
| 161 |
|
161 |
|
| 162 |
#In case of COD,increase delay by one more day
|
162 |
#In case of COD,increase delay by one more day
|
| 163 |
if type == DeliveryType.COD:
|
163 |
if type == DeliveryType.COD:
|
| 164 |
shipping_delay = shipping_delay + 24
|
164 |
shipping_delay = shipping_delay + 24
|
| - |
|
165 |
delivery_estimate.otgAvailable = False
|
| 165 |
|
166 |
|
| 166 |
delivery_time = delivery_time + shipping_delay
|
167 |
delivery_time = delivery_time + shipping_delay
|
| 167 |
|
168 |
|
| 168 |
shipping_delay = int(math.ceil(shipping_delay/24.0))
|
169 |
shipping_delay = int(math.ceil(shipping_delay/24.0))
|
| 169 |
delivery_time = int(math.ceil(delivery_time/24.0))
|
170 |
delivery_time = int(math.ceil(delivery_time/24.0))
|
| Line 173... |
Line 174... |
| 173 |
logistics_info.providerId = delivery_estimate.provider_id
|
174 |
logistics_info.providerId = delivery_estimate.provider_id
|
| 174 |
logistics_info.warehouseId = billingWarehouseId
|
175 |
logistics_info.warehouseId = billingWarehouseId
|
| 175 |
logistics_info.fulfilmentWarehouseId = fulfilmentWarehouseId
|
176 |
logistics_info.fulfilmentWarehouseId = fulfilmentWarehouseId
|
| 176 |
logistics_info.shippingTime = shipping_delay
|
177 |
logistics_info.shippingTime = shipping_delay
|
| 177 |
logistics_info.codAllowed = delivery_estimate.codAllowed
|
178 |
logistics_info.codAllowed = delivery_estimate.codAllowed
|
| - |
|
179 |
logistics_info.otgAvailable = delivery_estimate.otgAvailable
|
| 178 |
|
180 |
|
| 179 |
try:
|
181 |
try:
|
| 180 |
return logistics_info
|
182 |
return logistics_info
|
| 181 |
finally:
|
183 |
finally:
|
| 182 |
close_session()
|
184 |
close_session()
|
| Line 317... |
Line 319... |
| 317 |
try:
|
319 |
try:
|
| 318 |
storeToReturn = to_t_pickup_store(get_pickup_store_by_hotspot_id(hotspotId))
|
320 |
storeToReturn = to_t_pickup_store(get_pickup_store_by_hotspot_id(hotspotId))
|
| 319 |
return storeToReturn
|
321 |
return storeToReturn
|
| 320 |
finally:
|
322 |
finally:
|
| 321 |
close_session()
|
323 |
close_session()
|
| 322 |
def addPincode(self, providerId, pincode, destCode, exp, cod, stationType):
|
324 |
def addPincode(self, providerId, pincode, destCode, exp, cod, stationType, otgAvailable):
|
| 323 |
try:
|
325 |
try:
|
| 324 |
add_pincode(providerId, pincode, destCode, exp, cod, stationType)
|
326 |
add_pincode(providerId, pincode, destCode, exp, cod, stationType, otgAvailable)
|
| 325 |
finally:
|
327 |
finally:
|
| 326 |
close_session()
|
328 |
close_session()
|
| 327 |
def updatePincode(self, providerId, pincode, exp, cod):
|
329 |
def updatePincode(self, providerId, pincode, exp, cod, otgAvailable):
|
| 328 |
try:
|
330 |
try:
|
| 329 |
update_pincode(providerId, pincode, exp, cod)
|
331 |
update_pincode(providerId, pincode, exp, cod, otgAvailable)
|
| 330 |
finally:
|
332 |
finally:
|
| 331 |
close_session()
|
333 |
close_session()
|
| 332 |
|
334 |
|