Groovy web console

subscribe to the feed Subscribe
to this
site

Code Test

Published 3 months ago by Arman Kurmanbay
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def verification = [contact3_verified:null]

boolean all_variables_exist = true;
boolean contact3_provided = false;
boolean verification_confirmed = true;

if (!verification.isEmpty()) {
    for (v in verification) {
        if (v.key != "contact3_verified" && v.value == null) {
            all_variables_exist = false;
        }
    }
} else {
    all_variables_exist = false;
}

for (v in verification) {
    if (!v.key.contains("contact3")) {
        if (!v.value) {
            verification_confirmed = false;
        }
    }
    else {
        if (v.key == "contact3_provided" && v.value) {
            contact3_provided = true;
        }
        if (contact3_provided && v.key == "contact3_verified" && !v.value) {
            verification_confirmed = false;

        }
    }
}

println(verification_confirmed)