check the Tax Identification Number number, country version for Netherlands.

@param ptaxNumber vat id to check
@return true if checksum is ok
491460
private boolean checkNlTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(8) - '0';
    int sum = 0;
    for (int i = 0; i < ptaxNumber.length() - 1; i++) {
      sum += (ptaxNumber.charAt(i) - '0') * (9 - i);
    }
    sum -= checkSum;
    return sum % 11 == 0;
  }
1312388
public static boolean checkSasAgreement(Platform platform, byte[] aMsg, int sasPos,
			int sasCount) {
		if (sasCount != 2)
			return false;
		
		boolean result =  (platform.getUtils().equals(SasType.B256.getType(), 0, aMsg, sasPos , 4)  &&
			    platform.getUtils().equals(SasType.B32.getType(), 0, aMsg, sasPos + 1 * 4, 4));
		
		return result;
	}
1121343
static boolean isValidLuhnNumber(@Nullable String cardNumber) {
        if (cardNumber == null) {
            return false;
        }

        boolean isOdd = true;
        int sum = 0;

        for (int index = cardNumber.length() - 1; index >= 0; index--) {
            char c = cardNumber.charAt(index);
            if (!Character.isDigit(c)) {
                return false;
            }

            int digitInteger = Character.getNumericValue(c);
            isOdd = !isOdd;

            if (isOdd) {
                digitInteger *= 2;
            }

            if (digitInteger > 9) {
                digitInteger -= 9;
            }

            sum += digitInteger;
        }

        return sum % 10 == 0;
    }
667911
private boolean checkItVatId(final String pvatId) {
    final int checkSum = pvatId.charAt(12) - '0';
    final int sum = pvatId.charAt(2) - '0' + squareSum((pvatId.charAt(3) - '0') * 2)
        + pvatId.charAt(4) - '0' + squareSum((pvatId.charAt(5) - '0') * 2) + pvatId.charAt(6) - '0'
        + squareSum((pvatId.charAt(7) - '0') * 2) + pvatId.charAt(8) - '0'
        + squareSum((pvatId.charAt(9) - '0') * 2) + pvatId.charAt(10) - '0'
        + squareSum((pvatId.charAt(11) - '0') * 2);
    final int calculatedCheckSumIt = 10 - sum % 10;
    return checkSum == calculatedCheckSumIt;
  }
1198239
def company_vat_checksum(digits):
    
    weights_for_check_digit = [6, 5, 7, 2, 3, 4, 5, 6, 7]
    check_digit = 0

    for i in range(0, 9):
        check_digit += weights_for_check_digit[i] * digits[i]

    check_digit %= 11

    return check_digit
582457
private boolean checkEeTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(10) - '0';
    int calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 1 //
        + (ptaxNumber.charAt(1) - '0') * 2 //
        + (ptaxNumber.charAt(2) - '0') * 3 //
        + (ptaxNumber.charAt(3) - '0') * 4 //
        + (ptaxNumber.charAt(4) - '0') * 5 //
        + (ptaxNumber.charAt(5) - '0') * 6 //
        + (ptaxNumber.charAt(6) - '0') * 7 //
        + (ptaxNumber.charAt(7) - '0') * 8 //
        + (ptaxNumber.charAt(8) - '0') * 9 //
        + (ptaxNumber.charAt(9) - '0') * 1) //
        % MODULO_11;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 3 //
          + (ptaxNumber.charAt(1) - '0') * 4 //
          + (ptaxNumber.charAt(2) - '0') * 5 //
          + (ptaxNumber.charAt(3) - '0') * 6 //
          + (ptaxNumber.charAt(4) - '0') * 7 //
          + (ptaxNumber.charAt(5) - '0') * 8 //
          + (ptaxNumber.charAt(6) - '0') * 9 //
          + (ptaxNumber.charAt(7) - '0') * 1 //
          + (ptaxNumber.charAt(8) - '0') * 2 //
          + (ptaxNumber.charAt(9) - '0') * 3) //
          % MODULO_11 % 10;
    }
    return checkSum == calculatedCheckSum;
  }
956641
private boolean checkFiVatId(final String pvatId) {
    final int checkSum = pvatId.charAt(9) - '0';
    final int sum =
        (pvatId.charAt(2) - '0') * 7 + (pvatId.charAt(3) - '0') * 9 + (pvatId.charAt(4) - '0') * 10
            + (pvatId.charAt(5) - '0') * 5 + (pvatId.charAt(6) - '0') * 8
            + (pvatId.charAt(7) - '0') * 4 + (pvatId.charAt(8) - '0') * 2;
    final int calculatedCheckSum = MODULO_11 - sum % MODULO_11;
    return checkSum == calculatedCheckSum;
  }
234466
private boolean checkNoVatId(final String pvatId) {
    final int checkSum = pvatId.charAt(10) - '0';
    final int sum = (pvatId.charAt(2) - '0') * 3 + (pvatId.charAt(3) - '0') * 2
        + (pvatId.charAt(4) - '0') * 7 + (pvatId.charAt(5) - '0') * 6 + (pvatId.charAt(6) - '0') * 5
        + (pvatId.charAt(7) - '0') * 4 + (pvatId.charAt(8) - '0') * 3
        + (pvatId.charAt(9) - '0') * 2;
    final int calculatedCheckSum = MODULO_11 - sum % MODULO_11;
    return checkSum == calculatedCheckSum;
  }
