accounts

Accounts SDK for Android

The Accounts SDK is a solution to ease the integration with the Alviere services.

Features

  • User Account Management

  • User Addresses Management

  • User Documents Management

Requirements

  • Android Studio 4.0 or above

  • Android 5.0 (API level 21) or above

  • Java 11+

Maven Central Integration

  1. Add Maven Central to project repositories

repositories {
...
mavenCentral()
}
  1. Add Sdk dependency to module's build.gradle file using the latest version.

dependencies {
...
implementation 'com.alviere.android:accounts:X.Y.Z'
}

Manual Integration

1. Get the latest versions of accounts.aar and alcore.aar, and open up the project structure by right-clicking on your project and choosing Open Module Settings or choosing File Project Structure…. Click the + button in the top left to add a new module.

image

2. Choose Import .JAR/.AAR Package and click the Next button.

image

3. Find your accounts.aar file using the folder button beside the File name field. Android Studio will automatically create a subproject name. Just click Finish and repeat the process for the alcore.aar file.

image

4. Gradle will sync, which may take a few minutes. You should have the following implementation statements on your module's build.gradle file. Please note that sometimes Android Studio generates these statements on the project's build.gradle file. In that case, move them to the module's one.

...
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
...
implementation project(path: ':alcore')
implementation project(path: ':accounts')
}

5. Make sure you have enabled Java 8 language feature support. To do so, guarantee that the following configurations are on the module's build.gradle file.

...
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

6. Now that you have added the .aar modules, you need to add its dependencies as shown below. Once complete, sync gradle again.

apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
...
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
...
implementation project(path: ':alcore')
implementation project(path: ':accounts')
...
}

Usage

Before you can use the Accounts Sdk, and if you want to call the user management services you need to first start the AccountsSdk. Keep in mind that the process of starting the Sdk it will be run in the UI thread and cannot be run in the IO thread.

AccountsSdk.init()

On your android application class, setup Alviere Initialization and Fraud Detection.

class AndroidApplication : Application() {

override fun onCreate() {
super.onCreate()

Alviere.init(this, EnvironmentOption.PRD)
}
}

Request camera runtime permission for document capture.

ActivityCompat.requestPermissions(..., arrayOf(Manifest.permission.CAMERA),...)

Kotlin Coroutines

Optionally for every Sdk callback entry function without UI, there is an alternative suspend function with the same name without callback. Internal code will run with withContext(Dispatchers.IO) and will return an object of type Response<T>

val response = ...
when (response) {
is Response.Success -> { response.data }
is Response.Error -> { response.metadata }
}

User Account Management

This section outlines the integration with Alviere to create and manage your customers and users.

Declare the callback

The AccountUserCallback callback is the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

private val accountUserCallback = object : AccountUserCallback {
override fun onAddUserSuccess(userAccount: UserAccountModel) { /* handle success */ }

override fun onDeleteUserSuccess() { /* handle success */ }

override fun onGetUserSuccess(userAccount: UserAccountModel) { /* handle success */ }

override fun onUpdateUserSuccess(userAccount: UserAccountModel) { /* handle success */ }

override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle event */ }
}
onSuccess

This callback method is called when an user has successfully create or manage the user account. Use this to upload and store the user account with your service for use with the Alviere API.

onEvent

This callback method is called when the user exited from the Accounts SDK, when an error occurred, or when certain events in the Accounts SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Accounts SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

Get User Account

To obtain an user account, use the Accounts Sdk service method AccountsSdk.getUserAccount. Pass the session_token, the account_uuid and the AccountUserCallback.

AccountsSdk.getUserAccount(
sessionToken = session_token,
accountUuid = account_uuid,
clientCallback = accountUserCallback
)

