“resident” means any-
(a) natural person who is-
(i) ordinarily resident in the Republic; or
(ii) not at any time during the relevant year of assessment ordinarily resident in the Republic, if that person was physically present in the Republic-
(aa) for a period or periods exceeding 91 days in aggregate during the relevant year of assessment, as well as for a period or periods exceeding 91 days in aggregate during each of the five years of assessment preceding such year of assessment; and
(bb) for a period or periods exceeding 915 days in aggregate during those five preceding years of assessment:
in which case that person will be a resident with effect from the first day of that relevant year of assessment:
Provided that-
(A) a day shall include a part of a day, but shall not include any day that a person is in transit through the Republic between two places outside the Republic and that person does not formally enter the Republic through a ‘port of entry’ as contemplated in section 9(1) of the Immigration Act, 2002 (Act No. 13 of 2002), or at any other place as may be permitted by the Director General of the Department of Home Affairs or the Minister of Home Affairs in terms of that Act; and
(B) where a person who is a resident in terms of this subparagraph is physically outside the Republic for a continuous period of at least 330 full days immediately after the day on which such person ceases to be physically present in the Republic, such person shall be deemed not to have been a resident from the day on which such person so ceased to be physically present in the Republic; or
(b) person (other than a natural person) which is incorporated, established or formed in the Republic or which has its place of effective management in the Republic,
but does not include any person who is deemed to be exclusively a resident of another country for purposes of the application of any agreement entered into between the governments of the Republic and that other country for the avoidance of double taxation;
: Provided that where any person that is a resident ceases to be a resident during a year of assessment, that person must be regarded as not being a resident from the day on which that person ceases to be a resident;
: Provided further that in determining whether a person that is a foreign investment entity has its place of effective management in the Republic, no regard must be had to any activity that-
(a) constitutes-
(i) a financial service as defined in section 1 of the Financial Advisory and Intermediary Services Act, 2002 (Act No. 37 of 2002); or
(ii) any service that is incidental to a financial service contemplated in subparagraph (i) where the incidental service is in respect of a financial product that is exempted from the provisions of that Act, as contemplated in section 1(2) of that Act; and
(b) is carried on by a financial service provider as defined in section 1 of the Financial Advisory and Intermediary Services Act, 2002 (Act No. 37 of 2002), in terms of a licence issued to that financial service provider under section 8 of that Act;