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

Adjust swatch-contracts PUT/update logic

    XMLWordPrintable

Details

    Description

      Make sure the update functionality of the get contracts and update contract test APIs.  An org either has an active contract for a subscription or they don't.  We want our logic to mirror what the entitlement gateway considers "new contracts".  If the entitlement gateway receives an update on their "purchase" object, the entry at purchase.contract[?].endDate === undefined gets updated to purchase.contract[?].endDate = date.now, and then a new entry gets added to the purchase.contracts array - with a startDate = date.now, and endDate = undefined.  We want our logic to behave similarly.

      • If anything changes within Set<ContractMetric>,  this should create new Contract/ContractMetrics records in the database.
      • The old Contract record will have its end_date updated to OffsetDateTime.now()
      • The old Contract record should be cloned, and become a new Contract record.
      • The new Contract record should get a new UUID.randomUuid() as its id
      • The new Contract record should get startDate of OffsetDateTime.now()
      • The new Contract record should get an endDate of null
      • If PUT is called but a change to product_id is in the payload, this should warn/error in the logs that a new Contract is being created rather than "updated".  Programmatically this should be treated identically with a new Contract/ContractMetric record being created with its own uuid.

      Be sure to update the openapi spec to explain that "f there is increase in instance-hours it will be a new uuid and the previous contract will have end date as today's date. The new uuid will have end date as null. we're also saying is that when you CREATE a new contract, we're going to force end_date to be null.  even if someone tries to set it in the payload"

       

      Discussed during dev sync 2/27 https://docs.google.com/document/d/16bGEilEsp2nW2vVK2p9GEXdGOQyjvfOxpOtaN6Nfydg/edit 

      Attachments

        Issue Links

          There are no Sub-Tasks for this issue.

          Activity

            People

              lburnett0 Lindsey Burnett
              lburnett0 Lindsey Burnett
              Ryan Himmelwright Ryan Himmelwright
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: