private Request GetRefundsInternal(Refund refund = null, Filter filter = null)
        {
            Dictionary <String, String> queryStr = new Dictionary <String, String>();

            if (refund != null && !String.IsNullOrWhiteSpace(refund.MerchantRefNum()))
            {
                queryStr.Add("merchantRefNum", refund.MerchantRefNum());
            }
            if (filter != null)
            {
                if (filter.Limit != null)
                {
                    queryStr.Add("limit", filter.Limit.ToString());
                }
                if (filter.Offset != null)
                {
                    queryStr.Add("offset", filter.Offset.ToString());
                }
                if (!String.IsNullOrWhiteSpace(filter.StartDate))
                {
                    queryStr.Add("startDate", filter.StartDate);
                }
                if (!String.IsNullOrWhiteSpace(filter.EndDate))
                {
                    queryStr.Add("endDate", filter.EndDate);
                }
            }

            return(new Request(
                       method: RequestType.Get,
                       uri: PrepareUri("/refunds"),
                       queryString: queryStr
                       ));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get matching refunds
        /// </summary>
        /// <param name="refund"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public Pagerator <Refund> GetRefunds(Refund refund = null, Filter filter = null)
        {
            Dictionary <String, String> queryStr = new Dictionary <String, String>();

            if (refund != null && !String.IsNullOrWhiteSpace(refund.MerchantRefNum()))
            {
                queryStr.Add("merchantRefNum", refund.MerchantRefNum());
            }
            if (filter != null)
            {
                if (filter.Limit != null)
                {
                    queryStr.Add("limit", filter.Limit.ToString());
                }
                if (filter.Offset != null)
                {
                    queryStr.Add("offset", filter.Offset.ToString());
                }
                if (!String.IsNullOrWhiteSpace(filter.StartDate))
                {
                    queryStr.Add("startDate", filter.StartDate);
                }
                if (!String.IsNullOrWhiteSpace(filter.EndDate))
                {
                    queryStr.Add("endDate", filter.EndDate);
                }
            }

            Request request = new Request(
                method: RequestType.Get,
                uri: PrepareUri("/refunds"),
                queryString: queryStr
                );

            dynamic response = _client.ProcessRequest(request);

            return(new Pagerator <Refund>(_client, typeof(Refund), response));
        }