Skip to content

Commit

Permalink
Merge pull request #36 from sherweb/rcayouette/beta07
Browse files Browse the repository at this point in the history
Update NuGet source code and JSON API for version 1.0.0-beta07
  • Loading branch information
RaphCayou authored Nov 23, 2023
2 parents f2c1ff8 + c506998 commit 9afc1db
Show file tree
Hide file tree
Showing 9 changed files with 264 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public Charge()
/// </summary>
/// <param name="chargeType">Possible values include: 'Setup',
/// 'Recurring', 'Usage', 'Unknown'</param>
/// <param name="billingCycleType">Possible values include: 'OneTime',
/// 'Monthly', 'Yearly'</param>
/// <param name="costPrice">Price paid per unit.</param>
/// <param name="costPriceProrated">Prorated price paid per
/// unit.</param>
/// <param name="isProratable">Indicates whether or not the price of
/// the charge is proratable.</param>
public Charge(string productName = default(string), string sku = default(string), System.Guid? chargeId = default(System.Guid?), string chargeName = default(string), string chargeType = default(string), string billingCycleType = default(string), System.DateTime? periodFrom = default(System.DateTime?), System.DateTime? periodTo = default(System.DateTime?), double? quantity = default(double?), double? costPrice = default(double?), double? costPriceProrated = default(double?), string currency = default(string), bool? isProratable = default(bool?))
/// <param name="billingCycleType">Possible values include: 'OneTime',
/// 'Monthly', 'Yearly'</param>
public Charge(string productName, string sku, string chargeName, string chargeType, System.DateTime periodFrom, System.DateTime periodTo, double quantity, double costPrice, double costPriceProrated, string currency, bool isProratable, System.Guid? chargeId = default(System.Guid?), string billingCycleType = default(string))
{
ProductName = productName;
Sku = sku;
Expand Down Expand Up @@ -97,30 +97,30 @@ public Charge()
/// </summary>
[JsonConverter(typeof(DateJsonConverter))]
[JsonProperty(PropertyName = "periodFrom")]
public System.DateTime? PeriodFrom { get; set; }
public System.DateTime PeriodFrom { get; set; }

/// <summary>
/// </summary>
[JsonConverter(typeof(DateJsonConverter))]
[JsonProperty(PropertyName = "periodTo")]
public System.DateTime? PeriodTo { get; set; }
public System.DateTime PeriodTo { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "quantity")]
public double? Quantity { get; set; }
public double Quantity { get; set; }

/// <summary>
/// Gets or sets price paid per unit.
/// </summary>
[JsonProperty(PropertyName = "costPrice")]
public double? CostPrice { get; set; }
public double CostPrice { get; set; }

/// <summary>
/// Gets or sets prorated price paid per unit.
/// </summary>
[JsonProperty(PropertyName = "costPriceProrated")]
public double? CostPriceProrated { get; set; }
public double CostPriceProrated { get; set; }

/// <summary>
/// </summary>
Expand All @@ -132,7 +132,36 @@ public Charge()
/// proratable.
/// </summary>
[JsonProperty(PropertyName = "isProratable")]
public bool? IsProratable { get; set; }
public bool IsProratable { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (ProductName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "ProductName");
}
if (Sku == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Sku");
}
if (ChargeName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "ChargeName");
}
if (ChargeType == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "ChargeType");
}
if (Currency == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Currency");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Customer()
/// </summary>
/// <param name="suspendedOn">Format: yyyy-MM-ddTHH:mm:ss.fffffffK
/// (UTC). Example : 2021-01-13T20:30:05.7613888</param>
public Customer(System.Guid? id = default(System.Guid?), string displayName = default(string), IList<string> path = default(IList<string>), System.DateTime? suspendedOn = default(System.DateTime?))
public Customer(System.Guid id, string displayName, IList<string> path, System.DateTime? suspendedOn = default(System.DateTime?))
{
Id = id;
DisplayName = displayName;
Expand All @@ -43,24 +43,33 @@ public Customer()
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid? Id { get; set; }
public System.Guid Id { get; private set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "displayName")]
public string DisplayName { get; set; }
public string DisplayName { get; private set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "path")]
public IList<string> Path { get; set; }
public IList<string> Path { get; private set; }

