Skip to content

Instantly share code, notes, and snippets.

@thb
Created July 18, 2020 22:34
Show Gist options
  • Save thb/2df8d2ee2252cc35adcde5090c64e183 to your computer and use it in GitHub Desktop.
Save thb/2df8d2ee2252cc35adcde5090c64e183 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# frozen_string_literal: true
# prendre les 9 premiers chiffres, exception si plus ou moins que 9 chiffres
SIREN = ARGV[0]
# calculer la clé
key = (12 + 3 * (SIREN.to_i % 97)) % 97
# concaténer et prévixer de "FR" pour la france
tva = "FR#{key}#{SIREN}"
puts tva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment