The slap isn't entirely appropriate. In his mind he was doing something nice for you and was probably feeling quite proud of himself. From his point of view it was probably a bit like buying your mammy a present as a smallie and her turning around and saying "I hate it and you're stupid".
Far better to respond with a firm (not shouty!) "no" and put the dog outside with a minimum of fuss or stress. Withdrawing attention, which will modify behaviour quite quickly by establishing a "rules of the pack" mentality, is by far a better way to punish a pup than smacks, which only confuse and hurt them. You don't want them to be scared of you, you want them to know that you're disappointed in them. Hitting only makes them nervous and can result in alternative "what does it take to make you happy?!" behaviour, which may get wildly creative (creative for a puppy could be "it must have been the wrong sort of present" or it could be "shitting in his shoes is the best way to say 'I love you'") as opposed to "oh, this clearly doesn't make you happy, I probably shouldn't do it again" which is more desirable.