/// <summary> /// Consulta la información de un cliente /// </summary> /// <param name="request">Objeto que contiene todos los datos de autenticacion del usuario e información de la consulta</param> /// <returns>Respuesta de la consulta</returns> ConsultaClienteResponse ICash472ApiRest.ConsultaCliente(ConsultaClienteRequest request) { return(this.ConsultaCliente(request)); }
/// <summary> /// Consulta la información de un cliente /// </summary> /// <param name="request">Objeto que contiene todos los datos de autenticacion del usuario e información de la consulta</param> /// <returns>Respuesta de la consulta</returns> private ConsultaClienteResponse ConsultaCliente(ConsultaClienteRequest request) { return((new Provider.Cash472.CashProvider()).ConsultaCliente(request)); }
/// <summary> /// Consulta de un cliente /// </summary> /// <param name="request">Objeto que contiene todos los datos de autenticacion del usuario e información de la consulta</param> /// <returns>Información del cliente en caso de que exista</returns> public ConsultaClienteResponse ConsultaCliente(ConsultaClienteRequest request) { string methodName = string.Format("{0}", System.Reflection.MethodBase.GetCurrentMethod().Name); this.LogRequest(request); ConsultaClienteResponse response = new ConsultaClienteResponse(); string sessionId = this.GetSessionId(request, response, out this.errorMessage); if (this.errorMessage != ErrorMessagesMnemonics.None) { this.LogResponse(response); return(response); } if (!request.IsValidRequest()) { this.SetResponseErrorCode(response, ErrorMessagesMnemonics.InvalidRequiredFields); this.LogResponse(response); return(response); } // Validar en listas restrictivas ErrorMessagesMnemonics errorMessageRestrictiva = ErrorMessagesMnemonics.None; int ocurrenciaListas = this.GetInfoClienteListasRestrictivas(sessionId, request.TipoIdentificacion, request.NumeroIdentificacion, out errorMessageRestrictiva); // Obtener informacion del cliente en BD ErrorMessagesMnemonics errorMessageCliente = ErrorMessagesMnemonics.None; DwhModel.Cliente infoCliente = this.GetInfoCliente(sessionId, request.TipoIdentificacion, request.NumeroIdentificacion, out errorMessageCliente); if (errorMessageRestrictiva != ErrorMessagesMnemonics.None && errorMessageCliente == ErrorMessagesMnemonics.None) { // Cliente en listas restrictivas y enrolado if (request.FechaExpedicion != null && request.FechaExpedicion.HasValue) { if (infoCliente.FechaExpedicion == null && !infoCliente.FechaExpedicion.HasValue) { // Cliente enrolado sin Fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientWithoutDateEspeditionLists); response.Cliente = new DataContract.Cash472.Cliente(); this.EstablecerValoresCliente(response.Cliente, infoCliente); } else if (request.FechaExpedicion.Value.ToString("yyyy-MM-dd").Equals(infoCliente.FechaExpedicion.Value.ToString("yyyy-MM-dd"))) { // Cliente enrolado con la misma fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientInRestrictiveListsAndDatabase); response.Cliente = new DataContract.Cash472.Cliente(); this.EstablecerValoresCliente(response.Cliente, infoCliente); } else { // Cliente enrolado con otra fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientWithAnotherDateEspeditionLists); } } else { // Cliente enrolado no importa la fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientInRestrictiveListsAndDatabase); response.Cliente = new DataContract.Cash472.Cliente(); this.EstablecerValoresCliente(response.Cliente, infoCliente); } } else if (errorMessageRestrictiva != ErrorMessagesMnemonics.None && errorMessageCliente != ErrorMessagesMnemonics.None) { // Cliente en listas restrictivas y no enrolado. this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientInRestrictiveListsAndNotInDatabase); } else if (errorMessageRestrictiva == ErrorMessagesMnemonics.None && errorMessageCliente != ErrorMessagesMnemonics.None) { // Cliente No esta en listas restrictivas y no esta enrolado. this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientNotInRestrictiveListsAndNotInDatabase); } else if (errorMessageRestrictiva == ErrorMessagesMnemonics.None && errorMessageCliente == ErrorMessagesMnemonics.None) { // Cliente No esta en listas restrictivas y enrolado. if (request.FechaExpedicion != null && request.FechaExpedicion.HasValue) { if (infoCliente.FechaExpedicion == null && !infoCliente.FechaExpedicion.HasValue) { // Cliente enrolado con fecha de expedicion null this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientWithoutDateEspeditionNoLists); response.Cliente = new DataContract.Cash472.Cliente(); this.EstablecerValoresCliente(response.Cliente, infoCliente); } else if (request.FechaExpedicion.Value.ToString("yyyy-MM-dd").Equals(infoCliente.FechaExpedicion.Value.ToString("yyyy-MM-dd"))) { // Cliente enrolado con la misma fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientNotInRestrictiveListsAndInDatabase); response.Cliente = new DataContract.Cash472.Cliente(); this.EstablecerValoresCliente(response.Cliente, infoCliente); } else { // Cliente enrolado con otra fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientWithAnotherDateEspeditionNoLists); } } else { // Cliente enrolado no importa la fecha de expedicion this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientNotInRestrictiveListsAndInDatabase); response.Cliente = new DataContract.Cash472.Cliente(); this.EstablecerValoresCliente(response.Cliente, infoCliente); } } else { this.SetResponseErrorCode(response, ErrorMessagesMnemonics.ClientNotInRestrictiveListsAndNotInDatabase); } this.LogResponse(response); return(response); }