(a)Subject to subsection (d), as soon as practicable after completion by the debtor of all payments under the plan, and in the case of a debtor who is required by a judicial or administrative order, or by statute, to pay a domestic support obligation, after such debtor certifies that all amounts payable under such order or such statute that are due on or before the date of the certification (including amounts due before the petition was filed, but only to the extent provided for by the plan) have been paid, unless the court approves a written waiver of discharge executed by the debtor after the order for relief under this chapter, the court shall grant the debtor a discharge of all debts provided for by the plan or disallowed under section 502 of this title, except any debt—

(1)provided for under section 1322(b)(5);
(2)of the kind specified in section 507(a)(8)(C) or in paragraph (1)(B), (1)(C), (2), (3), (4), (5), (8), or (9) of section 523(a);
(3)for restitution, or a criminal fine, included in a sentence on the debtor’s conviction of a crime; or
(4)for restitution, or damages, awarded in a civil action against the debtor as a result of willful or malicious injury by the debtor that caused personal injury to an individual or the death of an individual.

(b)Subject to subsection (d), at any time after the confirmation of the plan and after notice and a hearing, the court may grant a discharge to a debtor that has not completed payments under the plan only if—

(1)the debtor’s failure to complete such payments is due to circumstances for which the debtor should not justly be held accountable;
(2)the value, as of the effective date of the plan, of property actually distributed under the plan on account of each allowed unsecured claim is not less than the amount that would have been paid on such claim if the estate of the debtor had been liquidated under chapter 7 of this title on such date; and
(3)modification of the plan under section 1329 of this title is not practicable.

(c)A discharge granted under subsection (b) of this section discharges the debtor from all unsecured debts provided for by the plan or disallowed under section 502 of this title, except any debt—

(1)provided for under section 1322(b)(5) of this title; or
(2)of a kind specified in section 523(a) of this title.

(d)Notwithstanding any other provision of this section, a discharge granted under this section does not discharge the debtor from any debt based on an allowed claim filed under section 1305(a)(2) of this title if prior approval by the trustee of the debtor’s incurring such debt was practicable and was not obtained.

(e)On request of a party in interest before one year after a discharge under this section is granted, and after notice and a hearing, the court may revoke such discharge only if—

(1)such discharge was obtained by the debtor through fraud; and
(2)the requesting party did not know of such fraud until after such discharge was granted.

(f)Notwithstanding subsections (a) and (b), the court shall not grant a discharge of all debts provided for in the plan or disallowed under section 502, if the debtor has received a discharge—

(1)in a case filed under chapter 7, 11, or 12 of this title during the 4-year period preceding the date of the order for relief under this chapter, or
(2)in a case filed under chapter 13 of this title during the 2-year period preceding the date of such order.

(g)

(1)The court shall not grant a discharge under this section to a debtor unless after filing a petition the debtor has completed an instructional course concerning personal financial management described in section 111.
(2)Paragraph (1) shall not apply with respect to a debtor who is a person described in section 109(h)(4) or who resides in a district for which the United States trustee (or the bankruptcy administrator, if any) determines that the approved instructional courses are not adequate to service the additional individuals who would otherwise be required to complete such instructional course by reason of the requirements of paragraph (1).
(3)The United States trustee (or the bankruptcy administrator, if any) who makes a determination described in paragraph (2) shall review such determination not later than 1 year after the date of such determination, and not less frequently than annually thereafter.

(h)The court may not grant a discharge under this chapter unless the court after notice and a hearing held not more than 10 days before the date of the entry of the order granting the discharge finds that there is no reasonable cause to believe that—

(1)section 522(q)(1) may be applicable to the debtor; and
(2)there is pending any proceeding in which the debtor may be found guilty of a felony of the kind described in section 522(q)(1)(A) or liable for a debt of the kind described in section 522(q)(1)(B).