-
Book Overview & Buying
-
Table Of Contents
Clean Architecture with .NET
By :
In this chapter, we're going to jump into the implementation of services and HTTP clients, with a specific focus on a payment gateway service and its corresponding payment gateway web API. We'll be utilizing Refit, an intuitive library that streamlines the process of making REST API calls, alongside HttpClientFactory, which optimizes the instantiation and management of HttpClient instances in .NET.
The PaymentGateway service is a key element for handling transactions, showcasing how external services can be seamlessly integrated into our application while adhering to Clean Architecture principles. Refit simplifies the creation of HTTP requests by allowing developers to define external APIs as interfaces, which it then translates into concrete HttpClient calls at runtime, resulting in clearer and more readable code that is easier to maintain. The HttpClientFactory service, on the other hand, ensures efficient and scalable management of HttpClient...