-
Notifications
You must be signed in to change notification settings - Fork 32
V3 missing client user id filter #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6cc167b
e3b273a
7626f3e
f7c50b4
a0e0743
920047a
75eb8f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.hyperwallet.clientsdk.model; | ||
|
||
public class HyperwalletUsersListPaginationOptions extends HyperwalletPaginationOptions{ | ||
|
||
private String clientUserId; | ||
private String email; | ||
private String programToken; | ||
private HyperwalletUser.Status status; | ||
private HyperwalletUser.VerificationStatus verificationStatus; | ||
|
||
public String getClientUserId() { | ||
return clientUserId; | ||
} | ||
|
||
public void setClientUserId(String clientUserId) { | ||
this.clientUserId = clientUserId; | ||
} | ||
|
||
public HyperwalletUsersListPaginationOptions clientUserId(String clientUserId) { | ||
this.clientUserId = clientUserId; | ||
return this; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
||
public HyperwalletUsersListPaginationOptions email(String email) { | ||
this.email = email; | ||
return this; | ||
} | ||
|
||
public String getProgramToken() { | ||
return programToken; | ||
} | ||
|
||
public void setProgramToken(String programToken) { | ||
this.programToken = programToken; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: redundant newLine |
||
|
||
public HyperwalletUsersListPaginationOptions programToken(String programToken) { | ||
this.programToken = programToken; | ||
return this; | ||
} | ||
|
||
public HyperwalletUser.Status getStatus() { | ||
return status; | ||
} | ||
|
||
public void setStatus(HyperwalletUser.Status status) { | ||
this.status = status; | ||
} | ||
|
||
public HyperwalletUsersListPaginationOptions status(HyperwalletUser.Status status) { | ||
this.status = status; | ||
return this; | ||
} | ||
public HyperwalletUser.VerificationStatus getVerificationStatus() { | ||
return verificationStatus; | ||
} | ||
|
||
public void setVerificationStatus(HyperwalletUser.VerificationStatus verificationStatus) { | ||
this.verificationStatus = verificationStatus; | ||
} | ||
|
||
public HyperwalletUsersListPaginationOptions verificationStatus(HyperwalletUser.VerificationStatus verificationStatus) { | ||
this.verificationStatus = verificationStatus; | ||
return this; | ||
} | ||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,60 @@ public void testListUserStatusTransitions() throws Exception { | |
assertThat(returnValue.getData().get(0).getToStatus(), is(equalTo(DE_ACTIVATED))); | ||
} | ||
|
||
@Test | ||
public void testListUsers_withNoParameters() throws Exception { | ||
String functionality = "listUsers"; | ||
initMockServer(functionality); | ||
|
||
HyperwalletList<HyperwalletUser> returnValue; | ||
try { | ||
returnValue = client.listUsers(); | ||
} catch (Exception e) { | ||
mockServer.verify(parseRequest(functionality)); | ||
throw e; | ||
} | ||
assertThat(returnValue.getCount(), is(equalTo(2))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls add assert statement for the 2nd index as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
HyperwalletUser userOne = returnValue.getData().get(0); | ||
assertThat(userOne.getToken(), is(equalTo("usr-00c6cfda-a43d-4b29-a20b-1abc7e800b58"))); | ||
assertThat(userOne.getCreatedOn(), is(equalTo(dateFormat.parse("2019-10-30T22:15:35 UTC")))); | ||
assertThat(userOne.getStatus(), is(equalTo(HyperwalletUser.Status.PRE_ACTIVATED))); | ||
assertThat(userOne.getVerificationStatus(), is(equalTo(HyperwalletUser.VerificationStatus.NOT_REQUIRED))); | ||
HyperwalletUser userTwo = returnValue.getData().get(1); | ||
assertThat(userTwo.getToken(), is(equalTo("usr-f9154016-94e8-4686-a840-075688ac07b5"))); | ||
assertThat(userTwo.getCreatedOn(), is(equalTo(dateFormat.parse("2019-10-30T22:15:45 UTC")))); | ||
assertThat(userTwo.getStatus(), is(equalTo(HyperwalletUser.Status.PRE_ACTIVATED))); | ||
assertThat(userTwo.getVerificationStatus(), is(equalTo(HyperwalletUser.VerificationStatus.REQUIRED))); | ||
} | ||
|
||
@Test | ||
public void testListUsers_withParameters() throws Exception { | ||
String functionality = "listUsers"; | ||
initMockServer(functionality); | ||
|
||
HyperwalletList<HyperwalletUser> returnValue; | ||
try { | ||
HyperwalletUsersListPaginationOptions options = new HyperwalletUsersListPaginationOptions(); | ||
options.limit(2); | ||
//options.clientUserId("CSLAJQt7bD"); | ||
returnValue = client.listUsers(options); | ||
} catch (Exception e) { | ||
mockServer.verify(parseRequest(functionality)); | ||
throw e; | ||
} | ||
assertThat(returnValue.getCount(), is(equalTo(2))); | ||
HyperwalletUser userOne = returnValue.getData().get(0); | ||
assertThat(userOne.getToken(), is(equalTo("usr-00c6cfda-a43d-4b29-a20b-1abc7e800b58"))); | ||
assertThat(userOne.getCreatedOn(), is(equalTo(dateFormat.parse("2019-10-30T22:15:35 UTC")))); | ||
assertThat(userOne.getStatus(), is(equalTo(HyperwalletUser.Status.PRE_ACTIVATED))); | ||
assertThat(userOne.getVerificationStatus(), is(equalTo(HyperwalletUser.VerificationStatus.NOT_REQUIRED))); | ||
HyperwalletUser userTwo = returnValue.getData().get(1); | ||
assertThat(userTwo.getToken(), is(equalTo("usr-f9154016-94e8-4686-a840-075688ac07b5"))); | ||
assertThat(userTwo.getCreatedOn(), is(equalTo(dateFormat.parse("2019-10-30T22:15:45 UTC")))); | ||
assertThat(userTwo.getStatus(), is(equalTo(HyperwalletUser.Status.PRE_ACTIVATED))); | ||
assertThat(userTwo.getVerificationStatus(), is(equalTo(HyperwalletUser.VerificationStatus.REQUIRED))); | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls add assert statement for the 2nd index as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
@Test | ||
public void testGetUserStatusTransition() throws Exception { | ||
String functionality = "getUserStatusTransition"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.hyperwallet.clientsdk.model; | ||
|
||
public class HyperwalletUsersListPaginationOptionsTest extends BaseModelTest<HyperwalletUsersListPaginationOptions> { | ||
protected HyperwalletUsersListPaginationOptions createBaseModel() { | ||
HyperwalletUsersListPaginationOptions options = new HyperwalletUsersListPaginationOptions(); | ||
options | ||
.clientUserId("test-client-id") | ||
.email("test@test.com") | ||
.programToken("test-prg-token") | ||
.status(HyperwalletUser.Status.ACTIVATED) | ||
.verificationStatus(HyperwalletUser.VerificationStatus.REQUIRED); | ||
|
||
return options; | ||
} | ||
|
||
protected Class<HyperwalletUsersListPaginationOptions> createModelClass() { | ||
return HyperwalletUsersListPaginationOptions.class; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
curl -X "GET" "https://api.sandbox.hyperwallet.com/rest/v3/users" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls add some query parameters for filtering options here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed before this couldnt be done as testing dynamically with query parameters is not feasible in the current mock test setup. |
||
-u testuser@12345678:myAccPassw0rd \ | ||
-H "Accept: application/json" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"count": 2, | ||
"offset": 0, | ||
"limit": 10, | ||
"data": [ | ||
{ | ||
"token": "usr-00c6cfda-a43d-4b29-a20b-1abc7e800b58", | ||
"status": "PRE_ACTIVATED", | ||
"verificationStatus": "NOT_REQUIRED", | ||
"createdOn": "2019-10-30T22:15:35", | ||
"clientUserId": "CSLAJQt7bD", | ||
"profileType": "INDIVIDUAL", | ||
"firstName": "John", | ||
"lastName": "Smith", | ||
"dateOfBirth": "1980-01-01", | ||
"email": "john@company.com", | ||
"addressLine1": "123 Main Street", | ||
"city": "New York", | ||
"stateProvince": "NY", | ||
"country": "US", | ||
"postalCode": "10016", | ||
"language": "en", | ||
"programToken": "prg-83836cdf-2ce2-4696-8bc5-f1b86077238c", | ||
"links": [ | ||
{ | ||
"params": { | ||
"rel": "self" | ||
}, | ||
"href": "https://api.sandbox.hyperwallet.com/rest/v3/users/usr-00c6cfda-a43d-4b29-a20b-1abc7e800b58" | ||
} | ||
] | ||
}, | ||
{ | ||
"token": "usr-f9154016-94e8-4686-a840-075688ac07b5", | ||
"status": "PRE_ACTIVATED", | ||
"verificationStatus": "REQUIRED", | ||
"createdOn": "2019-10-30T22:15:45", | ||
"clientUserId": "CSK7b8Ffch", | ||
"profileType": "INDIVIDUAL", | ||
"firstName": "John", | ||
"lastName": "Smith", | ||
"dateOfBirth": "1980-01-01", | ||
"email": "john@company.com", | ||
"addressLine1": "123 Smith Street", | ||
"city": "New York", | ||
"stateProvince": "NY", | ||
"country": "US", | ||
"postalCode": "10016", | ||
"language": "en", | ||
"programToken": "prg-83836cdf-2ce2-4696-8bc5-f1b86077238c", | ||
"links": [ | ||
{ | ||
"params": { | ||
"rel": "self" | ||
}, | ||
"href": "https://api.sandbox.hyperwallet.com/rest/v3/users/usr-f9154016-94e8-4686-a840-075688ac07b5" | ||
} | ||
] | ||
} | ||
], | ||
"links": [ | ||
{ | ||
"params": { | ||
"rel": "self" | ||
}, | ||
"href": "https://api.sandbox.hyperwallet.com/rest/v3/users?offset=0&limit=10" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: is your formatter turned on? there should be a space between HyperwalletPaginationOptions and {