Skip to content

Commit

Permalink
Fixed handling of multiple triggered rules
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnilhande committed Jan 24, 2018
1 parent dbb669f commit 7affbf8
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
= LitleOnline CHANGELOG

== Version 9.12.7 (Jan 24, 2018)
* BugFix: Fixed handling of multiple triggeredRule

== Version 9.12.6 (Nov 30, 2017)
* BugFix: Handled namespace issue from backend

Expand Down
71 changes: 65 additions & 6 deletions LitleSdkForNet/LitleSdkForNet/XmlResponseFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,17 +539,76 @@ public string advancedAVSResult
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.litle.com/schema")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.litle.com/schema", IsNullable = false)]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.litle.com/schema")]
public partial class advancedFraudResultsType
{
public string deviceReviewStatus;
public int deviceReputationScore;
public string triggeredRule;

private string deviceReviewStatusField;

private int deviceReputationScoreField;

private bool deviceReputationScoreFieldSpecified;

private string[] triggeredRuleField;

/// <remarks/>
public string deviceReviewStatus
{
get
{
return this.deviceReviewStatusField;
}
set
{
this.deviceReviewStatusField = value;
}
}

/// <remarks/>
public int deviceReputationScore
{
get
{
return this.deviceReputationScoreField;
}
set
{
this.deviceReputationScoreField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool deviceReputationScoreSpecified
{
get
{
return this.deviceReputationScoreFieldSpecified;
}
set
{
this.deviceReputationScoreFieldSpecified = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("triggeredRule")]
public string[] triggeredRule
{
get
{
return this.triggeredRuleField;
}
set
{
this.triggeredRuleField = value;
}
}
}

[System.SerializableAttribute()]
Expand Down
11 changes: 8 additions & 3 deletions LitleSdkForNet/LitleSdkForNetTest/Functional/TestFraudCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ public void TestCustomAttribute7TriggeredRules()

Assert.NotNull(fraudCheckResponse);
Assert.AreEqual(60, fraudCheckResponse.advancedFraudResults.deviceReputationScore);
// TODO: we should be parsing multiple triggered rules, noit just the first one
//Assert.AreEqual(7, fraudCheckResponse.advancedFraudResults.triggeredRule.Length);
Assert.AreEqual("triggered_rule_1", fraudCheckResponse.advancedFraudResults.triggeredRule);
Assert.AreEqual(7, fraudCheckResponse.advancedFraudResults.triggeredRule.Length);
Assert.AreEqual("triggered_rule_1", fraudCheckResponse.advancedFraudResults.triggeredRule[0]);
Assert.AreEqual("triggered_rule_2", fraudCheckResponse.advancedFraudResults.triggeredRule[1]);
Assert.AreEqual("triggered_rule_3", fraudCheckResponse.advancedFraudResults.triggeredRule[2]);
Assert.AreEqual("triggered_rule_4", fraudCheckResponse.advancedFraudResults.triggeredRule[3]);
Assert.AreEqual("triggered_rule_5", fraudCheckResponse.advancedFraudResults.triggeredRule[4]);
Assert.AreEqual("triggered_rule_6", fraudCheckResponse.advancedFraudResults.triggeredRule[5]);
Assert.AreEqual("triggered_rule_7", fraudCheckResponse.advancedFraudResults.triggeredRule[6]);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void TestCustomAttribute2()
fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck);

Assert.NotNull(fraudCheckResponse);
Assert.AreEqual("triggered_rule_default", fraudCheckResponse.advancedFraudResults.triggeredRule);
Assert.AreEqual("triggered_rule_default", fraudCheckResponse.advancedFraudResults.triggeredRule[0]);
}

[Test]
Expand Down
5 changes: 3 additions & 2 deletions LitleSdkForNet/LitleSdkForNetTest/Unit/TestAuthorization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ public void TestAdvancedFraudResponse()
Assert.AreEqual("ReviewStatus", authorizationResponse.fraudResult.advancedFraudResults.deviceReviewStatus);
Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore);
Assert.AreEqual(800, authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore);
Assert.AreEqual("rule triggered", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule);
Assert.AreEqual("rule triggered", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule[0]);
Assert.AreEqual("rule triggered 2", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule[1]);
}

[Test]
Expand Down Expand Up @@ -612,7 +613,7 @@ public void TestRecycleEngineActive()
Assert.AreEqual("ReviewStatus", authorizationResponse.fraudResult.advancedFraudResults.deviceReviewStatus);
Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore);
Assert.AreEqual(800, authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore);
Assert.AreEqual("rule triggered", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule);
Assert.AreEqual("rule triggered", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule[0]);
Assert.AreEqual(true, authorizationResponse.recycling.recycleEngineActive);
}

Expand Down

0 comments on commit 7affbf8

Please sign in to comment.