verifyOTPCode method

Future<AuthToken> verifyOTPCode (M4eAuthOTPVerificationForm m4eAuthOTPVerificationForm)

Takes in M4eAuthOTPVerificationForm parameter and returns AuthToken on success call

Throws ServerException if call to server fails

Throws ServerException with NO_INTERNET_CONNECTION error code if device is not connected to the internet

Implementation

Future<AuthToken> verifyOTPCode(
    M4eAuthOTPVerificationForm m4eAuthOTPVerificationForm) async {
  if ((await _connectionChecker.hasConnection) ?? false) {
    try {
      final _authToken =
          await _authApi.verifyOTPCode(m4eAuthOTPVerificationForm);

      await _authApi.cacheAuthToken(_authToken);
      return _authToken;
    } catch (e) {
      rethrow;
    }
  }

  throw ExceptionMessages.kNoInternetConnectionException;
}