Best practices when integrating with external APIs
I frequently need to implement services to integrate with remote API (such as stripe and google calendar). In this cases I simply create a service class (i.e. app/services/StripeService.php) providing methods to consume each API.
The problem with this approach is that I also use the same standard when creating application specific business services (i.e. app/services/ComissionService.php) that need to be "unit-tested".
It bothers me the fact that these two groups of classes have different purposes and yet share the same layer.
I am inclined to create a separate layer for integration services (i.e. app/integrations/StripeIntegration.php) and I wonder if anyone has a good "tip" for this scenario.
Thank you!
Please or to participate in this conversation.