Subversion Repositories SmartDukaan

Rev

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

Rev 6355 Rev 6367
Line 38... Line 38...
38
    coupon.coupon_code = coupon_code
38
    coupon.coupon_code = coupon_code
39
    coupon.arguments = ""
39
    coupon.arguments = ""
40
    session.commit()
40
    session.commit()
41
 
41
 
42
def create_coupon(promotionId, endOn, email, amount, isCod, usage):
42
def create_coupon(promotionId, endOn, email, amount, isCod, usage):
43
    if promotionId not in (16,26):
43
    if promotionId not in (26,27):
44
        raise PromotionException(101, 'Only promotion ids 16 and 26 are expected')
44
        raise PromotionException(101, 'Only promotion ids 26 and 27 are expected')
45
    promotion = Promotion.get_by(id = promotionId)
45
    promotion = Promotion.get_by(id = promotionId)
46
    if promotion:     
46
    if promotion:     
47
        coupon_code = uuid.uuid4().hex[:10]
47
        coupon_code = uuid.uuid4().hex[:10]
48
        coupon = Coupon.get_by(coupon_code = coupon_code)
48
        coupon = Coupon.get_by(coupon_code = coupon_code)
49
        while coupon is not None:
49
        while coupon is not None: