Esempio n. 1
0
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            GetParentListRequestBody  request  = requestObject as GetParentListRequestBody;
            GetParentListResponseBody response = null;

            GetAgentInfoResponseBody agentInfo = new ServiceExecutionDelegator <GetAgentInfoResponseBody, GetAgentInfoRequestBody>().ResolveRequest(
                new GetAgentInfoRequestBody()
            {
                AuthenticationData = new AuthenticationData()
                {
                    SessionID = sessionID
                },
                Agent      = request.Agent,
                DeviceType = request.DeviceType
            }, ApiTargetPlatform.Utiba, ApiServiceName.GetAgentInfo);

            getParentListByReferenceIDResponse utibaGetParentListResponse = utibaClientProxy.getParentListByReferenceID(new getParentListByReferenceIDRequest()
            {
                getParentListByReferenceIDRequestType = new getParentListByReferenceIDRequestType()
                {
                    sessionid        = sessionID,
                    device_type      = request.DeviceType,
                    agentReferenceID = agentInfo.AgentInfo.ReferenceID
                }
            });

            //logger.InfoLow("Ajá: " + request.Agent + " vs " + agentInfo.AgentInfo.ReferenceID);

            if (utibaGetParentListResponse != null)
            {
                response = new GetParentListResponseBody()
                {
                    ResponseCode    = Utils.BuildResponseCode(utibaGetParentListResponse.getParentListByReferenceIDResponseType.result, utibaGetParentListResponse.getParentListByReferenceIDResponseType.result_namespace),
                    ResponseMessage = utibaGetParentListResponse.getParentListByReferenceIDResponseType.result_message,
                    TransactionID   = utibaGetParentListResponse.getParentListByReferenceIDResponseType.transid
                };


                if (utibaGetParentListResponse.getParentListByReferenceIDResponseType.agentList != null &&
                    utibaGetParentListResponse.getParentListByReferenceIDResponseType.agentList.Length > 0)
                {
                    response.ParentList = new ParentList();

                    foreach (Agent agent in utibaGetParentListResponse.getParentListByReferenceIDResponseType.agentList)
                    {
                        response.ParentList.Add(new BasicAgentInfo()
                        {
                            Agent = agent.reference,
                            Name  = agent.name
                        });
                    }
                }
            }

            return(response);
        }
Esempio n. 2
0
        public override IMovilwayApiResponse PerformKinacuOperation(IMovilwayApiRequest requestObject, SaleInterface kinacuWS, String sessionID)
        {
            if (sessionID.Equals("0"))
            {
                return new GetParentListResponseBody()
                       {
                           ResponseCode    = 90,
                           ResponseMessage = "error session",
                           TransactionID   = 0,
                           ParentList      = new ParentList()
                       }
            }
            ;

            GetParentListRequestBody  request  = requestObject as GetParentListRequestBody;
            GetParentListResponseBody response = null;

            response = new GetParentListResponseBody()
            {
                ResponseCode    = 0,
                ResponseMessage = "exito",
                TransactionID   = 0
            };

            string parentAgentInfo = Kinacu.Utils.GetParentAgent(request.AuthenticationData.Username);

            response.ParentList = new ParentList();

            response.ParentList.Add(new BasicAgentInfo()
            {
                Agent = parentAgentInfo.Split('-')[0],
                Name  = parentAgentInfo.Split('-')[1]
            });

            return(response);
        }
    }