Open BerglundDaniel opened 9 months ago
The recent changes enhance Stripe integration with Makeradmin, focusing on membership products and subscription management. The firstrun.py
setup script now includes logic for creating specific products with different subscription types. Various files saw updates to better align product creation and payment handling with Stripe’s APIs. New functions and improved handling of scenarios ensure a smoother user experience and more robust backend operations.
File(s) | Change Summary |
---|---|
README.md | Added details on required membership products, Stripe-Makeradmin connection, and test instructions. |
api/src/firstrun.py | Added subscription type metadata and conditional block for creating Stripe data based on user input. |
api/src/shop/README.md | Introduced new file detailing Makeradmin and Stripe relationships and interactions. |
api/src/shop/stripe_product_price.py | Updated functions for handling Stripe product pricing, recurring intervals, and unit conversions. |
api/src/shop/stripe_util.py | Modified price calculation logic to use PriceType instead of StripeRecurring . |
api/src/shop/models.py | Updated Product class repr method and made created_at in Transaction class non-nullable. |
api/src/shop/pay.py | Revised payment processing and subscription setup logic. |
api/src/shop/shop_data.py | Added type annotations and a new function for retrieving product data by special ID. |
api/src/shop/stripe_charge.py | Updated type handling for error parameters and payment source IDs. |
api/src/shop/stripe_customer.py | Improved error handling and metadata verification for Stripe customers. |
api/src/shop/stripe_discounts.py | Modified type annotations and discount fraction assignment logic. |
api/src/shop/stripe_event.py | Updated event handling logic, type annotations, and metadata processing. |
api/src/shop/stripe_payment_intent.py | Added assertions and parameters for payment intent creation, including test mode handling. |
api/src/shop/stripe_setup.py | Updated Stripe API version in setup function. |
api/src/shop/stripe_setup_intent.py | Added assertion for setup intent error handling. |
api/src/shop/views.py | Updated function signatures and removed redundant imports related to Stripe subscriptions. |
In the code a rabbit hops, Through Stripe fields and Makeradmin crops, Memberships bloom with metadata clear, Subscriptions flow without a tear. Errors handled, payments right, A seamless process, day and night. Cheers to code, where changes bring, A smoother world, and joy they sing! 🐰✨
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?
It seems the test fail primarily because of the lack of API keys to Stripe?
raise Exception("Stripe keys in .env must both be set to either 'live' or 'test'. Please check your configuration.")
I might be missing something, but I don't see them being passed to the automation system. I would suggest to put the Stripe test keys in a secret - say STRIPE_TEST_API_KEY
- and pass that in the environment
.github/workflows/makeradmin.yml
STRIPE_PRIVATE_KEY="$STRIPE_TEST_API_KEY" make test
That should hopefully pass on the API key to the container test
from docker-compose.test.yml
any other env vars can be passed on in the same way.
I see that is it getting handled in #410 :)
The key checks are also for developing so that you don't accidentally runt the tests with the live keys for instance.
I have made a bunch of fixes to this PR now. Locally, all tests pass for me. I haven't had time to go through the rest of the code yet.
The aim of this PR is to switch over from stripe as the truth for some products to makeradmin. I.e. to start using what was made in PR #374
Summary by CodeRabbit
Documentation
New Features
Bug Fixes
Improvements
Chores
api/src/shop
for detailed overview of Makeradmin and Stripe relationships.