public async Task <Terminal> CreateNewTerminal(Guid tenantId, Guid storeId)
        {
            var userToken = await _authorizationApi.Login(_login, _password);

            _terminalApi.SetUserToken(userToken);
            var rnd         = (new Random()).Next(Int32.MaxValue);
            var terminalDto = new TerminalDto()
            {
                TerminalId     = Guid.NewGuid(),
                IsConfirmed    = true,
                Name           = "term" + rnd,
                StoreId        = storeId,
                TerminalNumber = rnd
            };
            var token    = (await _terminalApi.AddTerminalToStore(terminalDto)).Value;
            var terminal = new Terminal()
            {
                StoreId    = storeId,
                TenantId   = tenantId,
                TerminalId = terminalDto.TerminalId,
                Token      = token
            };

            _db.Terminals.Add(terminal);
            return(terminal);
        }
示例#2
0
        public async Task LoginToTerminal()
        {
            try
            {
                _context.EmployeeToken = await _authorizationApi.Login(_context.EmployeeLogin, _context.EmployeePassword);

                _terminalApi.SetUserToken(_context.EmployeeToken);
                _orderServiceApi.SetUserToken(_context.EmployeeToken);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                _context.EmployeeToken = "invalid password";
            }
            Debug.WriteLine("token: {0}", _context.EmployeeToken);
        }