class RejectPolicyHandler implements ContextualRequestMessageHandler<Person> {

   @Override
   public MessageBody handleRequest(Person context, PlatformMessage msg) {
      if(context == null) {
         throw new NotFoundException(msg.getDestination());
      }
      Errors.assertValidRequest(
            Objects.equal(msg.getActor(), msg.getDestination()),
            "Only the same user can accept new policy terms"
      );
      
      MessageBody body = msg.getValue();
      validate(body);

      String policyType = PersonCapability.RejectPolicyRequest.getType(body);
      if (PersonCapability.RejectPolicyRequest.TYPE_PRIVACY.equals(policyType)) {
         context.setPrivacyPolicyAgreed(new Date(0));
      }
      else if (PersonCapability.RejectPolicyRequest.TYPE_TERMS.equals(policyType)) {
         context.setTermsAgreed(new Date(0));
      }
      else {
         throw new ErrorEventException(Errors.CODE_INVALID_REQUEST, "policy type " + policyType + " is not valid.");
      }
      personDao.update(context);
      return PersonCapability.AcceptPolicyResponse.instance();
   }

   @Inject public  RejectPolicyHandler(
         PersonDAO personDao,
         BeanAttributesTransformer<Person> personTransformer,
         PlatformMessageBus bus
   );

}