Exemplo n.º 1
0
        public void EncodeClientOrder()
        {
            UrlEncoder urlEncoder = new UrlEncoder();

            Client.Order order = Client.CreateOrder();
            order.ByCreatedAt().Asc();
            String encodedObject = urlEncoder.EncodeFilterParameters(null, order, 20, 9);

            Assert.IsNotNull(encodedObject);
            Assert.AreEqual(encodedObject, "order=created_at_asc&count=20&offset=9");
        }
Exemplo n.º 2
0
        /// <summary>
        /// This function returns a <see cref="PaymillList"/> of PAYMILL  objects. In which order this list is returned depends on the
        /// optional parameters. If null is given, no filter or order will be applied, overriding the default count and
        /// offset.
        /// </summary>
        /// <param name="filter">Filter or null</param>
        /// <param name="order">Order or null.</param>
        /// <param name="count">Max count of returned objects in the PaymillList</param>
        /// <param name="offset">The offset to start from.</param>
        /// <returns>PaymillList which contains a List of PAYMILL objects and their total count.</returns>
        protected async Task <PaymillWrapper.Models.PaymillList <T> > listAsync(Object filter, Object order, int?count, int?offset)
        {
            var        encoder      = new UrlEncoder();
            String     encodedParam = encoder.EncodeFilterParameters(filter, order, count, offset);
            string     requestUri   = _apiUrl + "/" + _resource.ToString().ToLower();
            UriBuilder urlBuilder   = new UriBuilder(requestUri);

            urlBuilder.Query = encodedParam;
            HttpResponseMessage response = httpClient.GetAsync(urlBuilder.Uri).Result;
            String data = await readReponseMessage(response);

            return(ReadResults <T>(data));
        }
Exemplo n.º 3
0
        public void EncodeClientFilter()
        {
            UrlEncoder urlEncoder = new UrlEncoder();

            Client.Filter filter = Client.CreateFilter();
            filter.ByEmail("*****@*****.**");
            filter.ByPayment("_pay12345678");
            filter.BySubscriptionId("_subs12345678");
            filter.ByOfferId("_offery12345678");
            filter.ByCreatedAt(unixEpoch.AddSeconds(1340199740), unixEpoch.AddSeconds(1340199741));
            filter.ByUpdatedAt(unixEpoch.AddSeconds(1385145851), unixEpoch.AddSeconds(1385145851));

            String encodedObject = urlEncoder.EncodeFilterParameters(filter, null, 20, 9);

            Assert.IsNotNull(encodedObject);
            Assert.AreEqual(encodedObject, "payment=_pay12345678&subscription=_subs12345678&offer=_offery12345678&email=john.rambo%40qaiware.com&created_at=1340199740-1340199741&updated_at=1385145851-1385145851&count=20&offset=9");
        }
Exemplo n.º 4
0
        public void EncodeClientFilter()
        {
            UrlEncoder urlEncoder = new UrlEncoder();
            Client.Filter filter = Client.CreateFilter();
            filter.ByEmail("*****@*****.**");
            filter.ByPayment("_pay12345678");
            filter.BySubscriptionId("_subs12345678");
            filter.ByOfferId("_offery12345678");
            filter.ByCreatedAt(unixEpoch.AddSeconds(1340199740), unixEpoch.AddSeconds(1340199741));
            filter.ByUpdatedAt(unixEpoch.AddSeconds(1385145851), unixEpoch.AddSeconds(1385145851));

            String encodedObject = urlEncoder.EncodeFilterParameters(filter, null, 20, 9);

            Assert.IsNotNull(encodedObject);
            Assert.AreEqual(encodedObject, "payment=_pay12345678&subscription=_subs12345678&offer=_offery12345678&email=john.rambo%40qaiware.com&created_at=1340199740-1340199741&updated_at=1385145851-1385145851&count=20&offset=9");
        }
Exemplo n.º 5
0
 public void EncodeClientOrder()
 {
     UrlEncoder urlEncoder = new UrlEncoder();
     Client.Order order = Client.CreateOrder();
     order.ByCreatedAt().Asc();
     String encodedObject = urlEncoder.EncodeFilterParameters(null, order, 20, 9);
     Assert.IsNotNull(encodedObject);
     Assert.AreEqual(encodedObject, "order=created_at_asc&count=20&offset=9");
 }