Esempio n. 1
0
        public IActionResult GetUserInfo()
        {
            SingleResponse <AuthorizationResponse> response = new SingleResponse <AuthorizationResponse>();

            string sessionId = "";
            byte   language  = 0;

            //Սեսիայի նունականացման համար
            if (!string.IsNullOrEmpty(HttpContext.Request.Headers["SessionId"]))
            {
                sessionId = HttpContext.Request.Headers["SessionId"];
            }

            //Լեզու
            if (!string.IsNullOrEmpty(HttpContext.Request.Headers["language"]))
            {
                byte.TryParse(HttpContext.Request.Headers["language"], out language);
            }

            OnlineBankingUser onlineUserData = _xbSecurityService.CheckAuthorization(sessionId, language);

            if (onlineUserData.AuthorizationResult.IsAuthorized)
            {
                CustomerMainData customerMainData = _xbService.GetCustomerMainData(ulong.Parse(onlineUserData.CustomerNumber));

                if (customerMainData.CustomerType != 6)
                {
                    var str     = customerMainData.CustomerDescription;
                    var symbols = new string[] { "«", "»" };
                    foreach (var s in symbols)
                    {
                        str = str.Replace(s, "");
                    }

                    customerMainData.CustomerDescription = str;
                }

                response.Result           = new AuthorizationResponse();
                response.Result.SessionId = onlineUserData.SessionID;
                response.Result.PasswordChangeRequirement = onlineUserData.ChangeRequirement;
                response.Result.UserPermission            = onlineUserData.Permission;
                response.Result.FullName                 = customerMainData.CustomerDescription;
                response.Result.FullNameEnglish          = customerMainData.CustomerDescriptionEng;
                response.Result.IsLastConfirmer          = onlineUserData.IsLastConfirmer;
                response.Result.CustomerType             = (XBS.CustomerTypes)onlineUserData.TypeOfClient;
                response.Result.SecondConfirmRequirement = onlineUserData.SecondConfirm;
                response.Result.IsEmployee               = _xbService.IsEmployee(ulong.Parse(onlineUserData.CustomerNumber));
                response.Result.UserName                 = onlineUserData.UserName;
                response.ResultCode = ResultCodes.normal;
                try
                {
                    response.Result.TotalAvailableBalance = _xbService.GetUserTotalAvailableBalance(onlineUserData.UserID, ulong.Parse(onlineUserData.CustomerNumber));
                }
                catch (Exception)
                {
                    response.Result.TotalAvailableBalance = null;
                }
            }
            return(ResponseExtensions.ToHttpResponse(response));
        }
Esempio n. 2
0
        public OnlineBankingUser AuthorizeUser(LoginInfo loginInfo, byte lang)
        {
            var result = new OnlineBankingUser();

            this.Use(
                client => { result = client.AuthorizeUserAsync(loginInfo, lang).Result; }
                );
            return(result);
        }
Esempio n. 3
0
        public OnlineBankingUser AuthorizeUserByToken(LoginInfo loginInfo, LoginResult loginResult, byte language, string hostName)
        {
            OnlineBankingUser onlineBankingUser = null;

            this.Use(
                client => { onlineBankingUser = client.AuthorizeUserByTokenAsync(loginInfo, loginResult, language, hostName).Result; }
                );
            return(onlineBankingUser);
        }
Esempio n. 4
0
        public OnlineBankingUser AuthorizeUserByUserPassword(XBSecurity.LoginInfo loginInfo, byte language, string hostName = "")
        {
            OnlineBankingUser onlineBankingUser = null;

            this.Use(
                client => { onlineBankingUser = client.AuthorizeUserByUserPasswordAsync(loginInfo, language, hostName).Result; }
                );
            return(onlineBankingUser);
        }
Esempio n. 5
0
        public OnlineBankingUser CheckAuthorization(string sessionId, byte language)
        {
            var result = new OnlineBankingUser();

            this.Use(
                client => { result = client.CheckAuthorizationAsync(sessionId, language).Result; }
                );
            return(result);
        }
Esempio n. 6
0
        public OnlineBankingUser ChangeUserPassword(ChangePasswordInfo changePasswordInfo, string sessionId, byte language)
        {
            var result = new OnlineBankingUser();

            this.Use(
                client => { result = client.ChangeUserPasswordAsync(changePasswordInfo, sessionId, language).Result; }
                );
            return(result);
        }