Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #2290

Merged
merged 7 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ environment:
COVERALLS_REPO_TOKEN:
secure: T0PmP8uyzCseacBCDRBlti2y9Tz5DL6fknea0MKWvbPYrzADmLY2/5kOTfYIsPUk
# If you bump this, don't forget to bump `MinimumMockVersion` in `StripeMockFixture.cs` as well.
STRIPE_MOCK_VERSION: 0.101.0
STRIPE_MOCK_VERSION: 0.103.0

deploy:
- provider: NuGet
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Configuration : StripeEntity<Configuration>, IHasId, IHasObject
{
/// <summary>
/// Unique identifier for the object.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// String representing the object's type. Objects of the same type share the same value.
/// </summary>
[JsonProperty("object")]
public string Object { get; set; }

/// <summary>
/// Whether the configuration is active and can be used to create portal sessions.
/// </summary>
[JsonProperty("active")]
public bool Active { get; set; }

/// <summary>
/// ID of the Connect Application that created the configuration.
/// </summary>
[JsonProperty("application")]
public string Application { get; set; }

[JsonProperty("business_profile")]
public ConfigurationBusinessProfile BusinessProfile { get; set; }

/// <summary>
/// Time at which the object was created. Measured in seconds since the Unix epoch.
/// </summary>
[JsonProperty("created")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime Created { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch;

/// <summary>
/// The default URL to redirect customers to when they click on the portal's link to return
/// to your website. This can be <a
/// href="https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url">overriden</a>
/// when creating the session.
/// </summary>
[JsonProperty("default_return_url")]
public string DefaultReturnUrl { get; set; }

[JsonProperty("features")]
public ConfigurationFeatures Features { get; set; }

/// <summary>
/// Whether the configuration is the default. If <c>true</c>, this configuration can be
/// managed in the Dashboard and portal sessions will use this configuration unless it is
/// overriden when creating the session.
/// </summary>
[JsonProperty("is_default")]
public bool IsDefault { get; set; }

/// <summary>
/// Has the value <c>true</c> if the object exists in live mode or the value <c>false</c> if
/// the object exists in test mode.
/// </summary>
[JsonProperty("livemode")]
public bool Livemode { get; set; }

/// <summary>
/// Time at which the object was last updated. Measured in seconds since the Unix epoch.
/// </summary>
[JsonProperty("updated")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime Updated { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using Newtonsoft.Json;

public class ConfigurationBusinessProfile : StripeEntity<ConfigurationBusinessProfile>
{
/// <summary>
/// The messaging shown to customers in the portal.
/// </summary>
[JsonProperty("headline")]
public string Headline { get; set; }

/// <summary>
/// A link to the business’s publicly available privacy policy.
/// </summary>
[JsonProperty("privacy_policy_url")]
public string PrivacyPolicyUrl { get; set; }

/// <summary>
/// A link to the business’s publicly available terms of service.
/// </summary>
[JsonProperty("terms_of_service_url")]
public string TermsOfServiceUrl { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using Newtonsoft.Json;

public class ConfigurationFeatures : StripeEntity<ConfigurationFeatures>
{
[JsonProperty("customer_update")]
public ConfigurationFeaturesCustomerUpdate CustomerUpdate { get; set; }

[JsonProperty("invoice_history")]
public ConfigurationFeaturesInvoiceHistory InvoiceHistory { get; set; }

[JsonProperty("payment_method_update")]
public ConfigurationFeaturesPaymentMethodUpdate PaymentMethodUpdate { get; set; }

[JsonProperty("subscription_cancel")]
public ConfigurationFeaturesSubscriptionCancel SubscriptionCancel { get; set; }

[JsonProperty("subscription_update")]
public ConfigurationFeaturesSubscriptionUpdate SubscriptionUpdate { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using System.Collections.Generic;
using Newtonsoft.Json;

public class ConfigurationFeaturesCustomerUpdate : StripeEntity<ConfigurationFeaturesCustomerUpdate>
{
/// <summary>
/// The types of customer updates that are supported. When empty, customers are not
/// updateable.
/// </summary>
[JsonProperty("allowed_updates")]
public List<string> AllowedUpdates { get; set; }

/// <summary>
/// Whether the feature is enabled.
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using Newtonsoft.Json;

public class ConfigurationFeaturesInvoiceHistory : StripeEntity<ConfigurationFeaturesInvoiceHistory>
{
/// <summary>
/// Whether the feature is enabled.
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using Newtonsoft.Json;

public class ConfigurationFeaturesPaymentMethodUpdate : StripeEntity<ConfigurationFeaturesPaymentMethodUpdate>
{
/// <summary>
/// Whether the feature is enabled.
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using Newtonsoft.Json;

public class ConfigurationFeaturesSubscriptionCancel : StripeEntity<ConfigurationFeaturesSubscriptionCancel>
{
/// <summary>
/// Whether the feature is enabled.
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }

/// <summary>
/// Whether to cancel subscriptions immediately or at the end of the billing period.
/// One of: <c>at_period_end</c>, or <c>immediately</c>.
/// </summary>
[JsonProperty("mode")]
public string Mode { get; set; }

/// <summary>
/// Whether to create prorations when canceling subscriptions. Possible values are
/// <c>none</c> and <c>create_prorations</c>.
/// One of: <c>always_invoice</c>, <c>create_prorations</c>, or <c>none</c>.
/// </summary>
[JsonProperty("proration_behavior")]
public string ProrationBehavior { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using System.Collections.Generic;
using Newtonsoft.Json;

public class ConfigurationFeaturesSubscriptionUpdate : StripeEntity<ConfigurationFeaturesSubscriptionUpdate>
{
/// <summary>
/// The types of subscription updates that are supported for items listed in the
/// <c>products</c> attribute. When empty, subscriptions are not updateable.
/// </summary>
[JsonProperty("default_allowed_updates")]
public List<string> DefaultAllowedUpdates { get; set; }

/// <summary>
/// Whether the feature is enabled.
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }

/// <summary>
/// The list of products that support subscription updates.
/// </summary>
[JsonProperty("products")]
public List<ConfigurationFeaturesSubscriptionUpdateProduct> Products { get; set; }

/// <summary>
/// Determines how to handle prorations resulting from subscription updates. Valid values
/// are <c>none</c>, <c>create_prorations</c>, and <c>always_invoice</c>.
/// One of: <c>always_invoice</c>, <c>create_prorations</c>, or <c>none</c>.
/// </summary>
[JsonProperty("proration_behavior")]
public string ProrationBehavior { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// File generated from our OpenAPI spec
namespace Stripe.BillingPortal
{
using System.Collections.Generic;
using Newtonsoft.Json;

public class ConfigurationFeaturesSubscriptionUpdateProduct : StripeEntity<ConfigurationFeaturesSubscriptionUpdateProduct>
{
/// <summary>
/// The list of price IDs which, when subscribed to, a subscription can be updated.
/// </summary>
[JsonProperty("prices")]
public List<string> Prices { get; set; }

/// <summary>
/// The product ID.
/// </summary>
[JsonProperty("product")]
public string Product { get; set; }
}
}
50 changes: 47 additions & 3 deletions src/Stripe.net/Entities/BillingPortal/Sessions/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,37 @@ public class Session : StripeEntity<Session>, IHasId, IHasObject
[JsonProperty("object")]
public string Object { get; set; }

#region Expandable Configuration

/// <summary>
/// (ID of the Configuration)
/// The configuration used by this session, describing the features available.
/// </summary>
[JsonIgnore]
public string ConfigurationId
{
get => this.InternalConfiguration?.Id;
set => this.InternalConfiguration = SetExpandableFieldId(value, this.InternalConfiguration);
}

/// <summary>
/// (Expanded)
/// The configuration used by this session, describing the features available.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public Configuration Configuration
{
get => this.InternalConfiguration?.ExpandedObject;
set => this.InternalConfiguration = SetExpandableFieldObject(value, this.InternalConfiguration);
}

[JsonProperty("configuration")]
[JsonConverter(typeof(ExpandableFieldConverter<Configuration>))]
internal ExpandableField<Configuration> InternalConfiguration { get; set; }
#endregion

/// <summary>
/// Time at which the object was created. Measured in seconds since the Unix epoch.
/// </summary>
Expand All @@ -40,14 +71,27 @@ public class Session : StripeEntity<Session>, IHasId, IHasObject
public bool Livemode { get; set; }

/// <summary>
/// The URL to which Stripe should send customers when they click on the link to return to
/// your website.
/// The account for which the session was created on behalf of. When specified, only
/// subscriptions and invoices with this <c>on_behalf_of</c> account appear in the portal.
/// For more information, see the <a
/// href="https://stripe.com/docs/connect/charges-transfers#on-behalf-of">docs</a>. Use the
/// <a
/// href="https://stripe.com/docs/api/accounts/object#account_object-settings-branding">Accounts
/// API</a> to modify the <c>on_behalf_of</c> account's branding settings, which the portal
/// displays.
/// </summary>
[JsonProperty("on_behalf_of")]
public string OnBehalfOf { get; set; }

/// <summary>
/// The URL to redirect customers to when they click on the portal's link to return to your
/// website.
/// </summary>
[JsonProperty("return_url")]
public string ReturnUrl { get; set; }

/// <summary>
/// The short-lived URL of the session giving customers access to the customer portal.
/// The short-lived URL of the session that gives customers access to the customer portal.
/// </summary>
[JsonProperty("url")]
public string Url { get; set; }
Expand Down
5 changes: 3 additions & 2 deletions src/Stripe.net/Entities/Plans/Plan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ public class Plan : StripeEntity<Plan>, IHasId, IHasMetadata, IHasObject
public string AggregateUsage { get; set; }

/// <summary>
/// The unit amount in %s to be charged, represented as a whole integer if possible.
/// The unit amount in %s to be charged, represented as a whole integer if possible. Only
/// set if <c>billing_scheme=per_unit</c>.
/// </summary>
[JsonProperty("amount")]
public long? Amount { get; set; }

/// <summary>
/// The unit amount in %s to be charged, represented as a decimal string with at most 12
/// decimal places.
/// decimal places. Only set if <c>billing_scheme=per_unit</c>.
/// </summary>
[JsonProperty("amount_decimal")]
public decimal? AmountDecimal { get; set; }
Expand Down
5 changes: 3 additions & 2 deletions src/Stripe.net/Entities/Prices/Price.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,15 @@ public Product Product
public string Type { get; set; }

/// <summary>
/// The unit amount in %s to be charged, represented as a whole integer if possible.
/// The unit amount in %s to be charged, represented as a whole integer if possible. Only
/// set if <c>billing_scheme=per_unit</c>.
/// </summary>
[JsonProperty("unit_amount")]
public long? UnitAmount { get; set; }

/// <summary>
/// The unit amount in %s to be charged, represented as a decimal string with at most 12
/// decimal places.
/// decimal places. Only set if <c>billing_scheme=per_unit</c>.
/// </summary>
[JsonProperty("unit_amount_decimal")]
public decimal? UnitAmountDecimal { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static class StripeTypeRegistry
{ "balance_transaction", typeof(BalanceTransaction) },
{ "bank_account", typeof(BankAccount) },
{ "billing_portal.session", typeof(BillingPortal.Session) },
{ "billing_portal.configuration", typeof(BillingPortal.Configuration) },
{ "capability", typeof(Capability) },
{ "card", typeof(Card) },
{ "charge", typeof(Charge) },
Expand Down
Loading