Subversion Repositories SmartDukaan

Rev

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

Rev 12743 Rev 12893
Line 20... Line 20...
20
    OrderStatus, OrderSource
20
    OrderStatus, OrderSource
21
from shop2020.thriftpy.model.v1.user.ttypes import CartStatus, LineStatus, \
21
from shop2020.thriftpy.model.v1.user.ttypes import CartStatus, LineStatus, \
22
    ShoppingCartException, PromotionException, CartPlus
22
    ShoppingCartException, PromotionException, CartPlus
23
from shop2020.utils.Utils import to_py_date, to_java_date
23
from shop2020.utils.Utils import to_py_date, to_java_date
24
import datetime
24
import datetime
-
 
25
from shop2020.clients.InventoryClient import InventoryClient
25
 
26
 
26
 
27
 
27
 
28
 
28
 
29
 
29
def get_cart(userId):
30
def get_cart(userId):
Line 438... Line 439...
438
            except LogisticsServiceException:
439
            except LogisticsServiceException:
439
                item_delivery_estimate = -1
440
                item_delivery_estimate = -1
440
                #TODO Use the exception clause to set the retval appropriately
441
                #TODO Use the exception clause to set the retval appropriately
441
            except :
442
            except :
442
                item_delivery_estimate = -1
443
                item_delivery_estimate = -1
-
 
444
                
-
 
445
            if item_delivery_estimate !=-1:
-
 
446
                inv_client = InventoryClient().get_client()
-
 
447
                itemAvailability = None
-
 
448
                try:
-
 
449
                    itemAvailability = inv_client.getItemAvailabilityAtLocation(item_id, sourceId)
-
 
450
                except:
-
 
451
                    pass
-
 
452
                if itemAvailability is not None:
-
 
453
                    billingWarehouse = None
-
 
454
                    try:
-
 
455
                        billingWarehouse = inv_client.getWarehouse(itemAvailability.billingWarehouseId)
-
 
456
                    except:
-
 
457
                        pass
-
 
458
                    if billingWarehouse is not None:
-
 
459
                        if not logistics_client.isAlive() :
-
 
460
                            logistics_client = LogisticsClient().get_client()
-
 
461
                        try:
-
 
462
                            estimateVal = logistics_client.getFirstDeliveryEstimateForWhLocation(customer_pincode, billingWarehouse.logisticsLocation)
-
 
463
                            if estimateVal ==-1:
-
 
464
                                item_delivery_estimate =-1
-
 
465
                        except:
-
 
466
                            pass
443
            if old_estimate != item_delivery_estimate:
467
            if old_estimate != item_delivery_estimate:
444
                line.estimate = item_delivery_estimate
468
                line.estimate = item_delivery_estimate
445
                cart.updated_on = current_time
469
                cart.updated_on = current_time
446
        else:
470
        else:
447
            Discount.query.filter(Discount.line==line).delete()
471
            Discount.query.filter(Discount.line==line).delete()