Subversion Repositories SmartDukaan

Rev

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

Rev 11741 Rev 11819
Line 61... Line 61...
61
            isGiftVoucher = promotion_type == 1
61
            isGiftVoucher = promotion_type == 1
62
        finally:
62
        finally:
63
            PromotionDataAccessors.close_session()
63
            PromotionDataAccessors.close_session()
64
            return isGiftVoucher
64
            return isGiftVoucher
65
    
65
    
66
    def isCodApplicable(self, cart):
66
    def isCodApplicable(self, coupon_code):
67
        isCod = True
67
        isCod = True
68
        coupon_code = cart.coupon_code
-
 
69
        try:
68
        try:
70
            coupon = get_coupon(coupon_code)
69
            coupon = get_coupon(coupon_code)
71
            if coupon.arguments:
70
            if coupon.arguments:
72
                args = eval(coupon.arguments)
71
                args = eval(coupon.arguments)
73
                if 'isCod' in args:
72
                if 'isCod' in args:
Line 78... Line 77...
78
                    itemIds = []
77
                    itemIds = []
79
                    [itemIds.append(line.itemId) for line in cart.lines]
78
                    [itemIds.append(line.itemId) for line in cart.lines]
80
                    catalog_client = CatalogClient().get_client()
79
                    catalog_client = CatalogClient().get_client()
81
                    privateDeals= catalog_client.getAllActivePrivateDeals(itemIds,0)
80
                    privateDeals= catalog_client.getAllActivePrivateDeals(itemIds,0)
82
                    for privateDeal in privateDeals.values():
81
                    for privateDeal in privateDeals.values():
-
 
82
                        print `privateDeal.isCod`
83
                        if not privateDeal.isCod:
83
                        if not privateDeal.isCod:
84
                            return False
84
                            return False
85
        finally:
85
        finally:
86
            PromotionDataAccessors.close_session()
86
            PromotionDataAccessors.close_session()
87
            return isCod
87
            return isCod