Getting the cut of revenue & amount to be deducted from internal trade sales. Governorships need to be given money based on how much they contributed to the internal trade stockpile as a proportion of what was sold, then they need to have an equivalent amount of goods removed from their own stockpile too.
And the purchasing tradezones need to have the money that's given out actually taken away from them
The spending of money and adding of money will need to be able to go into certain pop groups and the state coffers based on some kind of breakdown too. So, it's also a good time to write a function to divvy up profits.
The profits effect will probably take the total amount of money pooled in a country's governorships after all trades are complete, and just run once to give it to the different pop groups and the state (and maybe characters). It would not be performant to run it every single time a trade is completed.