Testing presence of Purchased App in XCode

Plenty of info on test IAPs in xCode. I need to test whether the user has previously purchased the product in order to adjust my business model from a paid app to an in-app-purchased subscription.

I have implemented the code from "What's New in StoreKit" found at https://developer.apple.com/wwdc22/10007?time=527 and this works. but I don't know how to create a mock purchase that I can use to validate a previous purchase. This means I have no way of testing if the code actually works with a previous purchase in place.

My question is specifically: How do I create a mock/test "purchased product" that I can use in testing this functionality?

For clarity, I have successfully test IAP IAW: https://developer.apple.com/documentation/xcode/setting-up-storekit-testing-in-xcode/

Thanks

See Supporting business model changes by using the app transaction that describes how to access the app transaction to learn when a customer first purchased an app, to determine the app features they’re entitled to.

Hey - thanks for your reply. Yes, I followed that guide and the code seems to work.

That guide does not answer the question of how to go about testing the functionality.

Specifically: How do I create a mock/test "purchased product" that I can use to test "if the product as been purchased".

You see, I don't have a "purchased product" on my watch that I can validate as being purchased. XCode loads the app onto the watch for debugging. So the AppTransaction reports a originalPurchaseDate of 1970-01-01. As in, never purchased.

In order to validate that a product has been purchased, I need to test originalPurchaseDate against Data.now in a test environment. How do I accomplish that?

Testing presence of Purchased App in XCode
 
 
Q