The result of this action will return the specific UserAccountModel on onGetUserSuccess(userAccount: UserAccountModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Update User Account

To update an user account, use the Accounts Sdk service method AccountsSdk.updateUserAccount. Pass the session_token, the account_uuid, the UserAccountUpdateRequest model and the AccountUserCallback.

val model = UserAccountUpdateRequest(...)
AccountsSdk.getUserAccount(
sessionToken = session_token,
accountUuid = account_uuid,
data = model,
clientCallback = accountUserCallback
)

The result of this action will return the updated UserAccountModel on onUpdateUserSuccess(userAccount: UserAccountModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Delete User Account

To delete an user account, use the Accounts Sdk service method AccountsSdk.deleteUserAccount. Pass the session_token, the account_uuid, and the AccountUserCallback.

AccountsSdk.deleteUserAccount(
sessionToken = session_token,
accountUuid = account_uuid,
clientCallback = accountUserCallback
)

The result of this action will return on onDeleteUserSuccess() and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

User Addresses Management

This section outlines the integration with Alviere to create and manage your customers and users addresses.

Declare the callback

The AccountAddressCallback callback is the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

private val accountAddressCallback = object : AccountAddressCallback {
override fun onAddAddressSuccess(userAddress: UserAddressModel) { /* handle success */ }

override fun onDeleteAddressSuccess() { /* handle success */ }

override fun onGetAllAddressesSuccess(userAddressesList: List<UserAddressModel>) { /* handle success */ }

override fun onUpdateAddressSuccess(userAddress: UserAddressModel) { /* handle success */ }

override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle events */ }
}
onSuccess

This callback method is called when an user has successfully create or manage the user account address. Use this to upload and store the user account with your service for use with the Alviere API.

onEvent

This callback method is called when the user exited from the Accounts SDK, when an error occurred, or when certain events in the Accounts SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Accounts SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

Add User Account Address

To add an user account address, use the Accounts Sdk service method AccountsSdk.addAddress. Pass the session_token, the AddressRequest model and the AccountAddressCallback.

val model = AddressRequest(...)
AccountsSdk.addAddress(
sessionToken = session_token,
data = model,
clientCallback = accountAddressCallback
)

The result of this action will return the newly created UserAddressModel on onAddAddressSuccess(userAddress: UserAddressModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get All User Account Addresses

To obtain the user account addresses, use the Accounts Sdk service method AccountsSdk.getAllAddresses. Pass the session_token, the account_uuid and the AccountAddressCallback.

AccountsSdk.getAllAddresses(
sessionToken = session_token,
accountUuid = account_uuid,
clientCallback = accountAddressCallback
)

The result of this action will return the user's addresses List<UserAddressModel> on onGetAllAddressesSuccess(userAddressesList: List<UserAddressModel>) and any errors will be returned ononEvent(event: String, metadata: Map<String, String>?), both from the callback.

Update User Account Address

To update an user account address, use the Accounts Sdk service method AccountsSdk.updateAddress. Pass the session_token, the account_uuid, the address_id, the AddressUpdateRequest model and the AccountAddressCallback.

val model = AddressUpdateRequest(...)
AccountsSdk.updateAddress(
sessionToken = session_token,
accountUuid = account_uuid,
addressId = address_id,
data = model,
clientCallback = accountAddressCallback
)

The result of this action will return the updated UserAddressModel on onUpdateAddressSuccess(userAddress: UserAddressModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

User Dossier of Documents Management

This section outlines the integration with Alviere to create and manage your customers and users dossier of documents.

Declare the callback

The AccountDossierCallback callback is the main communication back channel to your application. For each action there is one method associated as follows. In addition to these methods, there is also an event method for handling events. Callbacks will always run on main thread.

  private val accountDossierCallback = object : AccountDossierCallback {
override fun onAddDossierSuccess(userDossier: UserDossierModel) { /* handle success */ }

override fun onUpdateDossierSuccess(userDossier: UserDossierModel) { /* handle success */ }

override fun onReplaceDossierSuccess(userDossier: UserDossierModel) { /* handle success */ }

override fun onGetDossierSuccess(userDossier: UserDossierFileModel) { /* handle success */ }

override fun onGetAllDossiersSuccess(userDossiersList: List<UserDossierModel>) { /* handle success */ }

override fun onDeleteDossierSuccess() { /* handle success */ }

override fun onEvent(event: String, metadata: Map<String, String>?) { /* handle success */ }
}
onSuccess

This callback method is called when an user has successfully create or manage the user account documents. Use this to upload and store the user account with your service for use with the Alviere API.

onEvent

This callback method is called when the user exited from the Accounts SDK, when an error occurred, or when certain events in the Accounts SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Accounts SDK flow. In case of an error, you may want to display information related to the error to the user and have them try doing the action again.

UI

The Add and Update Account Dossier of Documents uses a Capture Mode through Activity or through the navigation controller. To get started, set the Accounts Sdk event listener.

AccountsSdk.setEventListener(accountDossierCallback)

Add User Account Dossier of Documents

Activity

To start using this feature on an activity, create an Intent using AccountsSdk.addDossierByIntent, pass the parent_activity, the session_token, the external_id, the account_uuid, the primary_dossier, and an array of files to be capture using DocumentSpecificationModel with a selection of different document types.

val intent = AccountsSdk.addDossierByIntent(
parentActivity = parent_activity,
sessionToken = session_token,
externalId = external_id,
accountUuid = account_uuid,
primary = primary_dossier,
filesToCapture = arrayOf(
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_FRONT),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_BACK),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.SELFIE),
DocumentSpecificationModel(DocumentTypeModel.PASSPORT),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_ADDRESS),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_FUNDS)
)
)
startActivity(intent)
Navigation Controller

To start using this feature on a navigation controller, add the destination AccountsActivity to your navigation graph and connect it. An action will be generated that will have to have the arguments embedded, as follows.

<fragment
android:id="@+id/accounts_user_documents_fragment_add"
android:name="com.example.alvieretestapp.accounts.documents.add.AddUserDocumentsFragment"
tools:layout="@layout/accounts_user_documents_fragment_add">
<action
android:id="@+id/action_accounts_user_documents_fragment_add_to_accounts_activity"
app:destination="@id/accounts_activity" />
</fragment>

<activity
android:id="@+id/accounts_activity"
android:name="com.alviere.android.accounts.activity.view.AccountsActivity">
<argument
android:name="accounts_extra_feature_frag"
app:argType="com.alviere.android.accounts.AccountsSdk$Features" />
<argument
android:name="accounts_token_extra"
app:argType="string" />
<argument
android:name="accounts_external_id_extra"
app:argType="string"
app:nullable="true"
android:defaultValue="@null" />
<argument
android:name="accounts_uuid_extra"
app:argType="string" />
<argument
android:name="accounts_dossier_uuid_extra"
app:argType="string"
app:nullable="true"
android:defaultValue="@null" />
<argument
android:name="accounts_primary_extra"
app:argType="boolean"
android:defaultValue="false" />
<argument
android:name="accounts_files_to_capture_extra"
app:argType="com.alviere.android.accounts.sdk.model.common.DocumentSpecificationModel[]" />
</activity>

A class is created for each destination where an action originates. The name of this class is the name of the originating destination, appended with the word "Directions". For example, if the originating destination is a fragment that is named AddUserDocumentsFragment, the generated class would be called AddUserDocumentsFragmentDirections. This class has a method for each action defined in the originating destination, such as actionAddUserDocumentsFragmentToAccountsActivity() that returns a NavDirections object. This returned NavDirections object can then be passed directly to navigate(), as shown in the following example:

it.findNavController().navigate(
AddUserDocumentsFragmentDirections.actionAddUserDocumentsFragmentToAccountsActivity(
accountsExtraFeatureFrag = AccountsSdk.Features.ADD_DOSSIER_DOCUMENTS,
accountsTokenExtra = session_token,
accountsExternalIdExtra = external_id,
accountsUuidExtra = account_uuid,
accountsPrimaryExtra = true,
accountsFilesToCaptureExtra = arrayOf(
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_FRONT),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_BACK),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.SELFIE),
DocumentSpecificationModel(DocumentTypeModel.PASSPORT),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_ADDRESS),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_FUNDS)
)
)
)

The result of this actions will return the specific UserDossierModel on onAddDossierSuccess(userDossier: UserDossierModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Update User Account Dossier of Documents

Activity

To start using this feature on an activity, create an Intent using __AccountsSdk.updateDossierByIntent, pass the parent_activity, the session_token, the account_uuid, the dossier_uuid and an array of files to be capture using DocumentSpecificationModel with a selection of diferent document types.

val intent = AccountsSdk.updateDossierByIntent(
parentActivity = parent_activity,
sessionToken = session_token,
accountUuid = account_uuid,
dossierUuid = dossier_uuid,
filesToCapture = arrayOf(
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_FRONT),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_BACK),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.SELFIE),
DocumentSpecificationModel(DocumentTypeModel.PASSPORT),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_ADDRESS),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_FUNDS)
)
)
startActivity(intent)
Navigation Controller

