Subversion Repositories SmartDukaan

Rev

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

Rev 1899 Rev 1976
Line 14... Line 14...
14
    get_master_affiliate_by_id, get_master_affiliate_by_name, get_affiliates_by_master_affiliate, get_all_master_affiliates
14
    get_master_affiliate_by_id, get_master_affiliate_by_name, get_affiliates_by_master_affiliate, get_all_master_affiliates
15
from shop2020.model.v1.user.impl.CartDataAccessors import create_cart, get_cart,\
15
from shop2020.model.v1.user.impl.CartDataAccessors import create_cart, get_cart,\
16
    get_cart_by_id, get_cart_by_user_id_and_status, get_carts_by_status,\
16
    get_cart_by_id, get_cart_by_user_id_and_status, get_carts_by_status,\
17
    get_carts_between, change_cart_status, add_item_to_cart,\
17
    get_carts_between, change_cart_status, add_item_to_cart,\
18
    change_item_status, add_address_to_cart, commit_cart,\
18
    change_item_status, add_address_to_cart, commit_cart,\
19
    validate_cart, merge_cart, delete_item_from_cart, check_out, reset_cart
19
    validate_cart, merge_cart, delete_item_from_cart, check_out, reset_cart,\
-
 
20
    apply_coupon_to_cart, remove_coupon
20
from shop2020.model.v1.user.impl.Converters import to_t_user, to_t_user_state, to_t_cart, to_t_address, to_t_user_communication,\
21
from shop2020.model.v1.user.impl.Converters import to_t_user, to_t_user_state, to_t_cart, to_t_address, to_t_user_communication,\
21
     to_t_master_affiliate, to_t_affiliate, to_t_tracker, to_t_track_log
22
     to_t_master_affiliate, to_t_affiliate, to_t_tracker, to_t_track_log
22
 
23
 
23
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
24
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
24
 
25
 
Line 412... Line 413...
412
        """
413
        """
413
        try:
414
        try:
414
            return add_address_to_cart(cartId, addressId)
415
            return add_address_to_cart(cartId, addressId)
415
        finally:
416
        finally:
416
            CartDataAccessors.close_session()
417
            CartDataAccessors.close_session()
-
 
418
    
-
 
419
    def applyCouponToCart(self, cartId, couponCode, totalPrice, discountedPrice):
-
 
420
        '''
-
 
421
        Parameters:
-
 
422
        - cartId
-
 
423
        - couponCode
-
 
424
        - totalPrice
-
 
425
        - discountedPrice
-
 
426
        '''
417
            
427
        try:
-
 
428
            apply_coupon_to_cart(cartId, couponCode, totalPrice, discountedPrice)
-
 
429
        finally:
-
 
430
            CartDataAccessors.close_session()
-
 
431
    
-
 
432
    def removeCoupon(self, cartId):
-
 
433
        '''
-
 
434
        Parameters:
-
 
435
        - cartId
-
 
436
        '''
-
 
437
        try:
-
 
438
            remove_coupon(cartId)
-
 
439
        finally:
-
 
440
            CartDataAccessors.close_session()
-
 
441
    
418
    def createOrders(self, cartId):
442
    def createOrders(self, cartId):
419
        """
443
        """
420
        Parameters:
444
        Parameters:
421
         - cartId
445
         - cartId
422
        """
446
        """
Line 429... Line 453...
429
        """
453
        """
430
        Validates that:
454
        Validates that:
431
        1. The checkout timestamp is greater than the updatedOn timestamp.
455
        1. The checkout timestamp is greater than the updatedOn timestamp.
432
        2. All of the lines in the cart are active items.
456
        2. All of the lines in the cart are active items.
433
        3. The estimate for any of the lines in cart doesn't change.
457
        3. The estimate for any of the lines in cart doesn't change.
-
 
458
        4. If a Coupon Code is attached, it gets applied and discounted price is computed
434
        If all three are true, returns empty string; else returns appropriate message.
459
        If first three are true, returns empty string; else returns appropriate message.
435
        
460
        
436
        Parameters:
461
        Parameters:
437
         - cartId
462
         - cartId
438
        """
463
        """
439
        try:
464
        try: