Add Several OTP Enrollment With API_OTP

Resolved

Hello

I need to do two OTP Enrollment (mobile and email) at the same time. This enlistment is conditioned by the fact that the atrributs through which the enrollment are made is valued.

To do this, I proceeded in this way:

API_OTP.synchronizeIdentity()
        .module(OTPEnrollmentType.PHONE, "MemorityOtpPhone-Worker", (OBJECT.personalMobileNumber == null) ? [:] : [(OBJECT.personalMobileNumber): OTPRegistrationStatus.ACTIVE])
        .module(OTPEnrollmentType.EMAIL, "MemorityOtpMail-Worker", (OBJECT.personalEmail == null) ? [:] : [(OBJECT.personalEmail): OTPRegistrationStatus.ACTIVE])
        .synchronize(OBJECT)

The problem is: if only one attribute is evaluated on both, and this attribute is the second module (personalEmail in this case) it is not enrolled, it's the same with a classic if/else structure.

How can I fix it please?

Thanks in advance

Authentication
1
5 replies
Best reply by Hassan KANE

Hello Damien TEMPLER,
I finally did it with a switch case block. For your information, putting two .module files in succession works:

API_OTP.synchronizeIdentity() .module(OTPEnrollmentType.PHONE, "MemorityOtpPhone-Worker", (OBJECT.personalMobileNumber == null) ? [:] : [(OBJECT.personalMobileNumber): OTPRegistrationStatus.ACTIVE]) .module(OTPEnrollmentType.EMAIL, "MemorityOtpMail-Worker", (OBJECT.personalEmail == null) ? [:] : [(OBJECT.personalEmail): OTPRegistrationStatus.ACTIVE]) .synchronize(OBJECT)
View original