Esempio n. 1
0
        /// <summary>
        /// Gets all adjustments for this account, by type
        /// </summary>
        /// <param name="type">Adjustment type to retrieve. Optional, default: All.</param>
        /// <param name="state">State of the Adjustments to retrieve. Optional, default: Any.</param>
        /// <returns></returns>
        public RecurlyList<Adjustment> GetAdjustments(Adjustment.AdjustmentType type = Adjustment.AdjustmentType.All,
            Adjustment.AdjustmentState state = Adjustment.AdjustmentState.Any)
        {
            var adjustments = new AdjustmentList();
            var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,
                UrlPrefix + Uri.EscapeUriString(AccountCode) + "/adjustments/"
                + Build.QueryStringWith(Adjustment.AdjustmentState.Any == state ? "" : "state=" + state.ToString().EnumNameToTransportCase())
                .AndWith(Adjustment.AdjustmentType.All == type ? "" : "type=" + type.ToString().EnumNameToTransportCase())
                , adjustments.ReadXmlList);

            return statusCode == HttpStatusCode.NotFound ? null : adjustments;
        }
Esempio n. 2
0
        /// <summary>
        /// Gets all adjustments for this account, by type
        /// </summary>
        /// <param name="type">Adjustment type to retrieve</param>
        /// <returns></returns>
        public AdjustmentList GetAdjustments(Adjustment.AdjustmentType type = Adjustment.AdjustmentType.all,
            Adjustment.AdjustmentState state = Adjustment.AdjustmentState.any)
        {
            AdjustmentList l = new AdjustmentList();
            HttpStatusCode statusCode = Client.PerformRequest(Client.HttpRequestMethod.Get,
                Account.UrlPrefix + System.Uri.EscapeUriString(this.AccountCode) + "/adjustments/?"
                + (Adjustment.AdjustmentState.any == state ? "" : "state=" + state.ToString())
                + (Adjustment.AdjustmentType.all == type ? "" : "&type=" + type.ToString())
                ,
                new Client.ReadXmlListDelegate(l.ReadXmlList));

            if (statusCode == HttpStatusCode.NotFound)
                return null;

            return l;
        }