/// <summary>
/// Gets or sets format: yyyy-MM-ddTHH:mm:ss.fffffffK (UTC). Example :
/// Gets format: yyyy-MM-ddTHH:mm:ss.fffffffK (UTC). Example :
/// 2021-01-13T20:30:05.7613888
/// </summary>
[JsonProperty(PropertyName = "suspendedOn")]
public System.DateTime? SuspendedOn { get; set; }
public System.DateTime? SuspendedOn { get; private set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ReceivableCharges()
/// <summary>
/// Initializes a new instance of the ReceivableCharges class.
/// </summary>
public ReceivableCharges(System.DateTime? periodFrom = default(System.DateTime?), System.DateTime? periodTo = default(System.DateTime?), IList<Charge> charges = default(IList<Charge>))
public ReceivableCharges(System.DateTime periodFrom, System.DateTime periodTo, IList<Charge> charges)
{
PeriodFrom = periodFrom;
PeriodTo = periodTo;
Expand All @@ -46,18 +46,41 @@ public ReceivableCharges()
/// </summary>
[JsonConverter(typeof(DateJsonConverter))]
[JsonProperty(PropertyName = "periodFrom")]
public System.DateTime? PeriodFrom { get; set; }
public System.DateTime PeriodFrom { get; set; }

/// <summary>
/// </summary>
[JsonConverter(typeof(DateJsonConverter))]
[JsonProperty(PropertyName = "periodTo")]
public System.DateTime? PeriodTo { get; set; }
public System.DateTime PeriodTo { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "charges")]
public IList<Charge> Charges { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Charges == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Charges");
}
if (Charges != null)
{
foreach (var element in Charges)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Sherweb.Apis.ServiceProvider.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;

Expand All @@ -22,13 +23,24 @@ public Subscription()
/// <summary>
/// Initializes a new instance of the Subscription class.
/// </summary>
public Subscription(System.Guid? id = default(System.Guid?), string productName = default(string), string description = default(string), string sku = default(string), int? quantity = default(int?), SubscriptionCommitmentTerm commitmentTerm = default(SubscriptionCommitmentTerm))
/// <param name="billingCycle">A billing cycle, also referred to as a
/// billing period, is the interval of time between billing statements
/// Although billing cycles are most often set at one month, or one
/// year, they may vary in length depending on the SKU
/// Possible values: none, daily, weekly, monthly, yearly and
/// unknown</param>
/// <param name="purchaseDate">Format: yyyy-MM-ddTHH:mm:ss.fffffffK
/// (UTC). Example : 2023-11-21T20:27:05.7613888</param>
public Subscription(System.Guid id, string productName, string description, string sku, int quantity, string billingCycle, System.DateTime purchaseDate, SubscriptionFees fees = default(SubscriptionFees), SubscriptionCommitmentTerm commitmentTerm = default(SubscriptionCommitmentTerm))
{
Id = id;
ProductName = productName;
Description = description;
Sku = sku;
Quantity = quantity;
BillingCycle = billingCycle;
PurchaseDate = purchaseDate;
Fees = fees;
CommitmentTerm = commitmentTerm;
CustomInit();
}
Expand All @@ -41,7 +53,7 @@ public Subscription()
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid? Id { get; set; }
public System.Guid Id { get; set; }

/// <summary>
/// </summary>
Expand All @@ -61,12 +73,67 @@ public Subscription()
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "quantity")]
public int? Quantity { get; set; }
public int Quantity { get; set; }

/// <summary>
/// Gets or sets a billing cycle, also referred to as a billing period,
/// is the interval of time between billing statements
/// Although billing cycles are most often set at one month, or one
/// year, they may vary in length depending on the SKU
/// Possible values: none, daily, weekly, monthly, yearly and unknown
/// </summary>
[JsonProperty(PropertyName = "billingCycle")]
public string BillingCycle { get; set; }

/// <summary>
/// Gets or sets format: yyyy-MM-ddTHH:mm:ss.fffffffK (UTC). Example :
/// 2023-11-21T20:27:05.7613888
/// </summary>
[JsonProperty(PropertyName = "purchaseDate")]
public System.DateTime PurchaseDate { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "fees")]
public SubscriptionFees Fees { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "commitmentTerm")]
public SubscriptionCommitmentTerm CommitmentTerm { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (ProductName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "ProductName");
}
if (Description == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Description");
}
if (Sku == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Sku");
}
if (BillingCycle == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "BillingCycle");
}
if (Fees != null)
{
Fees.Validate();
}
if (CommitmentTerm != null)
{
CommitmentTerm.Validate();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SubscriptionCommitmentTerm()
/// 'Biennial', 'Triennial'</param>
/// <param name="termEndDate">The last day of the commitment
/// term</param>
public SubscriptionCommitmentTerm(string type = default(string), System.DateTime? termEndDate = default(System.DateTime?), SubscriptionRenewalConfiguration renewalConfiguration = default(SubscriptionRenewalConfiguration))
public SubscriptionCommitmentTerm(string type, System.DateTime termEndDate, SubscriptionRenewalConfiguration renewalConfiguration = default(SubscriptionRenewalConfiguration))
{
Type = type;
TermEndDate = termEndDate;
Expand All @@ -56,12 +56,29 @@ public SubscriptionCommitmentTerm()
/// </summary>
[JsonConverter(typeof(DateJsonConverter))]
[JsonProperty(PropertyName = "termEndDate")]
public System.DateTime? TermEndDate { get; set; }
public System.DateTime TermEndDate { get; set; }

/// <summary>
/// </summary>
[JsonProperty(PropertyName = "renewalConfiguration")]
public SubscriptionRenewalConfiguration RenewalConfiguration { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Type == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Type");
}
if (RenewalConfiguration != null)
{
RenewalConfiguration.Validate();
}
}
}
}
Loading

0 comments on commit 9afc1db

Please sign in to comment.