isValidIBANChecksum function
Calculate checksum of IBAN and compares it with checksum provided in IBAN Registry
@ignore
Implementation
bool isValidIBANChecksum(String iban) {
final String countryCode = iban.substring(0, 2);
final int providedChecksum = int.parse(iban.substring(2, 4), radix: 10);
final String bban = iban.substring(4);
// Wikipedia[validating_iban] says there are a specif way to check if a IBAN is valid but
// it. It says 'If the remainder is 1, the check digit test is passed and the
// IBAN might be valid.'. might, MIGHT!
// We don't want might but want yes or no. Since every BBAN is IBAN from the fifth
// (slice(4)) we can generate the IBAN from BBAN and country code(two first characters)
// from in the IBAN.
// To generate the (generate the iban check digits)[generating-iban-check]
// Move the country code to the end
// remove the checksum from the begging
// Add "00" to the end
// modulo 97 on the amount
// subtract remainder from 98, (98 - remainder)
// Add a leading 0 if the remainder is less then 10 (padStart(2, "0")) (we skip this
// since we compare int, not string)
//
// [validating_iban][https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN]
// [generating-iban-check][https://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits]
final String validationString =
replaceCharacterWithCode('$bban${countryCode}00');
final int rest = mod9710(validationString);
return 98 - rest == providedChecksum;
}