Interface SubscriptionProvider<SWI extends SubscriptionWithItems,S extends Subscription,SO extends SubscriptionOwnerInfo>

All Known Implementing Classes:
ExternalSubscriptionProvider

public interface SubscriptionProvider<SWI extends SubscriptionWithItems,S extends Subscription,SO extends SubscriptionOwnerInfo>
Provider interfacing with Broadleaf's BillingServices to gather, update, or create Subscription and related entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    addPriceDataChanges(@NonNull PriceDataChangeRequest priceDataChangeRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Add a price data change to a batch of subscriptions
    clearLock(String subscriptionId, boolean isRevert)
    Clear a lock for a subscription
    create(SWI subscriptionWithItems, boolean createSandboxRecord, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Persists a subscription alongside its items
    default SWI
    create(SWI subscriptionWithItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Persists a subscription alongside its items
    createOrReturnIfExists(SWI subscriptionWithItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Persists a subscription alongside its items.
    createToken(String subscriptionId, String tokenIdentifier)
    Create a reservation token for a child lock
    lockSubscription(String subscriptionId, List<String> reservations)
    Create a top-level lock for a subscription
    org.springframework.data.domain.Page<SO>
    readAllSubscriptionOwnerInfosByPriceData(@NonNull String priceDataId, Set<String> statuses, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find all SubscriptionOwnerInfo by priceDataId.
    readAllSubscriptionsByIds(Collection<String> subscriptionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a list of subscriptions with items for the given ids
    org.springframework.data.domain.Page<SWI>
    readAllSubscriptionsByUserRefAndStatuses(String userRefType, String userRef, Collection<String> statuses, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find all subscriptions by userRef and statuses.
    readSubscription(String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a subscription for a given id.
    readSubscriptionById(String subscriptionId, boolean isSandboxAware, boolean ignoreDeleteFiltering, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a subscription with items for a given id
    default Optional<SWI>
    readSubscriptionById(String subscriptionId, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a subscription with items for a given id
    default Optional<SWI>
    readSubscriptionById(String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a subscription with items for a given id
    org.springframework.data.domain.Page<SWI>
    readSubscriptionsForUserRefTypeAndUserRef(String userRefType, String userRef, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a page of subscriptions with items for a given user type and user id, taking into account the provided filters and paging
    readUserSubscriptionById(String userRefType, String userRef, String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a user-owned subscription with items for a given id
    replaceSubscription(S subscription, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Replaces a subscription.
    default S
    replaceSubscription(S subscription, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Replaces a subscription.
    replaceSubscriptionWithItems(SWI subscriptionWithItems, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Replaces a subscription and its items.
    default SWI
    replaceSubscriptionWithItems(SWI subscriptionWithItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Replaces a subscription and its items.
    unlockToken(String subscriptionId, String token, boolean propagate)
    Unlock a child lock identified by a token
  • Method Details

    • create

      default SWI create(SWI subscriptionWithItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Persists a subscription alongside its items
      Parameters:
      subscriptionWithItems - subscription with items to persist
      contextInfo - context information around multi-tenant state
      Returns:
      the created subscription and items
    • createOrReturnIfExists

      SWI createOrReturnIfExists(SWI subscriptionWithItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Persists a subscription alongside its items. If the subscription already exists, returns it.
      Parameters:
      subscriptionWithItems - subscription with items to persist
      contextInfo - context information around multi-tenant state
      Returns:
      the created subscription and items
    • create

      SWI create(SWI subscriptionWithItems, boolean createSandboxRecord, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Persists a subscription alongside its items
      Parameters:
      subscriptionWithItems - subscription with items to persist
      createSandboxRecord - Whether to create a sandbox record
      contextInfo - context information around multi-tenant state
      Returns:
      the created subscription and items
    • readSubscriptionsForUserRefTypeAndUserRef

      org.springframework.data.domain.Page<SWI> readSubscriptionsForUserRefTypeAndUserRef(String userRefType, String userRef, @Nullable org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a page of subscriptions with items for a given user type and user id, taking into account the provided filters and paging
      Parameters:
      userRefType - type of the owning user
      userRef - id of the owning user
      page - pageable
      filters - Additional RSQL filters
      contextInfo - context information around multi-tenant state
      Returns:
      a page of subscriptions with items for a given user type and user id
    • readAllSubscriptionOwnerInfosByPriceData

      org.springframework.data.domain.Page<SO> readAllSubscriptionOwnerInfosByPriceData(@NonNull @NonNull String priceDataId, @Nullable Set<String> statuses, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all SubscriptionOwnerInfo by priceDataId.
      Parameters:
      priceDataId - The id of the priceData belonging to one or more of the contained SubscriptionItem instances in associated Subscription instances.
      statuses - Set of statuses to filter by.
      page - The page information
      contextInfo - Additional sandbox and multitenant info
    • addPriceDataChanges

      List<String> addPriceDataChanges(@NonNull @NonNull PriceDataChangeRequest priceDataChangeRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Add a price data change to a batch of subscriptions
      Parameters:
      priceDataChangeRequest - The request to add price data changes
      contextInfo - Additional sandbox and multitenant info
      Returns:
      The list of subscription ids that were updated
    • readAllSubscriptionsByIds

      List<SWI> readAllSubscriptionsByIds(Collection<String> subscriptionIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a list of subscriptions with items for the given ids
      Parameters:
      subscriptionIds - The ids of the subscriptions
      contextInfo - context information around multi-tenant state
      Returns:
      A list of subscriptions with items for the given ids
    • readSubscriptionById

      default Optional<SWI> readSubscriptionById(String subscriptionId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a subscription with items for a given id
      Parameters:
      subscriptionId - The id of the subscription
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription with items for the given id
    • readSubscription

      Optional<S> readSubscription(String subscriptionId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a subscription for a given id.
      Parameters:
      subscriptionId - The id of the subscription
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription for the given id
    • readSubscriptionById

      default Optional<SWI> readSubscriptionById(String subscriptionId, boolean isSandboxAware, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a subscription with items for a given id
      Parameters:
      subscriptionId - The id of the subscription
      isSandboxAware - Whether to look for sandbox records
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription with items for the given id
    • readSubscriptionById

      Optional<SWI> readSubscriptionById(String subscriptionId, boolean isSandboxAware, boolean ignoreDeleteFiltering, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a subscription with items for a given id
      Parameters:
      subscriptionId - The id of the subscription
      isSandboxAware - Whether to look for sandbox records
      ignoreDeleteFiltering - Whether to ignore sandbox delete filtering
      contextInfo - context information around multi-tenant state
      Returns:
      a subscription with items for the given id
    • readUserSubscriptionById

      SWI readUserSubscriptionById(String userRefType, String userRef, String subscriptionId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves a user-owned subscription with items for a given id
      Parameters:
      userRefType - type of the owning user
      userRef - id of the owning user
      subscriptionId - The id of the subscription
      contextInfo - context information around multi-tenant state
      Returns:
      a user-owned subscription with items for a given id
    • replaceSubscription

      default S replaceSubscription(S subscription, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Replaces a subscription.
      Parameters:
      subscription - the Subscription used for the put operation
      contextInfo - context information around multi-tenant state
      Returns:
      the updated subscription
    • replaceSubscription

      S replaceSubscription(S subscription, boolean isSandboxAware, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Replaces a subscription.
      Parameters:
      subscription - the Subscription used for the put operation
      isSandboxAware - Whether the request should target a sandbox record
      contextInfo - context information around multi-tenant state
      Returns:
      the updated subscription
    • replaceSubscriptionWithItems

      default SWI replaceSubscriptionWithItems(SWI subscriptionWithItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Replaces a subscription and its items.
      Parameters:
      subscriptionWithItems -
      contextInfo - context information around multi-tenant state
      Returns:
      the updated subscription
    • replaceSubscriptionWithItems

      SWI replaceSubscriptionWithItems(SWI subscriptionWithItems, boolean isSandboxAware, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Replaces a subscription and its items.
      Parameters:
      subscriptionWithItems -
      isSandboxAware - Whether the request should target a sandbox record
      contextInfo - context information around multi-tenant state
      Returns:
      the updated subscription
    • readAllSubscriptionsByUserRefAndStatuses

      org.springframework.data.domain.Page<SWI> readAllSubscriptionsByUserRefAndStatuses(String userRefType, String userRef, Collection<String> statuses, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all subscriptions by userRef and statuses.
      Parameters:
      userRefType - the type of userRef provided. Could be "BLC_ACCOUNT" or "BLC_CUSTOMER"
      userRef - the reference to the user
      statuses - the list of SubscriptionStatuses
      page - The page information
      contextInfo - context information around multi-tenant state
      Returns:
      a list of SubscriptionWithItems that match the userRef and statuses.
    • lockSubscription

      LockStatus lockSubscription(String subscriptionId, @Nullable List<String> reservations)
      Create a top-level lock for a subscription
      Parameters:
      subscriptionId - The subscription ID to lock
      reservations - The child lock identifiers to reserve
      Returns:
      The status of the lock operation
    • clearLock

      LockStatus clearLock(String subscriptionId, boolean isRevert)
      Clear a lock for a subscription
      Parameters:
      subscriptionId - The subscription ID to clear the lock for
      isRevert - Whether the unlock operation is the result of a revert operation. Optional. Default is true.
      Returns:
      The status of the lock operation
    • unlockToken

      LockStatus unlockToken(String subscriptionId, String token, boolean propagate)
      Unlock a child lock identified by a token
      Parameters:
      subscriptionId - The subscription ID to unlock a child lock for
      token - The token identifying the child lock
      propagate - Whether to propagate the unlock operation to the parent lock
      Returns:
      The status of the unlock operation
    • createToken

      LockStatus createToken(String subscriptionId, String tokenIdentifier)
      Create a reservation token for a child lock
      Parameters:
      subscriptionId - The subscription ID to create a token for
      tokenIdentifier - The identifier for the token
      Returns:
      The status of the token creation operation