How to write a test to check if a value passed through the request is deleted based on the status present in a different endpoint?

I have a PATCH request containing the following request body

“sopDetailsId”: integer

Based on status, all the details present under that ID will be deleted.
Only if the status is drafted, all details will be deleted. Response shows true if deleted or else a message saying “Status is not drafted,So can’t delete”. The status is identified with a status ID which we get only using “getDetailsByID” endpoint. Am actually stuck on how to write a test for this case? I want to check the status id and validate that the right Id with draft status has been deleted. But statusID for particular sopDetailsId is retrieved in the getDetailsByID endpoint only if that id is given in the request.