Plugin design, having circular dependency issues
I have an ecomm application in Project#1.
I have a payment gateway implementation in Project#2 that references Project#1. It references interfaces so that the gateway is implemented to a contract.
Now I need to actually use the implementation from Project#2 in Project#1.
There is a circular dependency so it isnt' working as it is.
What shall I do? Should I break the interfaces into their own project? That seems like the easiest approach.
The point is that if I need to create another implementation of a gateway, it can easily be incorporated into Project#1.
Putting interfaces in a separate library is often a good idea. It also ensures that you can vary and deploy concrete implementations independently of each other.
As a general rule of thumb, when I design, I start by putting the interfaces together with their consumers, and I then move them to a separate library if the need arises.
As far as I understand your description, you have consumers in each library, so moving them sounds like the correct approach.
If you find that these interfaces are sufficiently unrelated, you may even want to consider putting them in two different libraries.