WalletCallback
Most methods return a callback when the SDK finishes, either with error or success
information. Methods for onSuccess and onError must be implemented for
WalletCallback. OnSuccess, the WalletCallback will in some cases include a data object,
documented under “Models” section. For more information on WalletSuccess and
WalletException, see Success and Error types sections.
Example
⚠️ When success returns a model, the model must be provided in the callback, or 'Unit' if no data is expected. See expected return data in 'SDK Methods' and definitions under 'Definitions'.
import com.aerahost.aerawalletssdk.external.model.callback.WalletCallback
import com.aerahost.aerawalletssdk.external.model.callback.success.WalletSuccess
import com.aerahost.aerawalletssdk.external.model.callback.exception.WalletException
import com.aerahost.aerawalletssdk.external.model.SDKInfo
val callback = object : WalletCallback<SDKInfo> {
override fun onSuccess(walletSuccess: WalletSuccess<SDKInfo>) {
Log.d("Wallets SDK: onSuccess”, walletSuccess.toString())
Log.d("Wallets SDK: onSuccess”, “${walletSuccess.type}, ${walletSuccess.message} ${walletSuccess.data}")
Log.d("SDK version: ", walletSuccesss.data.walletsSdkVersion)
}
override fun onError(walletException: WalletException) {
Log.e("Wallets SDK: onSuccess”, walletException.toString())
Log.e("Wallets SDK: onError", “${walletException.type}, ${walletException.type.errorCode} ${walletException.message}”)
}
}
// ...
walletsSDK.myWalletsSDKMethod(sessionId, sessionKey, callback)Updated 2 months ago
