Subversion Repositories SmartDukaan

Rev

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

Rev 6301 Rev 6355
Line 44... Line 44...
44
            return to_t_coupon(get_coupon(coupon_code))
44
            return to_t_coupon(get_coupon(coupon_code))
45
        finally:
45
        finally:
46
            PromotionDataAccessors.close_session()
46
            PromotionDataAccessors.close_session()
47
    
47
    
48
    def isGiftVoucher(self, coupon_code):
48
    def isGiftVoucher(self, coupon_code):
-
 
49
        isGiftVoucher = False
49
        try:
50
        try:
50
            return get_coupon(coupon_code).promotion.id == 26
51
            isGiftVoucher = get_coupon(coupon_code).promotion.id == 26
51
        finally:
52
        finally:
52
            PromotionDataAccessors.close_session()
53
            PromotionDataAccessors.close_session()
-
 
54
            return isGiftVoucher
-
 
55
    
-
 
56
    def isCodApplicable(self, coupon_code):
-
 
57
        isCod = True
-
 
58
        try:
-
 
59
            coupon = get_coupon(coupon_code)
-
 
60
            if coupon.arguments:
-
 
61
                args = eval(coupon.arguments)
-
 
62
                if 'isCod' in args:
-
 
63
                    isCod = args['isCod']
-
 
64
        finally:
-
 
65
            PromotionDataAccessors.close_session()
-
 
66
            return isCod
53
    
67
    
54
    def getPromotionById(self, promotionId):
68
    def getPromotionById(self, promotionId):
55
        '''
69
        '''
56
        Parameters:
70
        Parameters:
57
        - promotionId
71
        - promotionId
Line 70... Line 84...
70
        try:
84
        try:
71
            generate_coupons_for_promotion(promotionId, couponCode)
85
            generate_coupons_for_promotion(promotionId, couponCode)
72
        finally:
86
        finally:
73
            PromotionDataAccessors.close_session()
87
            PromotionDataAccessors.close_session()
74
    
88
    
75
    def createCoupon(self, promotionId, endOn, email, amount, usage):
89
    def createCoupon(self, promotionId, endOn, email, amount, isCod, usage):
76
        '''
90
        '''
77
        Parameters:
91
        Parameters:
78
        - promotionId
92
        - promotionId
79
        - couponCode
93
        - couponCode
80
        '''
94
        '''
81
        try:
95
        try:
82
            return create_coupon(promotionId, endOn, email, amount, usage)
96
            return create_coupon(promotionId, endOn, email, amount, isCod, usage)
83
        finally:
97
        finally:
84
            PromotionDataAccessors.close_session()
98
            PromotionDataAccessors.close_session()
85
    
99
    
86
    def applyCoupon(self, couponCode, cartId):
100
    def applyCoupon(self, couponCode, cartId):
87
        '''
101
        '''