Subversion Repositories SmartDukaan

Rev

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

Rev 21006 Rev 21081
Line 248... Line 248...
248
    inventory_client = CatalogClient().get_client()
248
    inventory_client = CatalogClient().get_client()
249
    itemsMap = inventory_client.getItems(itemIds)
249
    itemsMap = inventory_client.getItems(itemIds)
250
    for lineObj in cart.lines:
250
    for lineObj in cart.lines:
251
        item = itemsMap.get(lineObj.item_id)
251
        item = itemsMap.get(lineObj.item_id)
252
        totalCartVal += lineObj.actual_price * lineObj.quantity
252
        totalCartVal += lineObj.actual_price * lineObj.quantity
253
        if item.category in [10006, 10010]:
253
        #if item.category in [10006, 10010]:
254
            totalQty += lineObj.quantity
254
        totalQty += lineObj.quantity
255
    txn = TTransaction()
255
    txn = TTransaction()
256
    txn.shoppingCartid = cart_id
256
    txn.shoppingCartid = cart_id
257
    txn.customer_id = userId
257
    txn.customer_id = userId
258
    txn.createdOn = to_java_date(datetime.datetime.now())
258
    txn.createdOn = to_java_date(datetime.datetime.now())
259
    txn.transactionStatus = TTransactionStatus.INIT
259
    txn.transactionStatus = TTransactionStatus.INIT
Line 384... Line 384...
384
    else:
384
    else:
385
        freebie_item_id = None if freebieId == 0 else freebieId  
385
        freebie_item_id = None if freebieId == 0 else freebieId  
386
    t_order.source = orderSource
386
    t_order.source = orderSource
387
    t_order.dataProtectionInsurer = dataProtectionInsurer
387
    t_order.dataProtectionInsurer = dataProtectionInsurer
388
    t_order.dataProtectionAmount = dataProtectionAmount
388
    t_order.dataProtectionAmount = dataProtectionAmount
389
    if item.category in [10006, 10010]:
389
    #if item.category in [10006, 10010]:
390
        t_order.shippingCost = perUnitShippingCost*t_line_item.quantity
390
    t_order.shippingCost = perUnitShippingCost*t_line_item.quantity
391
    else:
391
    #else:
392
        t_order.shippingCost = 0
392
    #    t_order.shippingCost = 0
393
    return t_order
393
    return t_order
394
        
394
        
395
def create_line_item(line, final_price, quantity=1, item=None):
395
def create_line_item(line, final_price, quantity=1, item=None):
396
    if item is None:
396
    if item is None:
397
        inventory_client = CatalogClient().get_client()
397
        inventory_client = CatalogClient().get_client()
Line 700... Line 700...
700
    logistics_client = LogisticsClient().get_client()
700
    logistics_client = LogisticsClient().get_client()
701
    if cart:
701
    if cart:
702
        itemIds = []
702
        itemIds = []
703
        for line in cart.lines:
703
        for line in cart.lines:
704
            itemIds.append(line.item_id)
704
            itemIds.append(line.item_id)
705
        catalog_client = CatalogClient().get_client()
705
#        catalog_client = CatalogClient().get_client()
706
        items = catalog_client.getItems(itemIds).values()
706
#        items = catalog_client.getItems(itemIds).values()
707
        for item in items:
707
#        for item in items:
708
            if item.category not in [10006, 10010]:
708
#            if item.category not in [10006, 10010]:
709
                return False
709
#                return False
710
    
710
    
711
        if cart.coupon_code:
711
        if cart.coupon_code:
712
            promotion_client = PromotionClient().get_client()
712
            promotion_client = PromotionClient().get_client()
713
            cod_option = promotion_client.isCodApplicable(to_t_cart(cart))
713
            cod_option = promotion_client.isCodApplicable(to_t_cart(cart))
714
        
714
        
Line 719... Line 719...
719
                    if not logistics_info.codAllowed:
719
                    if not logistics_info.codAllowed:
720
                        cod_option = False
720
                        cod_option = False
721
                        break
721
                        break
722
                except:
722
                except:
723
                    pass    
723
                    pass    
724
            if cart.total_price > 60000:# or cart.total_price <= 250:
724
            if cart.total_price > 150000:
725
                cod_option = False
725
                cod_option = False
726
    return cod_option
726
    return cod_option
727
 
727
 
728
def get_products_added_to_cart(startDate, endDate):
728
def get_products_added_to_cart(startDate, endDate):
729
    lines = session.query(Line.item_id).filter(Line.created_on > to_py_date(startDate)).filter(Line.created_on < to_py_date(endDate)).all()
729
    lines = session.query(Line.item_id).filter(Line.created_on > to_py_date(startDate)).filter(Line.created_on < to_py_date(endDate)).all()