Subversion Repositories SmartDukaan

Rev

Rev 7256 | Rev 7734 | 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

include "GenericService.thrift"

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
}

enum PickUpType {
        COURIER = 0,
        RUNNER = 1,
        SELF = 2
}

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

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

struct AwbUpdate{
    1:string awbNumber,
    2:i64 providerId,
    3:i64 date,
    4:string status,
    5:string description,
    6:string location
}

struct LogisticsInfo {
        1:i64 warehouseId,
        2:i64 providerId,
        3:i64 deliveryTime,
        4:string airway_billno,
        5:i64 shippingTime,
        6:bool codAllowed,
        7:i64 fulfilmentWarehouseId,
        8:bool otgAvailable,
        9:i64 deliveryDelay
}

struct PickupStore {
        1:i64 id,
        2:string hotspotId,     
        3:string name,
    4:string line1,
    5:string line2,
    6:string city,
    7:string state,
    8:string pin,
    9:string phone,
    10:string email,
    11:string zone,
    12:string bdm,
    13:string bdmEmail
}
    
exception LogisticsServiceException{
        1:i64 id,
        2:string message
}

service LogisticsService extends GenericService.GenericService{
        /**
         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, 3:DeliveryType type) throws (1:LogisticsServiceException se),
        
        LogisticsInfo getLogisticsEstimationForStore(1:i64 itemId, 2:string destination_pin, 3:DeliveryType type) 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, 4:PickUpType pickUp) throws (1:LogisticsServiceException se),
        
        /**
         Returns an unused AWB number for the given provider.
        */
        string getEmptyAWB(1:i64 providerId, DeliveryType type) 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 awbNumber, 2:i64 providerId) throws (1:LogisticsServiceException se),
        
        /**
         Store the update for the given AWB number and provider id.
        */
        void storeShipmentInfo(1:AwbUpdate update) 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 of the given type  
        */
        i64 getFreeAwbCount(1:i64 providerId, 2:string type),
        
        /**
        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 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.
         */
        list<i64> getEntityLogisticsEstimation(1:i64 catalogItemId, 2:string destination_pin, 3:DeliveryType type) throws (1:LogisticsServiceException se)
        
        /**
        * Returns the id for a given pickUpType
        */
        i64 getProviderForPickupType(1:i64 pickUp),
        
        
        list<PickupStore> getAllPickupStores(),
        
        PickupStore getPickupStore(1:i64 storeId),
        
        PickupStore getPickupStoreByHotspotId(1:string hotspotId),
        
        void addPincode(1:i64 providerId, 2:string pincode, 3:string destCode, 4:bool exp, 5:bool cod, 6:i32 stationType, 7:bool otgAvailable),
        
        void updatePincode(1:i64 providerId, 2:string pincode, 3:bool exp, 4:bool cod, 5:bool otgAvailable),
        
        bool addNewAwbs(1:i64 providerId, 2:bool cod, 3:list<string> awbs)
}