Interface CommerceConsentService

All Known Implementing Classes:
DefaultCommerceConsentService

public interface CommerceConsentService
Handles activities relating to ConsentModel and ConsentTemplateModel.
  • Method Details

    • getConsentTemplates

      List<ConsentTemplateModel> getConsentTemplates(BaseSiteModel baseSite)
      Finds all the latest versions of consent templates for the given baseSite.
      Parameters:
      baseSite - the baseSite to retrieve the consent template for
      Returns:
      available consent templates
    • getConsentTemplate

      ConsentTemplateModel getConsentTemplate(String consentTemplateId, Integer consentTemplateVersion, BaseSiteModel baseSite)
      Finds the consent template for the supplied consentTemplateId, consentTemplateVersion and baseSite.
      Parameters:
      consentTemplateId - the id of the consent template
      consentTemplateVersion - the version of the consent template
      baseSite - the baseSite to retrieve the consent template for
      Returns:
      the consent template
    • getLatestConsentTemplate

      ConsentTemplateModel getLatestConsentTemplate(String consentTemplateId, BaseSiteModel baseSite)
      Finds the latest version of a ConsentTemplate for the given consentTemplateId and baseSite.
      Parameters:
      consentTemplateId - the id of the consent template
      baseSite - the baseSite to retrieve the consent template for.
      Returns:
      the consent template
    • getConsent

      ConsentModel getConsent(String consentCode)
      Finds the consent for the specified consentCode
      Parameters:
      consentCode - the consent code to get the consent for
      Returns:
      the consent
    • getActiveConsent

      ConsentModel getActiveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate)
      Finds the latest consent for the specified customer and consent template.
      Parameters:
      customer - the customer to get the consent for
      consentTemplate - the consent template to get the consent for
      Returns:
      the consent if found, otherwise null
    • hasEffectivelyActiveConsent

      boolean hasEffectivelyActiveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate)
      Checks if a customer has a consent that has not been withdrawn for the specified consent template.
      Parameters:
      customer - the customer to check the consent for
      consentTemplate - the consent template to check the consent for
      Returns:
      true, if the customer has a consent that has not been withdrawn
    • giveConsent

      void giveConsent(CustomerModel customer, ConsentTemplateModel consentTemplate)
      Gives consent for the specified customer and consent template. Creates a new Consent and sets the consentGivenDate.

      1. Doesn't create a new consent if the consent is already given and active and throws CommerceConsentGivenException
      Parameters:
      customer - the customer to give the consent for
      consentTemplate - the consent template to give the consent for
    • withdrawConsent

      void withdrawConsent(ConsentModel consent)
      Withdraws consent for the specified ConsentModel by updating the consentWithdrawnDate.

      1. Doesn't withdraw the consent if its already withdrawn, i.e, If Consent.consentWithdrawnDate is already set calling this method will not overwrite the existing value.
      Parameters:
      consent - the consent to withdraw the consent for