Example #1
0
        /// <summary>
        /// 過去に作成した課金のリストを取得します。
        /// </summary>
        /// <param name="list">リストを取得する際の条件</param>
        /// <param name="customerid">課金情報を取得する対象の顧客ID</param>
        /// <returns>課金情報のリスト</returns>
        public ChargeList All(ListRequest list, string customerid)
        {
            string query = string.Empty;
            if (list != null || !string.IsNullOrWhiteSpace(customerid))
            {
                Dictionary<string, string> dic = new Dictionary<string, string>();

                if (list != null)
                {
                    list.ToFormContent(dic);
                }

                if (!string.IsNullOrWhiteSpace(customerid))
                {
                    dic.Add("customer", customerid);
                }

                query = HelperImpl.ToQueryString(dic);
            }

            HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, new Uri(parent.BaseUri, "charges?" + query));

            ChargeList retval = this.parent.SendRequest<ChargeList>(message);

            return retval;
        }
Example #2
0
        public void CustomerAll()
        {
            int loops = 1;
            List<string> ids = new List<string>();

            ListRequest req = new ListRequest();
            CustomerList res = null;

            for (int i = 0; i <= loops; i++)
            {
                req.Offset = req.Count * i;
                res = client.Customer.All(req);

                Assert.AreEqual(res.Url, "/v1/customers");
                Assert.AreEqual(res.ObjectType, "list");

                foreach (var cus in res.Customers)
                {
                    Assert.IsFalse(ids.Contains(cus.ID));
                    ids.Add(cus.ID);
                }

                loops = res.Count / req.Count;
            }

            Assert.AreEqual(res.Count, ids.Count);
        }
Example #3
0
        /// <summary>
        /// 顧客のリストを取得します。
        /// </summary>
        /// <param name="list">リストを取得する際の条件</param>
        /// <returns>顧客のリスト</returns>
        public CustomerList All(ListRequest list)
        {
            Dictionary<string, string> dic = list.ToFormContent(new Dictionary<string, string>());
            string query = HelperImpl.ToQueryString(dic);
            HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, new Uri(parent.BaseUri, "customers?" + query));

            CustomerList retval = this.parent.SendRequest<CustomerList>(message);

            return retval;
        }
Example #4
0
        private List<Charge> AllCharges()
        {
            List<Charge> retval = new List<Charge>();
            {
                int loops = 1;
                ListRequest req = new ListRequest();
                for (int i = 0; i <= loops; i++)
                {
                    req.Offset = req.Count * i;
                    var res = client.Charge.All(req);
                    retval.AddRange(res.Charges);

                    loops = res.Count / req.Count;
                }
            }

            return retval;
        }
Example #5
0
 /// <summary>
 /// 過去に作成した課金のリストを取得します。
 /// </summary>
 /// <param name="list">リストを取得する際の条件</param>
 /// <returns>課金情報のリスト</returns>
 public ChargeList All(ListRequest list)
 {
     return this.All(list, null);
 }