Class InitiateUpgradeSubscriptionHandler
java.lang.Object
com.broadleafcommerce.subscriptionoperation.service.modification.AbstractModifySubscriptionHandler
com.broadleafcommerce.subscriptionoperation.service.modification.AbstractGradeChangeSubscriptionModificationHandler
com.broadleafcommerce.subscriptionoperation.service.modification.InitiateUpgradeSubscriptionHandler
- All Implemented Interfaces:
ModifySubscriptionHandler
public class InitiateUpgradeSubscriptionHandler
extends AbstractGradeChangeSubscriptionModificationHandler
implements ModifySubscriptionHandler
Handles upgrading a
Subscription.- Author:
- Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorsConstructorDescriptionInitiateUpgradeSubscriptionHandler(com.broadleafcommerce.common.extension.TypeFactory typeFactory, SubscriptionModificationUtils subscriptionModificationUtils, CatalogProvider<Product> catalogProvider, CartOperationProvider<com.broadleafcommerce.cart.client.domain.Cart> cartOperationProvider) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(@NonNull ModifySubscriptionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines whether the handler can handle theModifySubscriptionRequest.protected StringProduces the name of the modification flow.protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtilsprotected String[]getRequiredPermissions(@NonNull ModifySubscriptionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to supply the permissions required to perform the givenSubscriptionAction.voidsetPolicyUtils(com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils) protected voidvalidateBusinessRules(@NonNull ModifySubscriptionRequest request, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to supply custom business rules for specific action types.Methods inherited from class com.broadleafcommerce.subscriptionoperation.service.modification.AbstractGradeChangeSubscriptionModificationHandler
buildAddItemRequestForAddOn, buildCreateCartRequest, buildRootItemRequestWithDependents, determineItemQuantity, getCartOperationProvider, getCatalogProvider, getDependentItems, getDependentItemsCustom, handleInternal, hydrateAdditionalContextOntoRequest, hydrateSubscriptionReferencedItems, isRequiredAddOn, populateDefaultProductAndOrVariantId, readNewItemReferenced, readNewSubscriptionItemOfCustomTypeMethods inherited from class com.broadleafcommerce.subscriptionoperation.service.modification.AbstractModifySubscriptionHandler
addDependentsToParents, buildAddItemRequest, buildPriceCartRequest, generateCartName, getChildOptions, getSubscriptionModificationUtils, getTypeFactory, handle, hydrateProductsAndItemChoices, populateCartAttributesOnCreateCartRequest, validateActionType, validateAdditionalPermissionRules, validateCurrentSubscriptionState, validateRequest, validateUserAccessToSubscriptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.subscriptionoperation.service.modification.ModifySubscriptionHandler
handle
-
Constructor Details
-
InitiateUpgradeSubscriptionHandler
public InitiateUpgradeSubscriptionHandler(com.broadleafcommerce.common.extension.TypeFactory typeFactory, SubscriptionModificationUtils subscriptionModificationUtils, CatalogProvider<Product> catalogProvider, CartOperationProvider<com.broadleafcommerce.cart.client.domain.Cart> cartOperationProvider)
-
-
Method Details
-
canHandle
public boolean canHandle(@NonNull @NonNull ModifySubscriptionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:ModifySubscriptionHandlerDetermines whether the handler can handle theModifySubscriptionRequest.- Specified by:
canHandlein interfaceModifySubscriptionHandler- Parameters:
request- The incoming request to modify aSubscriptioncontextInfo- Additional sandbox and multitenant info- Returns:
- Whether this handler can handle the
ModifySubscriptionRequest.
-
getRequiredPermissions
protected String[] getRequiredPermissions(@NonNull @NonNull ModifySubscriptionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from class:AbstractModifySubscriptionHandlerHook point to supply the permissions required to perform the givenSubscriptionAction. These may be different depending on the type of user requesting the modification.- Specified by:
getRequiredPermissionsin classAbstractModifySubscriptionHandler- Parameters:
request- TheModifySubscriptionRequestwith the details related to the modification to make.contextInfo- the current sandbox and multitenant context- Returns:
- The required permissions for the requester to perform the modification.
-
validateBusinessRules
protected void validateBusinessRules(@NonNull @NonNull ModifySubscriptionRequest request, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from class:AbstractModifySubscriptionHandlerHook point to supply custom business rules for specific action types. Called byAbstractModifySubscriptionHandler.validateRequest(ModifySubscriptionRequest, ContextInfo).- Overrides:
validateBusinessRulesin classAbstractModifySubscriptionHandler- Parameters:
request- TheModifySubscriptionRequestwith the details related to the modification to make.errors- Object storing validation errors for the `request`contextInfo- the current sandbox and multitenant context
-
getFlowName
Description copied from class:AbstractModifySubscriptionHandlerProduces the name of the modification flow.- Specified by:
getFlowNamein classAbstractModifySubscriptionHandler- Returns:
- The name of the modification flow.
- See Also:
-
getPolicyUtils
@Nullable protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils getPolicyUtils()- Specified by:
getPolicyUtilsin classAbstractModifySubscriptionHandler
-
setPolicyUtils
@Autowired(required=false) public void setPolicyUtils(com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils)
-