Backend/Microservices/UserService/server/src/Entity/users.js
/**
    * Method to validate the phone with OTP before registering.
    * @returns {Promise<Array>}
    */
Method to validate the phone with OTP before registering.
@returns {Promise}
Method to validate the phone with OTP before registering . @returns { Promise }
validateBeforeRegister(usedReferralCode) {
      return new Promise((resolve, reject) => {
         const auth = new Authentication(this._phone, false);
         const userObj = {};
         userObj[constants.FIRST_NAME] = this._firstName;
         userObj[constants.LAST_NAME] = this._lastName;
         userObj[constants.GENDER] = this._gender;
         userObj[constants.PHONE_NUMBER] = this._phone;
         userObj[constants.USED_REFERRAL_CODE] = usedReferralCode;
         const jwToken = jwtGenerator.getToken(userObj);
         auth.createAndSendOTP(jwToken).then(response => {
            resolve(response);
         }).catch(err => {
            printer.printError(err);
            reject([constants.ERROR_LEVEL_3, constants.ERROR_MESSAGE]);
         });
      });
   }
validateBeforeRegister ( usedReferralCode ) { return new Promise ( ( resolve , reject ) => { const auth = new Authentication ( this . _phone , false ) ; const userObj = { } ; userObj [ constants . FIRST_NAME ] = this . _firstName ; userObj [ constants . LAST_NAME ] = this . _lastName ; userObj [ constants . GENDER ] = this . _gender ; userObj [ constants . PHONE_NUMBER ] = this . _phone ; userObj [ constants . USED_REFERRAL_CODE ] = usedReferralCode ; const jwToken = jwtGenerator . getToken ( userObj ) ; auth . createAndSendOTP ( jwToken ) . then ( response => { resolve ( response ) ; } ) . catch ( err => { printer . printError ( err ) ; reject ( [ constants . ERROR_LEVEL_3 , constants . ERROR_MESSAGE ] ) ; } ) ; } ) ; }
Method to validate the phone with OTP before registering.
Method to validate the phone with OTP before registering .