remit

Remit SDK for Android

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

Features

Beneficiaries Management

  • Create Beneficiary

  • Get All Beneficiaries

  • Get Beneficiary

  • Update Beneficiary

  • Delete Beneficiary

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:remit:X.Y.Z'
}

Manual Integration

1. Get the latest versions of remit.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 remit.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: ':remit')
}

5. Make sure you have enabled Java 11 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: ':remit')
...
}

Usage

Before you can use the Remit Sdk, and if you want to call the remit services you need to first setup the environment on RemitSdk. Keep in mind that the process of setting up the environment it will be run in the UI thread and cannot be run in the IO thread.

RemitSdk.init()

On your android application class, setup Alviere Environment.

class AndroidApplication : Application() {

override fun onCreate() {
super.onCreate()

AlviereEnvironment.currentEnvironment = EnvironmentOption.PRD
}
}

Beneficiaries Management

This section outlines the integration with Alviere to manage beneficiaries.

Declare the callback

The BeneficiariesManagementSdkCallback 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 beneficiariesManagementSdkCallback = object : BeneficiariesManagementSdkCallback {
override fun onCreateBeneficiarySuccess(beneficiaryDetails: BeneficiaryDetailsModel) { /* handle event */ }

override fun onGetAllBeneficiariesSuccess(beneficiaryDetailsList: List<BeneficiaryDetailsModel>) { /* handle event */ }

override fun onGetBeneficiarySuccess(beneficiaryDetails: BeneficiaryDetailsModel) { /* handle event */ }

override fun onUpdateBeneficiarySuccess(beneficiaryDetails: BeneficiaryDetailsModel) { /* handle event */ }

override fun onDeleteBeneficiarySuccess() { /* handle event */ }

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

This callback method is called when a beneficiary request was successfully executed. Use this to manage beneficiaries of a user's account with the Alviere API.

onEvent

This callback method is called when the user exited from the Remit SDK, when an error occurred, or when certain events in the Remit SDK flow have occurred. This allows your application to get more information about what is going on as the user goes through the Remit 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.

Create Beneficiary

To create a beneficiary, use the Remit Sdk service method RemitSdk.createBeneficiary. Pass the session_token, the account_uuid, the CreateBeneficiaryRequestModel model and the BeneficiariesManagementSdkCallback.

val model = CreateBeneficiaryRequestModel( ... )
RemitSdk.createBeneficiary(
token = session_token,
accountUuid = account_uuid,
data = model,
clientCallback = beneficiariesManagementSdkCallback
)

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

Get All Beneficiaries

To get all beneficiaries from an account, use the Remit Sdk service method RemitSdk.getAllBeneficiaries. Pass the session_token, the account_uuid and the BeneficiariesManagementSdkCallback.

RemitSdk.getAllBeneficiaries(
token = session_token,
accountUuid = account_uuid,
clientCallback = beneficiariesManagementSdkCallback
)

The result of this action will return the user's account beneficiaries List<BeneficiaryDetailsModel> on onGetAllBeneficiariesSuccess(beneficiaryDetailsList: List<BeneficiaryDetailsModel>) and any errors will be returned on onEvent(event: String, metadata: Map<String, String>?), both from the callback.

Get Beneficiary

To get a beneficiary, use the Remit Sdk service method RemitSdk.getBeneficiary. Pass the session_token, the account_uuid, the beneficiary_uuid and the BeneficiariesManagementSdkCallback.

RemitSdk.getBeneficiary(
token = session_token,
accountUuid = account_uuid,
beneficiaryUuid = beneficiary_uuid,
clientCallback = beneficiariesManagementSdkCallback
)

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

Update Beneficiary

To update a beneficiary, use the Remit Sdk service method RemitSdk.updateBeneficiary. Pass the session_token, the account_uuid, the beneficiary_uuid, the updated BeneficiaryDetailsModel model, and/or the updated BankAccountDetailsRequestModel model and the BeneficiariesManagementSdkCallback.

val beneficiaryDetails = BeneficiaryDetailsModel( ... )
val bankAccountDetails = BankAccountDetailsRequestModel( ... )

RemitSdk.updateBeneficiary(
sessionToken = session_token,
accountUuid = account_uuid,
beneficiaryUuid = beneficiary_uuid,
beneficiaryDetails = beneficiaryDetails,
bankAccountDetails = bankAccountDetails,
clientCallback = beneficiariesManagementSdkCallback
)

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

Delete Beneficiary

To delete a beneficiary, use the Remit Sdk service method RemitSdk.deleteBeneficiary. Pass the session_token, the account_uuid, the beneficiary_uuid and the BeneficiariesManagementSdkCallback.

RemitSdk.deleteBeneficiary(
sessionToken = session_token,
accountUuid = account_uuid,
beneficiaryUuid = beneficiary_uuid,
clientCallback = beneficiariesManagementSdkCallback
)

Packages