Activar la vinculación con OTP
AnteriorActivar la vinculación con app-to-appSiguienteActivar la vinculación con atención al cliente
Última actualización
¿Te fue útil?
¿Te fue útil?
@Override
public void onIssuerAuthenticationRequired(PendingBindingSession pendingBindingSession) {
// Enviar método ID&V OTP_SMS
for (IDVMethod idvMethod : pendingBindingSession.getIdvMethods()) {
if (idvMethod.getType().equals(IDVType.OTP_SMS)) {
pendingBindingSession.submitIdvMethod(idvMethod);
}
}
}
@Override
public void onIssuerAuthenticationReady(PendingBindingSession pendingBindingSession,
@Nullable OtpActivationStatus status) {
}
@Override
public void onError(TMGClientException exception) {
// Comprobar si hay algún error
int errorCode = exception.getErrorCode();
int errorMessage = exception.getMessage();
}guard let idvSession = VisaService.shared.idvSession else {
// no hay sesión idv
return
}
// 1. Mostrar la lista de métodos idv
do {
let idvMethods = try idvSession.idvMethods
let selectedIdvMethod = idvMethods[0] // el usuario selecciona un método idv OTP (OTP_SMS)
// 2. enviar el método idv
idvSession.selectIDVMethod(selectedIdvMethod) { (result) in
if let otpActivationStatus = result {
let maxOtpVerificationAllowed = otpActivationStatus.maxOTPVerificationAllowed
let maxOtpRequestsAllowed = otpActivationStatus.maxOTPRequestsAllowed
let otpExpiration = otpActivationStatus.otpExpiration
// 3. Mostrar página para introducir el OTP
}
}
} catch let error {
// manejar error
}
// 4. El fallo en el paso 2, selectIDVMethod, se manejará en completionHandler.
VisaService.shared.completionHandler = { (session, error) in
// 5. Comprobar si es un error de selectIDVMethod.
if let session = session,
let error = error,
error.description == TMGError.invalidIdvMethod.description {
VisaService.shared.idvSession = session
// 6. Reintentar el flujo IDV.
}
}@Override
public void onIssuerAuthenticationReady(IDVSession idvSession,
@Nullable OtpActivationStatus status) {
// Activar enlace
String otp;
idvSession.activateBinding(otp);
}
@Override
public void onIssuerAuthenticationError(@Nullable IDVSession idvSession,
TMGClientException tmgClientException) {
// Comprobar el error o reintentar
}// 1. Valor OTP de la entrada del usuario
let otp = ""
guard let idvSession = VisaService.shared.idvSession else {
// no hay sesión idv
return
}
// 2. Llamar a activar
idvSession.activateBinding(withValue: otp)
VisaService.shared.completionHandler = { (session, error) in
// 2. Enlace exitoso
if error == nil {
} else if let error = error,
let session = session,
error.description == TMGError.serverErrorWrongOTP.description {
VisaService.shared.idvSession = session
// 3. Reintentar la entrada OTP y mostrar mensaje de error
}
}