/// <summary> /// Resume a cancelled/paused subscription /// </summary> /// <returns>Indication of success</returns> public bool Resume() { var req = new Requests.Subscription { IsActive = true }; var response = Gateway.Put <Subscription>(String.Format("subscriptions/{0}.json", this.ID), req); this.IsActive = response.Result.IsActive; return(response.Successful); }
/// <summary> /// Create a new subscription /// </summary> /// <param name="customer_id">The Customer ID or Reference</param> /// <param name="plan_id">The Plan ID or Reference</param> /// <param name="frequency">Subscription frequency (Daily, Weekly, Fortnightly, Monthly, Quarterly, Bi-Annually, Annually)</param> /// <param name="reference">Your reference</param> /// <param name="start_date">Subscription start date</param> /// <param name="is_active">Indicates if the subscription is active or not.</param> /// <returns>Response</returns> public static Response <Subscription> Create(string customer_id, string plan_id, string frequency, string reference, DateTime start_date, bool is_active) { var req = new Requests.Subscription { CustomerID = customer_id, PlanID = plan_id, Reference = reference, Frequency = (SubscriptionFrequency)Enum.Parse(typeof(SubscriptionFrequency), frequency), StartDate = start_date, IsActive = is_active, TestMode = Gateway.TestMode }; return(Gateway.Post <Subscription>("subscriptions.json", req)); }
/// <summary> /// Resume a cancelled/paused subscription /// </summary> /// <returns>Indication of success</returns> public bool Resume() { var req = new Requests.Subscription { IsActive = true }; var response = Gateway.Put<Subscription>(String.Format("subscriptions/{0}.json", this.ID), req); this.IsActive = response.Result.IsActive; return response.Successful; }
/// <summary> /// Create a new subscription /// </summary> /// <param name="customer_id">The Customer ID or Reference</param> /// <param name="plan_id">The Plan ID or Reference</param> /// <param name="frequency">Subscription frequency (Daily, Weekly, Fortnightly, Monthly, Quarterly, Bi-Annually, Annually)</param> /// <param name="reference">Your reference</param> /// <param name="start_date">Subscription start date</param> /// <param name="is_active">Indicates if the subscription is active or not.</param> /// <returns>Response</returns> public static Response<Subscription> Create(string customer_id, string plan_id, string frequency, string reference, DateTime start_date, bool is_active) { var req = new Requests.Subscription { CustomerID = customer_id, PlanID = plan_id, Reference = reference, Frequency = (SubscriptionFrequency)Enum.Parse(typeof(SubscriptionFrequency), frequency), StartDate = start_date, IsActive = is_active, TestMode = Gateway.TestMode }; return Gateway.Post<Subscription>("subscriptions.json", req); }