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 support for expanding outcome.rule on a charge #1221

Merged
merged 1 commit into from
Jul 3, 2018
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
16 changes: 15 additions & 1 deletion src/Stripe.net/Entities/StripeOutcome.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Stripe.Infrastructure;

namespace Stripe
{
Expand All @@ -22,12 +23,25 @@ public class StripeOutcome : StripeEntityWithId
[JsonProperty("risk_level")]
public string RiskLevel { get; set; }

#region Expandable Rule
/// <summary>
/// The ID of the Radar rule that matched the payment, if applicable.
/// </summary>
[JsonProperty("rule")]
public string RuleId { get; set; }

[JsonIgnore]
public StripeOutcomeRule Rule { get; set; }

[JsonProperty("rule")]
internal object InternalOutcomeRule
{
set
{
StringOrObject<StripeOutcomeRule>.Map(value, s => RuleId = s, o => Rule = o);
}
}
#endregion

/// <summary>
/// A human-readable description of the outcome type and reason, designed for you (the recipient of the payment), not your customer.
/// </summary>
Expand Down
13 changes: 13 additions & 0 deletions src/Stripe.net/Entities/StripeOutcomeRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Newtonsoft.Json;

namespace Stripe
{
public class StripeOutcomeRule : StripeEntityWithId
{
[JsonProperty("action")]
public string Action { get; set; }

[JsonProperty("predicate")]
public string Predicate { get; set; }
}
}