diff --git a/README.md b/README.md
index 2bc8afc..a0a2407 100644
--- a/README.md
+++ b/README.md
@@ -141,6 +141,29 @@ try {
}
```
+#### Registering Web Login
+
+This method registers a new web login for the given installation and account, returning a `TransactionAssessment`, containing the risk assessment and supporting evidence.
+
+```java
+IncogniaAPI api = new IncogniaAPI("client-id", "client-secret");
+try {
+ RegisterLoginRequest registerLoginRequest =
+ RegisterLoginRequest.builder()
+ .installationId("installation id")
+ .accountId("account id")
+ .externalId("external id")
+ .sessionToken("session-token")
+ .evaluateTransaction(true) // can be omitted as it uses true as the default value
+ .build();
+ TransactionAssessment assessment = api.registerWebLogin(registerLoginRequest);
+} catch (IncogniaAPIException e) {
+ //Some api error happened (invalid data, invalid credentials)
+} catch (IncogniaException e) {
+ //Something unexpected happened
+}
+```
+
#### Registering Payment
This method registers a new payment for the given installation and account, returning a `TransactionAssessment`, containing the risk assessment and supporting evidence.
diff --git a/src/main/java/com/incognia/api/IncogniaAPI.java b/src/main/java/com/incognia/api/IncogniaAPI.java
index 9567274..e7ebb27 100644
--- a/src/main/java/com/incognia/api/IncogniaAPI.java
+++ b/src/main/java/com/incognia/api/IncogniaAPI.java
@@ -16,6 +16,7 @@
import com.incognia.transaction.TransactionAddress;
import com.incognia.transaction.TransactionAssessment;
import com.incognia.transaction.login.RegisterLoginRequest;
+import com.incognia.transaction.login.RegisterWebLoginRequest;
import com.incognia.transaction.payment.RegisterPaymentRequest;
import java.time.Instant;
import java.util.HashMap;
@@ -199,6 +200,61 @@ public TransactionAssessment registerLogin(RegisterLoginRequest request)
queryParameters);
}
+ /**
+ * Registers a web login to obtain a risk assessment. Check the docs
+ * Example:
+ *
+ *
{@code + * IncogniaAPI api = new IncogniaAPI("client-id", "client-secret", Region.BR); + * try { + * RegisterLoginRequest loginRequest = RegisterLoginRequest.builder() + * .installationId("installation-id") + * .accountId("account-id") + * .externalId("external-id") + * .sessionToken("session-token") + * .evaluateTransaction(true) // can be omitted as it uses true as the default value + * .build(); + * TransactionAssessment assessment = api.registerLogin(loginRequest); + * } catch (IncogniaAPIException e) { + * //Some api error happened (invalid data, invalid credentials) + * } catch (IncogniaException e) { + * //Something unexpected happened + * } + * }+ * + * @param request the {@link RegisterWebLoginRequest} model with the properties we need to make + * the assessment + * @return the assessment for the login + * @throws IncogniaAPIException in case of api errors + * @throws IncogniaException in case of unexpected errors + */ + public TransactionAssessment registerWebLogin(RegisterWebLoginRequest request) + throws IncogniaException { + Asserts.assertNotNull(request, "register login request"); + Asserts.assertNotEmpty(request.getInstallationId(), "installation id"); + Asserts.assertNotEmpty(request.getAccountId(), "account id"); + Asserts.assertNotEmpty(request.getSessionToken(), "session token"); + PostTransactionRequestBody requestBody = + PostTransactionRequestBody.builder() + .installationId(request.getInstallationId()) + .accountId(request.getAccountId()) + .externalId(request.getExternalId()) + .sessionToken(request.getSessionToken()) + .type("login") + .build(); + + Map