Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook, Signature verfication integration & refactored structure #5

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

BigBr41n
Copy link
Contributor

Summary

This pull request introduces a significant refactor of the chargily client, aimed at enhancing the code's modularity, scalability, and maintainability. The architecture has been improved by dividing the client into multiple atomic files, which encapsulate functionalities more clearly. Additionally, the webhook integration and signature verification functionality has been implemented to ensure the integrity of webhook events. The README.md has been condensed for clarity, and a new docs directory has been created to provide detailed documentation for each service.

Key Changes

  1. Client Refactor:

    • The client code has been organized into multiple files, making it easier to navigate and maintain. This atomic structure helps to isolate different functionalities and adhere to the single responsibility principle.

    • Each service (e.g., Payment Links, Checkouts, Webhook) now resides in its own file, promoting better scalability and clearer architecture.

  2. Webhook & Signature Verification:

    • Webhook now is supported with the signature verification functionality.

    • The verification logic implemented and uses HMAC with SHA-256, providing a robust method for signature validation as mentioned in Chargily Webhook documentation.

  3. Updated README.md:

    • The README.md has been streamlined to focus on essential information, improving the onboarding experience for new developers and contributors.
  4. Documentation Improvements:

    • A new docs folder has been added, containing comprehensive documentation for each service within the client.

    • Each service documentation includes details about available methods, parameters, return types, and examples where applicable. This change enhances the usability and understanding of the client for both current and future developers.

  5. Unified Usage Pattern:

    • All services now use a unified usage pattern, developers use the functionalists directly after initialize the client :

    • client.Customers.GetAll(), client.Products.GetAll(), client.Checkouts.Create() .....

    • this implemented method makes the usage of the SDK more easy and remembering the function much easier.

  6. Examples Refactor:

    • refactoring the examples folder to more clean and clear examples , implementing the new functionalities and the unified usage pattern.

    • This refactor make it more easy to navigate between the examples and understand the usage.

  7. Models and Types:

    • Dividing chargily.go file (types file) into (params , responses, types) in separate folder with its own packages. This refactor allow for shared models across the SDK and enhance the developers experience.

    • More clean structure for future scaling and maintaining.

Benefits of the Refactor

  • Modularity: The atomic file structure allows developers to work on specific parts of the client and models files without impacting unrelated components.

  • Scalability: The clear organization of files and documentation will facilitate easier future enhancements and modifications.

  • Maintainability: Improved documentation and modularity reduce the cognitive load for developers, making it easier to understand and maintain the codebase.

…ced scalability and clarity

- Refactored chargily.go by dividing it into separate files: params.go, responses.go, and types.go.
- Moved these model files into a newly created models package to improve separation of concerns.
- Enhanced maintainability and clarity by organizing related structures and defintions.
…_errors.go) in one utils folder for more calrity and structure organization
Moved all methods into dedicated files to enhance organization. Refactored the Client struct to provide a unified interface for accessing all SDK functionalities, improving usability and maintainability.
Moved individual functions into separate files for better organization. Implemented a consistent interface across different entities, allowing unified access to functions such as customers.get(), products.get(), customers.create(), and prices.create(). This enhances usability and simplifies interaction with the SDK.
…ocus. using the new updates made to the project
…ocus. using the new updates made to the project
…amples making it more easy to read and understand the logic flow.
…te & a public method the verify the signature sent by chargily
…nts ...), params & returns explained. example for each function of the services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant