Subversion Repositories SmartDukaan

Rev

Rev 12722 | Blame | Compare with Previous | Last modification | View Log | RSS feed

namespace java in.shop2020.utils
namespace py shop2020.thriftpy.utils

include "GenericService.thrift"

/**
Helper service
created by @ashish
**/

struct Agent {
    1:i64 id,
    2:string name,
    3:string emailId,
    4:optional i64 managerId,
    5:string password,
    6:bool isActive
}

struct Mail{
        1:list<string> to,
        2:string subject,
        3:string data,
        4:string sender,
        5:list<string> attachments,
        6:string password
}

struct TextMessage{
        1:string number,
        2:string message,
        3:i64 dispatchTime,
        4:i64 deliveryTime
}

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

struct Message{
        1:i64 id,
        2:string message
}

enum Role{
        WAREHOUSE_EXECUTIVE = 0,
        ADMIN = 1,
        WAREHOUSE_MONITOR = 2,
        WAREHOUSE_OBSERVER = 3
}

struct Location {
        1:double lattitude,
        2:double longitude
}

enum DealerAuthRole{
        ADMIN = 1,
        AREA_MANAGER = 2,
        ONFEET_EXECUTIVE = 3,
        CRM = 4
}

enum Campaigns{
        GOSF =1,
        CORPORATE_COUPONS = 2
}

struct DealerAuth {
        1:string username,
        2:string password,
        3:DealerAuthRole role,
        4:i64 createdOn,
        5:i64 lastLoggedIn,
        6:Location lastLocation,
        7:bool isActive
}


struct DashboardUser{
        1:string username,
        2:string password,
        3:i64 warehouseId,
        4:Role role,
        5:i64 source
}

struct LogisticsUser{
        1:string username,
        2:i64 providerId
}

struct StatisticsUser{
        1:string username
}

struct CatalogDashboardUser{
        1:string username,
        2:string password,
        3:i64 role
}

struct UserEmail{
        1:i64 id,
        2:list<string> emailTo,
        3:string emailFrom,
        4:string subject,
        5:string body,
        6:string source,
        7:string emailType,
        8:bool status,
        9:i64 timestamp,
        10:list<string> cc,
        11:list<string> bcc
}

struct ReportUser{
        1:string username,
        2:i64 role,
        3:string email
}

struct Report{
        1:i64 id,
        2:string description,
        3:string controller
}

struct QuickLink        {
        1:i64 id,
        2:string url,
        3:string text
}

struct AgentWarehouseMapping{
        1:i64 agentId,
        2:i64 warehouseId
}

enum SmsType{
        TRANSACTIONAL,
        PROMOTIONAL,
        SERVICE_ALERT
}

enum SmsStatus{
        IN_PROCESS,
        DELIVERED,
        UNDELIVERED,
        SERVICE_ERROR,
        USER_ABSENT,
        MEMORY_FULL,
        NDLC_FAIL,
        INVALID_NUMBER
}

enum SmsDeliveryStatus{
        NOT_SENT,
        SENT_TO_OPERATOR,
        SUBMITTED_TO_SMSC,
        GOT_STATUS_CODE
}

struct UserSms{
        1:i64 id,
        2:i64 user_id,
        3:string mobileNumber,
        4:string smsText,
        5:SmsType type,
        6:SmsStatus status,
        7:i64 attempts,
        8:i64 createdTimestamp,
        9:string responseId,
        10:string responseText
        11:SmsDeliveryStatus deliveryStatus,  
}

struct UserSmsInfo{
        1:i64 userId,
        2:string mobileNo,
        3:i32 dailyCount,
        4:i32 weeklyCount,
        5:bool dndStatus,
        6:bool smsSubscribed,
        7:i64 createdTimestamp,
        8:i64 updateTimestamp
}

