Skip to content

Commit 2c85bc3

Browse files
Minor refactor based on integration testing
1 parent f14e0ec commit 2c85bc3

11 files changed

+198
-30
lines changed

src/main/java/com/siftscience/VerificationCheckRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* The check call is used for verifying the OTP provided by the end user to Sift.
1717
* Check out https://sift.com/developers/docs/java/verification-api/check for more information on our request/response structure.
1818
*/
19-
public class VerificationCheckRequest extends SiftRequest<VerificationResponse> {
19+
public class VerificationCheckRequest extends SiftRequest<VerificationCheckResponse> {
2020

2121
VerificationCheckRequest(HttpUrl baseUrl, String accountId, OkHttpClient okClient, VerificationCheckFieldSet fields) {
2222
super(baseUrl, accountId, okClient, fields);
@@ -31,8 +31,8 @@ protected HttpUrl path(HttpUrl baseUrl) {
3131
}
3232

3333
@Override
34-
VerificationResponse buildResponse(Response response, FieldSet requestFields) throws IOException {
35-
return new VerificationResponse(response, requestFields);
34+
VerificationCheckResponse buildResponse(Response response, FieldSet requestFields) throws IOException {
35+
return new VerificationCheckResponse(response, requestFields);
3636
}
3737

3838
@Override
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.siftscience;
2+
3+
import com.siftscience.model.VerificationCheckResponseBody;
4+
import com.siftscience.model.VerificationResponseBody;
5+
import okhttp3.Response;
6+
7+
import java.io.IOException;
8+
9+
public class VerificationCheckResponse extends SiftResponse<VerificationCheckResponseBody> {
10+
VerificationCheckResponse(Response okResponse, FieldSet requestBody) throws IOException {
11+
super(okResponse, requestBody);
12+
}
13+
14+
@Override
15+
public void populateBodyFromJson(String jsonBody) {
16+
body = VerificationCheckResponseBody.fromJson(jsonBody);
17+
}
18+
}

src/main/java/com/siftscience/VerificationResendRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* The resend call generates a new OTP and sends it to the original recipient with the same settings.
1616
* Check out https://sift.com/developers/docs/java/verification-api/resend for more information on our request/response structuree.
1717
* */
18-
public class VerificationResendRequest extends SiftRequest<VerificationResponse> {
18+
public class VerificationResendRequest extends SiftRequest<VerificationResendResponse> {
1919

2020
VerificationResendRequest(HttpUrl baseUrl, String accountId, OkHttpClient okClient, VerificationResendFieldSet fields) {
2121
super(baseUrl, accountId, okClient, fields);
@@ -30,8 +30,8 @@ protected HttpUrl path(HttpUrl baseUrl) {
3030
}
3131

3232
@Override
33-
VerificationResponse buildResponse(Response response, FieldSet requestFields) throws IOException {
34-
return new VerificationResponse(response, requestFields);
33+
VerificationResendResponse buildResponse(Response response, FieldSet requestFields) throws IOException {
34+
return new VerificationResendResponse(response, requestFields);
3535
}
3636

3737
@Override
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.siftscience;
2+
3+
import com.siftscience.model.VerificationResendResponseBody;
4+
import okhttp3.Response;
5+
6+
import java.io.IOException;
7+
8+
public class VerificationResendResponse extends SiftResponse<VerificationResendResponseBody> {
9+
VerificationResendResponse(Response okResponse, FieldSet requestBody) throws IOException {
10+
super(okResponse, requestBody);
11+
}
12+
13+
@Override
14+
public void populateBodyFromJson(String jsonBody) {
15+
body = VerificationResendResponseBody.fromJson(jsonBody);
16+
}
17+
}

src/main/java/com/siftscience/VerificationResponse.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/main/java/com/siftscience/VerificationSendRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* and email/sms the code to the user.
1717
* Check out https://sift.com/developers/docs/java/verification-api/send for more information on our request/response structure.
1818
* */
19-
public class VerificationSendRequest extends SiftRequest<VerificationResponse> {
19+
public class VerificationSendRequest extends SiftRequest<VerificationSendResponse> {
2020

2121
VerificationSendRequest(HttpUrl baseUrl, String accountId, OkHttpClient okClient, VerificationSendFieldSet fields) {
2222
super(baseUrl, accountId, okClient, fields);
@@ -31,8 +31,8 @@ protected HttpUrl path(HttpUrl baseUrl) {
3131
}
3232

3333
@Override
34-
VerificationResponse buildResponse(Response response, FieldSet requestFields) throws IOException {
35-
return new VerificationResponse(response, requestFields);
34+
VerificationSendResponse buildResponse(Response response, FieldSet requestFields) throws IOException {
35+
return new VerificationSendResponse(response, requestFields);
3636
}
3737

3838
@Override
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.siftscience;
2+
3+
import com.siftscience.model.VerificationSendResponseBody;
4+
import okhttp3.Response;
5+
6+
import java.io.IOException;
7+
8+
public class VerificationSendResponse extends SiftResponse<VerificationSendResponseBody> {
9+
VerificationSendResponse(Response okResponse, FieldSet requestBody) throws IOException {
10+
super(okResponse, requestBody);
11+
}
12+
13+
@Override
14+
public void populateBodyFromJson(String jsonBody) {
15+
body = VerificationSendResponseBody.fromJson(jsonBody);
16+
}
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.siftscience.model;
2+
3+
import com.google.gson.annotations.Expose;
4+
import com.google.gson.annotations.SerializedName;
5+
6+
public class VerificationCheckResponseBody extends BaseResponseBody<VerificationCheckResponseBody> {
7+
8+
@Expose @SerializedName("checked_at") private Long checkedAt;
9+
10+
public static VerificationCheckResponseBody fromJson(String json) {
11+
return gson.fromJson(json, VerificationCheckResponseBody.class);
12+
}
13+
14+
public Long getCheckedAt() {
15+
return checkedAt;
16+
}
17+
18+
public VerificationCheckResponseBody setCheckedAt(Long checkedAt) {
19+
this.checkedAt = checkedAt;
20+
return this;
21+
}
22+
}
23+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.siftscience.model;
2+
3+
import com.google.gson.annotations.Expose;
4+
import com.google.gson.annotations.SerializedName;
5+
6+
public class VerificationResendResponseBody extends BaseResponseBody<VerificationResendResponseBody> {
7+
8+
@Expose @SerializedName("sent_at") private Long sentAt;
9+
10+
11+
public static VerificationResendResponseBody fromJson(String json) {
12+
return gson.fromJson(json, VerificationResendResponseBody.class);
13+
}
14+
15+
public Long getSentAt() {
16+
return sentAt;
17+
}
18+
19+
public VerificationResendResponseBody setSentAt(Long sentAt) {
20+
this.sentAt = sentAt;
21+
return this;
22+
}
23+
24+
}
25+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package com.siftscience.model;
2+
3+
import com.google.gson.annotations.Expose;
4+
import com.google.gson.annotations.SerializedName;
5+
6+
public class VerificationSendResponseBody extends BaseResponseBody<VerificationSendResponseBody> {
7+
8+
@Expose @SerializedName("sent_at") private Long sentAt;
9+
10+
@Expose @SerializedName("segment_id") private String segmentId;
11+
12+
@Expose @SerializedName("segment_name") private String segmentName;
13+
14+
@Expose @SerializedName("brand_name") private String brandName;
15+
16+
@Expose @SerializedName("site_country") private String siteCountry;
17+
18+
@Expose @SerializedName("content_language") private String contentLanguage;
19+
20+
21+
public static VerificationSendResponseBody fromJson(String json) {
22+
return gson.fromJson(json, VerificationSendResponseBody.class);
23+
}
24+
25+
26+
public Long getSentAt() {
27+
return sentAt;
28+
}
29+
30+
public VerificationSendResponseBody setSentAt(Long sentAt) {
31+
this.sentAt = sentAt;
32+
return this;
33+
}
34+
35+
public String getSegmentId() {
36+
return segmentId;
37+
}
38+
39+
public VerificationSendResponseBody setSegmentId(String segmentId) {
40+
this.segmentId = segmentId;
41+
return this;
42+
}
43+
44+
public String getSegmentName() {
45+
return segmentName;
46+
}
47+
48+
public VerificationSendResponseBody setSegmentName(String segmentName) {
49+
this.segmentName = segmentName;
50+
return this;
51+
}
52+
53+
public String getBrandName() {
54+
return brandName;
55+
}
56+
57+
public VerificationSendResponseBody setBrandName(String brandName) {
58+
this.brandName = brandName;
59+
return this;
60+
}
61+
62+
public String getSiteCountry() {
63+
return siteCountry;
64+
}
65+
66+
public VerificationSendResponseBody setSiteCountry(String siteCountry) {
67+
this.siteCountry = siteCountry;
68+
return this;
69+
}
70+
71+
public String getContentLanguage() {
72+
return contentLanguage;
73+
}
74+
75+
public VerificationSendResponseBody setContentLanguage(String contentLanguage) {
76+
this.contentLanguage = contentLanguage;
77+
return this;
78+
}
79+
80+
}
81+

0 commit comments

Comments
 (0)