Hi.
I don't have time to understand your code, but I want to help.
Here is a screenshot of my working purchase and a screenshot from Apstore Connect.
Just don't forget the restore purchase button, you can't do it without it.
At the first release of the build with purchases, I created a file in XCode to test the purchases on the simulator to check everything before sending it to the review. But in the next updates I did not use the test file in XCode, but immediately collected and sent for review.