Class SubscriptionStatusBillingJobGenerator<P extends GenerateSubscriptionBillingRequest>

java.lang.Object
com.broadleafcommerce.subscription.job.module.SubscriptionStatusBillingJobGenerator<P>

public class SubscriptionStatusBillingJobGenerator<P extends GenerateSubscriptionBillingRequest> extends Object
  • Field Details

  • Constructor Details

    • SubscriptionStatusBillingJobGenerator

      public SubscriptionStatusBillingJobGenerator()
  • Method Details

    • process

      @Deprecated(since="1.0.0") public void process(P request)
    • 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 provided fromStatus & toStatus, identify the DefaultSubscriptionActionFlow value representing the status change.
      Parameters:
      subscription - The Subscription whose status is being changed
      fromStatus - The subscription's status prior to the change
      toStatus - The status that the subscription is shifting into
      Returns:
      the DefaultSubscriptionActionFlow value representing the status change.
    • determineStatusChangeWorkflowName

      protected String determineStatusChangeWorkflowName(@NonNull @NonNull Subscription subscription, String fromStatus, String toStatus)
      Map the value harvested from Subscription.getFulfillmentWorkflow() for the targeted workflow to a real workflow name. Refer to WorkflowGenerationProperties for 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
      fromStatus - The original subscription status
      toStatus - 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

      protected String determineTermAutoRenewalWorkflowName(@NonNull @NonNull Subscription subscription)
      Map the value harvested from Subscription.getFulfillmentWorkflow() for the targeted workflow to a real workflow name. Refer to WorkflowGenerationProperties for 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

      protected String resolveWorkflowNameFromProperties(@NonNull @NonNull String basicWorkflowName)
    • 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

      public static Date atEndOfDay(Date date)
    • shouldAutomaticallyProcessBillingEvents

      protected boolean shouldAutomaticallyProcessBillingEvents(P request)
      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

      @Nullable protected String getApplicationId(@Nullable Subscription subscription)
    • getTenantId

      @Nullable protected String getTenantId(@Nullable Subscription subscription)
    • setBillingJobProperties

      @Autowired public void setBillingJobProperties(BillingJobProperties billingJobProperties)
    • setSubscriptionFinder

      @Autowired public void setSubscriptionFinder(SubscriptionFinder<SubscriptionWithItemsAndAdjustments> subscriptionFinder)
    • setSubscriptionBillingEventGeneratorService

      @Autowired public void setSubscriptionBillingEventGeneratorService(SubscriptionBillingEventGeneratorService subscriptionBillingEventGeneratorService)
    • setPaymentFinder

      @Autowired public void setPaymentFinder(BillingEventPaymentFinder<BillingEventPaymentWithEvent> paymentFinder)
    • setSubscriptionLockService

      @Autowired public void setSubscriptionLockService(SubscriptionLockService subscriptionLockService)
    • setExternalWorkflowProvider

      @Autowired public void setExternalWorkflowProvider(com.broadleafcommerce.orchestration.service.provider.external.WorkflowProvider externalWorkflowProvider)
    • setWorkflowGenerationProperties

      @Autowired public void setWorkflowGenerationProperties(WorkflowGenerationProperties workflowGenerationProperties)
    • setSender

      @Autowired public void setSender(BillingJobMessageSender sender)
    • setTypeFactory

      @Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)