service HelperService extends GenericService.GenericService{
        /**
        * Save email details, to be sent later; Also returns its identifier.
        */
        i64 saveUserEmailForSending(1:list<string> emailTo, 2:string emailFrom, 3:string subject, 4:string body, 5:string source, 6:string emailType, 7:list<string> cc, 8:list<string> bcc, 9:i64 sourceId) throws (1:HelperServiceException se),
        
        /**
        * Retreives all the emails pending for dispatch
        */
        list<UserEmail> getEmailsToBeSent() throws (1:HelperServiceException se),
        
        /**
        * Marks email as sent after successful dispatch
        */
        void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
        
        void sendMail(1:Mail mail) throws (1:HelperServiceException se),
        void sendText(1:TextMessage message) throws (1:HelperServiceException se),
        
        void addMessage(1:Message message) throws (1:HelperServiceException se),
        void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
        Message getMessage(1:i64 id) throws (1:HelperServiceException se),
        Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
        
        //authenticate dashboard users
        bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
        bool deleteUser(1:string username) throws (1:HelperServiceException se),
        
        /**
         Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
         The loggedOn timestamp for the dashboard user is updated .
        */
        DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
        
        /**
        Update the password of the dashboard user. Currently, there is no place where this method is called.
        */
        bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
        
        /**
         Returns the LogisticsUser struct associated with the given username and password if they match.
         Throws an exception otherwise.
        */
        LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
        
        /**
         Returns the StatisticsUser struct associated with the given username and password if they match.
         Throws an exception otherwise.
        */
        StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
        
        /**
         Returns the ReportUser struct associated with the given username and password if they match.
         Throws an exception otherwise.
        */
        ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
        
        /**
        Returns list of reports which are configured for the given role. 
        */
        list<Report> getReports(1:i64 role),
        
        /**
         Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
         Throws an exception otherwise.
        */
        CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
        
        /**
        Saves the list of entity Ids to be shared with an email address 
        */
        void shareEntities(1:list<i64> entityIds, 2:string email) throws(1:HelperServiceException hse),
        
    // Methods to read agent information
    list<Agent> getAgents(),
    bool validateLogIn(1:string emailId, 2:string password),
    void updatePasswordForAgent(1:string agentEmailId, 2:string password),

    // Methods to read roles and permissions information
    list<string> getRoleNamesForAgent(1:string agentEmailId),
    list<string> getPermissionsForRoleName(1:string roleName),
    
    //Methods to save and read QuickLinks
    void saveQuickLink(1:string url, 2:string text) throws(1:HelperServiceException hse),
    list<QuickLink> getQuickLinks() throws(1:HelperServiceException hse),
    void updateQuickLink(1:i64 id, 2:string url, 3:string text) throws(1:HelperServiceException hse),
    
        /**
        Returns a list of emails to which product notifications have been sent in a given date range
        */
        list<string> getEmailsForNotificationsSent(1:i64 startDatetime, 2:i64 endDatetime) throws(1:HelperServiceException hse),
        
        //Returns body of mail sent for order confirmation
        string getOrderConfirmationMail(1:i64 orderId),
        
        //Returns body of mail sent for delivery success
        string getOrderDeliveryMail(1:i64 orderId),
        
        list<i64> getWarehouseIdsForAgent(1:string agentEmailId),
        
        i64 saveUserSmsForSending(1:i64 userId, 2:string mobileNo, 3:string text, 4:SmsType type) throws (1:HelperServiceException se),
        
        list<UserSms> getSmsToBeSent() throws (1:HelperServiceException se),
        
        void addUserSmsInfo(1:UserSmsInfo userSmsInfo) throws (1:HelperServiceException se),
        
        bool updateUserSmsInfo(1:UserSmsInfo userSmsInfo) throws (1:HelperServiceException se),
        
        UserSmsInfo getUserSmsInfo(1:i64 userId) throws (1:HelperServiceException se),
        
        list<UserSmsInfo> getAllUsersSmsInfo(1:bool dndStatus, 2:bool smsSubscribed) throws (1:HelperServiceException se),
         
        list<UserSms> listSmsToGetDeliveryInfo() throws (1:HelperServiceException se),
        
        bool markMessagesAsSentToOperator(list<UserSms> userSmsList),
        
        bool markMessagesAsSubmittedToSmsc(list<UserSms> userSmsList),
        
        bool markMessagesAsSent(list<UserSms> userSmsList),
        
        bool markMessagesAsRetry(list<UserSms> userSmsList),
        
        DealerAuth authoriseDealer(1:DealerAuth dealer)
        
        string addCampaignNotification(1:string email, 2:i64 campaignType); 
}