@Override
  protected Money doCalculationForAmountToPay(Event event, DateTime when, boolean applyDiscount) {
    DegreeChangeIndividualCandidacy individualCandidacy =
        ((DegreeChangeIndividualCandidacyEvent) event).getIndividualCandidacy();
    final PrecedentDegreeInformation information =
        individualCandidacy.getRefactoredPrecedentDegreeInformation();

    if (individualCandidacy.getUtlStudent() != null) {
      return individualCandidacy.getUtlStudent()
          ? getAmountForInstitutionStudent()
          : getAmountForExternalStudent();
    } else {
      if (information.isCandidacyInternal()
          || hasAnyValidRegistration((DegreeChangeIndividualCandidacyEvent) event)
          || belongsToInstitutionGroup(information.getPrecedentInstitution())) {
        return getAmountForInstitutionStudent();
      } else {
        return getAmountForExternalStudent();
      }
    }
  }
  @Override
  public PaymentCodeType calculatePaymentCodeTypeFromEvent(
      Event event, DateTime when, boolean applyDiscount) {
    DegreeChangeIndividualCandidacy individualCandidacy =
        ((DegreeChangeIndividualCandidacyEvent) event).getIndividualCandidacy();
    final PrecedentDegreeInformation information =
        individualCandidacy.getRefactoredPrecedentDegreeInformation();

    if (individualCandidacy.getUtlStudent() != null) {
      return individualCandidacy.getUtlStudent()
          ? PaymentCodeType.INTERNAL_DEGREE_CHANGE_INDIVIDUAL_CANDIDACY_PROCESS
          : PaymentCodeType.EXTERNAL_DEGREE_CHANGE_INDIVIDUAL_CANDIDACY_PROCESS;
    } else {
      if (information.isCandidacyInternal()
          || hasAnyValidRegistration((DegreeChangeIndividualCandidacyEvent) event)
          || belongsToInstitutionGroup(information.getPrecedentInstitution())) {
        return PaymentCodeType.INTERNAL_DEGREE_CHANGE_INDIVIDUAL_CANDIDACY_PROCESS;
      } else {
        return PaymentCodeType.EXTERNAL_DEGREE_CHANGE_INDIVIDUAL_CANDIDACY_PROCESS;
      }
    }
  }