To start using this feature on a navigation controller, add the destination AccountsActivity to your navigation graph and connect it. An action will be generated that will have to have the arguments embedded, as follows.

<fragment
android:id="@+id/accounts_user_documents_fragment_update"
android:name="com.example.alvieretestapp.accounts.documents.update.UpdateUserDocumentsFragment"
tools:layout="@layout/accounts_user_documents_fragment_update">
<action
android:id="@+id/action_accounts_user_documents_fragment_update_to_accounts_activity"
app:destination="@id/accounts_activity" />
</fragment>

<activity
android:id="@+id/accounts_activity"
android:name="com.alviere.android.accounts.activity.view.AccountsActivity">
<argument
android:name="accounts_extra_feature_frag"
app:argType="com.alviere.android.accounts.AccountsSdk$Features" />
<argument
android:name="accounts_token_extra"
app:argType="string" />
<argument
android:name="accounts_external_id_extra"
app:argType="string"
app:nullable="true"
android:defaultValue="@null" />
<argument
android:name="accounts_uuid_extra"
app:argType="string" />
<argument
android:name="accounts_dossier_uuid_extra"
app:argType="string"
app:nullable="true"
android:defaultValue="@null" />
<argument
android:name="accounts_primary_extra"
app:argType="boolean"
android:defaultValue="false" />
<argument
android:name="accounts_files_to_capture_extra"
app:argType="com.alviere.android.accounts.sdk.model.common.DocumentSpecificationModel[]" />
</activity>

A class is created for each destination where an action originates. The name of this class is the name of the originating destination, appended with the word "Directions". For example, if the originating destination is a fragment that is named UpdateUserDocumentsFragment, the generated class would be called UpdateUserDocumentsFragmentDirections. This class has a method for each action defined in the originating destination, such as actionAccountsUserDocumentsFragmentUpdateToAccountsActivity() that returns a NavDirections object. This returned NavDirections object can then be passed directly to navigate(), as shown in the following example:

it.findNavController().navigate(
UpdateUserDocumentsFragmentDirections.actionAccountsUserDocumentsFragmentUpdateToAccountsActivity(
accountsExtraFeatureFrag = AccountsSdk.Features.UPDATE_DOSSIER_DOCUMENTS,
accountsTokenExtra = session_token,
accountsUuidExtra = account_uuid,
accountsDossierUuidExtra = dossier_uuid,
accountsFilesToCaptureExtra = arrayOf(
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_FRONT),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_BACK),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.SELFIE),
DocumentSpecificationModel(DocumentTypeModel.PASSPORT),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_ADDRESS),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_FUNDS)
)
)
)

The result of this actions will return the specific UserDossierModel on onUpdateDossierSuccess(userDossier: UserDossierModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Replace User Account Dossier of Documents

Activity

To start using this feature on an activity, create an Intent using __AccountsSdk.replaceDossierByIntent, pass the parent_activity, the session_token, the account_uuid, the dossier_uuid and an array of files to be capture using DocumentSpecificationModel with a selection of diferent document types.

val intent = AccountsSdk.replaceDossierByIntent(
parentActivity = parent_activity,
sessionToken = session_token,
accountUuid = account_uuid,
dossierUuid = dossier_uuid,
filesToCapture = arrayOf(
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_FRONT),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_BACK),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.SELFIE),
DocumentSpecificationModel(DocumentTypeModel.PASSPORT),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_ADDRESS),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_FUNDS)
)
)
startActivity(intent)
Navigation Controller

To start using this feature on a navigation controller, add the destination AccountsActivity to your navigation graph and connect it. An action will be generated that will have to have the arguments embedded, as follows.

<fragment
android:id="@+id/accounts_user_documents_fragment_replace"
android:name="com.example.alvieretestapp.accounts.documents.replace.ReplaceUserDocumentsFragment"
tools:layout="@layout/accounts_user_documents_fragment_replace">
<action
android:id="@+id/action_accounts_user_documents_fragment_replace_to_accounts_activity"
app:destination="@id/accounts_activity" />
</fragment>

