diff --git a/Sift/Schema/ComplexTypes/card_bin_metadata.json b/Sift/Schema/ComplexTypes/card_bin_metadata.json
new file mode 100644
index 0000000..54284e5
--- /dev/null
+++ b/Sift/Schema/ComplexTypes/card_bin_metadata.json
@@ -0,0 +1,22 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema",
+ "title": "CardBinMetadata",
+ "type": "object",
+ "properties": {
+ "$bank": {
+ "type": [ "string", "null" ]
+ },
+ "$brand": {
+ "type": [ "string", "null" ]
+ },
+ "$country": {
+ "type": [ "string", "null" ]
+ },
+ "$level": {
+ "type": [ "string", "null" ]
+ },
+ "$type": {
+ "type": [ "string", "null" ]
+ }
+ }
+}
diff --git a/Sift/Schema/ComplexTypes/payment_method.json b/Sift/Schema/ComplexTypes/payment_method.json
index 89b9229..00d9e06 100644
--- a/Sift/Schema/ComplexTypes/payment_method.json
+++ b/Sift/Schema/ComplexTypes/payment_method.json
@@ -92,6 +92,12 @@
},
"$wallet_type": {
"type": [ "string", "null" ]
+ },
+ "$card_bin_metadata": {
+ "oneOf": [
+ { "$ref": "card_bin_metadata.json" },
+ { "type": "null" }
+ ]
}
}
}
diff --git a/Sift/Sift.csproj b/Sift/Sift.csproj
index 4c16f53..927b0ab 100644
--- a/Sift/Sift.csproj
+++ b/Sift/Sift.csproj
@@ -4,8 +4,8 @@
Sift
Sift
Sift
- 1.5.0
- Release 1.5.0
+ 1.6.0
+ Release 1.6.0
netstandard2.0
Sift
sift;siftscience;client;api;client;async
diff --git a/Test.Integration.Net7/EventsAPI/Transactions.cs b/Test.Integration.Net7/EventsAPI/Transactions.cs
index 42c90f9..3b05346 100644
--- a/Test.Integration.Net7/EventsAPI/Transactions.cs
+++ b/Test.Integration.Net7/EventsAPI/Transactions.cs
@@ -240,5 +240,40 @@ public void WithdrawalTransactionTest()
EventResponse res = sift.SendAsync(eventRequest).Result;
Assert.Equal("0", res.Status.ToString());
}
+
+ [Fact]
+ public void TransactionEventWithAmountAndBinMetadataFieldsTest()
+ {
+ var sift = new Client(ApiKey);
+ var transaction = new Transaction
+ {
+ user_id = "test_dotnet_transaction_event",
+ amount = 100000000L,
+ currency_code = "EUR",
+ transaction_type = "$withdrawal",
+ transaction_status = "$failure",
+ payment_method = new PaymentMethod
+ {
+ payment_type = "$credit_card",
+ card_bin = "542486",
+ card_last4 = "4444",
+ card_bin_metadata = new CardBinMetadata
+ {
+ bank = "Chase",
+ brand = "VISA",
+ country = "US",
+ level = "Gold",
+ type = "CREDIT"
+ }
+ }
+ };
+
+ EventRequest eventRequest = new EventRequest()
+ {
+ Event = transaction
+ };
+ EventResponse res = sift.SendAsync(eventRequest).Result;
+ Assert.Equal("0", res.Status.ToString());
+ }
}
}
diff --git a/Test.Integration.NetFx48/EventsAPI/Transactions.cs b/Test.Integration.NetFx48/EventsAPI/Transactions.cs
index 1d4bcc7..06c3463 100644
--- a/Test.Integration.NetFx48/EventsAPI/Transactions.cs
+++ b/Test.Integration.NetFx48/EventsAPI/Transactions.cs
@@ -236,5 +236,40 @@ public void WithdrawalTransactionTest()
EventResponse res = sift.SendAsync(eventRequest).Result;
Assert.Equal("0", res.Status.ToString());
}
+
+ [Fact]
+ public void TransactionEventWithAmountAndBinMetadataFieldsTest()
+ {
+ var sift = new Client(ApiKey);
+ var transaction = new Transaction
+ {
+ user_id = "test_dotnet_transaction_event",
+ amount = 100000000L,
+ currency_code = "EUR",
+ transaction_type = "$withdrawal",
+ transaction_status = "$failure",
+ payment_method = new PaymentMethod
+ {
+ payment_type = "$credit_card",
+ card_bin = "542486",
+ card_last4 = "4444",
+ card_bin_metadata = new CardBinMetadata
+ {
+ bank = "Chase",
+ brand = "VISA",
+ country = "US",
+ level = "Gold",
+ type = "CREDIT"
+ }
+ }
+ };
+
+ EventRequest eventRequest = new EventRequest()
+ {
+ Event = transaction
+ };
+ EventResponse res = sift.SendAsync(eventRequest).Result;
+ Assert.Equal("0", res.Status.ToString());
+ }
}
}
diff --git a/Test/Test.cs b/Test/Test.cs
index 8d31f0b..a666164 100644
--- a/Test/Test.cs
+++ b/Test/Test.cs
@@ -2801,6 +2801,74 @@ public void TestWagerEvent()
Assert.Equal("https://api.sift.com/v205/events?abuse_types=legacy,payment_abuse&return_score=true",
Uri.UnescapeDataString(eventRequest.Request.RequestUri!.ToString()));
}
- }
+ [Fact]
+ public void TestTransactionEventWithAmountAndBinMetadataFields()
+ {
+ //Please provide the valid session id in place of 'sessionId'
+ var sessionId = "sessionId";
+ var transaction = new Transaction
+ {
+ user_id = "test_dotnet_transaction_event",
+ amount = 100000000L,
+ currency_code = "EUR",
+ session_id = sessionId,
+ transaction_type = "$deposit",
+ transaction_status = "$failure",
+ payment_method = new PaymentMethod
+ {
+ payment_type = "$credit_card",
+ card_bin = "542486",
+ card_last4 = "4444",
+ card_bin_metadata = new CardBinMetadata
+ {
+ bank = "Chase",
+ brand = "VISA",
+ country = "US",
+ level = "Gold",
+ type = "CREDIT"
+ }
+ }
+ };
+
+ Assert.Equal("{" +
+ "\"$type\":\"$transaction\"," +
+ "\"$user_id\":\"test_dotnet_transaction_event\"," +
+ "\"$session_id\":\"sessionId\"," +
+ "\"$transaction_type\":\"$deposit\"," +
+ "\"$transaction_status\":\"$failure\"," +
+ "\"$amount\":100000000," +
+ "\"$currency_code\":\"EUR\"," +
+ "\"$payment_method\":{" +
+ "\"$payment_type\":\"$credit_card\"," +
+ "\"$card_bin\":\"542486\"," +
+ "\"$card_last4\":\"4444\"," +
+ "\"$card_bin_metadata\":{" +
+ "\"$bank\":\"Chase\"," +
+ "\"$brand\":\"VISA\"," +
+ "\"$country\":\"US\"," +
+ "\"$level\":\"Gold\"," +
+ "\"$type\":\"CREDIT\"" +
+ "}" +
+ "}" +
+ "}", transaction.ToJson());
+
+ EventRequest eventRequest = new EventRequest
+ {
+ Event = transaction
+ };
+
+ Assert.Equal("https://api.sift.com/v205/events", eventRequest.Request.RequestUri!.ToString());
+
+ eventRequest = new EventRequest
+ {
+ Event = transaction,
+ AbuseTypes = { "legacy", "payment_abuse" },
+ ReturnScore = true
+ };
+
+ Assert.Equal("https://api.sift.com/v205/events?abuse_types=legacy,payment_abuse&return_score=true",
+ Uri.UnescapeDataString(eventRequest.Request.RequestUri!.ToString()));
+ }
+ }
}