Subversion Repositories SmartDukaan

Rev

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

Rev 4189 Rev 4494
Line 4... Line 4...
4
'''
4
'''
5
 
5
 
6
from shop2020.model.v1.user.impl.PromotionDataAccessors import initialize, create_promotion,\
6
from shop2020.model.v1.user.impl.PromotionDataAccessors import initialize, create_promotion,\
7
    generate_coupons_for_promotion, apply_coupon, track_coupon_usage, is_alive,\
7
    generate_coupons_for_promotion, apply_coupon, track_coupon_usage, is_alive,\
8
    get_active_coupons, get_successful_payment_count_for_coupon, get_rule_doc_string, \
8
    get_active_coupons, get_successful_payment_count_for_coupon, get_rule_doc_string, \
9
    get_item_discount_map
9
    get_item_discount_map, get_discounts_for_entity
10
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count_by_user
10
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import get_coupon_usage_count_by_user
11
from shop2020.model.v1.user.impl import PromotionDataAccessors
11
from shop2020.model.v1.user.impl import PromotionDataAccessors
12
from shop2020.model.v1.user.impl.Converters import to_t_coupon, to_t_item_coupon_discount
12
from shop2020.model.v1.user.impl.Converters import to_t_coupon, to_t_item_coupon_discount
13
 
13
 
14
class PromotionServiceHandler:
14
class PromotionServiceHandler:
Line 130... Line 130...
130
        '''
130
        '''
131
        try:
131
        try:
132
            return [to_t_item_coupon_discount(item_coupon_discount) for item_coupon_discount in get_item_discount_map(itemIds)]
132
            return [to_t_item_coupon_discount(item_coupon_discount) for item_coupon_discount in get_item_discount_map(itemIds)]
133
        finally:
133
        finally:
134
            PromotionDataAccessors.close_session()
134
            PromotionDataAccessors.close_session()
-
 
135
    
-
 
136
    def getDiscountsForEntity(self, entityId):
-
 
137
        '''
-
 
138
        Returns the tuple containing discount coupon and discount value applicable for this entity
135
        
139
        
-
 
140
        Parameters:
-
 
141
         - entityId
-
 
142
        '''
-
 
143
        try:
-
 
144
            return get_discounts_for_entity(entityId)
-
 
145
        finally:
-
 
146
            PromotionDataAccessors.close_session()
-
 
147
    
136
    def isAlive(self):
148
    def isAlive(self):
137
        """
149
        """
138
        For checking weather service is active alive or not. It also checks connectivity with database
150
        For checking weather service is active alive or not. It also checks connectivity with database
139
        """
151
        """
140
        try:
152
        try: