Subversion Repositories SmartDukaan

Rev

Rev 22364 | Blame | Compare with Previous | Last modification | View Log | RSS feed

'''
Created on 28-Apr-2010

@author: ashish
'''
from shop2020.helpers.impl.DataAccessor import close_session
from shop2020.model.v1.user.impl import UserDataAccessors, CartDataAccessors
from shop2020.model.v1.user.impl.CartDataAccessors import create_cart, get_cart, \
    get_cart_by_id, get_carts_between, add_item_to_cart, add_address_to_cart, \
    commit_cart, validate_cart, merge_cart, delete_item_from_cart, check_out, \
    reset_cart, apply_coupon_to_cart, remove_coupon, get_carts_with_coupon_count, \
    delete_discounts_from_cart, save_discounts, show_cod_option, insure_item, \
    cancel_insurance, store_insurance_specific_details, is_insurance_detail_present, \
    add_store_to_cart, get_products_added_to_cart, validate_cart_plus, \
    add_items_to_cart, validate_cart_new, set_wallet_amount_in_cart, \
    add_item_pricing_to_cart
from shop2020.model.v1.user.impl.Converters import to_t_user, to_t_cart, \
    to_t_address, to_t_user_communication, to_t_master_affiliate, to_t_affiliate, \
    to_t_tracker, to_t_track_log, to_t_private_deal_user, to_t_counter
from shop2020.model.v1.user.impl.Dataservice import UserWidgetItem
from shop2020.model.v1.user.impl.UserDataAccessors import create_user, \
    update_user, get_user_by_id, get_user_by_email, update_password, \
    set_user_as_logged_out, set_user_as_logged_in, remove_address_for_user, \
    add_address_for_user, authenticate_user, user_exists, initialize, \
    set_default_address, create_anonymous_user, forgot_password, \
    get_all_addresses_for_user, get_address, get_default_address_id, \
    get_default_pincode, create_user_communication, get_user_communication_by_id, \
    get_user_communication_by_user, get_all_user_communications, create_affiliate, \
    get_affiliate_by_id, get_affiliate_by_name, get_tracker_by_id, add_track_log, \
    get_track_log_by_id, get_track_logs_by_affiliate, get_track_logs_by_user, \
    get_track_logs, create_master_affiliate, get_master_affiliate_by_id, \
    get_master_affiliate_by_name, get_affiliates_by_master_affiliate, \
    get_all_master_affiliates, get_my_research_items, get_browse_history_items, \
    update_my_research, delete_item_from_my_research, update_browse_history, \
    get_user_by_mobile_number, is_alive, increase_trust_level, get_user_by_cart_id, \
    get_trust_level, remove_user_communication, get_user_emails, \
    is_private_deal_user, add_private_deal_user, change_private_deal_user_status, \
    get_private_deal_user, register_counter, search_counter, \
    get_all_users_by_counter, get_active_access_token_for_user, \
    validate_access_token, is_address_editable_for_counter, \
    get_billing_address_for_user, is_creditor_assigned, is_tax_invoice_enabled_user, \
    get_cart_by_value, get_counter_by_user_id, tax_invoice_available, \
    get_counter_name, update_address, update_counter
from shop2020.thriftpy.model.v1.user.UserContextService import \
    setWalletAmountInCart_args
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
from shop2020.utils.Utils import log_entry, to_py_date


#from apport.hookutils import ret
class UserContextServiceHandler:
    
    
    def __init__(self, dbname='user', db_hostname='localhost'):
        initialize(dbname, db_hostname)

    """
    service
    """
    def createAnonymousUser(self, jsessionId):
        try:
            return to_t_user(create_anonymous_user(jsessionId))
        finally:
            self.closeSession()

    def getUserById(self, userId):
        """
        Parameters:
        - userId
        """
        try:
            return to_t_user(get_user_by_id(userId))
        finally:
            self.closeSession()

    def getUserByCartId(self, cartId):
        """
        Parameters:
        - cartId
        """
        try:
            return to_t_user(get_user_by_cart_id(cartId))
        finally:
            self.closeSession()
        
    def getUserByMobileNumber(self, mobileNumber):
        """
        Parameters:
        - mobileNumber
        """
        try:
            return to_t_user(get_user_by_mobile_number(mobileNumber))
        finally:
            self.closeSession()

    def getUserByEmail(self, email):
        """
        Parameters:
         - email
        """
        try:
            return to_t_user(get_user_by_email(email))
        finally:
            self.closeSession()

    def createUser(self, user):
        """
        Parameters:
        - user
        """
        try:
            return to_t_user(create_user(user))
        finally:
            self.closeSession()

    def updateUser(self, user):
        """
        Parameters:
        - user
        """
        try:
            return to_t_user(update_user(user))
        finally:
            self.closeSession()
            
    def authenticateUser(self, email, password):
        """
        Parameters:
        - email
        - password
        """
        log_entry(self, "authenticate user")
        try:
            return to_t_user(authenticate_user(email, password))
        finally:
            self.closeSession()
            
    def userExists(self, email):
        """
        Parameters:
        - email
        """
        log_entry(self, "user exists")
        try:
            return user_exists(email)
        finally:
            self.closeSession()
            
    def addAddressForUser(self, userId, address, setDefault):
        """
        Parameters:
        - userId
        - address
        - setDefault
        """
        log_entry(self, "add address for user")
        try:
            return add_address_for_user(address, userId, setDefault)
        finally:
            self.closeSession()
            
    def removeAddressForUser(self, userid, addressId):
        """
        Parameters:
        - userid
        - addressId
        """
        log_entry(self, "removing address")
        try:
            return remove_address_for_user(userid, addressId)
        finally:
            self.closeSession()
            
    def setUserAsLoggedIn(self, userId, timestamp):
        """
        Parameters:
        - userId
        - timestamp
        """
        log_entry(self, "set_user_as_logged_in")
        try:
            return set_user_as_logged_in(userId, timestamp)
        finally:
            self.closeSession()
            
    def setUserAsLoggedOut(self, userId, timestamp):
        """
        Parameters:
        - userId
        - timestamp
        """
        log_entry(self, "set user as logged out")
        try:
            return set_user_as_logged_out(userId, timestamp)
        finally:
            self.closeSession()
            
    def setDefaultAddress(self, userId, addressId):
        """
        Parameters:
        - userId
        - addressId
        """
        try:
            return set_default_address(userId, addressId)
        finally:
            self.closeSession()
            
    def updatePassword(self, userid, oldPassword, newPassword):
        """
        Parameters:
         - userid
         - oldPassword
         - newPassword
        """
        log_entry(self, "updating password")
        try:
            return update_password(userid, oldPassword, newPassword)
        finally:
            self.closeSession()
            
    def forgotPassword(self, email, password):
        """
        Parameters:
         - email
        """
        log_entry(self, "forgot password")
        try:
            return forgot_password(email, password)
        finally:
            self.closeSession()

    def getAllAddressesForUser(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            addresses, taxInvoiceMap, creditOptionMap = get_all_addresses_for_user(userId)
            
            t_addresses = list()
            if len(taxInvoiceMap)==0 and len(creditOptionMap)==0: 
                for address in addresses:
                    t_addresses.append(to_t_address(address,False,False))
            else:
                for address in addresses:
                    t_addresses.append(to_t_address(address,taxInvoiceMap.get(address.id),creditOptionMap.get(address.id)))
            return t_addresses
        finally:
            self.closeSession()
              
    def getAddressById(self, addressId):
        """
        Parameters:
         - addressId
        """
        try:
            address, taxInvoiceMap, creditOptionMap = get_address(addressId)
            return to_t_address(address, taxInvoiceMap.get(address.id), creditOptionMap.get(address.id))
        finally:
            self.closeSession()
              
    def getDefaultAddressId(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            return get_default_address_id(userId)
        finally:
            self.closeSession()

    def getDefaultPincode(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            return get_default_pincode(userId)
        finally:
            self.closeSession()

    def getCurrentCart(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            cart = get_cart(userId)
            if cart:
                return to_t_cart(cart)
            else:
                raise ShoppingCartException(101, "not cart attached to this user")
        finally:
            self.closeSession()
            
    def getCart(self, cartId):
        """
        Parameters:
         - cartId
        """
        try:
            cart = get_cart_by_id(cartId)
            if cart:
                return to_t_cart(cart)
            else:
                raise ShoppingCartException(101, "not cart attached to this id")
        finally:
            self.closeSession()
            
    def getCartsByTime(self, from_time, to_time, status):
        """
        Parameters:
         - from_time
         - to_time
         - status
        """
        try:
            carts = get_carts_between(from_time, to_time, status)
            t_carts = []
            if carts:
                for cart in carts:
                    t_carts.append(to_t_cart(cart))
            return t_carts
        finally:
            self.closeSession()
            
    def addItemToCart(self, cartId, itemId, quantity, sourceId):
        """
        Parameters:
         - cartId
         - itemId
         - quantity
        """
        try:
            return add_item_to_cart(cartId, itemId, quantity, sourceId)
        finally:
            self.closeSession()
            
    def deleteItemFromCart(self, cartId, itemId):
        """
        Parameters:
         - cartId
         - itemId
        """
        try:
            delete_item_from_cart(cartId, itemId)
        finally:
            self.closeSession()
            
    def addAddressToCart(self, cartId, addressId):
        """
        Parameters:
         - cartId
         - addressId
        """
        try:
            return add_address_to_cart(cartId, addressId)
        finally:
            self.closeSession()
    
    def applyCouponToCart(self, t_cart, couponCode):
        '''
        Parameters:
        - cartId
        - couponCode
        - totalPrice
        - discountedPrice
        '''
        try:
            apply_coupon_to_cart(t_cart, couponCode)
        finally:
            self.closeSession()
    
    def removeCoupon(self, cartId):
        '''
        Parameters:
        - cartId
        '''
        try:
            remove_coupon(cartId)
        finally:
            self.closeSession()
    
    def createOrders(self, cartId, sessionSource, sessionTime, firstSource, firstSourceTime, userId, schemeId, orderSource, selfPickup=False):
        """
        Parameters:
         - cartId
         - sessionSource
        """
        try:
            return commit_cart(cartId, sessionSource, sessionTime, firstSource, firstSourceTime, userId, schemeId, orderSource, selfPickup)
        finally:
            self.closeSession()

    def validateCart(self, cartId, sourceId):
        """
        Validates that:
        1. The checkout timestamp is greater than the updatedOn timestamp.
        2. All of the lines in the cart are active items.
        3. The estimate for any of the lines in cart doesn't change.
        4. If a Coupon Code is attached, it gets applied and discounted price is computed
        If first three are true, returns empty string; else returns appropriate message.
        
        Parameters:
         - cartId
        """
        try:
            return validate_cart(cartId, sourceId, None)
        finally:
            self.closeSession()
            
    def validateCartWithDealerCoupon(self, cartId, sourceId, couponCode):
        """
        Validates that:
        1. The checkout timestamp is greater than the updatedOn timestamp.
        2. All of the lines in the cart are active items.
        3. The estimate for any of the lines in cart doesn't change.
        4. If a Coupon Code is attached, it gets applied and discounted price is computed
        If first three are true, returns empty string; else returns appropriate message.
        
        Parameters:
         - cartId
        """
        try:
            return validate_cart(cartId, sourceId, couponCode)
        finally:
            self.closeSession()
            
    def mergeCart(self, fromCartId, toCartId):
        """
        Parameters:
         - fromCartId
         - toCartId
        """
        try:
            merge_cart(fromCartId, toCartId)
        finally:
            self.closeSession()
            
    def checkOut(self, cartId):
        """
        Sets the checkedOutOn timestamp of the cart. Raises an exception if the specified cart can't be found.
        
        Parameters:
         - cartId
        """
        try:
            return check_out(cartId)
        finally:
            self.closeSession()
            
    def resetCart(self, cartId, items):
        """
        The second parameter is a map of item ids and their quantities which have been successfully processed.
        This methods removes the specified quantiry of the specified item from the cart.
        
        Parameters:
         - cartId
         - items
        """
        try:
            return reset_cart(cartId, items)
        finally:
            self.closeSession()

    #Widget related methods
    def updateMyResearch(self, userId, itemId):
        """
        Parameters:
         - user_id
         - item_id
        """
        try:
            return update_my_research(userId, itemId)
        finally:
            self.closeSession()

    def deleteItemFromMyResearch(self, userId, itemId):
        """
        Parameters:
         - user_id
         - item_id
        """
        try:
            return delete_item_from_my_research(userId, itemId)
        finally:
            self.closeSession()
            
    def updateBrowseHistory(self, userId, itemId):
        """
        Parameters: 
        - user_id
        - item_id
        """
        try:
            update_browse_history(userId, itemId)
        finally:
            self.closeSession()
            
    def mergeBrowseHistory(self, fromUserId, toUserId):
        """
        Parameters:
         - user_id
        """
        pass
    
    def saveUserCommunication(self, userId, email, communicationType, orderId, awb, product, subject, message):
        """
        Parameters:
         - userId
         - email
         - communicationType
         - orderId
         - awb
         - product
         - subject
         - message
        """
        try:
            return create_user_communication(userId, email, communicationType, orderId, awb, product, subject, message)
        finally:
            self.closeSession()
    
    def getUserCommunicationById(self, id):
        """
        Parameters:
         - id
        """
        try:
            return to_t_user_communication(get_user_communication_by_id(id))
        finally:
            self.closeSession()
    
    def getUserCommunicationByUser(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            return [to_t_user_communication(user_communication) for user_communication in get_user_communication_by_user(userId)]
        finally:
            self.closeSession()
    
    def getAllUserCommunications(self):
        try:
            return [to_t_user_communication(user_communication) for user_communication in get_all_user_communications()]
        finally:
            self.closeSession()
            
    def removeUserCommunication(self, id):
        try:
            remove_user_communication(id)
        finally:
            self.closeSession()

    def createMasterAffiliate(self, name, addedOn):
        """
        Parameters
         - name
         - addedOn
        """
        try:
            return to_t_master_affiliate(create_master_affiliate(name, addedOn))
        finally:
            self.closeSession()
    
    def getAllMasterAffiliates(self):
        try:
            return [to_t_master_affiliate(masterAffiliate) for masterAffiliate in get_all_master_affiliates()]
        finally:
            self.closeSession()
    
    def getMasterAffiliateById(self, id):
        """
        Parameters
         - id
        """
        try:
            return to_t_master_affiliate(get_master_affiliate_by_id(id))
        finally:
            self.closeSession()
    
    def getMasterAffiliateByName(self, name):
        """
        Parameters
         - id
        """
        try:
            return to_t_master_affiliate(get_master_affiliate_by_name(name))
        finally:
            self.closeSession()
    
    def createAffiliate(self, name, url, masterAffiliateId, addedOn):
        """
        Parameters
         - name
         - url
         - masterAffiliateId
         - addedOn
        """
        try:
            return to_t_affiliate(create_affiliate(name, url, masterAffiliateId, addedOn))
        finally:
            self.closeSession()
    
    def getAffiliateById(self, id):
        """
        Parameters
         - id
        """
        try:
            return to_t_affiliate(get_affiliate_by_id(id))
        finally:
            self.closeSession()
    
    def getAffiliateByName(self, name):
        """
        Parameters
         - name
        """
        try:
            return to_t_affiliate(get_affiliate_by_name(name))
        finally:
            self.closeSession()
    
    def getAffiliatesByMasterAffiliate(self, masterAffiliateId):
        """
        Parameters
         - master_id
        """
        try:
            return [to_t_affiliate(affiliate) for affiliate in get_affiliates_by_master_affiliate(masterAffiliateId)]
        finally:
            self.closeSession()
            
    def getTrackerById(self, trackerId):
        """
        Parameters
         - trackerId
        """
        try:
            return to_t_tracker(get_tracker_by_id(trackerId))
        finally:
            self.closeSession()
            
    def addTrackLog(self, affiliateId, userId, event, url, data, addedOn):
        """
        Parameter
         - affiliateId
         - userId
         - event
         - url
         - data
         - addedOn
        """
        try:
            return add_track_log(affiliateId, userId, event, url, data, addedOn)
        finally:
            self.closeSession()
    
    def getTrackLogById(self, id):
        """
        Parameter
         - id
        """
        try:
            return to_t_track_log(get_track_log_by_id(id))
        finally:
            self.closeSession()
    
    def getTrackLogsByAffiliate(self, affiliateId, startDate, endDate):
        """
        Parameter
         - affiliate_id
        """
        try:
            return [to_t_track_log(track_log) for track_log in get_track_logs_by_affiliate(affiliateId, startDate, endDate)]
        finally:
            self.closeSession()
    
    def getTrackLogsByUser(self, user_id):
        """
        Parameter
         - user_id
        """
        try:
            return [to_t_track_log(track_log) for track_log in get_track_logs_by_user(user_id)]
        finally:
            self.closeSession()
    
    def getTrackLogs(self, affiliateId, userId, event, url):
        """
        Parameter
         - affiliateId
         - userId
         - event
         - url
        """
        try:
            return [to_t_track_log(track_log) for track_log in get_track_logs(affiliateId, userId, event, url)]
        finally:
            self.closeSession()
    
    def getUserCount(self, userType):
        """
        Returns number of registered users.
        If userType = null, then it returns count of all users, including anonymous
        If userType = UserType.ANONYMOUS, then it returns count of anonymous users only
        If userType = UserType.USER, then it returns count of non-anonymous users only
        
        Parameters:
         - userType
        """
        try:
            return UserDataAccessors.get_user_count(userType)
        finally:
            self.closeSession()

    def getAllUsers(self, userType, startDate, endDate):
        """
        Returns list of users of type userType. If userType is null, then returns all the users.
        
        Parameters:
         - userType
        """
        try:
            users = UserDataAccessors.get_users(userType, startDate, endDate)
            t_users = list()
            for user in users:
                t_users.append(to_t_user(user))
            return t_users
        finally:
            self.closeSession()
    
    def getMyResearchItems(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            return get_my_research_items(userId)
        finally:
            self.closeSession()

    def getBrowseHistoryItems(self, userId):
        """
        Parameters:
         - userId
        """
        try:
            return get_browse_history_items(userId)
        finally:
            self.closeSession()

    def getCartsWithCouponCount(self, couponCode):
        '''
        Parameters:
         - couponCode
        '''
        try:
            return get_carts_with_coupon_count(couponCode)
        finally:
            self.closeSession()

    def increaseTrustLevel(self, userId, trustLevelDelta):
        """
        Parameters:
         - userId
         - trustLevelDelta
        """
        try:
            return increase_trust_level(userId, trustLevelDelta)
        finally:
            self.closeSession()
    
    def getTrustLevel(self, userId):
        try:
            return get_trust_level(userId)
        finally:
            self.closeSession()
            
    def deleteDiscountsFromCart(self, cartId):
        '''
        Parameters:
         - cartId
        '''
        try:
            return delete_discounts_from_cart(cart_id = cartId)
        finally:
            self.closeSession()
    
    def saveDiscounts(self, discounts):
        '''
        Parameters:
         - discounts
        '''
        try:
            return save_discounts(discounts)
        finally:
            self.closeSession()

    def showCODOption(self, cartId, sourceId, pincode):
        '''
        Parameters:
         - cartId
         - pincode
        '''
        try:
            return show_cod_option(cartId, sourceId, pincode)
        finally:
            self.closeSession()


    def addStoreToCart(self, cartId, storeId):
        """
        Parameters:
         - cartId
         - storeId
        """
        try:
            return add_store_to_cart(cartId, storeId)
        finally:
            self.closeSession()
            
    def getUserEmails(self, startDate, endDate):
        '''
        Get email addresses for users activated within a given date range
        
        Parameters:
         - startDate
         - endDate
        '''
        try:
            return get_user_emails(to_py_date(startDate), to_py_date(endDate))
        finally:
            self.closeSession()
    
    def getProductsAddedToCart(self, startDate, endDate):
        """
        Returns list of products added to cart from startDate to endDate
        """        
        try:
            return get_products_added_to_cart(startDate, endDate)
        finally:
            self.closeSession()
        
        
    def insureItem(self, itemId, cartId, toInsure, insurerType):
        try:
            return insure_item(itemId, cartId, toInsure, insurerType)
        finally:
            self.closeSession()
            
    def cancelInsurance(self, cartId):
        try:
            return cancel_insurance(cartId)
        finally:
            self.closeSession()
            
    def storeInsuranceSpecificDetails (self, addressId, dob, guardianName):
        try:
            return store_insurance_specific_details(addressId, dob, guardianName)
        finally:
            self.closeSession()
                    
    def isInsuranceDetailPresent(self, addressId):
        try:
            return is_insurance_detail_present(addressId)
        finally:
            self.closeSession()
            
    def validateCartPlus(self, cartId, sourceId, couponCode):
        try:
            return validate_cart_plus(cartId, sourceId, couponCode)
        finally:
            self.closeSession()
    
    def addItemsToCart(self, cartId, itemQty, couponCode):
        try:
            return add_items_to_cart(cartId, itemQty, couponCode)
        finally:
            self.closeSession()
    
    def validateCartNew(self, cartId, pinCode, sourceId):
        try:
            return validate_cart_new(cartId, pinCode, sourceId)
        finally:
            self.closeSession()
    
    def closeSession(self, ):
        CartDataAccessors.close_session()
        UserDataAccessors.close_session()
    
    def isPrivateDealUser(self,userId):
        return is_private_deal_user(userId)
    
    def addPrivateDealUser(self,userId):
        try:
            return add_private_deal_user(userId)
        finally:
            self.closeSession()
    
    def changePrivateDealUserStatus(self,userId,isActive):
        try:
            return change_private_deal_user_status(userId,isActive)
        finally:
            self.closeSession()
    
    def getPrivateDealUser(self,userId):
        try:
            return to_t_private_deal_user(get_private_deal_user(userId))
        finally:
            self.closeSession()
    
    def registerCounter(self, tCounter, userId):
        try:
            return register_counter(tCounter, userId)
        finally:
            self.closeSession()
            
    def searchCounter(self, type1, searchString):
        try:
            return [to_t_counter(counter) for counter in search_counter(type1, searchString)]
        finally:
            self.closeSession()
            
    def getCounterByUserId(self, userId):
        return to_t_counter(get_counter_by_user_id(userId))
                
    def getAllUsersByCounter(self, counterid):
        try:
            return [to_t_user(user) for user in get_all_users_by_counter(counterid)]
        finally:
            self.closeSession()
            
    def getActiveAccessTokenForUser(self, userId, source):
        try:
            return get_active_access_token_for_user(userId, source)
        finally:
            self.closeSession()
            
    def validateAccessToken(self, accessToken):
        try:
            return validate_access_token(accessToken)
        finally:
            self.closeSession()
            
    def isAddressEditableForCounter(self, userId):
        try:
            return is_address_editable_for_counter(userId)
        except:
            return True
        finally:
            self.closeSession()
            
    def getBillingAddressForUser(self, userId):
        try:
            address, taxInvoiceMap, creditAvailableMap = get_billing_address_for_user(userId)
            if address is not None:
                return to_t_address(address, taxInvoiceMap, creditAvailableMap)
            else:
                return None
        finally:
            self.closeSession()
            
    def isCreditorAssigned(self, userId):
        try:
            return is_creditor_assigned(userId)
        finally:
            self.closeSession()
            
    def isTaxInvoiceEnabledUser(self, userId):
        try:
            return is_tax_invoice_enabled_user(userId)
        finally:
            self.closeSession()
            
    def getCartByValue(self,cartIds):
        try:
            return get_cart_by_value(cartIds)
        finally:
            self.closeSession()

    def taxInvoiceAvailable(self,address_id):
        try:
            return tax_invoice_available(address_id)
        finally:
            self.closeSession()
            
    def isAlive(self, ):
        """
        For checking weather service is active alive or not. It also checks connectivity with database
        """
        try:
            return is_alive()
        finally:
            self.closeSession()
            
    def getCounterName(self,userIds):
        try:
            return get_counter_name(userIds)
        finally:
            self.closeSession()
            
    def setWalletAmountInCart(self, cartId, wallet_amount):
        try:
            return set_wallet_amount_in_cart(cartId, wallet_amount)
        finally:
            self.closeSession()
            
            
    def updateAddress(self, address):
        try:
            return update_address(address)
        finally:
            self.closeSession()
            
    def updateCounter(self, counter):
        try:
            return update_counter(counter)
        finally:
            self.closeSession()
            
    def addItemPricingToCart(self, cartId, item_pricing_qty_list):
    
        try:
            return add_item_pricing_to_cart(cartId, item_pricing_qty_list)
        finally:
            self.closeSession()