Subversion Repositories SmartDukaan

Rev

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

Rev 18634 Rev 18735
Line 35... Line 35...
35
    get_trust_level, remove_user_communication, get_user_emails, \
35
    get_trust_level, remove_user_communication, get_user_emails, \
36
    is_private_deal_user, add_private_deal_user, change_private_deal_user_status, \
36
    is_private_deal_user, add_private_deal_user, change_private_deal_user_status, \
37
    get_private_deal_user, register_counter, search_counter, \
37
    get_private_deal_user, register_counter, search_counter, \
38
    get_all_users_by_counter, get_active_access_token_for_user, \
38
    get_all_users_by_counter, get_active_access_token_for_user, \
39
    validate_access_token, is_address_editable_for_counter, get_billing_address_for_user, \
39
    validate_access_token, is_address_editable_for_counter, get_billing_address_for_user, \
40
    is_creditor_assigned
40
    is_creditor_assigned, is_tax_invoice_enabled_user
41
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
41
from shop2020.thriftpy.model.v1.user.ttypes import ShoppingCartException
42
from shop2020.utils.Utils import log_entry, to_py_date
42
from shop2020.utils.Utils import log_entry, to_py_date
43
 
43
 
44
    
44
    
45
 
45
 
Line 232... Line 232...
232
        """
232
        """
233
        Parameters:
233
        Parameters:
234
         - userId
234
         - userId
235
        """
235
        """
236
        try:
236
        try:
237
            addresses = get_all_addresses_for_user(userId)
237
            addresses, taxInvoiceMap, creditOptionMap = get_all_addresses_for_user(userId)
238
            
238
            
239
            t_addresses = list()
239
            t_addresses = list()
-
 
240
            if len(taxInvoiceMap)==0 and len(creditOptionMap)==0: 
240
            for address in addresses:
241
                for address in addresses:
241
                t_addresses.append(to_t_address(address))
242
                    t_addresses.append(to_t_address(address,False,False))
-
 
243
            else:
-
 
244
                for address in addresses:
-
 
245
                    t_addresses.append(to_t_address(address,taxInvoiceMap.get(address.id),creditOptionMap.get(address.id)))
242
            return t_addresses
246
            return t_addresses
243
        finally:
247
        finally:
244
            self.closeSession()
248
            self.closeSession()
245
              
249
              
246
    def getAddressById(self, addressId):
250
    def getAddressById(self, addressId):
247
        """
251
        """
248
        Parameters:
252
        Parameters:
249
         - addressId
253
         - addressId
250
        """
254
        """
251
        try:
255
        try:
252
            return to_t_address(get_address(addressId))
256
            address, taxInvoiceMap, creditOptionMap = get_address(addressId)
-
 
257
            return to_t_address(address, taxInvoiceMap.get(address.id), creditOptionMap.get(address.id))
253
        finally:
258
        finally:
254
            self.closeSession()
259
            self.closeSession()
255
              
260
              
256
    def getDefaultAddressId(self, userId):
261
    def getDefaultAddressId(self, userId):
257
        """
262
        """
Line 938... Line 943...
938
            
943
            
939
    def isAddressEditableForCounter(self, userId):
944
    def isAddressEditableForCounter(self, userId):
940
        try:
945
        try:
941
            return is_address_editable_for_counter(userId)
946
            return is_address_editable_for_counter(userId)
942
        except:
947
        except:
943
            return False
948
            return True
944
        finally:
949
        finally:
945
            self.closeSession()
950
            self.closeSession()
946
            
951
            
947
    def getBillingAddressForUser(self, userId):
952
    def getBillingAddressForUser(self, userId):
948
        try:
953
        try:
Line 954... Line 959...
954
        try:
959
        try:
955
            return is_creditor_assigned(userId)
960
            return is_creditor_assigned(userId)
956
        finally:
961
        finally:
957
            self.closeSession()
962
            self.closeSession()
958
            
963
            
-
 
964
    def isTaxInvoiceEnabledUser(self, userId):
-
 
965
        try:
-
 
966
            return is_tax_invoice_enabled_user(userId)
-
 
967
        finally:
-
 
968
            self.closeSession()
-
 
969
            
959
    def isAlive(self, ):
970
    def isAlive(self, ):
960
        """
971
        """
961
        For checking weather service is active alive or not. It also checks connectivity with database
972
        For checking weather service is active alive or not. It also checks connectivity with database
962
        """
973
        """
963
        try:
974
        try: