fix: restore payment page data loader #29722
All Vouch review confidence checks passed
Residual risk 0.44 = Change Risk (0.76) × (1 − Review Confidence (0.42)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.76 · 456 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.076
Real PR Conversation Timeline
1 comments
"Review active on #29722"
general
weight: 0.35
kpalang
What does this PR do?
Restores the
/payment/[uid]page's server-side data loader, which was stubbed out during the Cal.diy refactor (ab21c7f805, #28903). Since then the page has ignored theuidparam and rendered hardcoded placeholder data, which means:Invalid Date, and a wrong amount instead of their bookingpayment.appIdis alwaysnull), so paid bookings cannot be completed/booking/[uid]Changes:
apps/web/modules/payments/views/payments-single-view.getServerSideProps.tsx(new): the data loader, restored from the pre-refactor implementation (packages/features/ee/payments/pages/payment.tsxata17f28e9ab) and adapted to the current module conventions (same pattern as~/bookings/views/bookings-single-view.getServerSideProps). Loads the payment byuidvia the existingpaymentDataSelect, returnsnotFoundfor unknown uids, redirects cancelled/rejected bookings, computesclientSecret(incl. theHOLD/setupIntent case), and parses event type metadata.apps/web/app/(use-page-wrapper)/payment/[uid]/page.tsx: wiresgetDatato the real loader (removes the placeholder stub and the duplicated local props type).generateMetadatanow produces the real event name again.packages/prisma/selects/payment.ts: addsid(payment) andpaid(booking) topaymentDataSelect— fields the client components' prop types require.apps/web/playwright/payment.e2e.ts: the existing mock-payment test now also asserts that the real amount and event title render (this assertion fails against the stub).Out of scope (follow-up):
PaymentPage.tsxcontains{/ StripePaymentComponent removed /}— restoring the Stripe embedded checkout component is a separate concern; this PR fixes the data layer that all payment apps depend on.Visual Demo
Before: the page renders an empty title,
Invalid Date, no amount, and no checkout component regardless of the booking (see the code-level evidence in #29721 — the loader returns hardcoded placeholders and ignoresuid).After: the page renders the booked event name, date, and amount, and mounts the matching payment app component. The extended e2e assertion in
payment.e2e.tsdemonstrates this: it fails against the current stub and passes with this PR.Mandatory Tasks (DO NOT REMOVE)
apps/web/playwright/payment.e2e.tsto assert real payment data renders (fails on the current stub, passes with this fix).How should this be tested?
1. Set
MOCK_PAYMENT_APP_ENABLED=1(or install PayPal/Alby) and enable a price on an event type2. Book the event → you are redirected to
/payment/<uid>3. Before this PR: empty title,
Invalid Date, placeholder amount, no checkout component. After: real event name/date/amount, checkout component mounts4. Open
/payment/<random-string>→ 404 (before: placeholder page)5. Cancel the booking, open its payment link → redirected to
/booking/<uid>6. E2E:
yarn e2e payment.e2e.ts(the "should create a mock payment for a user" test)