Subversion Repositories SmartDukaan

Rev

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

Rev 7092 Rev 7746
Line 3... Line 3...
3
@author: Varun Gupta
3
@author: Varun Gupta
4
'''
4
'''
5
 
5
 
6
from shop2020.model.v1.user.impl import PromotionDataAccessors
6
from shop2020.model.v1.user.impl import PromotionDataAccessors
7
from shop2020.model.v1.user.impl.Converters import to_t_coupon, \
7
from shop2020.model.v1.user.impl.Converters import to_t_coupon, \
8
    to_t_item_coupon_discount, to_t_voucher
8
    to_t_item_coupon_discount, to_t_voucher, to_t_promotion
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, get_coupon, apply_recharge_coupon, \
14
    mark_voucher_as_redeemed, create_coupon, get_coupon, apply_recharge_coupon, \
15
    get_active_gvs, delete_coupon, get_emi_discount, get_all_coupons_by_promotion_id
15
    get_active_gvs, delete_coupon, get_emi_discount, get_all_coupons_by_promotion_id, \
-
 
16
    get_all_promotions, remove_all_coupons_by_promotion_id
16
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import \
17
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import \
17
    get_coupon_usage_count_by_user
18
    get_coupon_usage_count_by_user
18
 
19
 
19
class PromotionServiceHandler:
20
class PromotionServiceHandler:
20
    
21
    
Line 34... Line 35...
34
        finally:
35
        finally:
35
            PromotionDataAccessors.close_session()
36
            PromotionDataAccessors.close_session()
36
    
37
    
37
    def getAllPromotions(self):
38
    def getAllPromotions(self):
38
        try:
39
        try:
-
 
40
            return [to_t_promotion(promotion) for promotion in get_all_promotions()]
39
            pass
41
        finally:
-
 
42
            PromotionDataAccessors.close_session()
-
 
43
    
-
 
44
    def removeAllCouponsByPromotionId(self, promotionId):
-
 
45
        try:
-
 
46
            return remove_all_coupons_by_promotion_id(promotionId)
40
        finally:
47
        finally:
41
            PromotionDataAccessors.close_session()
48
            PromotionDataAccessors.close_session()
42
 
49
 
43
    def getCoupon(self, coupon_code):
50
    def getCoupon(self, coupon_code):
44
        try:
51
        try: