refactor: Abstract stripe API calls into their own modules#728
Merged
apetkov98 merged 15 commits intopodkrepi-bg:masterfrom Apr 9, 2026
Merged
refactor: Abstract stripe API calls into their own modules#728apetkov98 merged 15 commits intopodkrepi-bg:masterfrom
apetkov98 merged 15 commits intopodkrepi-bg:masterfrom
Conversation
|
✅ Tests will run for this PR. Once they succeed it can be merged. |
apetkov98
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
StripeApiClientgateway class to centralize and standardize all Stripe API interactions in the codebase. It updates the Stripe integration to ensure every Stripe SDK call goes through this gateway, improving maintainability, testability, and permission management. The PR also refactors tests and documentation to reflect this new structure.Stripe integration improvements:
StripeApiClientclass (apps/api/src/stripe/stripe-api-client.ts) as a single gateway for all Stripe SDK calls, enabling centralized permission probing, logging, and error handling. All direct Stripe SDK calls should now go through this class.apps/api/src/stripe/stripe.module.ts) to provideStripeApiClientas a dependency, ensuring it is available for injection throughout the application. [1] [2]Test refactoring:
stripe.controller.spec.ts,recurring-donation.controller.spec.ts, andstripe-payment.service.spec.tsto use a deep mock ofStripeApiClientinstead of mocking the Stripe SDK directly. This ensures tests are aligned with the new gateway and simplifies mocking Stripe calls. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Developer documentation:
TESTING.md, including first-time setup, recommended use of restricted keys, and a new workflow for verifying required permissions using the gateway. [1] [2]These changes make Stripe integration more robust, easier to audit, and safer to extend.