IT3(s) tax-free investment data: validations for a South African financial institution's IT3(s) submission to SARS

Written from SARS's Business Requirements Specification: IT3 Data Submission, version 4.0.0D-10 of 7 October 2022, which covers IT3(b), IT3(c), IT3(d), IT3(e) and IT3(s). These rules cover IT3(s), the return of tax-free investment accounts: each account's balances, the return on it, and the contributions, transfers and withdrawals in the tax year. Field lengths and code lists are the BRS's: Appendix A lists the natures of person, Appendix E the account types, Appendix G the ID types, Appendix N the source codes and Appendix O the transaction types (all in it3s-code-tables.csv), and Appendix F the country codes (it3s-country-codes.csv). Appendix I gives the income tax number check and Appendix J the South African ID number check.

There are three files, one for each of the BRS's IT3(s) record types:
- Account holders (AHDD): one row per account holder, with FICA status, names, ID, tax number, address and contact details. Only individuals, foreign individuals and individual estates hold tax-free investment accounts.
- Financial data (AHFD): one row per account, with its opening and closing balances, the dates of the active period, the return on investment in the tax year and the market value at the end of the period
- Transactions (ATD): the account's contributions, transfers in, transfers out and withdrawals, one row per transaction or, when the account's Transaction Value Total Indicator is Y, one row per type with the year's total

Each row has a Record Status (N new, C correction, D delete) and a Unique Number. Account holders and financial data carry the holder's I3S Unique Number. Each transaction carries its account's Unique Number in Account Unique Number: the BRS calls this field I3S Unique Number in the transaction record, but it must match the Unique Number of a financial data record.

Before the checks, the pipeline trims every value, collapses repeated spaces and puts code fields in upper case. Codes compare as numbers, so 001 and 1 are the same ID type. Except where a rule says a field is given, each check skips blank values.

FICA Status is Y when the holder has been through FICA, N when not, and E when exempt.

Data rules (Fail)

Account holders (AHDD)
H01  Record Status is N, C or D
H02  Unique Number is given
H03  I3S Unique Number is given, and appears once in the account holders file
H04  FICA Status is Y, N or E
H05  Surname is given, and isn't UNKNOWN when FICA Status is Y
H06  Names are given when FICA Status is Y
H07  ID Type is 001 (South African ID), 002 (foreign ID), 003 (foreign passport) or 009 (internal identification number), the Appendix G codes IT3(s) allows
H08  ID Number is given, and is NOIDNUMBER only with ID type 009
H09  South African ID numbers (ID type 001) have 13 digits and a valid check digit (Appendix J)
H10  Passport Country is given for passports (ID type 003), and is a code in Appendix F when given
H11  Income Tax Number, when given, has 10 digits, starts with 0, 1, 2, 3 or 9, and passes the modulus 10 check (Appendix I)
H12  Date of Birth is given for ID types 001 and 003 when FICA Status is Y, and is a CCYY-MM-DD date when given (0001-01-01 when unknown)
H13  SA Tax Resident is Y, N or U
H14  Nature of Person is INDIVIDUAL, FOREIGN_INDIVIDUAL or INDIVIDUAL_ESTATE, the Appendix A codes IT3(s) allows
H15  When FICA Status is Y, Physical Street or Farm or Postal Address Line 1 is given
H16  A physical address with a street or farm has a suburb or district, or a city or town, and a postal code
H17  Postal Same As Physical is Y or N, or blank
H18  A postal address has a postal code
H19  Telephone Number is blank or 9 to 15 digits starting with 0, and Cell Phone Number is 9 to 15 digits starting with 0, or 999999999999999 when unknown
H20  Email has 5 to 80 characters, with one @ and a dot after it (NO@EMAIL.COM when unknown)
H21  Names, addresses, ID numbers and unique numbers are within SARS's maximum lengths
H22  Unit and street numbers use only letters, digits and full stops, and postal codes only those and spaces
H23  Names, addresses, ID numbers, email and unique numbers use only Latin-1 characters, with no pipe

