class Faker::Invoice

def iban_checksum(country_code, account)

source: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN
Calculates the mandatory checksum in 3rd and 4th characters in IBAN format
def iban_checksum(country_code, account)
  # Converts letters to numbers according the iban rules, A=10..Z=35
  account_to_number = "#{account}#{country_code}00".upcase.chars.map do |d|
    d =~ /[A-Z]/ ? (d.ord - 55).to_s : d
  end.join.to_i
  # This is answer to (iban_to_num + checksum) % 97 == 1
  checksum = (1 - account_to_number) % 97
  # Use leftpad to make the size always to 2
  checksum.to_s.rjust(2, '0')
end