Prevent provision for out of term subscriptions

Problem

When investing this failed provision, it was found that the subscription was already out of term. Zuora still considers the subscription version "active" though. This means our ZuoraCallbackWorker still tries to process the subscription due to the active_subscription? check here. When attempting to check if the license is up to date, the BuildLicenseFromSubscriptionService will return nil if the subscription is expired which then causes the LicenseNotificationService to raise an error here.

Another example from SaaS subscription provision failure. order.current_subscription is nil because the Zuora subscription is already termed. This impact several places:

  • when SubscriptionParamsGenerator runs(called by update_plan_info_service) -- Not sure whether the update_plan_info_service will perform the update work as expected. But the update_plan_info_service logged an info Subscription not found and continued without throwing any error.
  • the provision won't be tracked because provision tracking rely on current_subscription --- For this reason, the provision did not have a chance to be marked as completed.

Proposal

Double check if subscriptions that are out of term still need to go through the callout logic and if not add a condition to prevent it.

The callout logic could be:

  • license sending(for SM),
  • update plan info(for SaaS) -- need further investigation
  • or, other related provision actions? -- need further investigation

Result

Prevent logic to be executed that is not needed (e.g. creating objects or even sending out emails).

Edited by Qingyu Zhao