Subversion Repositories SmartDukaan

Rev

Rev 3044 | Rev 3103 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

namespace java in.shop2020.logistics
namespace py shop2020.thriftpy.logistics

enum StationType{
        OWN_STATION = 0,                //The service provider's own station.
        ASSOCIATE_STATION = 1   //An associate's station
}

enum WarehouseLocation{
        Delhi = 0,
        Mumbai = 1,
        Bangalore = 2,
        Kolkata = 3
}

enum DeliveryType {
        PREPAID = 0,
        COD = 1
}

struct ProviderDetails{
        1:string accountNo,
        2:string email
}

struct Provider{
        1:i64 id,
        2:string name,
        3:map<DeliveryType, ProviderDetails> details
}

struct AwbUpdate{
    1:string awbNumber,
    2:string providerName,
    3:string location,
    4:i64 entryDate,
    5:string description
}

struct LogisticsInfo{
        1:i64 warehouseId,
        2:i64 providerId,
        3:i64 deliveryTime,
        4:string airway_billno
}

exception LogisticsServiceException{
        1:i64 id,
        2:string message
}

service LogisticsService{
        /**
        * For closing the open session in sqlalchemy
        */
        void closeSession(),
        
        /**
         Returns a provider for a given provider ID. Throws an exception if none found.
        */
        Provider getProvider(1:i64 providerId) throws (1:LogisticsServiceException lse),
        
        /**
         Returns a list containing all the providers.
        */
        list<Provider> getAllProviders() throws (1:LogisticsServiceException lse),
        
        /**
         Returns a LogisticsInfo structure w/o an airway bill number. Use this method during the estimation phase.
         Raises an exception if this pincode is not allocated to any warehouse zone or provider. Also, if the pincode
         is allocated to a warehouse zone but there are no actual warehouses in that zone, an exception is raised. 
         */
        LogisticsInfo getLogisticsEstimation(1:i64 itemId, 2:string destination_pin) throws (1:LogisticsServiceException se),
        
        /**
         Same as above excpet that an airway bill number is also allocated and returned.
        */
        LogisticsInfo getLogisticsInfo(1:string destination_pincode, 2:i64 item_id, 3:DeliveryType type) throws (1:LogisticsServiceException se),
        
        /**
         Returns an unused AWB number for the given provider.
        */
        string getEmptyAWB(1:i64 providerId) throws (1:LogisticsServiceException se),

        /**
         Returns the list of updates for the given AWB number and provider id. The list is empty if there are no updates yet.
        */
        list<AwbUpdate> getShipmentInfo(1:string awb, 2:i64 providerId) throws (1:LogisticsServiceException se),
        
        /**
         Returns the short three letter code of a pincode for the given provider.
     Raises an exception if the pin code is not serviced by the given provider.
        */
        string getDestinationCode(1:i64 providerId, 2:string pinCode) throws (1:LogisticsServiceException se),
        
        /**
        Returns the number of unused AWB numbers for the given provider  
        */
        i64 getFreeAwbCount(1:i64 providerId),
        
        /**
        Returns list of Holiday dates between fromDate and toDate (both inclusive)
        fromDate should be passed as milliseconds corresponding to the start of the day.
        If fromDate is passed as -1, fromDate is not considered for filtering
        If toDate is passed as -1, toDate is not considered for filtering
        */
        list<i64> getHolidays(1:i64 fromDate, 2:i64 toDate),
        
        /**
        Returns true if COD is allowed for this destination pincode
        */
        bool isCodAllowed(1:string destination_pincode)
}