Financial data (AHFD)
F01  Record Status is N, C or D
F02  Unique Number is given
F03  I3S Unique Number is an account holder in the account holders file
F04  Account Number is given
F05  Account Type is 19 (tax-free investment account), or 23 exactly when Account Number is NO ACCOUNT NUMBER (Appendix E)
F06  Sharia Indicator is Y, N or U
F07  Opening Balance and Closing Balance are given, with 2 decimal places at most (they can be negative)
F08  Account Start Date and Account Closing Date are CCYY-MM-DD dates
F09  Account Start Date is on or before Account Closing Date, and both are in the same tax year, 1 March to the end of February
F10  Net Return on Investment is given, or Interest, Dividends, Capital Gain or Loss and Other all are
F11  Net Return on Investment, Interest, Dividends, Capital Gain or Loss and Other are from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most, when given
F12  Each of those amounts has its source code, and each source code its amount
F13  Source codes are the Appendix N codes for their amounts: 4239 or 4240 (loss) for Net Return on Investment, 4241 for Interest, 4242 for Dividends, 4243 or 4244 (loss) for Capital Gain or Loss, and 4257 for Other
F14  Market Value at End of Period is given, with 2 decimal places at most (it can be negative)
F15  Transaction Value Total Indicator is Y or N
F16  Unique numbers and Account Number are within SARS's maximum lengths and use only Latin-1 characters, with no pipe
F17  The account has transactions of type 01 (contribution) and 04 (withdrawal), and of types 02 (transfer in) and 03 (transfer out) when Account Closing Date is from 1 March 2018, with an R0.00 record for a type with none
F18  When Transaction Value Total Indicator is Y, the account has no more than one transaction of each type

Transactions (ATD)
T01  Record Status is N, C or D
T02  Unique Number is given
T03  Account Unique Number is the Unique Number of an account in the financial data file
T04  Transaction Date is a CCYY-MM-DD date
T05  Transaction Type is 01 (contribution), 02 (transfer in), 03 (transfer out) or 04 (withdrawal) from Appendix O, and transfers are dated from 1 March 2018
T06  Assigned Source Code matches Transaction Type: 4219 for 01, 4246 for 02, 4247 for 03 and 4248 for 04 (Appendix N)
T07  Transaction Value is given, from 0.00 to 999,999,999,999,999.99 with 2 decimal places at most
T08  Unique numbers and Unique Transaction Identifier are within SARS's maximum lengths and use only Latin-1 characters, with no pipe

Unique numbers
U01  Each Unique Number appears once in its file

Warnings

Account holders
SARS accepts a file without this field but reports it.
H24  Initials are given when FICA Status is Y

Financial data
Quantemplate's own checks, not SARS's rules: SARS doesn't compare these fields.
F19  Net Return on Investment equals Interest plus Dividends plus Other, plus Capital Gain or Loss under source code 4243 or minus it under 4244, to within 1 cent, with the net return taken as negative under 4240
F20  Closing Balance equals Opening Balance plus contributions and transfers in, less transfers out and withdrawals, plus the net return on investment (or its parts when it isn't given), to within 2% of the larger of the two balances, which allows for fees IT3(s) doesn't report

Not checked
- The submission header, submitting entity and trailer, including the trailer's sum of the monetary fields. Dates aren't checked against today.
- Free text is checked as Latin-1 with no pipe, not against the BRS's narrower list of characters for each field.
- The exact number format. Amounts are checked as numbers with 2 decimal places at most. The tool that writes the submission file must write exactly two, with no leading zeros.
- Tax-free savings contribution limits, annual or lifetime: they depend on the holder's accounts at other institutions.
- Closing balances that are out by less than 2% of the larger balance: F20 allows that much for fees, which IT3(s) doesn't report.
