Class SubscriptionStatusBillingJobGenerator<P extends GenerateSubscriptionBillingRequest>
java.lang.Object
com.broadleafcommerce.subscription.job.module.SubscriptionStatusBillingJobGenerator<P>
public class SubscriptionStatusBillingJobGenerator<P extends GenerateSubscriptionBillingRequest>
extends Object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.util.AntPathMatcherprotected BillingJobPropertiesprotected com.broadleafcommerce.orchestration.service.provider.external.WorkflowProviderprotected BillingJobMessageSenderprotected SubscriptionBillingEventGeneratorServiceprotected SubscriptionLockServiceprotected com.broadleafcommerce.common.extension.TypeFactoryprotected WorkflowGenerationProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateatEndOfDay(Date date) protected StringdetermineDelayedActionWorkflowName(@NonNull Subscription subscription, @NonNull Date billDate) protected StringdetermineOrderFulfillmentId(@NonNull Subscription subscription, @NonNull Date billDate) protected StringdetermineStatusChangeBasicWorkflowName(@NonNull Subscription subscription, @NonNull String fromStatus, @NonNull String toStatus) protected StringdetermineStatusChangeWorkflowName(@NonNull Subscription subscription, String fromStatus, String toStatus) Map the value harvested fromSubscription.getFulfillmentWorkflow()for the targeted workflow to a real workflow name.protected StringdetermineSubscriptionActionFlow(@NonNull Subscription subscription, String fromStatus, String toStatus) Based on the providedfromStatus&toStatus, identify theDefaultSubscriptionActionFlowvalue representing the status change.protected StringdetermineTermAutoRenewalBasicWorkflowName(@NonNull Subscription subscription) protected StringdetermineTermAutoRenewalWorkflowName(@NonNull Subscription subscription) Map the value harvested fromSubscription.getFulfillmentWorkflow()for the targeted workflow to a real workflow name.protected StringgetApplicationId(Subscription subscription) protected <D extends DelayedSubscriptionAction>
Set<D>getDueDelayedSubscriptionActions(@NonNull Subscription subscription, @NonNull Date billDate) protected IntegergetPeriodForDueDelayedActionComparison(@NonNull Subscription subscription, @NonNull String subscriptionActionFlow) protected StringgetTenantId(Subscription subscription) protected booleanisDelayedActionDue(@NonNull Subscription subscription, @NonNull Date billDate) protected booleanisStatusChangeDue(@NonNull Subscription subscription, @NonNull Date billDate) protected booleanisSubscriptionBillingDue(@NonNull Subscription subscription, @NonNull Date billDate) protected booleanisTermAutoRenewalDue(@NonNull Subscription subscription, @NonNull Date billDate) voidDeprecated.voidprotected voidprocessSubscription(P request, @NonNull Date billDate, @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected StringresolveWorkflowNameFromProperties(@NonNull String basicWorkflowName) protected voidsendGenerateNewChargeRequestsMessage(String subscriptionJobId, Date billDate, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Construct the request for the Billing Job and send the message to NewChargeBillingRequestGeneratorvoidsetBillingJobProperties(BillingJobProperties billingJobProperties) voidsetExternalWorkflowProvider(com.broadleafcommerce.orchestration.service.provider.external.WorkflowProvider externalWorkflowProvider) voidsetPaymentFinder(BillingEventPaymentFinder<BillingEventPaymentWithEvent> paymentFinder) voidsetSender(BillingJobMessageSender sender) voidsetSubscriptionBillingEventGeneratorService(SubscriptionBillingEventGeneratorService subscriptionBillingEventGeneratorService) voidsetSubscriptionFinder(SubscriptionFinder<SubscriptionWithItemsAndAdjustments> subscriptionFinder) voidsetSubscriptionLockService(SubscriptionLockService subscriptionLockService) voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) voidsetWorkflowGenerationProperties(WorkflowGenerationProperties workflowGenerationProperties) protected booleanshouldAutomaticallyProcessBillingEvents(P request) Returns true to trigger the BillingJob automatically and false otherwise.protected voidstartDelayedActionWorkflow(P request, @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @NonNull Date billDate, @NonNull String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidstartStatusChangeWorkflow(P request, @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @NonNull Date billDate, @NonNull String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidstartTermAutoRenewalWorkflow(P request, @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @NonNull Date billDate, @NonNull String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Field Details
-
billingJobProperties
-
subscriptionFinder
-
subscriptionBillingEventGeneratorService
-
paymentFinder
-
subscriptionLockService
-
externalWorkflowProvider
protected com.broadleafcommerce.orchestration.service.provider.external.WorkflowProvider externalWorkflowProvider -
workflowGenerationProperties
-
antPathMatcher
protected org.springframework.util.AntPathMatcher antPathMatcher -
sender
-
typeFactory
protected com.broadleafcommerce.common.extension.TypeFactory typeFactory
-
-
Constructor Details
-
SubscriptionStatusBillingJobGenerator
public SubscriptionStatusBillingJobGenerator()
-
-
Method Details
-
process
Deprecated. -
process
public void process(P request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
processSubscription
protected void processSubscription(@NonNull P request, @NonNull @NonNull Date billDate, @NonNull @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
isStatusChangeDue
protected boolean isStatusChangeDue(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
startStatusChangeWorkflow
protected void startStatusChangeWorkflow(@NonNull P request, @NonNull @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @NonNull @NonNull Date billDate, @NonNull @NonNull String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
determineSubscriptionActionFlow
protected String determineSubscriptionActionFlow(@NonNull @NonNull Subscription subscription, String fromStatus, String toStatus) Based on the providedfromStatus&toStatus, identify theDefaultSubscriptionActionFlowvalue representing the status change.- Parameters:
subscription- TheSubscriptionwhose status is being changedfromStatus- The subscription's status prior to the changetoStatus- The status that the subscription is shifting into- Returns:
- the
DefaultSubscriptionActionFlowvalue representing the status change.
-
determineStatusChangeWorkflowName
protected String determineStatusChangeWorkflowName(@NonNull @NonNull Subscription subscription, String fromStatus, String toStatus) Map the value harvested fromSubscription.getFulfillmentWorkflow()for the targeted workflow to a real workflow name. Refer toWorkflowGenerationPropertiesfor more details on the backing configuration for the mapping, as well as the details around ant pattern matching for wildcards. Subclasses may override for custom mapping behavior.- Parameters:
subscription- The parent order being inspectedfromStatus- The original subscription statustoStatus- The targeted subscription status- Returns:
- The name of the workflow to launch in
WorkflowServices
-
determineStatusChangeBasicWorkflowName
protected String determineStatusChangeBasicWorkflowName(@NonNull @NonNull Subscription subscription, @NonNull @NonNull String fromStatus, @NonNull @NonNull String toStatus) -
isTermAutoRenewalDue
protected boolean isTermAutoRenewalDue(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
startTermAutoRenewalWorkflow
protected void startTermAutoRenewalWorkflow(@NonNull P request, @NonNull @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @NonNull @NonNull Date billDate, @NonNull @NonNull String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
determineTermAutoRenewalWorkflowName
Map the value harvested fromSubscription.getFulfillmentWorkflow()for the targeted workflow to a real workflow name. Refer toWorkflowGenerationPropertiesfor more details on the backing configuration for the mapping, as well as the details around ant pattern matching for wildcards. Subclasses may override for custom mapping behavior.- Parameters:
subscription- The parent order being inspected- Returns:
- The name of the workflow to launch in
WorkflowServices
-
determineTermAutoRenewalBasicWorkflowName
protected String determineTermAutoRenewalBasicWorkflowName(@NonNull @NonNull Subscription subscription) -
resolveWorkflowNameFromProperties
-
isDelayedActionDue
protected boolean isDelayedActionDue(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
getDueDelayedSubscriptionActions
protected <D extends DelayedSubscriptionAction> Set<D> getDueDelayedSubscriptionActions(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
getPeriodForDueDelayedActionComparison
protected Integer getPeriodForDueDelayedActionComparison(@NonNull @NonNull Subscription subscription, @NonNull @NonNull String subscriptionActionFlow) -
isSubscriptionBillingDue
protected boolean isSubscriptionBillingDue(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
startDelayedActionWorkflow
protected void startDelayedActionWorkflow(@NonNull P request, @NonNull @NonNull SubscriptionWithItemsAndAdjustments subscriptionWithItemsAndAdjustments, @NonNull @NonNull Date billDate, @NonNull @NonNull String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
determineDelayedActionWorkflowName
protected String determineDelayedActionWorkflowName(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
determineOrderFulfillmentId
protected String determineOrderFulfillmentId(@NonNull @NonNull Subscription subscription, @NonNull @NonNull Date billDate) -
sendGenerateNewChargeRequestsMessage
protected void sendGenerateNewChargeRequestsMessage(String subscriptionJobId, Date billDate, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Construct the request for the Billing Job and send the message to NewChargeBillingRequestGenerator -
atEndOfDay
-
shouldAutomaticallyProcessBillingEvents
Returns true to trigger the BillingJob automatically and false otherwise. Defaults to true.- Returns:
- true to trigger the BillingJob automatically and false otherwise
- See Also:
-
getApplicationId
-
getTenantId
-
setBillingJobProperties
-
setSubscriptionFinder
@Autowired public void setSubscriptionFinder(SubscriptionFinder<SubscriptionWithItemsAndAdjustments> subscriptionFinder) -
setSubscriptionBillingEventGeneratorService
@Autowired public void setSubscriptionBillingEventGeneratorService(SubscriptionBillingEventGeneratorService subscriptionBillingEventGeneratorService) -
setPaymentFinder
@Autowired public void setPaymentFinder(BillingEventPaymentFinder<BillingEventPaymentWithEvent> paymentFinder) -
setSubscriptionLockService
-
setExternalWorkflowProvider
@Autowired public void setExternalWorkflowProvider(com.broadleafcommerce.orchestration.service.provider.external.WorkflowProvider externalWorkflowProvider) -
setWorkflowGenerationProperties
@Autowired public void setWorkflowGenerationProperties(WorkflowGenerationProperties workflowGenerationProperties) -
setSender
-
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
process(GenerateSubscriptionBillingRequest, ContextInfo)instead