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

Add missing properties on Review #1987

Merged
merged 1 commit into from
Apr 9, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 73 additions & 0 deletions src/Stripe.net/Entities/Reviews/Review.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,39 @@ namespace Stripe

public class Review : StripeEntity<Review>, 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>
/// The ZIP or postal code of the card used, if applicable.
/// </summary>
[JsonProperty("billing_zip")]
public string BillingZip { get; set; }

#region Expandable Charge

/// <summary>
/// ID of the charge associated with this review.
/// </summary>
[JsonIgnore]
public string ChargeId
{
get => this.InternalCharge?.Id;
set => this.InternalCharge = SetExpandableFieldId(value, this.InternalCharge);
}

/// <summary>
/// The charge associated with this review.
/// </summary>
[JsonIgnore]
public Charge Charge
{
Expand All @@ -32,24 +51,68 @@ public Charge Charge
internal ExpandableField<Charge> InternalCharge { get; set; }
#endregion

/// <summary>
/// The reason the review was closed, or null if it has not yet been closed. One of
/// <c>approved</c>, <c>refunded</c>, <c>refunded_as_fraud</c>, or <c>disputed</c>.
/// </summary>
[JsonProperty("closed_reason")]
public string ClosedReason { get; set; }

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

/// <summary>
/// The IP address where the payment originated.
/// </summary>
[JsonProperty("ip_address")]
public string IpAddress { get; set; }

/// <summary>
/// Information related to the location of the payment. Note that this information is an
/// approximation and attempts to locate the nearest population center - it should not be
/// used to determine a specific address.
/// </summary>
[JsonProperty("ip_address_location")]
public ReviewLocation IpAddressLocation { 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>
/// If <c>true</c>, the review needs action.
/// </summary>
[JsonProperty("open")]
public bool Open { get; set; }

/// <summary>
/// The reason the review was opened. One of <c>rule</c> or <c>manual</c>.
/// </summary>
[JsonProperty("opened_reason")]
public string OpenedReason { get; set; }

#region Expandable PaymentIntent

/// <summary>
/// ID of the PaymentIntent associated with this review, if one exists.
/// </summary>
[JsonIgnore]
public string PaymentIntentId
{
get => this.InternalPaymentIntent?.Id;
set => this.InternalPaymentIntent = SetExpandableFieldId(value, this.InternalPaymentIntent);
}

/// <summary>
/// PaymentIntent associated with this review, if one exists.
/// </summary>
[JsonIgnore]
public PaymentIntent PaymentIntent
{
Expand All @@ -62,7 +125,17 @@ public PaymentIntent PaymentIntent
internal ExpandableField<PaymentIntent> InternalPaymentIntent { get; set; }
#endregion

/// <summary>
/// The reason the review is currently open or closed. One of <c>rule</c>, <c>manual</c>,
/// <c>approved</c>, <c>refunded</c>, <c>refunded_as_fraud</c>, or <c>disputed</c>.
/// </summary>
[JsonProperty("reason")]
public string Reason { get; set; }

/// <summary>
/// Information related to the browsing session of the user who initiated the payment.
/// </summary>
[JsonProperty("session")]
public ReviewSession Session { get; set; }
}
}
39 changes: 39 additions & 0 deletions src/Stripe.net/Entities/Reviews/ReviewLocation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ReviewLocation : StripeEntity<ReviewLocation>
{
/// <summary>
/// The city where the payment originated.
/// </summary>
[JsonProperty("city")]
public string City { get; set; }

/// <summary>
/// Two-letter ISO code representing the country where the payment originated.
/// </summary>
[JsonProperty("country")]
public string Country { get; set; }

/// <summary>
/// The geographic latitude where the payment originated.
/// </summary>
[JsonProperty("latitude")]
public decimal? Latitude { get; set; }

/// <summary>
/// The geographic longitude where the payment originated.
/// </summary>
[JsonProperty("longitude")]
public decimal? Longitude { get; set; }

/// <summary>
/// The state/county/province/region where the payment originated.
/// </summary>
[JsonProperty("region")]
public string Region { get; set; }
}
}
33 changes: 33 additions & 0 deletions src/Stripe.net/Entities/Reviews/ReviewSession.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class ReviewSession : StripeEntity<ReviewSession>
{
/// <summary>
/// The browser used in this browser session.
/// </summary>
[JsonProperty("browser")]
public string Browser { get; set; }

/// <summary>
/// Information about the device used for the browser session.
/// </summary>
[JsonProperty("device")]
public string Device { get; set; }

/// <summary>
/// The platform for the browser session.
/// </summary>
[JsonProperty("platform")]
public string Platform { get; set; }

/// <summary>
/// The version for the browser session.
/// </summary>
[JsonProperty("version")]
public string Version { get; set; }
}
}