makerspace / makeradmin

Stockholm Makerspace member administration and store.
20 stars 14 forks source link

Implement function that list gets all payment intents from stripe #394

Closed BerglundDaniel closed 8 months ago

BerglundDaniel commented 8 months ago

For bookkeeping we need to fetch all the transactions from stripe for two reasons, one to check that our transaction db is correct, two to get the transaction fees. This PR adds a function that does this and the corresponding tests for it

Summary by CodeRabbit

coderabbitai[bot] commented 8 months ago

[!WARNING]

Rate Limit Exceeded

@BerglundDaniel has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 12 minutes and 14 seconds before requesting another review.

How to resolve this issue? After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.
How do rate limits work? CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.
Commits Files that changed from the base of the PR and between efc80d68152548d5db26b622b3c06b1c78df5d2a and af2470ec8da82dcac7fc19b1e87cdecd1ba6373c.

Walkthrough

The recent updates across the API source files indicate a broader enhancement of the transaction and payment functionalities within the system. The create_shop_transactions function has been expanded to handle a variety of transaction statuses and types, including membership-related transactions. The Stripe integration has been refined with improved type annotations, error handling, and the addition of functions to manage payment intents and convert them to payments. Testing has also been updated to align with new functionality, focusing on Stripe customer interaction, payment intents, and subscriptions.

Changes

File(s) Change Summary
api/src/.../firstrun.py Extended create_shop_transactions to handle multiple transaction types and statuses.
api/src/.../stripe_charge.py
api/src/.../stripe_payment_intent.py
Updated function signatures and type annotations; added functions for handling and converting Stripe payment intents.
api/src/.../stripe_event.py Minor formatting change with no impact on functionality.
api/src/.../test/stripe_customer_test.py Updated test skip message to reflect focus shift to customer functionality.
api/src/.../test/stripe_payment_intent_test.py
api/src/.../test/subscriptions_test.py
Introduced tests for Stripe payment intents and subscription-related functionality.
api/src/test_aid/db.py
api/src/test_aid/obj.py
Added functionality for creating Transaction objects in test aid utilities.

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 X ?


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - You can directly reply to a review comment made by CodeRabbit. Example: - _I pushed a fix in commit ``._ - You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging `@coderabbitai` in a comment. Examples: - _@coderabbitai generate unit tests for this file_ - _@coderabbitai modularize this function_ - You can tag `@coderabbitai` in a PR comment and ask questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions. Examples: - _@coderabbitai render interesting statistics about this repository as a table_. - _@coderabbitai show all the `console.log` statements in this repository_. - _@coderabbitai generate unit tests for the `src/utils.ts` file_. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json` ### CodeRabbit Discord Community Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.