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 TypeMethodDescriptionaddPriceDataChanges(@NonNull PriceDataChangeRequest priceDataChangeRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Add a price data change to a batch of subscriptionsClear a lock for a subscriptioncreate(SWI subscriptionWithItems, boolean createSandboxRecord, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Persists a subscription alongside its itemsdefault SWIcreate(SWI subscriptionWithItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Persists a subscription alongside its itemscreateOrReturnIfExists(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 locklockSubscription(String subscriptionId, List<String> reservations) Create a top-level lock for a subscriptionorg.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 allSubscriptionOwnerInfoby priceDataId.readAllSubscriptionsByIds(Collection<String> subscriptionIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a list of subscriptions with items for the given idsorg.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 allsubscriptionsby 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 idreadSubscriptionById(String subscriptionId, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a subscription with items for a given idreadSubscriptionById(String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a subscription with items for a given idorg.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 pagingreadUserSubscriptionById(String userRefType, String userRef, String subscriptionId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a user-owned subscription with items for a given idreplaceSubscription(S subscription, boolean isSandboxAware, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Replaces a subscription.default SreplaceSubscription(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 SWIreplaceSubscriptionWithItems(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 persistcontextInfo- 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 persistcontextInfo- 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 persistcreateSandboxRecord- Whether to create a sandbox recordcontextInfo- 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 useruserRef- id of the owning userpage- pageablefilters- Additional RSQL filterscontextInfo- 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 allSubscriptionOwnerInfoby priceDataId.- Parameters:
priceDataId- The id of the priceData belonging to one or more of the containedSubscriptionIteminstances in associatedSubscriptioninstances.statuses- Set of statuses to filter by.page- The page informationcontextInfo- 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 changescontextInfo- 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 subscriptionscontextInfo- 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 subscriptioncontextInfo- 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 subscriptioncontextInfo- 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 subscriptionisSandboxAware- Whether to look for sandbox recordscontextInfo- 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 subscriptionisSandboxAware- Whether to look for sandbox recordsignoreDeleteFiltering- Whether to ignore sandbox delete filteringcontextInfo- 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 useruserRef- id of the owning usersubscriptionId- The id of the subscriptioncontextInfo- 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- theSubscriptionused for the put operationcontextInfo- 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- theSubscriptionused for the put operationisSandboxAware- Whether the request should target a sandbox recordcontextInfo- 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 recordcontextInfo- 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 allsubscriptionsby userRef and statuses.- Parameters:
userRefType- the type of userRef provided. Could be"BLC_ACCOUNT"or"BLC_CUSTOMER"userRef- the reference to the userstatuses- the list ofSubscriptionStatusespage- The page informationcontextInfo- context information around multi-tenant state- Returns:
- a list of
SubscriptionWithItemsthat match the userRef and statuses.
-
lockSubscription
Create a top-level lock for a subscription- Parameters:
subscriptionId- The subscription ID to lockreservations- The child lock identifiers to reserve- Returns:
- The status of the lock operation
-
clearLock
Clear a lock for a subscription- Parameters:
subscriptionId- The subscription ID to clear the lock forisRevert- Whether the unlock operation is the result of a revert operation. Optional. Default is true.- Returns:
- The status of the lock operation
-
unlockToken
Unlock a child lock identified by a token- Parameters:
subscriptionId- The subscription ID to unlock a child lock fortoken- The token identifying the child lockpropagate- Whether to propagate the unlock operation to the parent lock- Returns:
- The status of the unlock operation
-
createToken
Create a reservation token for a child lock- Parameters:
subscriptionId- The subscription ID to create a token fortokenIdentifier- The identifier for the token- Returns:
- The status of the token creation operation
-