CASE: check if Belgian VAT number is valid

If you want to check if a Belgian VAT number is valid or not (check modulo 97), you can see how you can configure just that in below case:

{% comment %}remove any string values that could be present{% endcomment %}
{% assign vat_nbr = custom.vat.nbr | remove:"BE" | remove:"BE0" | remove:" " | remove:"-" | remove:"." %}
{% comment %}create the vat nbr that can be only 9 numbers long!{% endcomment %}
{% if vat_nbr.size == 10 %}
  {% assign vat_nbr = vat_nbr | slice:1,9 %}
{% elsif vat_nbr.size == 9 %}
  {% assign vat_nbr = vat_nbr %}
{% endif %}
{% comment %}remove last 2 numbers{% endcomment %}
{% assign vat = vat_nbr | slice:0,7  %}
{% comment %}calculate modulo 97{% endcomment %}
{% assign calc_modulo = vat | modulo:97 %}
{% comment %}calculate difference between "97" and var "calc_modulo"{% endcomment %}
{% assign calc_modulo = 97-calc_modulo %}
{% comment %}if the check is 00, then it needs to be seen as "97"; if not, take the real value{% endcomment %}
{% if calc_modulo == 0 %}
  {% assign calc_modulo = 97 %}
{% else %}
  {% assign calc_modulo = calc_modulo %}
{% endif %}
{% comment %}create last 2 numbers of vat nbr{% endcomment %}
{% assign vat_nbr = vat_nbr | slice:-2,2 %}
{% comment %}compare vat_nbr & calc_modulo. If not the same, the VAT number is invalid{% endcomment %}
{% if INT(vat_nbr) != INT(calc_modulo) %}
  {% assign vat_ind = calc_modulo %}
  {% capture vat_warning %}
    {::warningtext as="hover"}
    {% t "Invalid VAT number" %}
    {:/warningtext}
  {% endcapture %}
{% else %}
  {% assign vat_ind = 0 %}  
{% endif %}


{% stripnewlines %}
|-----
{% newline %}
| {% unreconciled vat_ind as:indicator %}
  {% input custom.vat.nbr %}
  {{ vat_warning }}
{% endstripnewlines %}

All information is there between comment-tags.