| Line 244... |
Line 244... |
| 244 |
except Exception as ex:
|
244 |
except Exception as ex:
|
| 245 |
print ex
|
245 |
print ex
|
| 246 |
raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
|
246 |
raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
|
| 247 |
|
247 |
|
| 248 |
def __get_logistics_provider_for_destination_pincode(destination_pin, item_selling_price, weight, type, billingWarehouseId):
|
248 |
def __get_logistics_provider_for_destination_pincode(destination_pin, item_selling_price, weight, type, billingWarehouseId):
|
| 249 |
#As of now we are dealing with Aramex and Bluedart. i.e. 1 and 2 and we have just one location i.e. gurgaon will generailise this
|
249 |
#As of now we are dealing with Aramex and RQucikExpress. i.e. 2 and 47 and we have just one location i.e. gurgaon will generailise this
|
| 250 |
#Once bandwidth is available these things will be derived through improved logic.
|
250 |
#Once bandwidth is available these things will be derived through improved logic.
|
| 251 |
#As of now otg is set to False
|
251 |
#As of now otg is set to False, Use rquick if it is serviceable else use aramex
|
| 252 |
otg=False
|
252 |
otg=False
|
| - |
|
253 |
PRIMARY_PROVIDER = 47
|
| - |
|
254 |
SECONDARY_PROVIDER = 2
|
| 253 |
aramexServiceable = serviceable_location_cache.has_key(2) and serviceable_location_cache.get(2).has_key(destination_pin)
|
255 |
aramexServiceable = serviceable_location_cache.has_key(SECONDARY_PROVIDER) and serviceable_location_cache.get(SECONDARY_PROVIDER).has_key(destination_pin)
|
| 254 |
blueDartServiceable = serviceable_location_cache.has_key(1) and serviceable_location_cache.get(1).has_key(destination_pin)
|
256 |
rquickServiceable = serviceable_location_cache.has_key(PRIMARY_PROVIDER) and serviceable_location_cache.get(PRIMARY_PROVIDER).has_key(destination_pin)
|
| 255 |
|
257 |
|
| 256 |
#blueDartServiceable = False
|
258 |
#blueDartServiceable = False
|
| 257 |
if blueDartServiceable and aramexServiceable:
|
259 |
if rquickServiceable and aramexServiceable:
|
| 258 |
state = __getStateByPin(destination_pin)
|
- |
|
| 259 |
if state is None:
|
- |
|
| 260 |
state = 'DELHI'
|
- |
|
| 261 |
#Prioritise Bluedart in Gujarat and Rajasthan
|
- |
|
| 262 |
if state in ['GUJARAT', 'RAJASTHAN']:
|
- |
|
| 263 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(1).get(destination_pin)
|
260 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(PRIMARY_PROVIDER).get(destination_pin)
|
| 264 |
if item_selling_price <= providerPrepaidLimit:
|
261 |
if item_selling_price <= providerPrepaidLimit:
|
| 265 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
262 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
| 266 |
if iscod:
|
263 |
if iscod:
|
| 267 |
return 1, True, otg
|
264 |
return PRIMARY_PROVIDER, True, otg
|
| 268 |
else:
|
265 |
else:
|
| 269 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(2).get(destination_pin)
|
266 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(SECONDARY_PROVIDER).get(destination_pin)
|
| 270 |
if item_selling_price <= providerPrepaidLimit:
|
267 |
if item_selling_price <= providerPrepaidLimit:
|
| 271 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
268 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
| 272 |
if iscod:
|
269 |
if iscod:
|
| 273 |
return 2, True, otg
|
270 |
return SECONDARY_PROVIDER, True, otg
|
| 274 |
else:
|
271 |
else:
|
| 275 |
return 1, False, otg
|
272 |
return PRIMARY_PROVIDER, False, otg
|
| 276 |
else:
|
273 |
else:
|
| 277 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(2).get(destination_pin)
|
274 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(SECONDARY_PROVIDER).get(destination_pin)
|
| 278 |
if item_selling_price <= providerPrepaidLimit:
|
275 |
if item_selling_price <= providerPrepaidLimit:
|
| 279 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
276 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
| 280 |
if iscod:
|
- |
|
| 281 |
return 2, True, otg
|
- |
|
| 282 |
else:
|
- |
|
| 283 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(1).get(destination_pin)
|
- |
|
| 284 |
if item_selling_price <= providerPrepaidLimit:
|
- |
|
| 285 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
- |
|
| 286 |
if iscod:
|
- |
|
| 287 |
return 1, True, otg
|
- |
|
| 288 |
else:
|
- |
|
| 289 |
return 2, False, otg
|
277 |
return SECONDARY_PROVIDER, iscod, otg
|
| 290 |
|
278 |
|
| 291 |
else:
|
279 |
else:
|
| 292 |
if blueDartServiceable:
|
280 |
if rquickServiceable:
|
| 293 |
provider=1
|
281 |
provider=PRIMARY_PROVIDER
|
| 294 |
elif aramexServiceable:
|
282 |
elif aramexServiceable:
|
| 295 |
provider=2
|
283 |
provider=SECONDARY_PROVIDER
|
| 296 |
else:
|
284 |
else:
|
| 297 |
provider = None
|
285 |
provider = None
|
| 298 |
|
286 |
|
| 299 |
if provider:
|
287 |
if provider:
|
| 300 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(provider).get(destination_pin)
|
288 |
dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(provider).get(destination_pin)
|
| 301 |
if item_selling_price <= providerPrepaidLimit:
|
289 |
if item_selling_price <= providerPrepaidLimit:
|
| 302 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
290 |
iscod = iscod and item_selling_price <= websiteCodLimit
|
| 303 |
return provider, iscod, otg
|
291 |
return provider, iscod, otg
|