Upgrade stripe from 5.5.0 to 16

未关闭
#6,374 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
backend, payments

调研方向

Start with stripe_webhook in contentcuration/contentcuration/views/subscription.py, where the event data object is passed to the DRF serializers, and with the mocked tests in tests/views/test_subscription.py. Pin stripe to 16.x in requirements.txt, then add one test per handled event type that builds the event with stripe.Event.construct_from(...) and checks the UserSubscription change. Done when those tests fail without the view fix and pass with it. The issue is marked as not open for contribution, so confirm with maintainers before starting.

由索引模型根据 Issue 内容生成。

描述

dependencies DEV: backend python

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Dependabot PR #6370 bumped stripe from 5.5.0 to 16.0.0 and was closed unmerged: on stripe ≥15 every Stripe webhook Studio receives is dropped. The upgrade needs a code change in stripe_webhook and tests that build real Stripe objects.

Complexity: Low
Target branch: unstable

Context
  • stripe 15.0.0 (stripe-python#1762) made StripeObject stop subclassing dict.
  • stripe_webhook (contentcuration/contentcuration/views/subscription.py) passes event["data"]["object"] to the DRF serializers for checkout.session.completed, customer.subscription.updated and customer.subscription.deleted.
  • On 16.0.0 with DRF 3.15.1, a serializer fed a stripe.Event.construct_from(...) data object fails validation; the same probe passes on 5.5.0:
    valid: False {'non_field_errors': [... 'Invalid data. Expected a dictionary, but got Subscription.']}
    
  • The view then logs a warning and returns 200, so Stripe does not retry: paid checkouts never grant storage and cancellations never revoke it.
  • CI passed on #6370 because tests/views/test_subscription.py mocks construct_event with plain dicts.
  • No other 6–16 breaking change touches Studio: stripe.error.*, stripe.api_key and stripe.api_version remain; StripeObject.request() and stripe.Reversal are unused.
The Change
  • All three webhook handlers should process real Stripe events on stripe 16.
Acceptance Criteria
  • requirements.txt pins stripe==16.x.
  • A test per handled event type builds the event with stripe.Event.construct_from(...) and asserts the UserSubscription change; each fails on stripe 16 without the view fix.
  • Those tests pass on stripe 16.

AI usage

Drafted by rtibblesbot (Claude Code) from its review of #6370; the construct_from probe output is from that review.

Filed from #6370's review.

主要语言
Python
星标
212
派生
321
平均合并
1 天 7 小时
30 天内合并 PR
14

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/studio 的其他 Issue

查看 learningequality/studio 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。