-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from SiftScience/API-7197
API-7197: Implement missing fields in Events API
- Loading branch information
Showing
25 changed files
with
901 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.siftscience; | ||
|
||
import com.siftscience.model.AddItemToCartFieldSet; | ||
import com.siftscience.model.EventResponseBody; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.mockwebserver.MockResponse; | ||
import okhttp3.mockwebserver.MockWebServer; | ||
|
@@ -34,6 +35,7 @@ public void testAddItemToCart() throws Exception { | |
" \"$color\" : \"Texas Tea\",\n" + | ||
" \"$quantity\" : 2\n" + | ||
" },\n" + | ||
" \"$user_email\" : \"[email protected]\",\n" + | ||
" \"$verification_phone_number\" : \"+12345678901\"\n" + | ||
"}"; | ||
|
||
|
@@ -57,13 +59,14 @@ public void testAddItemToCart() throws Exception { | |
.build()); | ||
|
||
// Build and execute the request against the mock server. | ||
SiftRequest request = client.buildRequest(new AddItemToCartFieldSet() | ||
SiftRequest<EventResponse> request = client.buildRequest(new AddItemToCartFieldSet() | ||
.setUserId("billy_jones_301") | ||
.setSessionId("gigtleqddo84l8cm15qe4il") | ||
.setItem(TestUtils.sampleItem2()) | ||
.setUserEmail("[email protected]") | ||
.setVerificationPhoneNumber("+12345678901")); | ||
|
||
SiftResponse siftResponse = request.send(); | ||
SiftResponse<EventResponseBody> siftResponse = request.send(); | ||
|
||
// Verify the request. | ||
RecordedRequest request1 = server.takeRequest(); | ||
|
@@ -73,6 +76,7 @@ public void testAddItemToCart() throws Exception { | |
|
||
// Verify the response. | ||
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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import java.util.List; | ||
|
||
import com.siftscience.model.AddPromotionFieldSet; | ||
import com.siftscience.model.EventResponseBody; | ||
import com.siftscience.model.Promotion; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.mockwebserver.MockResponse; | ||
|
@@ -34,6 +35,7 @@ public void testAddPromotion() throws Exception { | |
" }\n" + | ||
" }\n" + | ||
" ],\n" + | ||
" \"$user_email\" : \"[email protected]\",\n" + | ||
" \"$verification_phone_number\" : \"+12345678901\"\n" + | ||
"}"; | ||
|
||
|
@@ -61,12 +63,13 @@ public void testAddPromotion() throws Exception { | |
promotions.add(TestUtils.samplePromotion3()); | ||
|
||
// Build and execute the request against the mock server. | ||
SiftRequest request = client.buildRequest(new AddPromotionFieldSet() | ||
SiftRequest<EventResponse> request = client.buildRequest(new AddPromotionFieldSet() | ||
.setUserId("billy_jones_301") | ||
.setPromotions(promotions) | ||
.setUserEmail("[email protected]") | ||
.setVerificationPhoneNumber("+12345678901")); | ||
|
||
SiftResponse siftResponse = request.send(); | ||
SiftResponse<EventResponseBody> siftResponse = request.send(); | ||
|
||
// Verify the request. | ||
RecordedRequest request1 = server.takeRequest(); | ||
|
@@ -76,6 +79,7 @@ public void testAddPromotion() throws Exception { | |
|
||
// Verify the response. | ||
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); | ||
|
Oops, something went wrong.