Handling the onValidated - Android- V 2.2.3
- Bharadwaj Reddy Sama (Unlicensed)
- Siddhartha Chikatamalla
onValidated() is triggered when the transaction has been terminated. This is how the Cardinal Mobile SDK hands back control to the merchant's application. This event will include data on how the transaction attempt ended and should be where you review the results of the transaction and make decisions regarding the next steps. The field ActionCode should be used to determine the overall state of the transaction. On the first pass, we recommend that on an ActionCode of 'SUCCESS' or 'NOACTION' you send the response JWT to your backend for verification. There is more information on verifying JWT's in the next section.@Override
public void onValidated(Context currentContext, ValidateResponse validateResponse, String serverJWT) {
switch (validateResponse.getActionCode()){
case SUCCESS:
// Handle successful transaction, send JWT to backend to verify
break;
case NOACTION:
// Handle no actionable outcome
break;
case FAILURE:
// Handle failed transaction attempt
break;
case CANCEL:
// Handle cancel transaction
break;
case ERROR:
// Handle service level error
break;
case TIMEOUT:
// Handle timeout
break;
}
}
override fun onValidated(currentContext: Context?, validateResponse: ValidateResponse, serverJWT: String?) {
when (validateResponse.getActionCode()!!) {
CardinalActionCode.SUCCESS -> {
// Handle successful transaction, send JWT to backend to verify
}
CardinalActionCode.NOACTION -> {
// Handle no actionable outcome
}
CardinalActionCode.FAILURE -> {
// Handle failed transaction attempt
}
CardinalActionCode.CANCEL -> {
// Handle cancel transaction
}
CardinalActionCode.ERROR -> {
// Handle service level error
}
CardinalActionCode.TIMEOUT -> {
// Handle timeout
}
}
}
Value | Description |
---|---|
SUCCESS | Authentication was completed successfully. You will have a CAVV, ECIFlag, and XID to send during authorization. |
NOACTION | Authentication was not applicable and no service level errors were encountered. When the ErrorNumber is 0, generally this means you may move on to authorization, but be aware the transaction may not be eligible for liability shift. |
FAILURE | Authentication resulted in a failure - this includes the end user failing authentication. |
ERROR | An error was encountered. Refer to ErrorNumber and ErrorDescription for more details on the error. If a Payment object is present you may have additional details in the ReasonCode and ReasonDescription fields within the Payment object. |
CANCEL | Transaction canceled by the user. |
TIMEOUT | Returned when the challenge process reaches or exceeds the timeout interval that is specified during the cca_continue call. |