# Migration to v3.x

This guide helps you migrate your Android Fraud Prevention integration to version 3.x.

Important
Version 3.x includes breaking changes that will cause runtime errors if not addressed. Review all changes before upgrading.

## What's new

**Breaking changes**:

- `setUserID()` is renamed to `setAuthenticatedUser()`.
- `baseUrl` is now a mandatory parameter in `initialize()`.
- `claimUserId` in `ActionEventOptions` is deprecated. Use `claimedUserId` instead.


**New features**:

- `claimedUserId` and `claimedUserIdType` parameters in `ActionEventOptions` for typed user identification.
- `TSClaimedUserIdType` enum for specifying the type of claimed user ID.


## Migrate your integration to v3.x

### Step 1: Update SDK dependency

Update your `app/build.gradle` dependency:

Before:


```gradle
dependencies {
    implementation("com.ts.sdk:accountprotection:2.1.+")
}
```

After:


```gradle
dependencies {
    implementation("com.ts.sdk:accountprotection:3.0.0")
}
```

### Step 2: Add baseUrl to initialization

If you initialize the SDK with explicit parameters using `initialize()`, `baseUrl` is now a required parameter. The `baseUrl` value must include the `/risk-collect/` path.

If you initialize using `strings.xml`, make sure it includes `transmit_security_base_url`:


```xml
<resources>
    <string name="transmit_security_client_id">"CLIENT_ID"</string>
    <string name="transmit_security_base_url">https://api.transmitsecurity.io/risk-collect/</string>
</resources>
```

### Step 3: Rename setUserID to setAuthenticatedUser

The `setUserID()` method has been renamed to `setAuthenticatedUser()`. Update all occurrences in your code.

Before:

Kotlin

```kotlin
TSAccountProtection.setUserID(userId)
```

Java

```java
TSAccountProtection.setUserID(userId);
```

After:

Kotlin

```kotlin
TSAccountProtection.setAuthenticatedUser(userId)
```

Java

```java
TSAccountProtection.setAuthenticatedUser(userId);
```

### Step 4: Update triggerAction options

The `claimUserId` property in `ActionEventOptions` is deprecated. Use `claimedUserId` and `claimedUserIdType` instead.

Before:

Kotlin

```kotlin
object : ActionEventOptions {
    override val correlationId: String?
        get() = correlationIdStr
    override val claimUserId: String?
        get() = claimUserIdStr
    override val referenceUserId: String?
        get() = referenceUserIdStr
}
```

Java

```java
new ActionEventOptions() {
    @Override public String getCorrelationId() { return "CorrelationIdStr"; }
    @Override public String getClaimUserId() { return "ClaimUserIdStr"; }
    @Override public String getReferenceUserId() { return "ReferenceUserIdStr"; }
}
```

After:

Kotlin

```kotlin
object : ActionEventOptions {
    override val correlationId: String?
        get() = correlationIdStr
    override val claimedUserId: String?
        get() = "91e25bea0c..." // hashed identifier
    override val claimedUserIdType: TSClaimedUserIdType?
        get() = TSClaimedUserIdType.EMAIL
    override val referenceUserId: String?
        get() = referenceUserIdStr
}
```

Java

```java
new ActionEventOptions() {
    @Override public String getCorrelationId() { return "CorrelationIdStr"; }
    @Override public String getClaimedUserId() { return "91e25bea0c..."; } // hashed identifier
    @Override public TSClaimedUserIdType getClaimedUserIdType() { return TSClaimedUserIdType.EMAIL; }
    @Override public String getReferenceUserId() { return "ReferenceUserIdStr"; }
}
```

### Step 5: Test your integration

- Verify all SDK functionality works as expected.
- Check for any runtime errors related to renamed methods.
- Confirm that `triggerAction()` returns action tokens as expected with the new parameter structure.