Skip to content

Commit

Permalink
Merge pull request #84 from recurly/bulk-postpone
Browse files Browse the repository at this point in the history
Adding bulk parameter to Subscription
  • Loading branch information
cbarton committed Jul 2, 2015
2 parents ca04e5d + ffc8286 commit 530e466
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased
==================

* added; `bulk` param to `Postpone` call on `Subscription`
* fixed; no content returning from the server will no longer throw "Root element is missing"
* added; `TaxRegion` to `Invoice`
* added; `ProductCode` to `Adjustment`
Expand Down
20 changes: 13 additions & 7 deletions Library/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public Plan Plan

/// <summary>
/// Date the trial ends, if the subscription has/had a trial.
///
/// This may optionally be set on new subscriptions to specify an exact time for the
///
/// This may optionally be set on new subscriptions to specify an exact time for the
/// subscription to commence. The subscription will be active and in "trial" until
/// this date.
/// </summary>
Expand All @@ -136,7 +136,7 @@ public DateTime? TrialPeriodEndsAt
private DateTime? _trialPeriodEndsAt;

/// <summary>
/// If set, the subscription will begin in the future on this date.
/// If set, the subscription will begin in the future on this date.
/// The subscription will apply the setup fee and trial period, unless the plan has no trial.
/// </summary>
public DateTime? StartsAt { get; set; }
Expand Down Expand Up @@ -344,10 +344,16 @@ public void Preview()
Preview(ChangeTimeframe.Now);
}

public void Postpone(DateTime nextRenewalDate)
/// <summary>
/// For an active subscription, this will pause the subscription until the specified date.
/// </summary>
/// <param name="nextRenewalDate">The specified time the subscription will be postponed</param>
/// <param name="bulk">bulk = false (default) or true to bypass the 60 second wait while postponing</param>
public void Postpone(DateTime nextRenewalDate, bool bulk = false)

{
Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,
UrlPrefix + Uri.EscapeUriString(Uuid) + "/postpone?next_renewal_date=" + nextRenewalDate.ToString("yyyy-MM-ddThh:mm:ssZ"),
UrlPrefix + Uri.EscapeUriString(Uuid) + "/postpone?next_renewal_date=" + nextRenewalDate.ToString("yyyy-MM-ddThh:mm:ssZ") + "&bulk=" + bulk.ToString().ToLower(),
ReadXml);
}

Expand Down Expand Up @@ -452,7 +458,7 @@ internal override void ReadXml(XmlTextReader reader)
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
CurrentPeriodStartedAt = dateVal;
break;

case "current_period_ends_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
CurrentPeriodEndsAt = dateVal;
Expand Down Expand Up @@ -705,7 +711,7 @@ public sealed class Subscriptions
{
/// <summary>
/// Returns a list of recurly subscriptions
///
///
/// A subscription will belong to more than one state.
/// </summary>
/// <param name="state">State of subscriptions to return, defaults to "live"</param>
Expand Down

0 comments on commit 530e466

Please sign in to comment.