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 #2415

Merged
merged 4 commits into from
Jan 20, 2022
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.116.0
STRIPE_MOCK_VERSION: 0.117.0

deploy:
- provider: NuGet
Expand Down
31 changes: 31 additions & 0 deletions src/Stripe.net/Entities/Checkout/Sessions/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,37 @@ public PaymentIntent PaymentIntent
internal ExpandableField<PaymentIntent> InternalPaymentIntent { get; set; }
#endregion

#region Expandable PaymentLink

/// <summary>
/// (ID of the PaymentLink)
/// The ID of the Payment Link that created this Session.
/// </summary>
[JsonIgnore]
public string PaymentLinkId
{
get => this.InternalPaymentLink?.Id;
set => this.InternalPaymentLink = SetExpandableFieldId(value, this.InternalPaymentLink);
}

/// <summary>
/// (Expanded)
/// The ID of the Payment Link that created this Session.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public PaymentLink PaymentLink
{
get => this.InternalPaymentLink?.ExpandedObject;
set => this.InternalPaymentLink = SetExpandableFieldObject(value, this.InternalPaymentLink);
}

[JsonProperty("payment_link")]
[JsonConverter(typeof(ExpandableFieldConverter<PaymentLink>))]
internal ExpandableField<PaymentLink> InternalPaymentLink { get; set; }
#endregion

/// <summary>
/// Payment-method-specific configuration for the PaymentIntent or SetupIntent of this
/// CheckoutSession.
Expand Down
156 changes: 156 additions & 0 deletions src/Stripe.net/Entities/PaymentLinks/PaymentLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;

/// <summary>
/// A payment link allows you create payment pages through a url you can share with
/// customers.
/// </summary>
public class PaymentLink : StripeEntity<PaymentLink>, IHasId, IHasMetadata, 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 payment link's <c>url</c> is active. If <c>false</c>, customers visiting the
/// url will be redirected.
/// </summary>
[JsonProperty("active")]
public bool Active { get; set; }

[JsonProperty("after_completion")]
public PaymentLinkAfterCompletion AfterCompletion { get; set; }

/// <summary>
/// Whether user redeemable promotion codes are enabled.
/// </summary>
[JsonProperty("allow_promotion_codes")]
public bool AllowPromotionCodes { get; set; }

/// <summary>
/// The amount of the application fee (if any) that will be requested to be applied to the
/// payment and transferred to the application owner's Stripe account.
/// </summary>
[JsonProperty("application_fee_amount")]
public long? ApplicationFeeAmount { get; set; }

/// <summary>
/// This represents the percentage of the subscription invoice subtotal that will be
/// transferred to the application owner's Stripe account.
/// </summary>
[JsonProperty("application_fee_percent")]
public decimal? ApplicationFeePercent { get; set; }

[JsonProperty("automatic_tax")]
public PaymentLinkAutomaticTax AutomaticTax { get; set; }

/// <summary>
/// Configuration for collecting the customer's billing address.
/// One of: <c>auto</c>, or <c>required</c>.
/// </summary>
[JsonProperty("billing_address_collection")]
public string BillingAddressCollection { get; set; }

/// <summary>
/// The line items representing what is being sold.
/// </summary>
[JsonProperty("line_items")]
public StripeList<LineItem> LineItems { 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>
/// Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
/// attach to an object. This can be useful for storing additional information about the
/// object in a structured format.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

#region Expandable OnBehalfOf

/// <summary>
/// (ID of the Account)
/// The account on behalf of which to charge. See the <a
/// href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect
/// documentation</a> for details.
/// </summary>
[JsonIgnore]
public string OnBehalfOfId
{
get => this.InternalOnBehalfOf?.Id;
set => this.InternalOnBehalfOf = SetExpandableFieldId(value, this.InternalOnBehalfOf);
}

/// <summary>
/// (Expanded)
/// The account on behalf of which to charge. See the <a
/// href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect
/// documentation</a> for details.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public Account OnBehalfOf
{
get => this.InternalOnBehalfOf?.ExpandedObject;
set => this.InternalOnBehalfOf = SetExpandableFieldObject(value, this.InternalOnBehalfOf);
}

[JsonProperty("on_behalf_of")]
[JsonConverter(typeof(ExpandableFieldConverter<Account>))]
internal ExpandableField<Account> InternalOnBehalfOf { get; set; }
#endregion

/// <summary>
/// The list of payment method types that customers can use. When <c>null</c>, your <a
/// href="https://dashboard.stripe.com/settings/payment_methods">payment methods
/// settings</a> will be used.
/// </summary>
[JsonProperty("payment_method_types")]
public List<string> PaymentMethodTypes { get; set; }

/// <summary>
/// Configuration for collecting the customer's shipping address.
/// </summary>
[JsonProperty("shipping_address_collection")]
public PaymentLinkShippingAddressCollection ShippingAddressCollection { get; set; }

/// <summary>
/// When creating a subscription, the specified configuration data will be used. There must
/// be at least one line item with a recurring price to use <c>subscription_data</c>.
/// </summary>
[JsonProperty("subscription_data")]
public PaymentLinkSubscriptionData SubscriptionData { get; set; }

/// <summary>
/// The account (if any) the payments will be attributed to for tax reporting, and where
/// funds from each payment will be transferred to.
/// </summary>
[JsonProperty("transfer_data")]
public PaymentLinkTransferData TransferData { get; set; }

/// <summary>
/// The public url that can be shared with customers.
/// </summary>
[JsonProperty("url")]
public string Url { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentLinkAfterCompletion : StripeEntity<PaymentLinkAfterCompletion>
{
[JsonProperty("hosted_confirmation")]
public PaymentLinkAfterCompletionHostedConfirmation HostedConfirmation { get; set; }

[JsonProperty("redirect")]
public PaymentLinkAfterCompletionRedirect Redirect { get; set; }

/// <summary>
/// The specified behavior after the purchase is complete.
/// One of: <c>hosted_confirmation</c>, or <c>redirect</c>.
/// </summary>
[JsonProperty("type")]
public string Type { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentLinkAfterCompletionHostedConfirmation : StripeEntity<PaymentLinkAfterCompletionHostedConfirmation>
{
/// <summary>
/// The custom message that is displayed to the customer after the purchase is complete.
/// </summary>
[JsonProperty("custom_message")]
public string CustomMessage { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentLinkAfterCompletionRedirect : StripeEntity<PaymentLinkAfterCompletionRedirect>
{
/// <summary>
/// The <c>url</c> the customer will be redirected to after the purchase is complete.
/// </summary>
[JsonProperty("url")]
public string Url { get; set; }
}
}
14 changes: 14 additions & 0 deletions src/Stripe.net/Entities/PaymentLinks/PaymentLinkAutomaticTax.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentLinkAutomaticTax : StripeEntity<PaymentLinkAutomaticTax>
{
/// <summary>
/// If <c>true</c>, tax will be calculated automatically using the customer's location.
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using System.Collections.Generic;
using Newtonsoft.Json;

public class PaymentLinkShippingAddressCollection : StripeEntity<PaymentLinkShippingAddressCollection>
{
/// <summary>
/// An array of two-letter ISO country codes representing which countries Checkout should
/// provide as options for shipping locations. Unsupported country codes: <c>AS, CX, CC, CU,
/// HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI</c>.
/// </summary>
[JsonProperty("allowed_countries")]
public List<string> AllowedCountries { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentLinkSubscriptionData : StripeEntity<PaymentLinkSubscriptionData>
{
/// <summary>
/// When creating a subscription, the specified configuration data will be used. There must
/// be at least one line item with a recurring price to use <c>subscription_data</c>.
/// </summary>
[JsonProperty("trial_period_days")]
public long? TrialPeriodDays { get; set; }
}
}
47 changes: 47 additions & 0 deletions src/Stripe.net/Entities/PaymentLinks/PaymentLinkTransferData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class PaymentLinkTransferData : StripeEntity<PaymentLinkTransferData>
{
/// <summary>
/// The amount in %s that will be transferred to the destination account. By default, the
/// entire amount is transferred to the destination.
/// </summary>
[JsonProperty("amount")]
public long? Amount { get; set; }

#region Expandable Destination

/// <summary>
/// (ID of the Account)
/// The connected account receiving the transfer.
/// </summary>
[JsonIgnore]
public string DestinationId
{
get => this.InternalDestination?.Id;
set => this.InternalDestination = SetExpandableFieldId(value, this.InternalDestination);
}

/// <summary>
/// (Expanded)
/// The connected account receiving the transfer.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public Account Destination
{
get => this.InternalDestination?.ExpandedObject;
set => this.InternalDestination = SetExpandableFieldObject(value, this.InternalDestination);
}

[JsonProperty("destination")]
[JsonConverter(typeof(ExpandableFieldConverter<Account>))]
internal ExpandableField<Account> InternalDestination { get; set; }
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static class StripeTypeRegistry
{ "order_item", typeof(OrderItem) },
{ "order_return", typeof(OrderReturn) },
{ "payment_intent", typeof(PaymentIntent) },
{ "payment_link", typeof(PaymentLink) },
{ "payment_method", typeof(PaymentMethod) },
{ "payout", typeof(Payout) },
{ "person", typeof(Person) },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentLinkAfterCompletionHostedConfirmationOptions : INestedOptions
{
/// <summary>
/// A custom message to display to the customer after the purchase is complete.
/// </summary>
[JsonProperty("custom_message")]
public string CustomMessage { get; set; }
}
}
Loading