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 Contacts 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)
FraudDetection.initFraudDetection(this)
}
}

Request camera runtime permission for document capture.

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

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,
callback = 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 UpdateUserAccountModel model and the AccountUserCallback.

val model = UpdateUserAccountModel( ... )
AccountsSdk.getUserAccount(
sessionToken = session_token,
accountUuid = account_uuid,
data = model,
callback = 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,
callback = 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 onGetAddressSuccess(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 AddAddressRequestModel model and the AccountAddressCallback.

val model = AddAddressRequestModel( ... )
AccountsSdk.addAddress(
sessionToken = session_token,
data = model,
callback = 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 User Account Address

To obtain an user account address, use the Accounts Sdk service method AccountsSdk.getAddress. Pass the session_token, the account_uuid and the AccountAddressCallback.

AccountsSdk.getAddress(
sessionToken = session_token,
accountUuid = account_uuid,
callback = accountAddressCallback
)

The result of this action will return the user's addresses List<UserAddressModel> on onGetAddressSuccess(userAddressesList: List<UserAddressModel>) and any errors will be returned on onEvent(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 UpdateAddressModel model and the AccountAddressCallback.

val model = UpdateAddressModel( ... )
AccountsSdk.updateAddress(
sessionToken = session_token,
accountUuid = account_uuid,
addressId = address_id,
data = model,
callback = 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.

Delete User Account Address

To delete an user account address, use the Accounts Sdk service method AccountsSdk.deleteAddress. Pass the session_token, the account_uuid, and the AccountAddressCallback.

AccountsSdk.deleteAddress(
sessionToken = session_token,
accountUuid = account_uuid,
addressId = address_id,
callback = accountAddressCallback
)

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

User Contacts Management

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

Declare the callback

The AccountContactCallback 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 accountContactCallback = object : AccountContactCallback {
override fun onAddContactSuccess(userContact: UserContactModel) { /* handle success */ }

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

override fun onGetContactSuccess(userContacts: List<UserContactModel>) { /* handle success */ }

override fun onUpdateContactSuccess(userContact: UserContactModel) { /* 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 contacts. 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 Contact

To add an user account address, use the Accounts Sdk service method AccountsSdk.addContact. Pass the session_token, the AddContactModel model and the AccountContactCallback.

val model = AddContactModel( ... )
AccountsSdk.addAddress(
sessionToken = session_token,
data = model,
callback = accountContactCallback
)

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

Get User Account Contact

To obtain an user account contact, use the Accounts Sdk service method AccountsSdk.getContact. Pass the session_token, the account_uuid and the AccountContactCallback.

AccountsSdk.getAddress(
sessionToken = session_token,
accountUuid = account_uuid,
callback = accountContactCallback
)

The result of this action will return the user's contacts List<UserContactModel> on onGetContactSuccess(userContacts: List<UserContactModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Update User Account Contact

To update an user account contact, use the Accounts Sdk service method AccountsSdk.updateContact. Pass the session_token, the account_uuid, the contact_id, the UpdateContactModel model and the AccountContactCallback.

val model = UpdateContactModel( ... )
AccountsSdk.updateContact(
sessionToken = session_token,
accountUuid = account_uuid,
contactId = contact_id,
data = model,
callback = accountContactCallback
)

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

Delete User Account Contact

To delete an user account contact, use the Accounts Sdk service method AccountsSdk.deleteContact. Pass the session_token, the account_uuid, the contact_id and the AccountContactCallback.

AccountsSdk.deleteContact(
sessionToken = session_token,
accountUuid = account_uuid,
contactId = contact_id,
callback = accountContactCallback
)

The result of this action will return on onDeleteContactSuccess() 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: GetUserDossierResponseModel) { /* handle success */ }

override fun onGetDossiersSuccess(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/add_user_documents_fragment"
android:name="com.example.app.AddUserDocumentsFragment"
tools:layout="@layout/add_user_documents_fragment">
<action
android:id="@+id/action_add_user_documents_fragment_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.document.DocumentSpecificationModel[]" />
</activity>

Safe Args it will generate a AddUserDocumentsFragmentDirections class with a single method, 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/update_user_documents_fragment"
android:name="com.example.app.UpdateUserDocumentsFragment"
tools:layout="@layout/update_user_documents_fragment">
<action
android:id="@+id/action_update_user_documents_fragment_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.document.DocumentSpecificationModel[]" />
</activity>

Safe Args it will generate a UpdateUserDocumentsFragmentDirections class with a single method, actionReplaceUserDocumentsFragmentToAccountsActivity() 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.actionReplaceUserDocumentsFragmentToAccountsActivity(
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/replace_user_documents_fragment"
android:name="com.example.app.ReplaceUserDocumentsFragment"
tools:layout="@layout/replace_user_documents_fragment">
<action
android:id="@+id/action_replace_user_documents_fragment_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.document.DocumentSpecificationModel[]" />
</activity>

Safe Args it will generate a ReplaceUserDocumentsFragmentDirections class with a single method, actionReplaceUserDocumentsFragmentToAccountsActivity() 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.actionReplaceUserDocumentsFragmentToAccountsActivity(
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,
callback = accountDocumentCallback
)

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

Get User Account All Dossiers of Documents

To obtain an user account all 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,
callback = accountDocumentCallback
)

The result of this action will return the specific List<UserDossierModel> on onGetDossiersSuccess(userDossiersList: 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,
callback = 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 |
'------------------------'--------------------'------------------------------------'

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_manual_capture_option_size | 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

com.alviere.android.accounts
Link copied to clipboard
com.alviere.android.accounts.customize
Link copied to clipboard