Closed GoogleCodeExporter closed 8 years ago
The algorithm for the VAT for Colombia (Called RUT) is: def check_vat_co(vat): ''' Check Colombian VAT number. Called RUT ''' if len(str(vat)) != 10: return False try: int(vat) except ValueError: return False nums = [3, 7, 13, 17, 19, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71] sum = 0 RUTLen = len(str(vat)) for i in range (RUTLen - 2, -1, -1): sum += int(str(vat)[i]) * nums [RUTLen - 2 - i] if sum % 11 > 1: return str(vat)[RUTLen - 1] == str(11 - (sum % 11)) else: return str(vat)[RUTLen - 1] == str(sum % 11) Example: 9001279338 is valid one. Regards Juan Fernando Jaramillo
Original issue reported on code.google.com by juanf.ja...@gtempaccount.com on 4 Sep 2009 at 7:19
juanf.ja...@gtempaccount.com
Fix with changeset 1b20d5a2e2a0
Original comment by cedric.krier@b2ck.com on 13 Nov 2009 at 5:41
cedric.krier@b2ck.com
Original comment by cedric.krier@b2ck.com on 13 Nov 2009 at 5:51
Original issue reported on code.google.com by
juanf.ja...@gtempaccount.com
on 4 Sep 2009 at 7:19