SDK for using the Tikkie API on Android
- Add the library to your project
implementation 'nl.dss.abnamro:tikkie:0.0.1'
- Initialize the library with your API key and your private key
// Setup the library
val config = TikkieConfig(getString(R.string.abn_ambro_api_key), getString(R.string.abn_ambro_private_key))
Tikkie.setup(config)
- All done! You can now use the library to use the Tikkie API
val platformConfig = PlatformSetupConfig("SmartScan", "0600000000", "[email protected]", PlatformUsage.PAYMENT_REQUEST_FOR_MYSELF)
Platform.create(platformConfig, object : Callback<Platform> {
override fun onSuccess(value: Platform) {
Log.i("MainActivity", value.name)
}
override fun onApiError(errors: List<ApiError>) {
for(error : ApiError in errors) {
Log.e("MainActivity", error.message)
}
}
override fun onException(throwable: Throwable) {
throw throwable
}
})
Platform.get(object : Callback<List<Platform>> {
override fun onSuccess(value: List<Platform>) {
for(platform in value) {
Log.i("MainActivity", platform.name)
}
}
override fun onApiError(errors: List<ApiError>) {
for(error : ApiError in errors) {
Log.e("MainActivity", error.message)
}
}
override fun onException(throwable: Throwable) {
throw throwable
}
})
platform.user(userConfig, object : Callback<User> {
override fun onSuccess(value: User) {
Log.i("MainActivity", "User created with token id: " + value.token)
}
override fun onApiError(errors: List<ApiError>) {
for(error : ApiError in errors) {
Log.e("MainActivity", error.message)
}
}
override fun onException(throwable: Throwable) {
throw throwable
}
})
platform.users(object : Callback<List<User>> {
override fun onSuccess(value: List<User>) {
for(user in value) {
Log.i("MainActivity", user.name)
}
}
override fun onApiError(errors: List<ApiError>) {
for(error : ApiError in errors) {
Log.e("MainActivity", error.message)
}
}
override fun onException(throwable: Throwable) {
throw throwable
}
})