Subversion Repositories SmartDukaan

Rev

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

Rev 6680 Rev 6688
Line 115... Line 115...
115
            if count_coupon_usage >= globalLimit:
115
            if count_coupon_usage >= globalLimit:
116
                return {0:'This promotion is over.'}
116
                return {0:'This promotion is over.'}
117
        
117
        
118
        if 'discountType' in args:
118
        if 'discountType' in args:
119
            discountType = args['discountType']
119
            discountType = args['discountType']
-
 
120
        else :
-
 
121
            discountType = 'absolute' #Default is absolute
-
 
122
            
120
            if discountType == 'percent' :
123
        if discountType == 'percent' :
121
                discount = round(total_amount * (args['discount']/float(100)))
124
            discount = round(total_amount * (args['discount']/float(100)))
122
            elif discountType == 'absolute' :
125
        elif discountType == 'absolute' :
123
                discount = min(args['discount'], total_amount)
126
            discount = min(args['discount'], total_amount)
124
            else :
127
        else :
125
                return {0 : 'Invalid coupon'}
128
            return {0 : 'Invalid coupon'}
126
        
129
        
127
        if 'maxDiscount' in args and discount > int(args['maxDiscount']):
130
        if 'maxDiscount' in args and discount > int(args['maxDiscount']):
128
            return {int(args['maxDiscount']):"Coupon Applied"}
131
            return {int(args['maxDiscount']):"Coupon Applied"}
129
        
132
        
130
        return {discount:'Coupon Applied'}
133
        return {discount:'Coupon Applied'}