Subversion Repositories SmartDukaan

Rev

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

Rev 6250 Rev 6301
Line 9... Line 9...
9
from shop2020.model.v1.user.impl.PromotionDataAccessors import initialize, \
9
from shop2020.model.v1.user.impl.PromotionDataAccessors import initialize, \
10
    create_promotion, generate_coupons_for_promotion, apply_coupon, \
10
    create_promotion, generate_coupons_for_promotion, apply_coupon, \
11
    track_coupon_usage, is_alive, get_active_coupons, \
11
    track_coupon_usage, is_alive, get_active_coupons, \
12
    get_successful_payment_count_for_coupon, get_rule_doc_string, \
12
    get_successful_payment_count_for_coupon, get_rule_doc_string, \
13
    get_item_discount_map, get_discounts_for_entity, add_voucher, assign_voucher, \
13
    get_item_discount_map, get_discounts_for_entity, add_voucher, assign_voucher, \
14
    mark_voucher_as_redeemed, create_coupon
14
    mark_voucher_as_redeemed, create_coupon, get_coupon
15
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import \
15
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import \
16
    get_coupon_usage_count_by_user
16
    get_coupon_usage_count_by_user
17
 
17
 
18
class PromotionServiceHandler:
18
class PromotionServiceHandler:
19
    
19
    
Line 36... Line 36...
36
    def getAllPromotions(self):
36
    def getAllPromotions(self):
37
        try:
37
        try:
38
            pass
38
            pass
39
        finally:
39
        finally:
40
            PromotionDataAccessors.close_session()
40
            PromotionDataAccessors.close_session()
-
 
41
 
-
 
42
    def getCoupon(self, coupon_code):
-
 
43
        try:
-
 
44
            return to_t_coupon(get_coupon(coupon_code))
-
 
45
        finally:
-
 
46
            PromotionDataAccessors.close_session()
-
 
47
    
-
 
48
    def isGiftVoucher(self, coupon_code):
-
 
49
        try:
-
 
50
            return get_coupon(coupon_code).promotion.id == 26
-
 
51
        finally:
-
 
52
            PromotionDataAccessors.close_session()
41
    
53
    
42
    def getPromotionById(self, promotionId):
54
    def getPromotionById(self, promotionId):
43
        '''
55
        '''
44
        Parameters:
56
        Parameters:
45
        - promotionId
57
        - promotionId