Add onRegisterCode and onFailedRegisterCode events.