Skip to content

Commit

Permalink
feat: change FraudScoreLabel into an enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Dec 1, 2023
1 parent 505329c commit f45bf94
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal static Result<FraudCheckRequest> BuildRequestWithSimSwap() =>
new Guid("6cb4c489-0fc8-4c40-8c3d-95e7e74f9450"),
"phone",
new PhoneData("16197363066", "Orange France", "MOBILE"),
new FraudScore("54", "flag", "medium", "completed"),
new FraudScore("54", "flag", FraudScoreLabel.Medium, "completed"),
new SimSwap("failed", true, "Mobile Network Operator Not Supported"));

internal static Result<FraudCheckRequest> BuildRequestWithFraudScore() =>
Expand Down
25 changes: 24 additions & 1 deletion Vonage/NumberInsightV2/FraudCheck/FraudCheckResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
using System.ComponentModel;
using System.Text.Json.Serialization;
using Vonage.Common.Serialization;

namespace Vonage.NumberInsightV2.FraudCheck;

Expand Down Expand Up @@ -43,7 +46,27 @@ public record PhoneData(string Phone, string Carrier, string Type);
/// <param name="RiskRecommendation">Recommended action based on the risk_score.</param>
/// <param name="Label">Mapping of risk score to a verbose description.</param>
/// <param name="Status">The status of the fraud_score call.</param>
public record FraudScore(string RiskScore, string RiskRecommendation, string Label, string Status);
public record FraudScore(string RiskScore, string RiskRecommendation,
[property: JsonConverter(typeof(EnumDescriptionJsonConverter<FraudScoreLabel>))]
FraudScoreLabel Label, string Status);

/// <summary>
/// Represents the mapping of risk score to a verbose description.
/// </summary>
public enum FraudScoreLabel
{
/// <summary>
/// </summary>
[Description("low")] Low,

/// <summary>
/// </summary>
[Description("medium")] Medium,

/// <summary>
/// </summary>
[Description("high")] High,
}

/// <summary>
/// Represents the result of the sim_swap insight operation.
Expand Down

0 comments on commit f45bf94

Please sign in to comment.