Skip to content

Commit 4561b26

Browse files
authored
Merge pull request #35 from SiftScience/cchi_update_login_event
(for Mohammed or Gary) add new fields to the login event
2 parents b3715ff + dc0b861 commit 4561b26

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

CHANGES.MD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2.5.0 (2019-01-09)
2+
=================
3+
4+
- Add support for `$failure_reason` to the `$login` event
5+
- Add support for `$account_types` to the `$login` event
6+
- Add support for `$username` to the `$login` event
7+
- Add support for `$social_sign_on_type` to the `$login` event
8+
19
2.4.0 (2018-10-24)
210
=================
311
- Add support for Rescore User and Get User Score APIs

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ Java 1.7 or later.
1111
<dependency>
1212
<groupId>com.siftscience</groupId>
1313
<artifactId>sift-java</artifactId>
14-
<version>2.4.0</version>
14+
<version>2.5.0</version>
1515
</dependency>
1616
```
1717
### Gradle
1818
```
1919
dependencies {
20-
compile 'com.siftscience:sift-java:2.4.0'
20+
compile 'com.siftscience:sift-java:2.5.0'
2121
}
2222
```
2323
### Other

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'signing'
55
apply plugin: 'java-library-distribution'
66

77
group = 'com.siftscience'
8-
version = '2.4.0'
8+
version = '2.5.0'
99
sourceCompatibility = 1.7
1010
targetCompatibility = 1.7
1111

src/main/java/com/siftscience/model/LoginFieldSet.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.siftscience.model;
22

3+
import java.util.List;
4+
35
import com.google.gson.annotations.Expose;
46
import com.google.gson.annotations.SerializedName;
57

@@ -9,6 +11,10 @@ public static LoginFieldSet fromJson(String json) {
911
}
1012

1113
@Expose @SerializedName("$login_status") private String loginStatus;
14+
@Expose @SerializedName("$failure_reason") private String failureReason;
15+
@Expose @SerializedName("$username") private String username;
16+
@Expose @SerializedName("$social_sign_on_type") private String socialSignOnType;
17+
@Expose @SerializedName("$account_types") private List<String> accountTypes;
1218

1319
@Override
1420
public String getEventType() {
@@ -23,4 +29,34 @@ public LoginFieldSet setLoginStatus(String loginStatus) {
2329
this.loginStatus = loginStatus;
2430
return this;
2531
}
32+
33+
public String getFailureReason() { return failureReason; }
34+
35+
public LoginFieldSet setFailureReason(String failureReason) {
36+
this.failureReason = failureReason;
37+
return this;
38+
}
39+
40+
public String getUsername() { return username; }
41+
42+
public LoginFieldSet setUsername(String username) {
43+
this.username = username;
44+
return this;
45+
}
46+
47+
public String getSocialSignOnType() { return socialSignOnType; }
48+
49+
public LoginFieldSet setSocialSignOnType(String socialSignOnType) {
50+
this.socialSignOnType = socialSignOnType;
51+
return this;
52+
}
53+
54+
public List<String> getAccountTypes() {
55+
return accountTypes;
56+
}
57+
58+
public LoginFieldSet setAccountTypes(List<String> accountTypes) {
59+
this.accountTypes = accountTypes;
60+
return this;
61+
}
2662
}

src/test/java/com/siftscience/LoginEventTest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.siftscience;
22

3+
import java.util.Arrays;
4+
import java.util.List;
5+
36
import com.siftscience.model.App;
47
import com.siftscience.model.Browser;
58
import com.siftscience.model.LoginFieldSet;
@@ -28,7 +31,11 @@ public void testLoginWithApp() throws Exception {
2831
" \"$app\" : {\n" +
2932
" \"$os\" : \"" + operatingSystem + "\",\n" +
3033
" \"$app_name\" : \"" + appName + "\"\n" +
31-
" }\n" +
34+
" },\n" +
35+
" \"$failure_reason\": \"$account_suspended\",\n" +
36+
" \"$username\" : \"seattle_001\",\n" +
37+
" \"$social_sign_on_type\" : \"$facebook\",\n" +
38+
" \"$account_types\" : [\"merchant\", \"premium\"]\n" +
3239
"}";
3340

3441
// Start a new mock server and enqueue a mock response.
@@ -55,7 +62,11 @@ public void testLoginWithApp() throws Exception {
5562
.setLoginStatus("$success")
5663
.setApp(new App()
5764
.setOperatingSystem(operatingSystem)
58-
.setAppName(appName)));
65+
.setAppName(appName))
66+
.setFailureReason("$account_suspended")
67+
.setUsername("seattle_001")
68+
.setSocialSignOnType("$facebook")
69+
.setAccountTypes(Arrays.asList("merchant", "premium")));
5970

6071
SiftResponse siftResponse = request.send();
6172

0 commit comments

Comments
 (0)