Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2696

Use IT Partner Gateway as source of truth for payg & contract based subscriptions

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 2024-09-17 - API
    • None
    • None
    • 5
    • False
    • Hide

      None

      Show
      None
    • True

      Currently, when quantity changes on a subscription, we terminate the current subscription record and create a new record with the same ID but with the updated quantity, a start date of the current time, and an end date of the original subscription record.

      Rather than using changes as they come in as authoritative, we should use the entitlement gateway as authoritative (for contract or paygo subscriptions) on the history and rewrite our history based on information provided by the entitlement gateway. 

      The quantity updating code is in SubscriptionSyncController.syncSubscription.

      Partner Gateway API Information: 

      Done Criteria 

      • For subscriptions coming from the IT Partner Gateway, history of changes as represented in the Partner Gateway records is used as the authoritative source of history for a subscription in subscription-watch. 
      • If a subscription has data from both the Subscription Service and the IT Partner Gateway, then the data from the Partner Gateway is considered canonical. 
      • After a sync the full history in subscription-watch matches the history from the IT Partner Gateway
      • Automation tests that cover the above cases in ephemeral environments. Some prior work around automation of this type of test was done in https://github.com/RedHatInsights/rhsm-subscriptions/pull/2841

      The internal contracts api /api/swatch-contracts/internal/contracts/ properly reflects the proper quantity based on dates before the change & after the change. This is specified with the timestamp parameter on the api endpoint (https://github.com/RedHatInsights/rhsm-subscriptions/blob/fd2af75cdb4e05cf2ec44cad99b0bc593e9cfcac/swatch-contracts/src/main/resources/META-INF/openapi.yaml#L146)

        • This should be done using helpers. There is an existing python library for working with wiremock (https://github.com/wiremock/python-wiremock)
        • Test that when the start date of a subscription is moved later, it is accurately represented for a contract/payg subscription. 
        • Test that when the start date of a subscription is moved earlier, it is accurately represented for a contract/payg subscription. 
        • When a subscription is sourced from the entitlement gateway, and they increase a dimension (eg 100 vcpu hours to 200 vcpu hours), the change is recorded properly & is reflected in the capacity API responses based on the day queried. 

              kflahert@redhat.com Kevin Flaherty
              awood1@redhat.com Alex Wood
              Trayvon McKnight Trayvon McKnight
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: