Outdated Contracts Edge Case Handling
In the UI, the button to add an item to basket was hidden for outdated contracts however, we discovered an edge case that allowed users to copy a previously ordered campaign.
To prevent circumvent this, we have added checks to SDK functions so that campaign can not have outdated contracts via copying.
We have also added checks to prevent an ATS developer from adding an outdated contract to the basket.
copyCampaign service function in Campaign module will now do:
- if the campaign has all outdated contracts
- it will print a warning message in the console
- re-run itself with
withExistingProductsasfalse
- if the campaign has outdated contracts and some products/valid contracts
- it will print a warning message in the console
addProductOrContractById service function in Basket module will now do:
- throw an error when the contract is outdated
There are still ways to bypass these checks so we will also be preventing the order on the HAPI backend as well.