Challenge Status Receiver
ChallengeStatusReceiver is an interface used to obtain the result of the SDK challenge process. This should be implemented in the application and passed to the doChallenge method when Starting the Challenge. When the challenge process has finished, either successfully or in error, one of the following corresponding methods will be called:
Name | Description |
completed | Called when the challenge process (that is, the transaction) is completed. When a transaction is completed, a transaction status will be available. |
cancelled | Called when the cardholder selects the option to cancel the transaction on the challenge screen. |
timedout | Called when the challenge process reaches or exceeds the timeout interval that is specified during the doChallenge call. |
protocolError | Called when the 3DS SDK receives an EMV® 3-D Secure protocol-defined error message from the ACS. |
runtimeError | Called when the 3DS SDK encounters errors during the challenge process. These errors include all errors except those covered by the protocolError method. |
@Override
public void completed(CompletionEvent completionEvent) {
showToast("Challenge completed with transactionStatus " + completionEvent.getTransactionStatus());
closeTransaction();
}
@Override
public void cancelled() {
showToast("Challenge cancelled.");
closeTransaction();
}
@Override
public void timedout() {
showToast("Challenge timed out.");
closeTransaction();
}
@Override
public void protocolError(ProtocolErrorEvent protocolErrorEvent) {
showToast("Challenge protocolError: " +
protocolErrorEvent.getErrorMessage().getErrorDescription() + "\t" +
protocolErrorEvent.getErrorMessage().getErrorDetails());
closeTransaction();
}
@Override
public void runtimeError(RuntimeErrorEvent runtimeErrorEvent) {
showToast("Challenge runtimeError: " + runtimeErrorEvent.getErrorMessage());
closeTransaction();
}
// Helper method
public void closeTransaction() {
if (sdkTransaction != null) {
sdkTransaction.close();
sdkTransaction = null;
}
sdkProgressDialog = null;
}