To amend title II of the Social Security Act to restrict totalization agreements between the United States and other countries to providing for appropriate exchange of Social Security taxes or contributions between the parties to such agreements, and to prohibit crediting of individuals under such title with earnings from employment or self-employment in the United States performed while such individuals are not citizens, nationals, or lawful permanent residents of the United States and are not authorized by law to be employed in the United States.

SECTION 1. SHORT TITLE.

    This Act may be cited as the ``Total Overhaul of Totalization 
Agreements Law of 2007''.

SEC. 2. RESTRICTION OF TOTALIZATION AGREEMENTS TO PROVIDING FOR 
              APPROPRIATE EXCHANGE OF SOCIAL SECURITY TAXES OR 
              CONTRIBUTIONS.

    (a) In General.--Section 233(c)(1) of the Social Security Act (42 
U.S.C. 433(c)(1)) is amended--
            (1) in subsection (a), by striking ``for the purposes of'' 
        and all that follows and inserting the following: ``for the 
        purposes of providing appropriate exchange between the parties 
        to such agreements of taxes or contributions paid under their 
        respective social security systems, as provided in subsection 
        (c)(1).''; and
            (2) by striking subsection (c)(1) and inserting the 
        following:
    ``(c)(1) Any agreement establishing a totalization arrangement 
pursuant to this section between the United States and another country 
shall provide that--
            ``(A) in any case in which--
                    ``(i) an individual who is a citizen or national of 
                the other country or lawfully admitted to the other 
                country for permanent residence in the other country 
                becomes entitled to cash benefits under the social 
                security system of the other country, and
                    ``(ii) such individual (or, in the case of a 
                survivor or derivative benefit, the individual on whose 
                contributions such benefits are based) has been 
                credited with at least 6 quarters of coverage as 
                defined in section 213 based on wages paid for services 
                performed in the United States or self-employment 
                income derived in the United States,
        the Secretary of the Treasury shall transfer from the Federal 
        Old-Age and Survivors Insurance Trust Fund and the Federal 
        Disability Insurance Trust Fund to the other country amounts 
        appropriated to each such Trust Fund under section 201 in 
        connection with taxes under chapters 2 and 21 of the Internal 
        Revenue Code of 1986 paid in connection with such wages and 
        self-employment income, and
            ``(B) in any case in which--
                    ``(i) an individual who is a citizen or national of 
                the United States or lawfully admitted for permanent 
                residence in the United States becomes entitled to cash 
                benefits under this title, and
                    ``(ii) such individual (or, in the case of a 
                survivor or derivative benefit, the individual on whose 
                wages and self-employment income such benefits are 
                based) has been credited with a period of coverage 
                under the social security system of the other country, 
                based on service performed, or earnings derived, in the 
                other country, equivalent (under the terms of the 
                agreement) to 6 quarters of coverage as defined in 
                section 213,
        the other country shall pay to the United States an amount 
        equivalent to any taxes or other contributions paid by the 
        credited individual described in clause (ii) or such 
        individual's employer to the social security system of the 
        other country, based on such service or earnings, as required 
        under the social security system of the other country.''.
    (b) Conforming Amendment.--Section 233(c)(3) of such Act is amended 
to read as follows:
    ``(3) Any such agreement shall provide for the exchange of such 
information between the parties to the agreement as is necessary to 
provide for the transfers between the parties under paragraph (1). The 
Secretary of the Treasury and the Commissioner of Social Security shall 
exchange such information as is necessary to enable the Secretary of 
the Treasury to carry out any transfers referred to in paragraph 
(1)(A).''.
    (c) Effective Date.--The amendments made by this section shall 
apply with respect to agreements becoming effective on or after January 
1, 2007.

SEC. 3. LIMITATIONS ON COVERAGE OF INDIVIDUALS BASED ON EARNINGS BY 
              INDIVIDUALS IN THE UNITED STATES WHILE SUCH INDIVIDUALS 
              WERE NOT CITIZENS, NATIONALS, OR LAWFUL PERMANENT 
              RESIDENTS OF THE UNITED STATES AND WERE NOT AUTHORIZED TO 
              BE EMPLOYED IN THE UNITED STATES.

    (a) In General.--Section 215(e) of the Social Security Act (42 
U.S.C. 415(e)) is amended--
            (1) by redesignating paragraphs (1) and (2) as 
        subparagraphs (A) and (B), respectively;
            (2) by inserting ``(1)'' after ``(e)''; and
            (3) by adding at the end the following new paragraph:
    ``(2) For purposes of subsections (b) and (d), in computing an 
individual's average indexed monthly earnings (or in the case of an 
individual whose primary insurance amount is computed under section 
215(a) as in effect prior to January 1979, average monthly wage), such 
individual shall not be credited with any wages paid to such individual 
for services performed in the United States, or any self-employment 
income derived by such individual in the United States, if such 
services were performed, or such self-employment income was derived, 
while such individual was neither a citizen or national of the United 
States nor lawfully admitted for permanent residence in the United 
States and was not authorized to be employed in the United States.''.
    (b) Effective Date.--The amendments made by subsection (a) shall 
apply with respect to wages paid, and self-employment income derived, 
before, on, or after the date of the enactment of this Act. 
Notwithstanding section 215(f)(1) of the Social Security Act (42 U.S.C. 
415(f)(1)), as soon as practicable after the date of the enactment of 
this Act, the Commissioner of Social Security shall recompute all 
primary insurance amounts to the extent necessary to carry out such 
amendments. Such amendments shall affect benefits only for months after 
the date of the enactment of this Act.

Summary: Total Overhaul of Totalization Agreements Law of 2007 - Amends title II (OASDI) of the Social Security Act to revise requirements for agreements establishing a totalization arrangement between the United States and another country with respect to the exchange of funds and information between the countries on behalf citizens, nationals, or permanent residents of one country who become entitled to cash benefits under the other country's social security system. Prohibits, in computing an individual's average indexed monthly earnings, the crediting of individuals under OASDI with wages from employment or self-employment in the United States performed while such individuals: (1) are not citizens, nationals, or lawful permanent residents of the United States. And (2) are not authorized by law to be employed in the United States.