<activity
android:id="@+id/accounts_activity"
android:name="com.alviere.android.accounts.activity.view.AccountsActivity">
<argument
android:name="accounts_extra_feature_frag"
app:argType="com.alviere.android.accounts.AccountsSdk$Features" />
<argument
android:name="accounts_token_extra"
app:argType="string" />
<argument
android:name="accounts_external_id_extra"
app:argType="string"
app:nullable="true"
android:defaultValue="@null" />
<argument
android:name="accounts_uuid_extra"
app:argType="string" />
<argument
android:name="accounts_dossier_uuid_extra"
app:argType="string"
app:nullable="true"
android:defaultValue="@null" />
<argument
android:name="accounts_primary_extra"
app:argType="boolean"
android:defaultValue="false" />
<argument
android:name="accounts_files_to_capture_extra"
app:argType="com.alviere.android.accounts.sdk.model.common.DocumentSpecificationModel[]" />
</activity>

A class is created for each destination where an action originates. The name of this class is the name of the originating destination, appended with the word "Directions". For example, if the originating destination is a fragment that is named ReplaceUserDocumentsFragment, the generated class would be called ReplaceUserDocumentsFragmentDirections. This class has a method for each action defined in the originating destination, such as actionAccountsUserDocumentsFragmentReplaceToAccountsActivity() that returns a NavDirections object. This returned NavDirections object can then be passed directly to navigate(), as shown in the following example:

it.findNavController().navigate(
ReplaceUserDocumentsFragmentDirections.actionAccountsUserDocumentsFragmentReplaceToAccountsActivity(
accountsExtraFeatureFrag = AccountsSdk.Features.REPLACE_DOSSIER_DOCUMENTS,
accountsTokenExtra = session_token,
accountsUuidExtra = account_uuid,
accountsDossierUuidExtra = dossier_uuid,
accountsFilesToCaptureExtra = arrayOf(
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.ID_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_FRONT),
DocumentSpecificationModel(DocumentTypeModel.DRIVER_LICENSE_BACK),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_FRONT),
DocumentSpecificationModel(DocumentTypeModel.MC_DOCUMENT_BACK),
DocumentSpecificationModel(DocumentTypeModel.SELFIE),
DocumentSpecificationModel(DocumentTypeModel.PASSPORT),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_ADDRESS),
DocumentSpecificationModel(DocumentTypeModel.PROOF_OF_FUNDS)
)
)
)

