Interface ConsentFacade

All Known Implementing Classes:
DefaultConsentFacade

public interface ConsentFacade
Facade interface providing an API for performing various consent operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the list of consent templates available for the current base site (in their latest version) along with current user consents embedded in ConsentTemplateData.consentData.
    getLatestConsentTemplate(String consentTemplateId)
    Gets the latest consent template for the specified consentTemplateId and the current base site.
    void
    giveConsent(String consentTemplateId, Integer consentTemplateVersion)
    Gives consent for the specified consentTemplateId and consentTemplateVersion, the current base site and current user.
    void
    withdrawConsent(String consentCode)
    Withdraws consent for the specified consentCode.
  • Method Details

    • getLatestConsentTemplate

      ConsentTemplateData getLatestConsentTemplate(String consentTemplateId)
      Gets the latest consent template for the specified consentTemplateId and the current base site.
      Parameters:
      consentTemplateId - the id of the consent template to retrieve the consent for. Should be a valid id for a ConsentTemplateModel.
      Returns:
      the active consent
    • getConsentTemplatesWithConsents

      List<ConsentTemplateData> getConsentTemplatesWithConsents()
      Gets the list of consent templates available for the current base site (in their latest version) along with current user consents embedded in ConsentTemplateData.consentData.
      Returns:
      a list of active consent templates
    • giveConsent

      void giveConsent(String consentTemplateId, Integer consentTemplateVersion)
      Gives consent for the specified consentTemplateId and consentTemplateVersion, the current base site and current user. If no Consent is found for the specified Consent Template, or if a Consent exists but is withdrawn (i.e. the withdrawal date is not null), a new Consent is created with the current date set to consentGivenDate attribute.
      Parameters:
      consentTemplateId - the id of the consent template to give the consent for. Should be a valid id for a ConsentTemplateModel.
      consentTemplateVersion - the version of the consent template to give the consent for
      Throws:
      ModelNotFoundException - if no ConsentTemplate with the specified consentTemplateId and consentTemplateVersion was found
      AmbiguousIdentifierException - if multiple ConsentTemplate entities were found for the the specified consentTemplateId and consentTemplateVersion
      CommerceConsentGivenException - if a consent was already given
      See Also:
    • withdrawConsent

      void withdrawConsent(String consentCode)
      Withdraws consent for the specified consentCode. If the given Consent has been withdrawn already, nothing happens
      Parameters:
      consentCode - the code of the user consent to withdraw
      Throws:
      ModelNotFoundException - if no Consent with the specified consentCode was found
      See Also: