/// <summary> /// If enabled, allows specific line items and/or quantities to be refunded. /// </summary> /// <param name="adjustment"></param> /// <param name="prorate"></param> /// <param name="quantity"></param> /// <returns>new Invoice object</returns> public Invoice Refund(Adjustment adjustment, bool prorate = false, int quantity = 0) { var adjustments = new List<Adjustment>(); adjustments.Add(adjustment); return Refund(adjustments, prorate, quantity); }
/// <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; }
public static Adjustment Get(string uuid) { var adjustment = new Adjustment(); Client.Instance.PerformRequest(Client.HttpRequestMethod.Get, "/adjustments/" + Uri.EscapeUriString(uuid), adjustment.WriteXml); return adjustment; }
internal Refund(Adjustment adjustment, bool prorate, int quantity) { Prorate = prorate; Quantity = quantity; Uuid = adjustment.Uuid; }
/// <summary> /// If enabled, allows specific line items and/or quantities to be refunded. /// </summary> /// <param name="adjustment"></param> /// <param name="prorate"></param> /// <param name="quantity"></param> /// <returns>new Invoice object</returns> public Invoice Refund(Adjustment adjustment, bool prorate = false, int quantity = 0, RefundOrderPriority refundPriority = RefundOrderPriority.Credit) { var adjustments = new List<Adjustment>(); adjustments.Add(adjustment); return Refund(adjustments, prorate, quantity, refundPriority); }
/// <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; }