The mentioned treatment for quitting smoking falls under aversive conditioning therapy or aversion therapy.
Aversion therapy refers to a kind of psychological treatment in which the patient is encountered with a stimulus while at the same time being exposed to some kind of discomfort.
The aversive refer to an unpleasant stimulus, which instigates modifications in behavior via punishment. By using an aversive instantaneously after a behavior, the occurrence of the behavior taking place in the future is minimized.