Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of any stored phone number #235

Open
mariusvandam opened this issue Aug 29, 2024 · 1 comment
Open

Validation of any stored phone number #235

mariusvandam opened this issue Aug 29, 2024 · 1 comment
Assignees
Labels

Comments

@mariusvandam
Copy link

mariusvandam commented Aug 29, 2024

Thema / Theme

Klantinteracties API

Omschrijving / Description

It is desirable to have OpenKlant validate and/or format/transform phone numbers before storing them so that they are stored in a consistent way.

Toegevoegde waarde / Added value

This make sure only valid phone numbers are stored and any connected system can rely on the provided addresses.

Aanvullende opmerkingen / Additional context

As discussed on 29-8 with Andy, ICATT & Maykin

@mariusvandam mariusvandam added enhancement New feature or request triage labels Aug 29, 2024
@andyverberne
Copy link

andyverberne commented Sep 2, 2024

Hieronder de conversie en validatie regels en patterns welke in e-Suite worden gehanteerd

/**
     * (0[8-9]00[0-9]{4,7}) : 0800 of 0900 Nederlands service nummer. Begint altijd met 0800 of 0900 en daarna nog minimaal 4 tot maximal 7 cijfers.
     * (0[1-9][0-9]{8,8})   : Nederland 10 cijferig nummer. Begint altijd met 0, dan een getal <> 0 en daarna nog 8 cijfers.</>
     * (\+[0-9]{9,20})      : Internationaal nummer.
     * 1400                 : Het 1400 Rijksoverheidnummer.
     * 140[0-9]{2,3})       : Het 14+ nummer voor gemeenten, 14 + netnummer.
     */
    public static final Pattern TELEFOON_PATTERN = Pattern.compile("(0[8-9]00[0-9]{4,7})|(0[1-9][0-9]{8})|(\\+[0-9]{9,20}|1400|140[0-9]{2,3})");

    /**
     * Characters that must be removed from telefoonnummers.
     */
    public static final Pattern TELEFOON_NOISE_PATTERN = Pattern.compile("[-()\\s]+");

    /**
     * Onderstaande patterns worden gebruikt om telefoonnummers te standaardiseren
     *
     * Een 0031... wordt altijd een +31...
     * Een +310... wordt altijd een +31... dus zonder de netnummer 0
     * Een +31140... wordt altijd 140... dus zonder de landcode
     */
    public static final Pattern TELEFOON_0031 = Pattern.compile("^0031");
    public static final Pattern TELEFOON_PLUS_310 = Pattern.compile("^\\+310");
    public static final Pattern TELEFOON_PLUS_31140 = Pattern.compile("^\\+31140");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

4 participants