Open rubish opened 6 years ago
Thanks for the suggestion @rubish! This is actually a pretty sound idea, and we would like to implement it. It would naturally involve a bit of a refactor and new major release, but it seems worth it. We're not going to be picking this up immediately, but you can feel free to raise a pull request if you're interested in working on this!
Any updates on this?
Its convenient that all the API calls and entities of razorpay can be accessed using class methods, but the design makes heavy use of class variables. Class variables should be frowned upon because they are not thread safe. Moreover, despite everything implemented as classes; usage is mostly as if these were modules. Currently no instances can be created which can be configured at runtime.
There can be many different ways to implement thread safe code, which can be configured at runtime. One such implementation can be as follows:
I am open to feedback and other suggestions to be able use multiple merchant accounts in a single project.