diff --git a/CHANGES.MD b/CHANGES.MD index 408f53d..dc1bfc2 100644 --- a/CHANGES.MD +++ b/CHANGES.MD @@ -1,3 +1,11 @@ +3.23.0 (2026-08-20) +================= +- Added support for `$nationality`, `$year_of_birth` fields to `$create_account`, `$update_account` events +- Added support for `$kyc` complex field to `$create_account`, `$update_account`, `$transaction`, + `$create_order`, `$update_order`, `$verification` events +- Added support for `$geo`, `$bot_identification` complex fields to `$create_account`, + `$update_account`, `$login`, `$transaction`, `$create_order`, `$update_order` events + 3.22.0 (2026-01-05) ================= - Added support for `$user_email`, `$review.$reviewed_user_id` fields to `$create_content`, `$update_content` events diff --git a/README.md b/README.md index efe027b..2f06608 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ Java 1.7 or later. com.siftscience sift-java - 3.22.0 + 3.23.0 ``` ### Gradle ``` dependencies { - compile 'com.siftscience:sift-java:3.22.0' + compile 'com.siftscience:sift-java:3.23.0' } ``` ### Other diff --git a/build.gradle b/build.gradle index b46c813..38b05ae 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'signing' apply plugin: 'java-library-distribution' group = 'com.siftscience' -version = '3.22.0' +version = '3.23.0' repositories { mavenCentral() diff --git a/src/main/java/com/siftscience/model/BaseAccountFieldSet.java b/src/main/java/com/siftscience/model/BaseAccountFieldSet.java index 95979e5..2241a53 100644 --- a/src/main/java/com/siftscience/model/BaseAccountFieldSet.java +++ b/src/main/java/com/siftscience/model/BaseAccountFieldSet.java @@ -18,6 +18,11 @@ public abstract class BaseAccountFieldSet> @Expose @SerializedName("$social_sign_on_type") private String socialSignOnType; @Expose @SerializedName("$merchant_profile") private MerchantProfile merchantProfile; @Expose @SerializedName(VERIFICATION_PHONE_NUMBER) private String verificationPhoneNumber; + @Expose @SerializedName("$nationality") private String nationality; + @Expose @SerializedName("$year_of_birth") private Integer yearOfBirth; + @Expose @SerializedName("$kyc") private Kyc kyc; + @Expose @SerializedName("$geo") private Geo geo; + @Expose @SerializedName("$bot_identification") private BotIdentification botIdentification; public String getUserEmail() { return userEmail; @@ -117,4 +122,49 @@ public T setPromotions(List promotions) { this.promotions = promotions; return (T) this; } + + public String getNationality() { + return nationality; + } + + public T setNationality(String nationality) { + this.nationality = nationality; + return (T) this; + } + + public Integer getYearOfBirth() { + return yearOfBirth; + } + + public T setYearOfBirth(Integer yearOfBirth) { + this.yearOfBirth = yearOfBirth; + return (T) this; + } + + public Kyc getKyc() { + return kyc; + } + + public T setKyc(Kyc kyc) { + this.kyc = kyc; + return (T) this; + } + + public Geo getGeo() { + return geo; + } + + public T setGeo(Geo geo) { + this.geo = geo; + return (T) this; + } + + public BotIdentification getBotIdentification() { + return botIdentification; + } + + public T setBotIdentification(BotIdentification botIdentification) { + this.botIdentification = botIdentification; + return (T) this; + } } diff --git a/src/main/java/com/siftscience/model/BaseOrderFieldSet.java b/src/main/java/com/siftscience/model/BaseOrderFieldSet.java index e02f8bd..a494283 100644 --- a/src/main/java/com/siftscience/model/BaseOrderFieldSet.java +++ b/src/main/java/com/siftscience/model/BaseOrderFieldSet.java @@ -27,6 +27,9 @@ public abstract class BaseOrderFieldSet> @Expose @SerializedName("$merchant_profile") private MerchantProfile merchantProfile; @Expose @SerializedName(VERIFICATION_PHONE_NUMBER) private String verificationPhoneNumber; @Expose @SerializedName("$digital_orders") private List digitalOrders; + @Expose @SerializedName("$kyc") private Kyc kyc; + @Expose @SerializedName("$geo") private Geo geo; + @Expose @SerializedName("$bot_identification") private BotIdentification botIdentification; public String getOrderId() { return orderId; @@ -211,4 +214,31 @@ public T setDigitalOrders(List digitalOrders) { this.digitalOrders = digitalOrders; return (T) this; } + + public Kyc getKyc() { + return kyc; + } + + public T setKyc(Kyc kyc) { + this.kyc = kyc; + return (T) this; + } + + public Geo getGeo() { + return geo; + } + + public T setGeo(Geo geo) { + this.geo = geo; + return (T) this; + } + + public BotIdentification getBotIdentification() { + return botIdentification; + } + + public T setBotIdentification(BotIdentification botIdentification) { + this.botIdentification = botIdentification; + return (T) this; + } } diff --git a/src/main/java/com/siftscience/model/BotIdentification.java b/src/main/java/com/siftscience/model/BotIdentification.java new file mode 100644 index 0000000..9dc05ad --- /dev/null +++ b/src/main/java/com/siftscience/model/BotIdentification.java @@ -0,0 +1,27 @@ +package com.siftscience.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class BotIdentification { + @Expose @SerializedName("$result") private String result; + @Expose @SerializedName("$provider") private String provider; + + public String getResult() { + return result; + } + + public BotIdentification setResult(String result) { + this.result = result; + return this; + } + + public String getProvider() { + return provider; + } + + public BotIdentification setProvider(String provider) { + this.provider = provider; + return this; + } +} diff --git a/src/main/java/com/siftscience/model/Geo.java b/src/main/java/com/siftscience/model/Geo.java new file mode 100644 index 0000000..172ec17 --- /dev/null +++ b/src/main/java/com/siftscience/model/Geo.java @@ -0,0 +1,27 @@ +package com.siftscience.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Geo { + @Expose @SerializedName("$uuid") private String uuid; + @Expose @SerializedName("$provider") private String provider; + + public String getUuid() { + return uuid; + } + + public Geo setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public String getProvider() { + return provider; + } + + public Geo setProvider(String provider) { + this.provider = provider; + return this; + } +} diff --git a/src/main/java/com/siftscience/model/Kyc.java b/src/main/java/com/siftscience/model/Kyc.java new file mode 100644 index 0000000..153e2e6 --- /dev/null +++ b/src/main/java/com/siftscience/model/Kyc.java @@ -0,0 +1,47 @@ +package com.siftscience.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Kyc { + @Expose @SerializedName("$names_match") private Boolean namesMatch; + @Expose @SerializedName("$kyc_level") private String kycLevel; + @Expose @SerializedName("$bin_nationality_match") private Boolean binNationalityMatch; + @Expose @SerializedName("$provider") private String provider; + + public Boolean getNamesMatch() { + return namesMatch; + } + + public Kyc setNamesMatch(Boolean namesMatch) { + this.namesMatch = namesMatch; + return this; + } + + public String getKycLevel() { + return kycLevel; + } + + public Kyc setKycLevel(String kycLevel) { + this.kycLevel = kycLevel; + return this; + } + + public Boolean getBinNationalityMatch() { + return binNationalityMatch; + } + + public Kyc setBinNationalityMatch(Boolean binNationalityMatch) { + this.binNationalityMatch = binNationalityMatch; + return this; + } + + public String getProvider() { + return provider; + } + + public Kyc setProvider(String provider) { + this.provider = provider; + return this; + } +} diff --git a/src/main/java/com/siftscience/model/LoginFieldSet.java b/src/main/java/com/siftscience/model/LoginFieldSet.java index 01d16df..08e068e 100644 --- a/src/main/java/com/siftscience/model/LoginFieldSet.java +++ b/src/main/java/com/siftscience/model/LoginFieldSet.java @@ -17,6 +17,8 @@ public static LoginFieldSet fromJson(String json) { @Expose @SerializedName("$account_types") private List accountTypes; @Expose @SerializedName(USER_EMAIL) private String userEmail; @Expose @SerializedName(VERIFICATION_PHONE_NUMBER) private String verificationPhoneNumber; + @Expose @SerializedName("$geo") private Geo geo; + @Expose @SerializedName("$bot_identification") private BotIdentification botIdentification; @Override public String getEventType() { @@ -79,4 +81,22 @@ public LoginFieldSet setVerificationPhoneNumber(String verificationPhoneNumber) this.verificationPhoneNumber = verificationPhoneNumber; return this; } + + public Geo getGeo() { + return geo; + } + + public LoginFieldSet setGeo(Geo geo) { + this.geo = geo; + return this; + } + + public BotIdentification getBotIdentification() { + return botIdentification; + } + + public LoginFieldSet setBotIdentification(BotIdentification botIdentification) { + this.botIdentification = botIdentification; + return this; + } } diff --git a/src/main/java/com/siftscience/model/TransactionFieldSet.java b/src/main/java/com/siftscience/model/TransactionFieldSet.java index e578ec2..5daa165 100644 --- a/src/main/java/com/siftscience/model/TransactionFieldSet.java +++ b/src/main/java/com/siftscience/model/TransactionFieldSet.java @@ -38,6 +38,9 @@ public class TransactionFieldSet extends BaseAppBrowserSiteBrandFieldSet request = client.buildRequest( + new UpdateOrderFieldSet() + .setUserId("billy_jones_301") + .setOrderId("ORDER-28168441") + .setAmount(115940000L) + .setCurrencyCode("USD") + .setKyc(new Kyc() + .setNamesMatch(true) + .setKycLevel("basic") + .setBinNationalityMatch(true) + .setProvider("lexisnexis")) + .setGeo(new Geo() + .setUuid("gc-abc-123") + .setProvider("geocomply")) + .setBotIdentification(new BotIdentification() + .setResult("human") + .setProvider("datadome"))); + + SiftResponse siftResponse = request.send(); + + RecordedRequest request1 = server.takeRequest(); + Assert.assertEquals("POST", request1.getMethod()); + Assert.assertEquals("/v205/events", request1.getPath()); + JSONAssert.assertEquals(expectedRequestBody, request.getFieldSet().toJson(), true); + + Assert.assertEquals(HTTP_OK, siftResponse.getHttpStatusCode()); + Assert.assertNotNull(siftResponse.getBody()); + Assert.assertEquals(0, (int) siftResponse.getBody().getStatus()); + JSONAssert.assertEquals(response.getBody().readUtf8(), + siftResponse.getBody().toJson(), true); + + server.shutdown(); + } } diff --git a/src/test/java/com/siftscience/VerificationEventTest.java b/src/test/java/com/siftscience/VerificationEventTest.java index 081fbcb..50fbb28 100644 --- a/src/test/java/com/siftscience/VerificationEventTest.java +++ b/src/test/java/com/siftscience/VerificationEventTest.java @@ -3,6 +3,7 @@ import static java.net.HttpURLConnection.HTTP_OK; import com.siftscience.model.App; +import com.siftscience.model.Kyc; import com.siftscience.model.VerificationFieldSet; import okhttp3.OkHttpClient; import okhttp3.mockwebserver.MockResponse; @@ -98,4 +99,62 @@ public void testVerification() throws Exception { server.shutdown(); } + + @Test + public void testVerificationWithKyc() throws Exception { + String expectedRequestBody = "{\n" + + " \"$type\" : \"$verification\",\n" + + " \"$api_key\" : \"YOUR_API_KEY\",\n" + + " \"$user_id\" : \"billy_jones_301\",\n" + + " \"$status\" : \"$success\",\n" + + " \"$verification_type\" : \"$kyc\",\n" + + " \"$kyc\" : {\n" + + " \"$names_match\" : true,\n" + + " \"$kyc_level\" : \"basic\",\n" + + " \"$bin_nationality_match\" : false,\n" + + " \"$provider\" : \"lexisnexis\"\n" + + " }\n" + + "}"; + + MockWebServer server = new MockWebServer(); + MockResponse response = new MockResponse(); + response.setResponseCode(HTTP_OK); + response.setBody("{\n" + + " \"status\" : 0,\n" + + " \"error_message\" : \"OK\",\n" + + " \"time\" : 1327604222,\n" + + " \"request\" : \"" + TestUtils.unescapeJson(expectedRequestBody) + "\"\n" + + "}"); + server.enqueue(response); + server.start(); + + SiftClient client = new SiftClient("YOUR_API_KEY", "YOUR_ACCOUNT_ID", + new OkHttpClient.Builder() + .addInterceptor(OkHttpUtils.urlRewritingInterceptor(server)) + .build()); + + SiftRequest request = client.buildRequest(new VerificationFieldSet() + .setUserId("billy_jones_301") + .setStatus("$success") + .setVerificationType("$kyc") + .setKyc(new Kyc() + .setNamesMatch(true) + .setKycLevel("basic") + .setBinNationalityMatch(false) + .setProvider("lexisnexis"))); + + SiftResponse siftResponse = request.send(); + + RecordedRequest request1 = server.takeRequest(); + Assert.assertEquals("POST", request1.getMethod()); + Assert.assertEquals("/v205/events", request1.getPath()); + JSONAssert.assertEquals(expectedRequestBody, request.getFieldSet().toJson(), true); + + Assert.assertEquals(HTTP_OK, siftResponse.getHttpStatusCode()); + Assert.assertEquals(0, (int) siftResponse.getBody().getStatus()); + JSONAssert.assertEquals(response.getBody().readUtf8(), + siftResponse.getBody().toJson(), true); + + server.shutdown(); + } }