Skip to content
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

Feat/make request token optional #258

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ And then add the artifact `incognia-api-client` **or** `incognia-api-client-shad
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</dependency>
```
```xml
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client-shaded</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</dependency>
```

Expand All @@ -47,13 +47,13 @@ repositories {
And then add the dependency
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client:3.2.0'
implementation 'com.incognia:incognia-api-client:3.3.0'
}
```
OR
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client-shaded:3.2.0'
implementation 'com.incognia:incognia-api-client-shaded:3.3.0'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.incognia"
version = "3.2.0"
version = "3.3.0"

task createProjectVersionFile {
def projectVersionDir = "$projectDir/src/main/java/com/incognia/api"
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/com/incognia/api/IncogniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ public static IncogniaAPI instance() {
*/
public SignupAssessment registerSignup(RegisterSignupRequest request) throws IncogniaException {
Asserts.assertNotNull(request, "register signup request");
Asserts.assertNotEmpty(
Optional.ofNullable(request.getRequestToken()).orElse(request.getInstallationId()),
"request token");
Optional<Address> address = Optional.ofNullable(request.getAddress());
PostSignupRequestBody postSignupRequestBody =
PostSignupRequestBody.builder()
Expand Down Expand Up @@ -190,9 +187,6 @@ public SignupAssessment registerSignup(RegisterSignupRequest request) throws Inc
public TransactionAssessment registerLogin(RegisterLoginRequest request)
throws IncogniaException {
Asserts.assertNotNull(request, "register login request");
Asserts.assertNotEmpty(
Optional.ofNullable(request.getRequestToken()).orElse(request.getInstallationId()),
"request token");
Asserts.assertNotEmpty(request.getAccountId(), "account id");
PostTransactionRequestBody requestBody =
PostTransactionRequestBody.builder()
Expand Down Expand Up @@ -388,9 +382,6 @@ public SignupAssessment registerWebSignup(RegisterWebSignupRequest request)
public TransactionAssessment registerPayment(RegisterPaymentRequest request)
throws IncogniaException {
Asserts.assertNotNull(request, "register payment request");
Asserts.assertNotEmpty(
Optional.ofNullable(request.getRequestToken()).orElse(request.getInstallationId()),
"request token");
Asserts.assertNotEmpty(request.getAccountId(), "account id");
List<TransactionAddress> transactionAddresses =
addressMapToTransactionAddresses(request.getAddresses());
Expand Down
76 changes: 0 additions & 76 deletions src/test/java/com/incognia/api/IncogniaAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,34 +270,6 @@ void testRegisterWebSignup_whenDataIsValid() {
assertThat(webSignupAssessment.getReasons()).containsExactly(expectedReason);
}

@Test
@DisplayName("should throw illegal argument exception with correct message")
@SneakyThrows
void testRegisterSignup_whenEmptyRequestToken() {
assertThatThrownBy(
() ->
client.registerSignup(
RegisterSignupRequest.builder()
.requestToken("")
.address(AddressFixture.ADDRESS_ADDRESS_LINE)
.customProperties(null)
.build()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("'request token' cannot be empty");
}

@Test
@DisplayName("should throw illegal argument exception with correct message")
@SneakyThrows
void testRegisterWebSignup_whenEmptyRequestToken() {
assertThatThrownBy(
() ->
client.registerWebSignup(
RegisterWebSignupRequest.builder().requestToken("").build()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("'request token' cannot be empty");
}

@ParameterizedTest
@ValueSource(booleans = {true})
@NullSource
Expand Down Expand Up @@ -608,54 +580,6 @@ void testRegisterFeedback_whenDataIsValid(boolean dryRun) {
dryRun);
}

@Test
@DisplayName("should throw illegal argument exception with correct message")
@SneakyThrows
void testRegisterPayment_whenRequestTokenIsNotValid() {
assertThatThrownBy(
() ->
client.registerPayment(
RegisterPaymentRequest.builder()
.requestToken("")
.accountId("account id")
.build()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("'request token' cannot be empty");
assertThatThrownBy(
() ->
client.registerPayment(
RegisterPaymentRequest.builder()
.requestToken(null)
.accountId("account id")
.build()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("'request token' cannot be empty");
}

@Test
@DisplayName("should throw illegal argument exception with correct message")
@SneakyThrows
void testRegisterLogin_whenRequestTokenIsNotValid() {
assertThatThrownBy(
() ->
client.registerLogin(
RegisterLoginRequest.builder()
.requestToken("")
.accountId("account id")
.build()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("'request token' cannot be empty");
assertThatThrownBy(
() ->
client.registerLogin(
RegisterLoginRequest.builder()
.requestToken(null)
.accountId("account id")
.build()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("'request token' cannot be empty");
}

@Test
@DisplayName("should throw illegal argument exception with correct message")
@SneakyThrows
Expand Down
Loading