Beispiel #1
0
        /// <summary>
        /// Method Name     : GetContactListForMoveResponse
        /// Author          : Hiren Patel
        /// Creation Date   : 27 Dec 2017
        /// Purpose         : To Get contact list for move.
        /// Revision :
        /// </summary>
        /// <returns>The move data.</returns>
        /// <param name="moveId">Move identifier.</param>
        public async Task <APIResponse <GetContactListForMoveResponse> > GetContactListForMove(string moveId)
        {
            APIResponse <GetContactListForMoveResponse> response = new APIResponse <GetContactListForMoveResponse>()
            {
                STATUS = false
            };

            string apiURL = string.Format(Resource.MoveContactUrl, baseAPIUrl, moveId);
            HttpResponseMessage responseMessage = await apiHelper.InvokeGetAPI(apiURL);

            switch (responseMessage.StatusCode)
            {
            case HttpStatusCode.OK:
                response = await SerializeHttpResponse <APIResponse <GetContactListForMoveResponse> > .Deserialize(responseMessage);

                response.STATUS  = true;
                response.Message = Resource.msgGetContactListForMoveOK;
                break;

            case HttpStatusCode.NoContent:
                response.Message = Resource.msgGetContactListForMoveNoContent;
                break;

            case HttpStatusCode.NotFound:
                response.Message = Resource.msgGetContactListForMoveNotFound;
                break;

            default:
                response.Message = apiHelper.GetAPIResponseStatusCodeMessage(responseMessage);
                break;
            }
            return(response);
        }
Beispiel #2
0
        /// <summary>
        /// Method Name     : GetMoveData
        /// Author          : Hiren Patel
        /// Creation Date   : 27 Dec 2017
        /// Purpose         : Get move data
        /// Revision :
        /// </summary>
        /// <returns>The move data.</returns>
        /// <param name="moveId">Move identifier.</param>
        public async Task <APIResponse <GetMoveDataResponse> > GetMoveData(string moveId)
        {
            APIResponse <GetMoveDataResponse> response = new APIResponse <GetMoveDataResponse>()
            {
                STATUS = false
            };

            HttpResponseMessage httpResponseMessage = await apiHelper.InvokeGetAPI(baseAPIUrl + moveId);

            switch (httpResponseMessage.StatusCode)
            {
            case HttpStatusCode.OK:
                response = await SerializeHttpResponse <APIResponse <GetMoveDataResponse> > .Deserialize(httpResponseMessage);

                response.STATUS  = true;
                response.Message = Resource.msgGetMoveDataOk;
                break;

            case HttpStatusCode.NotFound:
                response.Message = Resource.msgGetMoveDataNotFound;
                break;

            default:
                response.Message = apiHelper.GetAPIResponseStatusCodeMessage(httpResponseMessage);
                break;
            }

            return(response);
        }
        /// <summary>
        /// Method Name     : SetDocumentResponseMessage
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 07 Feb 2018
        /// Purpose         : set response message as per http response
        /// Revision :
        /// </summary>
        /// <param name="httpResponseMessage"></param>
        /// <param name="response"></param>
        /// <returns></returns>
        private async Task <APIResponse <List <DocumentModel> > > SetDocumentResponseMessage(HttpResponseMessage httpResponseMessage, APIResponse <List <DocumentModel> > response)
        {
            switch (httpResponseMessage.StatusCode)
            {
            case HttpStatusCode.OK:
                response = await SerializeHttpResponse <APIResponse <List <DocumentModel> > > .Deserialize(httpResponseMessage);

                response.STATUS  = true;
                response.Message = Resource.msgGetDocumentService;
                break;

            case HttpStatusCode.NotFound:
                response.Message = Resource.msgUnregisteredCustomer;
                break;

            case HttpStatusCode.NoContent:
                response.Message = Resource.msgNoDocumentFound;
                break;

            default:
                response.Message = apiHelper.GetAPIResponseStatusCodeMessage(httpResponseMessage);
                break;
            }
            return(response);
        }
