Subversion Repositories SmartDukaan

Rev

Rev 20275 | Rev 20724 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20275 Rev 20641
Line 235... Line 235...
235
    except Exception as ex:
235
    except Exception as ex:
236
        print ex
236
        print ex
237
        raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
237
        raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
238
 
238
 
239
def __get_logistics_provider_for_destination_pincode(destination_pin, item_selling_price, weight, type, billingWarehouseId):
239
def __get_logistics_provider_for_destination_pincode(destination_pin, item_selling_price, weight, type, billingWarehouseId):
-
 
240
    #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 
-
 
241
    #Once bandwidth is available these things will be derived through improved logic.
-
 
242
    #As of now otg is set to False
-
 
243
    otg=False
-
 
244
    prepaidProvider=None
-
 
245
    if serviceable_location_cache.has_key(2) and serviceable_location_cache.get(2).has_key(destination_pin):
-
 
246
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(2).get(destination_pin)
-
 
247
        if item_selling_price <= providerPrepaidLimit:
-
 
248
            iscod = iscod and item_selling_price <= websiteCodLimit
-
 
249
            if iscod:
-
 
250
                return 2, True, otg
-
 
251
        prepaidProvider=2
-
 
252
    if serviceable_location_cache.has_key(1) and serviceable_location_cache.get(1).has_key(destination_pin):
-
 
253
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(1).get(destination_pin)
-
 
254
        if item_selling_price <= providerPrepaidLimit:
-
 
255
            iscod = iscod and item_selling_price <= websiteCodLimit
-
 
256
            if iscod:
-
 
257
                return 1, True, otg
-
 
258
        if prepaidProvider is None:
-
 
259
            prepaidProvider=1
-
 
260
            
-
 
261
    if prepaidProvider:
-
 
262
        return prepaidProvider, False, otg 
-
 
263
    
-
 
264
    return None, False, False
-
 
265
 
-
 
266
def __get_logistics_provider_for_destination_pincode_old(destination_pin, item_selling_price, weight, type, billingWarehouseId):
240
    '''
267
    '''
241
    if serviceable_location_cache.get(6).has_key(destination_pin):
268
    if serviceable_location_cache.get(6).has_key(destination_pin):
242
        if weight < 480 and serviceable_location_cache.get(3).has_key(destination_pin) and type == DeliveryType.PREPAID:
269
        if weight < 480 and serviceable_location_cache.get(3).has_key(destination_pin) and type == DeliveryType.PREPAID:
243
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(3).get(destination_pin)
270
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(3).get(destination_pin)
244
            if item_selling_price <= providerPrepaidLimit:
271
            if item_selling_price <= providerPrepaidLimit:
Line 249... Line 276...
249
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(6).get(destination_pin)
276
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(6).get(destination_pin)
250
            if item_selling_price <= providerPrepaidLimit:
277
            if item_selling_price <= providerPrepaidLimit:
251
                iscod = iscod and item_selling_price <= websiteCodLimit
278
                iscod = iscod and item_selling_price <= websiteCodLimit
252
                otgAvailable = otgAvailable and item_selling_price >= 2000
279
                otgAvailable = otgAvailable and item_selling_price >= 2000
253
                return 6, iscod, otgAvailable
280
                return 6, iscod, otgAvailable
254
    '''
281
    '''        
-
 
282
    if serviceable_location_cache.has_key(3) and serviceable_location_cache.get(3).has_key(destination_pin):
-
 
283
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(3).get(destination_pin)
255
    ''' lets give opportunity to provider who is cod serviceable
284
        if item_selling_price <= providerPrepaidLimit:
-
 
285
            iscod = iscod and item_selling_price <= websiteCodLimit
-
 
286
            otgAvailable = otgAvailable and item_selling_price >= 2000
256
    '''
287
            return 3, iscod, otgAvailable
257
        
288
        
258
    if billingWarehouseId not in [12,13] and serviceable_location_cache.has_key(7) and serviceable_location_cache.get(7).has_key(destination_pin):
289
    if billingWarehouseId not in [12,13] and serviceable_location_cache.has_key(7) and serviceable_location_cache.get(7).has_key(destination_pin):
259
        if item_selling_price < 3000 and serviceable_location_cache.has_key(1) and serviceable_location_cache.get(1).has_key(destination_pin):
290
        if item_selling_price < 3000 and serviceable_location_cache.has_key(1) and serviceable_location_cache.get(1).has_key(destination_pin):
260
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(1).get(destination_pin)
291
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit, providerCodLimit = serviceable_location_cache.get(1).get(destination_pin)
261
            if item_selling_price <= providerPrepaidLimit:
292
            if item_selling_price <= providerPrepaidLimit: