Exemplo n.º 1
0
        public async Task <IActionResult> GetAccountInfo(string accountNumber)
        {
            ClientValidationProduct product = new ClientValidationProduct();

            if (string.IsNullOrEmpty(accountNumber))
            {
                return(BadRequest(new FrontStatusCode("Debes especificar una cuenta para realizar la consulta")));
            }

            try
            {
                var genericRequest = new GetGeneric <BeneficiaryAccount>(GenericEndPoints.BeneficiaryValidateAccount, accountNumber);

                var response = _broker.SendBroker <MQResponse4 <BeneficiaryAccount> >(genericRequest);


                if (response.CodigoError == Enums.GetEnumDescription(ResponseCode.Fail))
                {
                    return(BadRequest(new FrontStatusCode(!string.IsNullOrEmpty(response.DescripcionError) ? response.DescripcionError : "Hubo un inconveniente al recuperar los datos de la cuenta.")));
                }

                product = new ClientValidationProduct()
                {
                    ClientName  = response.Data.FullName,
                    Image       = response.Data.PhotoImge,
                    ProductType = Enums.GetValueFromDescription <ProductType2>(response.Data.Type),
                    Status      = response.Data.Status
                };
            }
            catch (Exception ex)
            {
                return(StatusCode(500, string.Format($"{Enums.GetEnumDescription(ApiMessages.DefaultError)} {ex.Message} ")));
            }

            await Task.CompletedTask;

            return(Ok(product));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Get()
        {
            Profile profile = new Profile();

            try
            {
                JwtData jwtToken = (JwtData)RouteData.Values["jwtData"];

                var genericRequest = new GetGeneric <GenericProfile>(GenericEndPoints.ClientGet, jwtToken.UserName);

                var response = _broker.SendBroker <MQResponse4 <GenericProfile> >(genericRequest);


                if (response.CodigoError != Enums.GetEnumDescription(ResponseCode.Success))
                {
                    return(BadRequest(new FrontStatusCode(!string.IsNullOrEmpty(response.DescripcionError) ? response.DescripcionError : "Hubo un inconveniente al tratar de recuperar el perfil de usuario")));
                }

                profile = new Profile()
                {
                    Email   = response.Data.Email,
                    Name    = response.Data.FullName,
                    PayMeID = response.Data.PaymeId,
                    Image   = response.Data.PhotoImage,
                    ExistInAlternateDomain = false
                };
            }
            catch (Exception ex)
            {
                return(StatusCode(500, string.Format($"{Enums.GetEnumDescription(ApiMessages.DefaultError)} {ex.Message} ")));
            }

            await Task.CompletedTask;

            return(Ok(profile));
        }
        public void UpdateGeneric(Dictionary<string, int> inbound, Dictionary<string, bool> outbound, GetGeneric getFunc, OnChangeGeneric changeFunc) {
            Dictionary<string, bool> results = getFunc(inbound);
            foreach (var pair in results) {
                bool old_val = false;
                bool val = pair.Value;

                if (outbound.ContainsKey(pair.Key)) {
                    old_val = outbound[pair.Key];
                }

                if (val != old_val) {
                    outbound[pair.Key] = val;
                    changeFunc(pair.Key, val);
                }
            }
        }
Exemplo n.º 4
0
        public void UpdateGeneric(Dictionary <string, int> inbound, Dictionary <string, bool> outbound, GetGeneric getFunc, OnChangeGeneric changeFunc)
        {
            Dictionary <string, bool> results = getFunc(inbound);

            foreach (var pair in results)
            {
                bool old_val = false;
                bool val     = pair.Value;

                if (outbound.ContainsKey(pair.Key))
                {
                    old_val = outbound[pair.Key];
                }

                if (val != old_val)
                {
                    outbound[pair.Key] = val;
                    changeFunc(pair.Key, val);
                }
            }
        }