Skip to content

Commit

Permalink
Add missing IHas* interfaces everywhere (stripe#1733)
Browse files Browse the repository at this point in the history
* Add new wholesome test to look for missing IHas* interfaces

* Add missing IHasId interface

* Add missing IHasObject interface

* Fix test

* Add missing IHasMetadata interface
  • Loading branch information
ob-stripe authored and pull[bot] committed Aug 14, 2019
1 parent 32cfbe8 commit 6f71ddb
Show file tree
Hide file tree
Showing 84 changed files with 156 additions and 87 deletions.
Expand Up @@ -2,7 +2,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class EphemeralKeyAssociatedObject : StripeEntity<EphemeralKeyAssociatedObject>
public class EphemeralKeyAssociatedObject : StripeEntity<EphemeralKeyAssociatedObject>, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Events/EventRequest.cs
Expand Up @@ -2,7 +2,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class EventRequest : StripeEntity<EventRequest>
public class EventRequest : StripeEntity<EventRequest>, IHasId
{
/// <summary>
/// ID of the API request that caused the event. If null, the event was automatic (e.g.,
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Orders/ShippingMethod.cs
Expand Up @@ -2,7 +2,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class ShippingMethod : StripeEntity<ShippingMethod>
public class ShippingMethod : StripeEntity<ShippingMethod>, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Persons/Person.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Person : StripeEntity<Person>, IHasId, IHasObject
public class Person : StripeEntity<Person>, IHasId, IHasObject, IHasMetadata
{
/// <summary>
/// Unique identifier for the object.
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Account/AccountCardOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class AccountCardOptions : INestedOptions
public class AccountCardOptions : INestedOptions, IHasMetadata
{
[JsonProperty("object")]
internal string Object => "card";
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Account/AccountSharedOptions.cs
Expand Up @@ -4,7 +4,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public abstract class AccountSharedOptions : BaseOptions
public abstract class AccountSharedOptions : BaseOptions, IHasMetadata
{
[JsonProperty("account_token")]
public string AccountToken { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class ApplicationFeeRefundCreateOptions : BaseOptions
public class ApplicationFeeRefundCreateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("amount")]
public long? Amount { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class ApplicationFeeRefundUpdateOptions : BaseOptions
public class ApplicationFeeRefundUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class BankAccountUpdateOptions : BaseOptions
public class BankAccountUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("account_holder_name")]
public string AccountHolderName { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Cards/CardCreateOptions.cs
Expand Up @@ -4,7 +4,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class CardCreateOptions : BaseOptions
public class CardCreateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("default_for_currency")]
public bool? DefaultForCurrency { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Cards/CardUpdateOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class CardUpdateOptions : BaseOptions
public class CardUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("address_city")]
public string AddressCity { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Charges/ChargeCreateOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ChargeCreateOptions : BaseOptions
public class ChargeCreateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// A positive integer in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a 0-decimal currency) representing how much to charge the card. The minimum amount is $0.50 US or equivalent in charge currency.
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Charges/ChargeSourceListOptions.cs
Expand Up @@ -2,7 +2,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class ChargeSourceListOptions : INestedOptions
public class ChargeSourceListOptions : INestedOptions, IHasObject
{
[JsonProperty("object")]
public string Object { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Charges/ChargeUpdateOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class ChargeUpdateOptions : BaseOptions
public class ChargeUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("description")]
public string Description { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe.Checkout
using System.Collections.Generic;
using Newtonsoft.Json;

public class SessionPaymentIntentDataOptions : INestedOptions
public class SessionPaymentIntentDataOptions : INestedOptions, IHasMetadata
{
/// <summary>
/// The amount of the application fee (if any) that will be applied to the payment and
Expand Down
Expand Up @@ -5,7 +5,7 @@ namespace Stripe.Checkout
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class SessionSubscriptionDataOptions : INestedOptions
public class SessionSubscriptionDataOptions : INestedOptions, IHasMetadata
{
/// <summary>
/// A non-negative decimal between 0 and 100, with at most two decimal places. This
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Coupons/CouponCreateOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class CouponCreateOptions : BaseOptions
public class CouponCreateOptions : BaseOptions, IHasId, IHasMetadata
{
[JsonProperty("id")]
public string Id { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Coupons/CouponUpdateOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class CouponUpdateOptions : BaseOptions
public class CouponUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class CreditNoteCreateOptions : BaseOptions
public class CreditNoteCreateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// Credit note amount.
Expand Down
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class CreditNoteUpdateOptions : BaseOptions
public class CreditNoteUpdateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// Credit note memo.
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class CustomerBalanceTransactionCreateOptions : BaseOptions
public class CustomerBalanceTransactionCreateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// The amount to apply to the customer’s balance. Pass a negative amount to credit the
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class CustomerBalanceTransactionUpdateOptions : BaseOptions
public class CustomerBalanceTransactionUpdateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// An arbitrary string attached to the object. Often useful for displaying to users.
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Customers/CustomerCreateOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class CustomerCreateOptions : BaseOptions
public class CustomerCreateOptions : BaseOptions, IHasMetadata
{
[Obsolete("Use Balance")]
[JsonProperty("account_balance")]
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Customers/CustomerUpdateOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class CustomerUpdateOptions : BaseOptions
public class CustomerUpdateOptions : BaseOptions, IHasMetadata
{
[Obsolete("Use Balance")]
[JsonProperty("account_balance")]
Expand Down
8 changes: 4 additions & 4 deletions src/Stripe.net/Services/Disputes/DisputeEvidenceOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class DisputeEvidenceOptions : INestedOptions
public class DisputeEvidenceOptions : INestedOptions, IHasMetadata
{
[JsonProperty("access_activity_log")]
public string AccessActivityLog { get; set; }
Expand Down Expand Up @@ -44,6 +44,9 @@ public class DisputeEvidenceOptions : INestedOptions
[JsonProperty("duplicate_charge_id")]
public string DuplicateChargeFileId { get; set; }

[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

[JsonProperty("product_description")]
public string ProductDescription { get; set; }

Expand Down Expand Up @@ -85,8 +88,5 @@ public class DisputeEvidenceOptions : INestedOptions

[JsonProperty("uncategorized_text")]
public string UncategorizedText { get; set; }

[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Disputes/DisputeUpdateOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class DisputeUpdateOptions : BaseOptions
public class DisputeUpdateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// Evidence to upload, to respond to a dispute. Updating any field in the hash will submit
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class ExternalAccountCardUpdateOptions : INestedOptions
public class ExternalAccountCardUpdateOptions : INestedOptions, IHasMetadata
{
[JsonProperty("default_for_currency")]
public bool? DefaultForCurrency { get; set; }
Expand Down
Expand Up @@ -4,7 +4,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ExternalAccountCreateOptions : BaseOptions
public class ExternalAccountCreateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// REQUIRED. Either a token, like the ones returned by
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class ExternalAccountUpdateOptions : BaseOptions
public class ExternalAccountUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/FileLinks/FileLinkSharedOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class FileLinkSharedOptions : BaseOptions
public class FileLinkSharedOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// A future timestamp after which the link will no longer be usable.
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Files/FileLinkDataOptions.cs
Expand Up @@ -4,7 +4,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class FileLinkDataOptions : BaseOptions
public class FileLinkDataOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// Set this to <c>true</c> to create a file link for the newly created file. Creating a
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class InvoiceItemCreateOptions : BaseOptions
public class InvoiceItemCreateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("amount")]
public long? Amount { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class InvoiceItemUpdateOptions : BaseOptions
public class InvoiceItemUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("amount")]
public long? Amount { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Invoices/InvoiceCreateOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class InvoiceCreateOptions : BaseOptions
public class InvoiceCreateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// A fee in cents that will be applied to the invoice and transferred to the application
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class InvoiceSubscriptionItemOptions : BaseOptions
public class InvoiceSubscriptionItemOptions : BaseOptions, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class InvoiceUpcomingInvoiceItemOption : INestedOptions
public class InvoiceUpcomingInvoiceItemOption : INestedOptions, IHasMetadata
{
[JsonProperty("amount")]
public long? Amount { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Invoices/InvoiceUpdateOptions.cs
Expand Up @@ -5,7 +5,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class InvoiceUpdateOptions : BaseOptions
public class InvoiceUpdateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// A fee in cents that will be applied to the invoice and transferred to the application
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe.Issuing
using System.Collections.Generic;
using Newtonsoft.Json;

public class AuthorizationUpdateOptions : BaseOptions
public class AuthorizationUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe.Issuing
using System.Collections.Generic;
using Newtonsoft.Json;

public class CardholderSharedOptions : BaseOptions
public class CardholderSharedOptions : BaseOptions, IHasMetadata
{
[JsonProperty("billing")]
public BillingOptions Billing { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Services/Issuing/Cards/CardSharedOptions.cs
Expand Up @@ -3,7 +3,7 @@ namespace Stripe.Issuing
using System.Collections.Generic;
using Newtonsoft.Json;

public class CardSharedOptions : BaseOptions
public class CardSharedOptions : BaseOptions, IHasMetadata
{
[JsonProperty("authorization_controls")]
public AuthorizationControlsOptions AuthorizationControls { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe.Issuing
using System.Collections.Generic;
using Newtonsoft.Json;

public class DisputeSharedOptions : BaseOptions
public class DisputeSharedOptions : BaseOptions, IHasMetadata
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
Expand Down
Expand Up @@ -3,7 +3,7 @@ namespace Stripe.Issuing
using System.Collections.Generic;
using Newtonsoft.Json;

public class TransactionUpdateOptions : BaseOptions
public class TransactionUpdateOptions : BaseOptions, IHasMetadata
{
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
Expand Down

0 comments on commit 6f71ddb

Please sign in to comment.