Closed laouji closed 1 month ago
The changes introduce a new httpwrapper
package across various components in the payments module to standardize and streamline HTTP request handling. This includes refactoring existing HTTP client implementations to utilize the new wrapper, which encapsulates error handling and response parsing, thereby reducing code duplication and improving maintainability. Additionally, several methods across different clients have been updated to enhance error management and response processing.
Files | Change Summary |
---|---|
components/payments/internal/connectors/httpwrapper/* |
Introduced httpwrapper package, including Client interface and NewClient function for structured HTTP interactions, error handling, and response unmarshaling. |
components/payments/internal/connectors/plugins/public/bankingcircle/client/* |
Refactored HTTP request handling in various methods to use httpwrapper , simplifying error handling and response processing. |
components/payments/internal/connectors/plugins/public/currencycloud/client/* |
Updated HTTP request handling in multiple methods to utilize httpwrapper , enhancing error management and reducing boilerplate code. |
components/payments/internal/connectors/plugins/public/mangopay/client/* |
Refactored to use httpwrapper for HTTP requests and responses, improving clarity and maintainability by centralizing error handling. |
components/payments/internal/connectors/plugins/public/modulr/client/* |
Updated client methods to leverage httpwrapper , streamlining error handling and response processing. |
components/payments/internal/connectors/plugins/public/moneycorp/client/* |
Refactored to utilize httpwrapper , enhancing error handling and simplifying HTTP request logic. |
components/payments/internal/connectors/plugins/public/wise/client/* |
Refactored to integrate httpwrapper , improving error handling and response management across various methods. |
components/payments/internal/connectors/plugins/public/wise/plugin.go |
Updated client initialization in the Install function to include error handling during client creation. |
sequenceDiagram
participant Client
participant HTTPWrapper
participant Server
Client->>HTTPWrapper: Create request
HTTPWrapper->>Server: Send request
Server-->>HTTPWrapper: Response
HTTPWrapper->>Client: Return response or error
Objective | Addressed | Explanation |
---|---|---|
Add HTTP wrapper for all connectors to avoid code duplication (ENG-1370) | β |
π "In the meadow, the code does play,
With wrappers now, itβs a brighter day!
Errors handled with grace and ease,
Simplified calls bring us to our knees.
Hopping through functions, oh what a sight,
Our code is tidy, and everything's right!" π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai summary
As proposed in ENG-1370
Reducing repetition by adding http wrapper which separates business logic from http boilerplate