Subversion Repositories SmartDukaan

Rev

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

Rev 716 Rev 731
Line 12... Line 12...
12
    to_t_provider
12
    to_t_provider
13
from shop2020.clients.InventoryClient import InventoryClient
13
from shop2020.clients.InventoryClient import InventoryClient
14
from shop2020.config.client.ConfigClient import ConfigClient
14
from shop2020.config.client.ConfigClient import ConfigClient
15
import datetime
15
import datetime
16
import math
16
import math
-
 
17
from shop2020.logistics.service.impl.DataService import ServiceableLocationDetails
17
 
18
 
18
class LogisticsServiceHandler:
19
class LogisticsServiceHandler:
19
    
20
    
20
    def __init__(self):
21
    def __init__(self):
21
        initialize()
22
        initialize()
Line 90... Line 91...
90
        logistics_info = LogisticsInfo()
91
        logistics_info = LogisticsInfo()
91
        logistics_info.deliveryTime = delivery_time
92
        logistics_info.deliveryTime = delivery_time
92
        logistics_info.providerId = delivery_estimate.provider_id
93
        logistics_info.providerId = delivery_estimate.provider_id
93
        logistics_info.warehouseId = warehouse_id
94
        logistics_info.warehouseId = warehouse_id
94
        
95
        
95
        return logistics_info
-
 
96
96
        return logistics_info
-
 
97
    
-
 
98
    def getDestinationCode(self, providerId, pinCode):
-
 
99
        """
-
 
100
        Returns the short three letter code of a pincode for the given provider.
-
 
101
        Raises an exception if the pin code is not serviced by the given provider.
-
 
102
        
-
 
103
        Parameters:
-
 
104
         - providerId
-
 
105
         - pinCode
-
 
106
        """
-
 
107
        sld = ServiceableLocationDetails.get_by(provider_id = providerId, dest_pincode = pinCode)
-
 
108
        if sld != None:
-
 
109
            return sld.dest_code
-
 
110
        else:
-
 
111
            raise LogisticsServiceException(101, "The pincode " + pinCode + " is not serviced by this provider: " + str(providerId))
-
 
112
97
113