Skip to content

Commit

Permalink
Revamp interfaces on Stripe model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed Oct 4, 2018
1 parent ba4369b commit 79e5289
Show file tree
Hide file tree
Showing 142 changed files with 355 additions and 183 deletions.
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Accounts/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Account : StripeEntityWithId, ISupportMetadata
public class Account : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class AdditionalOwners : StripeEntity
public class AdditionalOwner : StripeEntity
{
[JsonProperty("address")]
public Address Address { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Accounts/LegalEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Stripe
public class LegalEntity : StripeEntity
{
[JsonProperty("additional_owners")]
public List<AdditionalOwners> AdditionalOwners { get; set; }
public List<AdditionalOwner> AdditionalOwners { get; set; }

[JsonProperty("address")]
public Address Address { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/ApplePayDomains/ApplePayDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ApplePayDomain : StripeEntityWithId
public class ApplePayDomain : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ApplicationFeeRefund : StripeEntityWithId, ISupportMetadata
public class ApplicationFeeRefund : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/ApplicationFees/ApplicationFee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ApplicationFee : StripeEntityWithId
public class ApplicationFee : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Balance/Balance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class Balance : StripeEntity
public class Balance : StripeEntity, IHasObject
{
[JsonProperty("object")]
public string Object { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class BalanceTransaction : StripeEntityWithId
public class BalanceTransaction : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ public enum BalanceTransactionSourceType
}

[JsonConverter(typeof(BalanceTransactionSourceConverter))]
public class BalanceTransactionSource : StripeEntityWithId
public class BalanceTransactionSource : StripeEntity, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }

public BalanceTransactionSourceType Type { get; set; }

public ApplicationFee ApplicationFee { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/BankAccounts/BankAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class BankAccount : StripeEntityWithId, ISupportMetadata
public class BankAccount : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Cards/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Card : StripeEntityWithId, ISupportMetadata
public class Card : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Charges/Charge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Charge : StripeEntityWithId, ISupportMetadata
public class Charge : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Charges/Outcome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Outcome : StripeEntityWithId
public class Outcome : StripeEntity
{
/// <summary>
/// Possible values are approved_by_network, declined_by_network, not_sent_to_network, and reversed_after_approval. The value reversed_after_approval indicates the payment was blocked by Stripe after bank authorization, and may temporarily appear as “pending” on a cardholder’s statement.
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Charges/OutcomeRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ namespace Stripe
{
using Newtonsoft.Json;

public class OutcomeRule : StripeEntityWithId
public class OutcomeRule : StripeEntity, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("action")]
public string Action { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ namespace Stripe
{
using Newtonsoft.Json;

public class Application : StripeEntityWithId
public class Application : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Common/PaymentSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ public enum PaymentSourceType
}

[JsonConverter(typeof(PaymentSourceConverter))]
public class PaymentSource : StripeEntityWithId
public class PaymentSource : StripeEntity, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }

public PaymentSourceType Type { get; set; }

public Account Account { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Common/Review.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Review : StripeEntityWithId
public class Review : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/CountrySpecs/CountrySpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class CountrySpec : StripeEntityWithId
public class CountrySpec : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Coupons/Coupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Coupon : StripeEntityWithId, ISupportMetadata
public class Coupon : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Customers/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Customer : StripeEntityWithId, ISupportMetadata
public class Customer : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Stripe.net/Entities/Discounts/Discount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Discount : StripeEntityWithId
public class Discount : StripeEntity, IHasObject
{
[JsonProperty("object")]
public string Object { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Disputes/Dispute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Dispute : StripeEntityWithId, ISupportMetadata
public class Dispute : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/EphemeralKeys/EphemeralKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class EphemeralKey : StripeEntityWithId
public class EphemeralKey : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ namespace Stripe
{
using Newtonsoft.Json;

public class EphemeralKeyAssociatedObject : StripeEntityWithId
public class EphemeralKeyAssociatedObject : StripeEntity
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("type")]
public string Type { get; set; }
}
Expand Down
26 changes: 5 additions & 21 deletions src/Stripe.net/Entities/Events/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class Event : StripeEntityWithId
public class Event : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand All @@ -27,27 +30,8 @@ public class Event : StripeEntityWithId
[JsonProperty("pending_webhooks")]
public int PendingWebhooks { get; set; }

#region Request

/*
* This works like expandable properties. it's used for the event having just a string for the request id or
* the Request object for requests after the 2017-05-25 api release
*/

public string RequestId { get; set; }

[JsonIgnore]
public EventRequest Request { get; set; }

[JsonProperty("request")]
internal object InternalRequest
{
set
{
StringOrObject<EventRequest>.Map(value, s => this.RequestId = s, o => this.Request = o);
}
}
#endregion
public EventRequest Request { get; set; }

[JsonProperty("type")]
public string Type { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/Events/EventRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ namespace Stripe
{
using Newtonsoft.Json;

public class EventRequest : StripeEntityWithId
public class EventRequest : StripeEntity
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("idempotency_key")]
public string IdempotencyKey { get; set; }
}
Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/ExchangeRates/ExchangeRate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ namespace Stripe
using System.Collections.Generic;
using Newtonsoft.Json;

public class ExchangeRate : StripeEntityWithId
public class ExchangeRate : StripeEntity, IHasId, IHasObject
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Stripe.net/Entities/ExternalAccounts/ExternalAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ public enum ExternalAccountType
}

[JsonConverter(typeof(ExternalAccountConverter))]
public class ExternalAccount : StripeEntityWithId
public class ExternalAccount : StripeEntity, IHasId
{
[JsonProperty("id")]
public string Id { get; set; }

public ExternalAccountType Type { get; set; }

public Card Card { get; set; }
Expand Down
8 changes: 4 additions & 4 deletions src/Stripe.net/Entities/FileLinks/FileLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace Stripe
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class FileLink : StripeEntityWithId, ISupportMetadata
public class FileLink : StripeEntity, IHasId, IHasObject
{
/// <summary>
/// String representing the object’s type. Objects of the same type share the same value.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("object")]
public string Object { get; set; }

Expand Down
Loading

0 comments on commit 79e5289

Please sign in to comment.