Beispiel #4
0
        /// <summary>
        /// Method Name     : SetResponseMessage
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 20 Feb 2018
        /// Purpose         : set response for httpresponse message base on input
        /// Revision        :
        /// </summary>
        /// <param name="httpResponseMessage"></param>
        /// <param name="response"></param>
        /// <returns></returns>
        private async Task <APIResponse <PaymentModel> > SetResponseMessage(HttpResponseMessage httpResponseMessage, APIResponse <PaymentModel> response, RequestType requestType)
        {
            switch (httpResponseMessage.StatusCode)
            {
            case HttpStatusCode.OK:
                if (requestType == RequestType.Get)
                {
                    response = await SerializeHttpResponse <APIResponse <PaymentModel> > .Deserialize(httpResponseMessage);

                    response.Message = Resource.msgGetDepositAmount;
                }
                else
                {
                    response.Message = Resource.msgPutAmount;
                }
                response.STATUS = true;
                break;

            case HttpStatusCode.BadRequest:
                response.Message = Resource.msgBadRequest;
                break;

            case HttpStatusCode.NotFound:
                response.Message = Resource.msgUnregisteredCustomer;
                break;

            default:
                response.Message = apiHelper.GetAPIResponseStatusCodeMessage(httpResponseMessage);
                break;
            }
            return(response);
        }
Beispiel #5
0
        /// <summary>
        /// Method Name     : SetMoveIdResponseMessage
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 29 Dec 2017
        /// Purpose         : set response base on http response
        /// Revision :
        /// </summary>
        /// <param name="httpResponseMessage"></param>
        /// <param name="response"></param>
        /// <returns></returns>
        private async Task <APIResponse <GetMoveIDModel> > SetMoveIdResponseMessage(HttpResponseMessage httpResponseMessage, APIResponse <GetMoveIDModel> response)
        {
            if (httpResponseMessage.StatusCode == HttpStatusCode.OK)
            {
                response = await SerializeHttpResponse <APIResponse <GetMoveIDModel> > .Deserialize(httpResponseMessage);

                response.STATUS  = true;
                response.Message = Resource.msgGetMoveService;
            }
            else
            {
                if (httpResponseMessage.StatusCode == HttpStatusCode.NoContent)
                {
                    response.Message = Resource.msgNoMoveForCustomer;
                }
                else
                {
                    response.Message = apiHelper.GetAPIResponseStatusCodeMessage(httpResponseMessage);
                }
            }
            return(response);
        }
Beispiel #6
0
        /// <summary>
        /// Method Name     : GetDeviceID
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 08 Feb 2018
        /// Purpose         : get Device id from service
        /// Revision        :
        /// </summary>
        /// <returns></returns>
        private async Task <string> GetDeviceID()
        {
            try
            {
                string apiURL = Resource.BaseAPIUrl + Resource.DeviceIDService;

                HttpResponseMessage httpResponseMessage = await apiHelper.InvokeGetAPI(apiURL);

                if (httpResponseMessage.StatusCode == HttpStatusCode.OK)
                {
                    PaymentModel paymentModel = await SerializeHttpResponse <PaymentModel> .Deserialize(httpResponseMessage);

                    return(paymentModel.Data.DeviceID);
                }

                return(string.Empty);
            }
            catch
            {
                return(string.Empty);
            }
        }
        /// <summary>
        /// Method Name     : GetResponse
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 07 Feb 2018
        /// Purpose         : set  response as per http response message
        /// Revision :
        /// </summary>
        /// <param name="response"></param>
        /// <param name="httpResponseMessage"></param>
        /// <returns></returns>
        private async Task GetResponse(APIResponse <GetDocumentPDF> response, HttpResponseMessage httpResponseMessage)
        {
            switch (httpResponseMessage.StatusCode)
            {
            case HttpStatusCode.OK:
                response = await SerializeHttpResponse <APIResponse <GetDocumentPDF> > .Deserialize(httpResponseMessage);

                response.STATUS  = true;
                response.Message = Resource.msgGetDocumentService;
                break;

            case HttpStatusCode.BadRequest:
                response.Message = Resource.msgBadRequest;
                break;

            case HttpStatusCode.NotFound:
                response.Message = Resource.msgInvalidDocumentID;
                break;

            default:
                response.Message = apiHelper.GetAPIResponseStatusCodeMessage(httpResponseMessage);
                break;
            }
        }