Skip to content
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.11.1</version>
<version>3.13.0</version>
</dependency>
```
```xml
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client-shaded</artifactId>
<version>3.11.1</version>
<version>3.13.0</version>
</dependency>
```

Expand All @@ -47,13 +47,13 @@ repositories {
And then add the dependency
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client:3.11.1'
implementation 'com.incognia:incognia-api-client:3.13.0'
}
```
OR
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client-shaded:3.11.1'
implementation 'com.incognia:incognia-api-client-shaded:3.13.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.11.1"
version = "3.13.0"

task createProjectVersionFile {
def projectVersionDir = "$projectDir/src/main/java/com/incognia/api"
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/incognia/api/IncogniaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ public SignupAssessment registerSignup(RegisterSignupRequest request) throws Inc
.additionalLocations(request.getAdditionalLocations())
.customProperties(request.getCustomProperties())
.personId(request.getPersonId())
.tenantId(request.getTenantId())
.relatedWebRequestToken(request.getRelatedWebRequestToken())
.build();
return tokenAwareNetworkingClient.doPost(
"api/v2/onboarding/signups", postSignupRequestBody, SignupAssessment.class);
Expand Down Expand Up @@ -254,6 +256,8 @@ public TransactionAssessment registerLogin(RegisterLoginRequest request)
.relatedAccountId(request.getRelatedAccountId())
.customProperties(request.getCustomProperties())
.personId(request.getPersonId())
.tenantId(request.getTenantId())
.relatedWebRequestToken(request.getRelatedWebRequestToken())
.type("login")
.build();

Expand Down Expand Up @@ -313,6 +317,7 @@ public TransactionAssessment registerWebLogin(RegisterWebLoginRequest request)
.policyId(request.getPolicyId())
.customProperties(request.getCustomProperties())
.personId(request.getPersonId())
.tenantId(request.getTenantId())
.type("login")
.build();

Expand Down Expand Up @@ -365,6 +370,7 @@ public SignupAssessment registerWebSignup(RegisterWebSignupRequest request)
.accountId(request.getAccountId())
.customProperties(request.getCustomProperties())
.personId(request.getPersonId())
.tenantId(request.getTenantId())
.build();
return tokenAwareNetworkingClient.doPost(
"api/v2/onboarding/signups", postSignupRequestBody, SignupAssessment.class);
Expand Down Expand Up @@ -465,6 +471,8 @@ public TransactionAssessment registerPayment(RegisterPaymentRequest request)
.personId(request.getPersonId())
.debtorAccount(request.getDebtorAccount())
.creditorAccount(request.getCreditorAccount())
.tenantId(request.getTenantId())
.relatedWebRequestToken(request.getRelatedWebRequestToken())
.build();

Map<String, String> queryParameters = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public class PostSignupRequestBody {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Builder.Default
Map<String, Object> customProperties = Collections.emptyMap();

@JsonInclude(JsonInclude.Include.NON_NULL)
String relatedWebRequestToken;

@JsonInclude(JsonInclude.Include.NON_NULL)
String tenantId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ public class RegisterSignupRequest {
List<AdditionalLocation> additionalLocations;
Map<String, Object> customProperties;
PersonID personId;
String relatedWebRequestToken;
String tenantId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public class RegisterWebSignupRequest {
String accountId;
Map<String, Object> customProperties;
PersonID personId;
String tenantId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ public class PostTransactionRequestBody {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Builder.Default
Map<String, Object> customProperties = Collections.emptyMap();

@JsonInclude(JsonInclude.Include.NON_NULL)
String relatedWebRequestToken;

@JsonInclude(JsonInclude.Include.NON_NULL)
String tenantId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class RegisterLoginRequest {
Map<String, Object> customProperties;
Location location;
PersonID personId;
String relatedWebRequestToken;
String tenantId;

@Getter(AccessLevel.NONE)
Boolean evaluateTransaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class RegisterWebLoginRequest {
String policyId;
Map<String, Object> customProperties;
PersonID personId;
String tenantId;

@Getter(AccessLevel.NONE)
Boolean evaluateTransaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class RegisterPaymentRequest {
PersonID personId;
BankAccountInfo debtorAccount;
BankAccountInfo creditorAccount;
String relatedWebRequestToken;
String tenantId;

@Getter(AccessLevel.NONE)
Boolean evaluateTransaction;
Expand Down
51 changes: 51 additions & 0 deletions src/test/java/com/incognia/api/IncogniaAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ void testRegisterSignup_whenDataIsValid() {
Map<String, Object> map = new HashMap<>();
map.put("custom-property", "custom-value");
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedAddressLine(address.getAddressLine());
dispatcher.setExpectedRequestToken(requestToken);
Expand All @@ -268,6 +270,8 @@ void testRegisterSignup_whenDataIsValid() {
.address(address)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
SignupAssessment signupAssessment = client.registerSignup(registerSignupRequest);
assertThat(signupAssessment)
Expand Down Expand Up @@ -318,6 +322,8 @@ void testRegisterSignup_whenDataIsValidAndExpectSignals() {
Map<String, Object> map = new HashMap<>();
map.put("custom-property", "custom-value");
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedAddressLine(address.getAddressLine());
dispatcher.setExpectedRequestToken(requestToken);
Expand All @@ -337,6 +343,8 @@ void testRegisterSignup_whenDataIsValidAndExpectSignals() {
.address(address)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
SignupAssessment signupAssessment = client.registerSignup(registerSignupRequest);
assertThat(signupAssessment)
Expand Down Expand Up @@ -370,6 +378,8 @@ void testRegisterSignup_withEmptyAddress() {
String externalId = "external-id";
String appVersion = "1.4.3";
String deviceOs = "iOS";
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedAddressLine(null);
dispatcher.setExpectedRequestToken(requestToken);
Expand All @@ -389,6 +399,8 @@ void testRegisterSignup_withEmptyAddress() {
.appVersion(appVersion)
.deviceOs(deviceOs)
.customProperties(null)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
SignupAssessment signupAssessment = client.registerSignup(registerSignupRequest);
assertThat(signupAssessment)
Expand Down Expand Up @@ -433,6 +445,7 @@ void testRegisterWebSignup_whenDataIsValid() {
Map<String, Object> map = new HashMap<>();
map.put("custom-property", "custom-value");
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";

dispatcher.setExpectedRequestToken(requestToken);
dispatcher.setExpectedExternalId(externalId);
Expand All @@ -449,6 +462,7 @@ void testRegisterWebSignup_whenDataIsValid() {
.externalId(externalId)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.build();
SignupAssessment webSignupAssessment = client.registerWebSignup(registerSignupRequest);
assertThat(webSignupAssessment)
Expand Down Expand Up @@ -497,6 +511,7 @@ void testRegisterLogin_whenReachesTheTimeout(Boolean eval) {
String requestToken = "request-token";
String accountId = "account-id";
String policyId = "policy-id";
String tenantId = "tenant_id";

dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
Expand All @@ -506,6 +521,7 @@ void testRegisterLogin_whenReachesTheTimeout(Boolean eval) {
.addresses(null)
.paymentMethods(null)
.policyId(policyId)
.tenantId(tenantId)
.build());
mockServer.setDispatcher(dispatcher);
RegisterLoginRequest loginRequest =
Expand All @@ -514,6 +530,7 @@ void testRegisterLogin_whenReachesTheTimeout(Boolean eval) {
.accountId(accountId)
.evaluateTransaction(eval)
.policyId(policyId)
.tenantId(tenantId)
.build();
assertThatThrownBy(() -> clientWithLowTimeout.registerLogin(loginRequest))
.isInstanceOf(IncogniaException.class)
Expand Down Expand Up @@ -542,6 +559,8 @@ void testRegisterLogin_whenDataIsValid(Boolean eval) {
Map<String, Object> map = new HashMap<>();
map.put("custom-property", "custom-value");
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
Expand All @@ -558,6 +577,8 @@ void testRegisterLogin_whenDataIsValid(Boolean eval) {
.relatedAccountId(relatedAccountId)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build());
mockServer.setDispatcher(dispatcher);
RegisterLoginRequest loginRequest =
Expand All @@ -573,6 +594,8 @@ void testRegisterLogin_whenDataIsValid(Boolean eval) {
.relatedAccountId(relatedAccountId)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
TransactionAssessment transactionAssessment = client.registerLogin(loginRequest);
assertTransactionAssessment(transactionAssessment);
Expand All @@ -598,6 +621,8 @@ void testRegisterLogin_whenDataIsValidForSignalsResponse() {
Map<String, Object> map = new HashMap<>();
map.put("custom-property", "custom-value");
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
Expand All @@ -614,6 +639,8 @@ void testRegisterLogin_whenDataIsValidForSignalsResponse() {
.relatedAccountId(relatedAccountId)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build());
dispatcher.setIsSignalConfigured(true);
mockServer.setDispatcher(dispatcher);
Expand All @@ -629,6 +656,8 @@ void testRegisterLogin_whenDataIsValidForSignalsResponse() {
.relatedAccountId(relatedAccountId)
.customProperties(map)
.personId(personId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();

Map<String, Object> expectedSignalsMap = createSignalsMapping();
Expand Down Expand Up @@ -658,6 +687,7 @@ void testRegisterWebLogin_whenDataIsValid(Boolean eval) {
customProperties.put("string-property", "string-value");
customProperties.put("float-property", 12.345);
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";

dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
Expand All @@ -670,6 +700,7 @@ void testRegisterWebLogin_whenDataIsValid(Boolean eval) {
.policyId(policyId)
.customProperties(customProperties)
.personId(personId)
.tenantId(tenantId)
.build());
mockServer.setDispatcher(dispatcher);
RegisterWebLoginRequest loginRequest =
Expand All @@ -681,6 +712,7 @@ void testRegisterWebLogin_whenDataIsValid(Boolean eval) {
.policyId(policyId)
.customProperties(customProperties)
.personId(personId)
.tenantId(tenantId)
.build();
TransactionAssessment transactionAssessment = client.registerWebLogin(loginRequest);
assertTransactionAssessment(transactionAssessment);
Expand All @@ -694,6 +726,8 @@ void testRegisterLogin_whenEvalIsFalse() {
String accountId = "account-id";
String externalId = "external-id";
String policyId = "policy-id";
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
Expand All @@ -705,6 +739,8 @@ void testRegisterLogin_whenEvalIsFalse() {
.paymentMethods(null)
.policyId(policyId)
.customProperties(null)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build());
mockServer.setDispatcher(dispatcher);
RegisterLoginRequest loginRequest =
Expand All @@ -714,6 +750,8 @@ void testRegisterLogin_whenEvalIsFalse() {
.externalId(externalId)
.evaluateTransaction(false)
.policyId(policyId)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
TransactionAssessment transactionAssessment = client.registerLogin(loginRequest);
assertThat(transactionAssessment).isEqualTo(TransactionAssessment.builder().build());
Expand Down Expand Up @@ -781,6 +819,8 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
.build());
PaymentValue paymentValue = PaymentValue.builder().amount(13.0).currency("BRL").build();
PersonID personId = PersonID.ofCPF("12345678901");
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

List<TransactionAddress> transactionAddresses =
Collections.singletonList(
Expand Down Expand Up @@ -823,6 +863,8 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
.personId(personId)
.debtorAccount(bankAccount)
.creditorAccount(bankAccount)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
Expand All @@ -843,6 +885,8 @@ void testRegisterPayment_whenDataIsValid(Boolean eval) {
.personId(personId)
.debtorAccount(bankAccount)
.creditorAccount(bankAccount)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build());
mockServer.setDispatcher(dispatcher);
TransactionAssessment transactionAssessment = client.registerPayment(paymentRequest);
Expand Down Expand Up @@ -893,6 +937,9 @@ void testRegisterPayment_whenEvalIsFalse() {
.type(PaymentType.CREDIT_CARD)
.build());
PaymentValue paymentValue = PaymentValue.builder().amount(13.0).currency("BRL").build();
String tenantId = "tenant_id";
String relatedWebRequestToken = "related_web_request_token";

dispatcher.setExpectedTransactionRequestBody(
PostTransactionRequestBody.builder()
.requestToken(requestToken)
Expand All @@ -904,6 +951,8 @@ void testRegisterPayment_whenEvalIsFalse() {
.paymentMethods(paymentMethods)
.paymentValue(paymentValue)
.customProperties(null)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build());
mockServer.setDispatcher(dispatcher);
RegisterPaymentRequest paymentRequest =
Expand All @@ -916,6 +965,8 @@ void testRegisterPayment_whenEvalIsFalse() {
.evaluateTransaction(false)
.paymentValue(paymentValue)
.paymentMethods(paymentMethods)
.tenantId(tenantId)
.relatedWebRequestToken(relatedWebRequestToken)
.build();
TransactionAssessment transactionAssessment = client.registerPayment(paymentRequest);
assertThat(transactionAssessment).isEqualTo(TransactionAssessment.builder().build());
Expand Down
Loading