void validate()

in src/main/java/org/openvasp/client/model/PostalAddress.java [38:58]


    void validate(@NonNull final VaspMessage source) {
        if (StringUtils.isEmpty(postCode)) {
            throw new VaspValidationException(source, "Post code must be present");
        }

        if (StringUtils.isEmpty(town)) {
            throw new VaspValidationException(source, "Town name must be present");
        }

        if (country == null) {
            throw new VaspValidationException(source, "Country code must be present");
        }

        // whitepaper sections 7.10.1 and 7.11.1, rule 1)
        if ((null == adrline || adrline.isEmpty()) &&
                (null == street || street.isEmpty() || null == number || number.isEmpty())) {

            throw new VaspValidationException(source,
                    "Postal address rules not met - either [street] and [number] must both be present or [adrline]");
        }
    }