Exemplo n.º 1
0
        public void Authorization(Authorization authorization)
        {
            try
            {
                Connect();
            }
            catch (Exception e)
            {
                Error(e);
                Disconnect();
                return;
            }

            var request = JsonSerializer.Serialize(new Request {
                Type = RequestType.Authorization, Data = JsonSerializer.Serialize(authorization)
            });

            SendRequest(request);
        }
Exemplo n.º 2
0
        public AuthorizationResult Authorize(Authorization authorization)
        {
            AuthorizationResult result;
            var card = dataBase.GetCardById(authorization.CardId);

            if (card.Password == authorization.Password)
            {
                result = new AuthorizationResult {
                    Success = true
                }
            }
            ;
            else
            {
                result = new AuthorizationResult {
                    Success = false, Message = "Неверный пин-код"
                }
            };
            return(result);
        }