Files
backend/account-service/src/main/java/com/drinkool/utils/PhoneValidator.java
T
TakahashiNguyen a2b9de91f5
Release package / release (push) Failing after 2m57s
feat: init customer authentication (#2)
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Co-authored-by: gitea-actions <actions-user@noreply.git.demonkernel.io.vn>
Reviewed-on: #2
2026-03-23 13:21:00 +00:00

21 lines
489 B
Java

package com.drinkool.utils;
import com.google.i18n.phonenumbers.*;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
public class PhoneValidator {
private static final PhoneNumberUtil phoneUtil =
PhoneNumberUtil.getInstance();
public static boolean isValidInternationalPhone(String phone) {
try {
PhoneNumber numberProto = phoneUtil.parse(phone, "VN");
return phoneUtil.isValidNumber(numberProto);
} catch (NumberParseException e) {
return false;
}
}
}