Subversion Repositories SmartDukaan

Rev

Rev 23218 | 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 DeliveryType {
        PREPAID = 0,
        COD = 1
}

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

struct ProviderDetails{
        1:string accountNo,
        2:string email,
        3:i64 logisticLocation
        4:DeliveryType deliveryType
}

/* Text to be displayed as product page*/
struct ItemText{
        1:i64 itemId,
        2:string displayText
}

struct Provider{
        1:i64 id,
        2:string name,
        3:list<ProviderDetails> details,
        4:PickUpType pickup,
        5:double bundleWeightLimit,
        6:bool groupShipmentAllowed,
        7:double maxCodLimit
}

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
}

struct LogisticsLocationInfo {
        1:i64 providerId,
        2:string pinCode,
        3:string destinationCode,
        4:bool expAvailable,
        5:bool codAvailable,
        6:bool otgAvailable,
        7:i64 codLimit,
        8:i64 prepaidLimit,
        9:i64 warehouseId,
        10:i64 deliveryTime,
        11:i64 delivery_delay,
        12:string zoneCode
}

struct ProviderInfo {
        1:i64 providerId,
        2:bool isCodAvailable,
        3:bool isOtgAvailable,
        4:i64 delayDays
}       
struct LocationInfo {
        1:i64 locationId,
        2:bool sameState,
        3:bool isCod,
        4:bool isOtg,
        5:i64 minDelay,
        6:i64 maxDelay
}

struct DeliveryEstimateAndCosting{
        1:i64 logistics_provider_id,
        2:string pincode,
        3:i64 deliveryTime,
        4:i64 delivery_delay,
        5:bool codAllowed,
        6:bool otgAvailable,
        7:double logisticsCost,
        8:double codCollectionCharges,
        9:i64 shippingTime
}

struct BluedartAttributes{
        1:string logisticsTransactionId,
        2:string name,
        3:string value
} 
    
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, 5:i64 stateId) throws (1:LogisticsServiceException se),
        
        /**
         Returns an unused AWB number for the given provider.
        */
        string getEmptyAWB(1:i64 providerId, 2:string logisticsTransactionId) 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<ItemText> 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, 4:i64 awbUsedFor),
        
        void runLogisticsLocationInfoUpdate(1:list<LogisticsLocationInfo> logisticsLocationInfoList, 2:bool runCompleteUpdate, 3:i64 provider),
        
        i64 adjustDeliveryDays(1:i64 startDate, 2:i64 days),
        
        i64 getFirstDeliveryEstimateForWhLocation(1:string pincode, 2:i64 whLocation),
        
        string getNewEmptyAwb(1:i64 providerId, 2:DeliveryType type, 3:i64 orderQuantity) throws (1:LogisticsServiceException se),
        
        map<string, string> getProviderLimitDetailsForPincode(1:i64 providerId, 2:string pincode) throws (1:LogisticsServiceException se),

        /**
        * This returns map for locations and providers corresponding their serviceability and delay 
        */
        map<i64, map<i64, LocationInfo>> getLocationInfoMap(1:string destPincode, 2:list<i64> price)
        
        DeliveryEstimateAndCosting getCostingAndDeliveryEstimateForPincode(1:string pincode, 2:double transactionAmount, 3:bool isCod, 4:double weight, 5:i64 billingWarehouseId, 6:bool isCompleteTxn)  throws (1:LogisticsServiceException se)
        
        BluedartAttributes getBluedartAttributesForLogisticsTxnId(1:string logisticsTxnId,2:string name) throws (1:LogisticsServiceException se);
        
        bool pushCourierDetailsForEcomExpress(1:list<string> logisticsTransactionIds)
}