Subversion Repositories SmartDukaan

Rev

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

Rev 6433 Rev 6497
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, get_coupon, apply_recharge_coupon
14
    mark_voucher_as_redeemed, create_coupon, get_coupon, apply_recharge_coupon, \
-
 
15
    get_active_gvs, delete_coupon
15
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import \
16
from shop2020.model.v1.user.impl.PromotionRuleDataUtilities import \
16
    get_coupon_usage_count_by_user
17
    get_coupon_usage_count_by_user
17
 
18
 
18
class PromotionServiceHandler:
19
class PromotionServiceHandler:
19
    
20
    
Line 146... Line 147...
146
        try:
147
        try:
147
            return [to_t_coupon(coupon) for coupon in get_active_coupons()]
148
            return [to_t_coupon(coupon) for coupon in get_active_coupons()]
148
        finally:
149
        finally:
149
            PromotionDataAccessors.close_session()
150
            PromotionDataAccessors.close_session()
150
    
151
    
-
 
152
 
-
 
153
    def deleteCoupon(self, couponCode):
-
 
154
        '''
-
 
155
        Returns a list of active coupons
-
 
156
        '''
-
 
157
        try:
-
 
158
            delete_coupon(couponCode)
-
 
159
        finally:
-
 
160
            PromotionDataAccessors.close_session()
-
 
161
    
151
    def getSuccessfulPaymentCountForCoupon(self, couponCode):
162
    def getSuccessfulPaymentCountForCoupon(self, couponCode):
152
        '''
163
        '''
153
        Returns the count of successful payments done using this coupon
164
        Returns the count of successful payments done using this coupon
154
        
165
        
155
        Parameters:
166
        Parameters:
Line 191... Line 202...
191
        try:
202
        try:
192
            return get_discounts_for_entity(entityId)
203
            return get_discounts_for_entity(entityId)
193
        finally:
204
        finally:
194
            PromotionDataAccessors.close_session()
205
            PromotionDataAccessors.close_session()
195
 
206
 
-
 
207
    def getActiveCodes(self, promotionId):
-
 
208
        '''
-
 
209
        Returns the tuple containing Active gift vouchers
-
 
210
        
-
 
211
        Parameters:
-
 
212
         - entityId
-
 
213
        '''
-
 
214
        try:
-
 
215
            return get_active_gvs(promotionId)
-
 
216
        finally:
-
 
217
            PromotionDataAccessors.close_session()
-
 
218
 
196
    def addVoucher(self, voucher):
219
    def addVoucher(self, voucher):
197
        """
220
        """
198
        Parameters:
221
        Parameters:
199
         - voucher
222
         - voucher
200
        """
223
        """