예제 #1
0
 public ProxyUsersCommunicationsNodeRequestHandler(NodeRequest request, NodeConnection current, IAppServiceProvider serviceProvider)
 {
     this.request         = (ProxyUsersCommunicationsNodeRequest)request;
     this.current         = current;
     clientRequestService = new ClientRequestService(serviceProvider.NoticeService);
     this.serviceProvider = serviceProvider;
 }
예제 #2
0
        public async Task RealCaseJSONGeocodeTest()
        {
            ICreateRequestService <GeocodeRequest> requestService = new CreateBasicRequestService <GeocodeRequest>();

            requestService.BaseRequest = @"http://maps.googleapis.com/maps/api/geocode/json?";
            requestService.Equal       = "=";
            requestService.Separator   = "&";
            IClientService clientService = new ClientRequestService();
            ISerializeService <IntegrationTest.Classes.JSONClasses.GeocodeResponse> serializeService = new SerializeJsonService <IntegrationTest.Classes.JSONClasses.GeocodeResponse>();

            IRestService <GeocodeRequest, IntegrationTest.Classes.JSONClasses.GeocodeResponse> restService = new RestService <GeocodeRequest, IntegrationTest.Classes.JSONClasses.GeocodeResponse>(
                requestService, clientService, serializeService);

            GeocodeRequest request = new GeocodeRequest()
            {
                Address  = "Valladolid",
                Language = "es",
                Region   = "es",
                Sensor   = "false"
            };

            var response = await restService.Get(request);

            Assert.AreEqual("OK", response.Status);
            Assert.IsTrue(response.Geocode[0].Geometry.Location.Latitude > 0f);
            Assert.IsTrue(response.Geocode[0].Geometry.Location.Longitude < 0f);
        }
예제 #3
0
        public async Task SimpleGetDataTest()
        {
            string dummyURL = "http://www.google.com";
            ClientRequestService clientWeb = new ClientRequestService();
            var result = await clientWeb.GetData(dummyURL);

            Assert.IsTrue(result.Contains("google"));
        }
        private async Task <Response> GetTokenizedCreditCard()
        {
            var clientResponse = await ClientRequestService.SendRequestAsync(Request.Headers.ToRequestParameter());

            if (clientResponse.StatusCode != HttpStatusCode.OK)
            {
                throw new HttpRequestException();
            }

            var checkoutDetails = clientResponse.SoapResponse.ToCheckoutDetails();

            var tokenFromTokeniser = await new TokeniserService(GetTokeniserUrl(Request.Url.HostName, _tokeniserUrl, _tokeniserUrlDomainPlaceHolder))
                                     .GetTokenAsync(checkoutDetails.ToCreditCard());

            checkoutDetails.CardNumber = tokenFromTokeniser;

            return(Response.AsJson(checkoutDetails));
        }
예제 #5
0
        private static async Task <Location> GetCoordinates(string address)
        {
            ICreateRequestService <GeocodeRequest> requestService = new CreateBasicRequestService <GeocodeRequest>();

            requestService.BaseRequest = @"http://maps.googleapis.com/maps/api/geocode/xml?";
            requestService.Equal       = "=";
            requestService.Separator   = "&";
            IClientService clientService = new ClientRequestService();
            ISerializeService <GeocodeResponse> serializeService = new SerializeXmlService <GeocodeResponse>();

            IRestService <GeocodeRequest, GeocodeResponse> restService = new RestService <GeocodeRequest, GeocodeResponse>(
                requestService, clientService, serializeService);

            GeocodeRequest request = new GeocodeRequest()
            {
                Address  = address,
                Language = "es",
                Region   = "es",
                Sensor   = "false"
            };
            var response = await restService.Get(request);

            return(response.Geocode.Geometry.Location);
        }