831091
public Response checkLoginDeptUser(String CorpNum) throws PopbillException{
		if (CorpNum == null || CorpNum.isEmpty())
			throw new PopbillException(-99999999, "연동회원 사업자번호(CorpNum)가 입력되지 않았습니다.");
		
		return httpget("/HomeTax/Taxinvoice/DeptUser/Check", CorpNum, null, Response.class); 
	}
1102128
private boolean checkDkTin(final String ptin) {
    final int checkSum = ptin.charAt(9) - '0';
    final int sum = ((ptin.charAt(0) - '0') * 4 //
        + (ptin.charAt(1) - '0') * 2 //
        + (ptin.charAt(2) - '0') * 3 //
        + (ptin.charAt(3) - '0') * 7 //
        + (ptin.charAt(4) - '0') * 6 //
        + (ptin.charAt(5) - '0') * 5 //
        + (ptin.charAt(6) - '0') * 4 //
        + (ptin.charAt(7) - '0') * 3 //
        + (ptin.charAt(8) - '0') * 2) //
        % MODULO_11;
    int calculatedCheckSum = MODULO_11 - sum;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = 0;
    }
    return checkSum == calculatedCheckSum;
  }
33832
private function isFormatValid()
    {
        $countryCode = $this->getCountryCode();
        $accountIdentification = $this->getAccountIdentification();

        return !(preg_match('/' . static::$ibanFormatMap[$countryCode][1] . '/', $accountIdentification) !== 1);
    }
107406
public function checkVat(string $countryCode, string $vatNumber) : bool 
    {
        try {
            $response = $this->getClient()->checkVat(
                array(
                    'countryCode' => $countryCode,
                    'vatNumber' => $vatNumber
                )
            );
        } catch( SoapFault $e ) {
            throw new ViesException( $e->getMessage(), $e->getCode() );
        }

        return (bool) $response->valid;
    }
6934
private boolean checkModulo11Tin(final String ptin) {
    final int checkSum = ptin.charAt(ptin.length() - 1) - '0';
    int sum = 10;
    for (int i = 0; i < ptin.length() - 1; i++) {
      int summe = (ptin.charAt(i) - '0' + sum) % 10;
      if (summe == 0) {
        summe = 10;
      }
      sum = 2 * summe % MODULO_11;
    }
    int calculatedCheckSum = MODULO_11 - sum;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = 0;
    }
    return checkSum == calculatedCheckSum;
  }
317028
private boolean checkFrVatId(final String pvatId) {
    final int checkSum = Integer.parseInt(pvatId.substring(2, 4));
    final int sum = Integer.parseInt(pvatId.substring(4));
    final int calculatedCheckSum = (12 + 3 * (sum % MODULO_97)) % MODULO_97;
    return checkSum == calculatedCheckSum;
  }
1143754
public static function validate($phoneNumber, $country = null)
    {
        $phoneNumber = trim($phoneNumber);
        if (empty($phoneNumber)) {
            return false;
        }
        $country = strtoupper($country);
        $phoneUtil = PhoneNumberUtil::getInstance();
        try {
            $numberProto = $phoneUtil->parse($phoneNumber, $country);
        } catch (NumberParseException $e) {
            return false;
        }

        return $phoneUtil->isValidNumber($numberProto);
    }
682557
private function validateIPNumber(): bool
    {
        $value = $this->value;

        if (\preg_match('/^([01]{8}\.){3}[01]{8}$/', $this->value)) {
            // binary format 00000000.00000000.00000000.00000000
            $value = \sprintf(
                '%s.%s.%s.%s',
                \bindec(\substr($this->value, 0, 8)),
                \bindec(\substr($this->value, 9, 8)),
                \bindec(\substr($this->value, 18, 8)),
                \bindec(\substr($this->value, 27, 8))
            );
        } elseif (\preg_match('/^([0-9a-f]{2}\.){3}[0-9a-f]{2}$/i', $this->value)) {
            // hex format ff.ff.ff.ff
            $value = \sprintf(
                '%s.%s.%s.%s',
                \hexdec(\substr($this->value, 0, 2)),
                \hexdec(\substr($this->value, 3, 2)),
                \hexdec(\substr($this->value, 6, 2)),
                \hexdec(\substr($this->value, 9, 2))
            );
        }
        $flags = 0;
        if ($this->options['allow-ipv4'] === true) {
            $flags |= FILTER_FLAG_IPV4;
        }
        if ($this->options['allow-ipv6'] === true) {
            $flags |= FILTER_FLAG_IPV6;
        }
        $isValid = \filter_var($value, FILTER_VALIDATE_IP, ['flags' => $flags]) !== false ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_IP_INVALID_NUMBER);
        }
        return $isValid;
    }
455693
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString = Objects.toString(pvalue, null);

    if (StringUtils.isEmpty(valueAsString)) {
      // empty field is ok
      return true;
    }
    return allowDin5008 && valueAsString.matches(PHONE_NUMBER_DIN5008) //
        || allowE123 && valueAsString.matches(PHONE_NUMBER_E123) //
        || allowUri && valueAsString.matches(PHONE_NUMBER_URI) //
        || allowMs && valueAsString.matches(PHONE_NUMBER_MS) //
        || allowCommon && valueAsString.matches(PHONE_NUMBER_COMMON);
  }