feat(education): add bounded commercialization entitlements

This commit is contained in:
2026-07-31 12:58:48 +08:00
parent 8312859b39
commit 5bc1e9e634
27 changed files with 804 additions and 19 deletions

View File

@@ -1,9 +1,32 @@
# EDU-013 — Education commercialization binding
- **Status:** blocked
- **Type:** decision and implementation program
- **Status:** in-progress
- **Type:** bounded implementation
- **Phase:** 5
- **Blockers:** product/entitlement model, Mall/Pay API assessment, Member entitlement decision, EDU-004
- **Blockers:** Mall order-item paid/refunded public event, CRM referral/commission public contract
## Delivered bounded slice
Education now owns only:
- `QUESTION_COLLECTION` to Mall SPU bindings;
- tenant/member/resource entitlement aggregate;
- duplicate-safe grant, revoke, refund, and time-based expiry decisions;
- admin fulfillment endpoints and an internal public Java API;
- fail-closed collection question and new-practice access checks.
`education_question_collection.access_mode` is authoritative (`FREE`, `PRIVATE`, `PAID`). Existing `access_rules` remains descriptive metadata and is never evaluated for authorization. Financial orders, payment status, refund status, amounts, and ledgers remain outside Education.
The Product public API can validate SPUs when a Product adapter is installed, but the current reactor does not enable Mall. Current Trade public DTOs omit order items/SKU data and Pay callbacks cannot fan out, so no adapter pretends to infer fulfillment from insufficient signatures. Mall-owned automatic fulfillment remains blocked on a public paid/refunded order-item event.
## Public/admin interfaces
- `EducationEntitlementApi`: idempotent grant/revoke/refund and access check for trusted module adapters.
- `POST /admin-api/education/commercialization/bindings`
- `PUT /admin-api/education/commercialization/bindings/{resourceType}/{resourceId}/deactivate`
- `POST /admin-api/education/commercialization/entitlement-events`
Permissions: `education:commercialization:binding`, `education:commercialization:entitlement`.
## Outcome
@@ -19,13 +42,13 @@ Education may own only domain bindings and fulfillment orchestration, such as:
## Acceptance criteria
- [ ] Mall/Pay/Member/CRM public contracts are mapped before implementation.
- [ ] Payment callbacks and refunds remain in Pay.
- [ ] Generic products/orders remain in Mall where applicable.
- [ ] Entitlement issuance, revocation, expiry, and refund effects are explicit and idempotent.
- [ ] Paid/private practice remains inaccessible until entitlement checks are complete.
- [ ] Reconciliation and commission/referral ownership is explicit.
- [ ] Financial and authorization tests cover duplicate callbacks and cross-tenant access.
- [x] Mall/Pay/Member/CRM public contracts are mapped before implementation.
- [x] Payment callbacks and refunds remain in Pay.
- [x] Generic products/orders remain in Mall where applicable.
- [x] Entitlement issuance, revocation, expiry, and refund effects are explicit and idempotent.
- [x] Paid/private practice remains inaccessible until entitlement checks are complete.
- [x] Reconciliation and commission/referral ownership is explicit.
- [x] Financial and authorization tests cover duplicate callbacks and cross-tenant access.
## Risk and rollback