Beispiel #1
0
        public RegisterAgentResponse RegisterAgent(RegisterAgentRequest externalRequest)
        {
            Log(Logger.LogMessageType.Info, "->   -------------------- Comienza la ejecución del método Registration.RegisterAgent", Logger.LoggingLevelType.Medium);
            RegisterAgentResponse externalResponse = null;

            try
            {
                Log(Logger.LogMessageType.Info, String.Format("Llamando a AgentRegistration.RegisterAgent con los parametros: Agent={0}, Name={1}, LegalName={2}, Address={3}, PhoneNumber={4}," +
                                                              "ProvinceID={5}, CityID={6}, ContactName={7}, BirthDate={8}, Gender={9}, NationalIDType={10}, NationalID={11}, SMSAddress={12}, Email={13}, Referrer={14}," +
                                                              "MNO1={15}, MNO2={16}, MNO3={17}, MNO4={18}, MNO5={19}", externalRequest.Request.Agent, externalRequest.Request.Name, externalRequest.Request.LegalName, externalRequest.Request.Address,
                                                              externalRequest.Request.PhoneNumber, externalRequest.Request.ProvinceID, externalRequest.Request.CityID, externalRequest.Request.ContactName, externalRequest.Request.BirthDate,
                                                              externalRequest.Request.Gender, externalRequest.Request.NationalIDType, externalRequest.Request.NationalID, externalRequest.Request.SMSAddress, externalRequest.Request.Email,
                                                              externalRequest.Request.Referrer, externalRequest.Request.MNO1, externalRequest.Request.MNO2, externalRequest.Request.MNO3, externalRequest.Request.MNO4, externalRequest.Request.MNO5)
                    , Logger.LoggingLevelType.Low);


                RegisterAgentRequestInternal internalRequest = new RegisterAgentRequestInternal()
                {
                    Address        = externalRequest.Request.Address,
                    Agent          = externalRequest.Request.Agent,
                    BirthDate      = externalRequest.Request.BirthDate,
                    CityID         = externalRequest.Request.CityID,
                    ContactName    = externalRequest.Request.ContactName,
                    CountryID      = _countryID,
                    Email          = externalRequest.Request.Email,
                    Gender         = (API.Service.Internal.Gender)externalRequest.Request.Gender,
                    LegalName      = externalRequest.Request.LegalName,
                    MNO1           = externalRequest.Request.MNO1,
                    MNO2           = externalRequest.Request.MNO2,
                    MNO3           = externalRequest.Request.MNO3,
                    MNO4           = externalRequest.Request.MNO4,
                    MNO5           = externalRequest.Request.MNO5,
                    Name           = externalRequest.Request.Name,
                    NationalID     = externalRequest.Request.NationalID,
                    NationalIDType = externalRequest.Request.NationalIDType,
                    PhoneNumber    = externalRequest.Request.PhoneNumber,
                    ProvinceID     = externalRequest.Request.ProvinceID,
                    Referrer       = externalRequest.Request.Referrer,
                    SessionID      = externalRequest.Request.SessionID,
                    SMSAddress     = externalRequest.Request.SMSAddress
                };
                RegisterAgentResponseInternal internalResponse     = RegisterAgentInternal(internalRequest, 1);
                RegisterAgentResponseBody     externalResponseBody = new RegisterAgentResponseBody()
                {
                    ResponseCode    = internalResponse.ResponseCode,
                    ResponseMessage = internalResponse.ResponseMessage
                };
                externalResponse          = new RegisterAgentResponse();
                externalResponse.Response = externalResponseBody;

                Log(Logger.LogMessageType.Info, String.Format("Parametros de respuesta de AgentRegistration.RegisterAgent: ResponseCode={0}, ResponseMessage={1}, TransactionID={2}", externalResponse.Response.ResponseCode, externalResponse.Response.ResponseMessage, externalResponse.Response.TransactionID), Logger.LoggingLevelType.Low);
            }
            catch (Exception e)
            {
                Log(Logger.LogMessageType.Error, "Excepcion en el metodo AgentRegistration.RegisterAgent: " + e.ToString(), Logger.LoggingLevelType.Low);
            }
            Log(Logger.LogMessageType.Info, "->   -------------------- Termina la ejecución del método Registration.RegisterAgent", Logger.LoggingLevelType.Medium);
            return(externalResponse);
        }
        public IActionResult RegisterAgent([FromBody] RegisterAgentRequest agentInfo)
        {
            _logger.LogInformation("RegisterAgent AgentAddress:{0} AgentId {1}", agentInfo.AgentAddress, agentInfo.AgentId);

            _agents.RegisterAgent(new Agents()
            {
                AgentId = agentInfo.AgentId, AgentUrl = agentInfo.AgentAddress.AbsoluteUri, Enabled = true
            });
            return(Ok());
        }
        public void RegisterAgent_ReturnOk()
        {
            //Arrange
            var agentInfo = new RegisterAgentRequest()
            {
                AgentId = 1, AgentAddress = new Uri("http://localhost:51684/api/agent")
            };

            //Act
            var result = agentsController.RegisterAgent(agentInfo);

            //Assert
            _ = Assert.IsAssignableFrom <IActionResult>(result);
        }
Beispiel #4
0
        private States RegisterAgent()
        {
            var uri  = Url.Combine(this.BuildServer, "/agents/register");
            var req  = new RegisterAgentRequest(this);
            var auth = GetJwtToken();

            var client = new HttpClient <JsonKeyValuePairs>();
            var res    = client.Post(uri, req, auth);

            if (res.Code == 201)
            {
                var resAgent = (JsonKeyValuePairs)res.Body["agent"];
                this.ID = (string)resAgent["_id"];
                return(States.Idle);
            }

            return(States.Idle);
        }
Beispiel #5
0
 public RegisterAgentResponse RegisterAgent(RegisterAgentRequest request)
 {
     return(WrapResponse <RegisterAgentResponse, RegisterAgentResponseBody>(new ServiceExecutionDelegator <RegisterAgentResponseBody, RegisterAgentRequestBody>().ResolveRequest(request.Request,
                                                                                                                                                                                 ApiTargetPlatform.Utiba, ApiServiceName.RegisterAgent)));
 }