The result of this actions will return the specific UserDossierModel on onReplaceDossierSuccess(userDossier: UserDossierModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get User Account Dossier of Documents

To obtain an user account dossier of documents, use the Accounts Sdk service method AccountsSdk.getUserDossier. Pass the session_token, the account_uuid, the dossier_uuid and the AccountDossierCallback.

AccountsSdk.getUserDossier(
sessionToken = session_token,
accountUuid = account_uuid,
dossierUuid = dossier_uuid,
clientCallback = accountDocumentCallback
)

The result of this action will return the specific UserDossierFileModel on onGetDossierSuccess(userDossier: UserDossierFileModel) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get All User Account Dossiers of Documents

To obtain an user account dossiers of documents, use the Accounts Sdk service method AccountsSdk.getUserAllDossiers. Pass the session_token, the account_uuid and the AccountDossierCallback.

AccountsSdk.getUserAllDossiers(
sessionToken = session_token,
accountUuid = account_uuid,
clientCallback = accountDocumentCallback
)

The result of this action will return the specific List<UserDossierModel> on onGetAllDossiersSuccess(userDossiers: List<UserDossierModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Delete User Account Dossier of Documents

To delete an user account dossier of documents, use the Accounts Sdk service method AccountsSdk.deleteUserDossier. Pass the session_token, the account_uuid, the dossier_uuid and the AccountDossierCallback.

AccountsSdk.deleteUserDossier(
sessionToken = session_token,
accountUuid = account_uuid,
documentId = dossier_uuid,
clientCallback = accountDocumentCallback
)

The result of this action will return on onDeleteDossierSuccess() and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Customization

The Accounts SDK for Android provides a set of UI styling customizations to allow you to adjust the provided UI to fit your needs. To customize the UI, you can use the AccountsCustomize object or override the colors.xml, strings.xml and dimens.xml values.

Customize Object

To start using AccountsCustomize set the object using Accounts.setCustomize. This will override some of the colors.xml, strings.xml and dimens.xml values.

.------------------------.--------------------.------------------------------------.
| Class | Attribute | Description |
:------------------------+--------------------+------------------------------------:
| AccountsCustomize | documentsCustomize | DocumentsCustomize resource keys |
| :--------------------+------------------------------------:
| | loadingCustomize | LoadingCustomize resource keys |
| '--------------------'------------------------------------'
| | tryAgainCustomize | TryAgainCustomize resource keys |
'------------------------'--------------------'------------------------------------'

Themes

The Accounts SDK for Android allows you to customize the main and capture UI Themes used by activities. To do so, you will need to redefine de Theme AccountsSdkTheme, AccountsSdkDocumentsCaptureTheme and AccountsSdkFacialCaptureTheme or redefine the used colors and font family. Some UI elements use specific colors that need to be redefined separately.

<style name="AccountsSdkTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/alviere_sdk_accounts_color_primary</item>
<item name="colorPrimaryDark">@color/alviere_sdk_accounts_color_primary_dark</item>
<item name="colorAccent">@color/alviere_sdk_accounts_color_accent</item>
<item name="android:windowBackground">@color/alviere_sdk_accounts_color_background</item>
<item name="android:navigationBarColor">@color/alviere_sdk_accounts_color_navigation_bar</item>
<item name="android:fontFamily">@string/alviere_sdk_accounts_font</item>
</style>

<style name="AccountsSdkDocumentsCaptureTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fontFamily">@string/alviere_sdk_accounts_font</item>
</style>

<style name="AccountsSdkFacialCaptureTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fontFamily">@string/alviere_sdk_accounts_font</item>
</style>

Fonts

The Accounts SDK for Android allows you to customize the UI font. To do so, you will need to redefine the font key that you want to change on your strings.xml file. Below is a list of the current font keys. For custom fonts you can use <string name="alviere_sdk_accounts_font">@font/custom_font</string>.

.-----------------------------------------------------------------.----------------------------.
| Key | PaymentsCustomize Support |
:-----------------------------------------------------------------.----------------------------:
| alviere_sdk_payments_font | No |
'-----------------------------------------------------------------+----------------------------'

Colors

The Accounts SDK for Android allows you to customize the UI colors. To do so, you will need to override the color key that you want to change on your colors.xml file. Below is a list of the current color keys.

.-----------------------------------------------------------------.---------------------------------.
| Key | Accounts Customize Support |
:-----------------------------------------------------------------.---------------------------------:
| alviere_sdk_accounts_color_primary | No |
'-----------------------------------------------------------------+---------------------------------'
| alviere_sdk_accounts_color_primary_dark | No |
'-----------------------------------------------------------------+---------------------------------'
| alviere_sdk_accounts_color_accent | No |
'-----------------------------------------------------------------+---------------------------------'
| alviere_sdk_accounts_color_background | No |
'-----------------------------------------------------------------+---------------------------------'
| alviere_sdk_accounts_color_navigation_bar | No |
'-----------------------------------------------------------------+---------------------------------'

:-----------------------------------------------------------------.---------------------------------:
| alviere_sdk_accounts_manual_capture_option_color | Yes |
'-----------------------------------------------------------------+---------------------------------'

:-----------------------------------------------------------------+---------------------------------:
| alviere_sdk_accounts_try_again_background | Yes |
:-----------------------------------------------------------------+---------------------------------:
| alviere_sdk_accounts_try_again_error_message_text_color | Yes |
:-----------------------------------------------------------------+---------------------------------:
| alviere_sdk_accounts_try_again_button_background | Yes. Changing Drawable. |
:-----------------------------------------------------------------+---------------------------------:
| alviere_sdk_accounts_try_again_button_background_pressed | Yes. Changing Drawable. |
:-----------------------------------------------------------------+---------------------------------:
| alviere_sdk_accounts_try_again_button_text | Yes |
:-----------------------------------------------------------------+---------------------------------'

.-----------------------------------------------------------------.---------------------------------.
| alviere_sdk_accounts_loading_background | Yes |
:-----------------------------------------------------------------+---------------------------------+
| alviere_sdk_accounts_loading_bar | Yes |
:-----------------------------------------------------------------+---------------------------------+
| alviere_sdk_accounts_loading_message | Yes |
'-----------------------------------------------------------------'---------------------------------'

Text and Localization

The Accounts SDK for Android allows you to customize the UI text. To do so, you will need to override the string key that you want to change on your strings.xml file. The next section details a list of the current localization keys. Currently, the SDK only provides english localization.

.-----------------------------------------------------------------.------------------------------.---------------------------------.
| Key | English Value | Accounts Customize Support |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_id_document_front | Card Front | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_id_document_back | Card Back | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_driver_license_front | Driver License Front | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_driver_license_back | Driver License Back | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_matricula_consular_front | Matrícula Consular Front | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_matricula_consular_back | Matrícula Consular Back | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_message_id_document | Place ID a on a flat surface.| Yes |
| | Please no fingers, | |
| | hands or reflections. | |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_message_id_document_manual | Place ID on a flat surface. | Yes |
| | Please no fingers, | |
| | hands or reflections. | |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_passport | Passport | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_proof_of_address | Proof of address | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_proof_of_funds | Proof of funds | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_message_proof | Place document on a | Yes |
| | flat surface. | |
| | Please no fingers, | |
| | hands or reflections. | |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_title_selfie | Selfie | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_message_selfie | Smile to automatically | Yes |
| | grab your picture | |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_message_selfie_manual | Take a picture | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_step | Step %1$d of %2$d | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_retake | Take a new one | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_accept_photo | Yes | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_is_photo_ok | Looking good? | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_success | Success | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_uploading_title | | Yes |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_documents_uploading_message | Uploading | Yes |
'-----------------------------------------------------------------'------------------------------'---------------------------------'

.-----------------------------------------------------------------.------------------------------.---------------------------------.
| alviere_sdk_accounts_facialcapture_hint_no_face | No face detected | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_multiple_faces | Multiple faces detected | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_face_center | Center Face In The Oval | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_get_farther | Get farther | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_get_closer | Get closer | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_smile | Smile | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_stop_smiling | Stop smiling | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_press_capture_button | Press button when ready | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_facialcapture_hint_hold_still | Hold Still | No |
'-----------------------------------------------------------------'------------------------------'---------------------------------'

.-----------------------------------------------------------------.------------------------------.---------------------------------.
| alviere_sdk_accounts_misnap_hint_too_dim | Too dim | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_too_bright | Too bright | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_hold_steady | Hold Still | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_too_far | Too far | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_too_close | Too close | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_angle_too_large | Angle too large | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_angle_rotation | Reduce rotation | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_glare | Reduce glare | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_busy_background | Busy background | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_low_contrast | Low contrast | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_wrong_document | Center the document | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_not_check_back | Not check back | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_misnap_hint_not_check_front | Not check front | No |
'-----------------------------------------------------------------'------------------------------'---------------------------------'

.-----------------------------------------------------------------.------------------------------.---------------------------------.
| alviere_sdk_accounts_try_again_error_message | An error has occurred | No |
:-----------------------------------------------------------------+------------------------------+---------------------------------:
| alviere_sdk_accounts_try_again_error_button_text | Try again | No |
'-----------------------------------------------------------------'------------------------------'---------------------------------'

Dimensions

The Accounts SDK for Android allows you to customize the UI dimensions. To do so, you will need to redefine the localization key that you want to change on your dimens.xml file. The next section details a list of the current localization keys.

.-----------------------------------------------------------------.----------------------------.
| Key | Accounts Customize Support |
.-----------------------------------------------------------------.----------------------------.
| alviere_sdk_accounts_documents_title_max_size | Yes |
'-----------------------------------------------------------------+----------------------------'

.-----------------------------------------------------------------.----------------------------.
| alviere_sdk_accounts_manual_capture_option_size | Yes |
'-----------------------------------------------------------------+----------------------------'

:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_button_margin_start | Yes |
:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_button_margin_end | Yes |
:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_button_margin_bottom | Yes |
:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_button_margin_top | Yes |
:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_button_corner_radius | Yes. Changing Drawable. |
:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_button_text_size | Yes |
:-----------------------------------------------------------------+----------------------------:
| alviere_sdk_accounts_try_again_message_text_size | Yes |
'-----------------------------------------------------------------'----------------------------'

.-----------------------------------------------------------------.----------------------------.
| alviere_sdk_accounts_loading_text_size | Yes |
'-----------------------------------------------------------------+----------------------------'

Packages