Repository navigation
fix(learn): fulfill paid activities removed from the cart - #1295
PixelCraftLab wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. WalkthroughCheckout completion now enrolls authenticated buyers in activities represented by paid Stripe line items, even when those activities are no longer in the cart. Free activities still in the cart remain included. A parameterized test covers both an empty cart and one containing a different unpaid activity. ChangesCheckout enrollment
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk:
|
👀 Peer Review RequiredHi @PixelCraftLab! This pull request does not yet have a peer review. Before this PR can be merged, please request a review from one of your peers:
Thank you for contributing! 🎉 |
Related issues
Fixes #1294
What changed
Paid checkout completion now enrolls the authenticated buyer in activities from the verified Stripe line-item metadata even if those activities were removed from the cart while payment was open. Free activities still in the cart retain their existing behavior.
The change keeps ownership and paid-status checks, guest checkout behavior, and duplicate-safe enrollment inserts. There are no schema changes or new dependencies.
Two regression cases cover an empty edited cart and a cart containing only an unrelated unpaid activity. Both fail before the fix and pass afterward.
Validation
This PR fixes cart removal during authenticated paid fulfillment. It does not redesign checkout snapshots, line-item pagination or enrollment-write error handling.
Checklist
AI assistance was used to investigate the failure and prepare the patch and tests. The validation above describes the checks actually performed.
Fixes
api_complete_checkoutinlearn/src/worker.py. Paid enrollments now come from verified Stripe paid line items, not from current cart membership. A paid activity removed from the cart during checkout still gets enrollment. Free activities still in the cart keep their existing behavior. The code builds a set of enrollment IDs and inserts each one in sorted order, using the existingINSERT OR IGNOREfor duplicate safety. Ownership and paid-status checks are unchanged.Adds a parameterized test covering an empty remaining cart and a cart with only an unrelated unpaid activity.
Impact: buyers who remove a paid activity during checkout are enrolled. Both regression cases passed. The full test suite completed with 421 passing tests and 29 unchanged baseline failures. Browser and Stripe end-to-end checks were not run.