Skip to content

Commit

Permalink
Merge pull request #2430 from stripe/latest-codegen
Browse files Browse the repository at this point in the history
API Updates
  • Loading branch information
richardm-stripe authored Mar 1, 2022
2 parents d3b42a4 + 6b643e0 commit 4a7b659
Show file tree
Hide file tree
Showing 24 changed files with 552 additions and 2 deletions.
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.118.0
STRIPE_MOCK_VERSION: 0.119.0

deploy:
- provider: NuGet
Expand Down
31 changes: 31 additions & 0 deletions src/Stripe.net/Entities/Customers/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,36 @@ public IPaymentSource DefaultSource
/// </summary>
[JsonProperty("tax_ids")]
public StripeList<TaxId> TaxIds { get; set; }

#region Expandable TestClock

/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this customer belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}

/// <summary>
/// (Expanded)
/// ID of the test clock this customer belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}

[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion
}
}
31 changes: 31 additions & 0 deletions src/Stripe.net/Entities/InvoiceItems/InvoiceItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,37 @@ public Subscription Subscription
[JsonProperty("tax_rates")]
public List<TaxRate> TaxRates { get; set; }

#region Expandable TestClock

/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this invoice item belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}

/// <summary>
/// (Expanded)
/// ID of the test clock this invoice item belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}

[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion

/// <summary>
/// Unit amount (in the <c>currency</c> specified) of the invoice item.
/// </summary>
Expand Down
31 changes: 31 additions & 0 deletions src/Stripe.net/Entities/Invoices/Invoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,37 @@ public Subscription Subscription
[JsonProperty("tax")]
public long? Tax { get; set; }

#region Expandable TestClock

/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this invoice belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}

/// <summary>
/// (Expanded)
/// ID of the test clock this invoice belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}

[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion

[JsonProperty("threshold_reason")]
public InvoiceThresholdReason ThresholdReason { get; set; }

Expand Down
31 changes: 31 additions & 0 deletions src/Stripe.net/Entities/Quotes/Quote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,37 @@ public SubscriptionSchedule SubscriptionSchedule
internal ExpandableField<SubscriptionSchedule> InternalSubscriptionSchedule { get; set; }
#endregion

#region Expandable TestClock

/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this quote belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}

/// <summary>
/// (Expanded)
/// ID of the test clock this quote belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}

[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion

[JsonProperty("total_details")]
public QuoteTotalDetails TotalDetails { get; set; }

Expand Down
3 changes: 3 additions & 0 deletions src/Stripe.net/Entities/Refunds/Refund.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public BalanceTransaction FailureBalanceTransaction
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

[JsonProperty("next_action")]
public RefundNextAction NextAction { get; set; }

#region Expandable PaymentIntent

/// <summary>
Expand Down
20 changes: 20 additions & 0 deletions src/Stripe.net/Entities/Refunds/RefundNextAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class RefundNextAction : StripeEntity<RefundNextAction>
{
/// <summary>
/// Contains the refund details.
/// </summary>
[JsonProperty("display_details")]
public RefundNextActionDisplayDetails DisplayDetails { get; set; }

/// <summary>
/// Type of the next action to perform.
/// </summary>
[JsonProperty("type")]
public string Type { get; set; }
}
}
20 changes: 20 additions & 0 deletions src/Stripe.net/Entities/Refunds/RefundNextActionDisplayDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class RefundNextActionDisplayDetails : StripeEntity<RefundNextActionDisplayDetails>
{
[JsonProperty("email_sent")]
public RefundNextActionDisplayDetailsEmailSent EmailSent { get; set; }

/// <summary>
/// The expiry timestamp.
/// </summary>
[JsonProperty("expires_at")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime ExpiresAt { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class RefundNextActionDisplayDetailsEmailSent : StripeEntity<RefundNextActionDisplayDetailsEmailSent>
{
/// <summary>
/// The timestamp when the email was sent.
/// </summary>
[JsonProperty("email_sent_at")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime EmailSentAt { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch;

/// <summary>
/// The recipient's email address.
/// </summary>
[JsonProperty("email_sent_to")]
public string EmailSentTo { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,36 @@ public Subscription Subscription
[JsonConverter(typeof(ExpandableFieldConverter<Subscription>))]
internal ExpandableField<Subscription> InternalSubscription { get; set; }
#endregion

#region Expandable TestClock

/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this subscription schedule belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}

/// <summary>
/// (Expanded)
/// ID of the test clock this subscription schedule belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}

[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion
}
}
31 changes: 31 additions & 0 deletions src/Stripe.net/Entities/Subscriptions/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,37 @@ public SubscriptionSchedule Schedule
[JsonProperty("status")]
public string Status { get; set; }

#region Expandable TestClock

/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this subscription belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}

/// <summary>
/// (Expanded)
/// ID of the test clock this subscription belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}

[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion

/// <summary>
/// The account (if any) the subscription's payments will be attributed to for tax
/// reporting, and where funds from each payment will be transferred to for each of the
Expand Down
70 changes: 70 additions & 0 deletions src/Stripe.net/Entities/TestHelpers/TestClocks/TestClock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// File generated from our OpenAPI spec
namespace Stripe.TestHelpers
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

/// <summary>
/// A test clock enables deterministic control over objects in testmode. With a test clock,
/// you can create objects at a frozen time in the past or future, and advance to a specific
/// future time to observe webhooks and state changes. After the clock advances, you can
/// either validate the current state of your scenario (and test your assumptions), change
/// the current state of your scenario (and test more complex scenarios), or keep advancing
/// forward in time.
/// </summary>
public class TestClock : StripeEntity<TestClock>, 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>
/// 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>
/// Whether this object is deleted or not.
/// </summary>
[JsonProperty("deleted", NullValueHandling = NullValueHandling.Ignore)]
public bool? Deleted { get; set; }

/// <summary>
/// Time at which all objects belonging to this clock are frozen.
/// </summary>
[JsonProperty("frozen_time")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime FrozenTime { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch;

/// <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>
/// The custom name supplied at creation.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }

/// <summary>
/// The status of the Test Clock.
/// One of: <c>advancing</c>, <c>internal_failure</c>, or <c>ready</c>.
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static class StripeTypeRegistry
},
{ "terminal.location", typeof(Terminal.Location) },
{ "terminal.reader", typeof(Terminal.Reader) },
{ "test_helpers.test_clock", typeof(TestHelpers.TestClock) },
{ "token", typeof(Token) },
{ "topup", typeof(Topup) },
{ "transfer", typeof(Transfer) },
Expand Down
Loading

0 comments on commit 4a7b659

Please sign in to comment.