Fix Stripe checkout 500 handling and admin claims UI layout#325
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
api/admin/create-checkout-session.jsto validate Stripe initialization (returningSTRIPE_NOT_CONFIGURED/STRIPE_SECRET_KEY_INVALID), return explicit statuses for claim and payment states (CLAIM_NOT_FOUND,CLAIM_NOT_READY_FOR_PAYMENT,PAYMENT_ALREADY_COMPLETED), and returnCHECKOUT_SESSION_CREATE_FAILEDwith optional debug payload (only whenNODE_ENV !== 'production') when Stripe throws, while logging only safe fields (message,code,claimId).stripeimport with a small factory inlib/stripe-client.jsthat rejects missing keys or publishablepk_keys and returns a properly constructed Stripe client for server-side use.mode: 'payment',price_datainusdwithunit_amount: 2000, product name/description and metadata includingclaimId,tenant,packId,product) and that DB mutations (claim_payments, claim status transition topayment_pending) occur only after a successful Stripe session creation.public/admin/claims.htmlso the admin page uses a wider responsive container (max-width: 1400px/width: min(1400px, calc(100% - 48px))), a two-columnadmin-grid(420px minmax(0, 1fr)), clickable claim cards instead of a cramped fixed table, non-wrapping inline-flex status badges, horizontally scrollable pipeline badges, more compact action buttons, and clearer checkout error messages surfaced from the API (including debug details when available).tests/api-payments.test.jsto cover missing Stripe key,pk_publishable-key rejection, Stripe creation failure not mutating DB, and successfulcards_publishedcheckout flow returning acheckoutUrl.Testing
npm testin the repository and all tests passed (107tests passed,0failures).cd examples/webhook-auto-verify && npm run checkand the example checks succeeded.STRIPE_NOT_CONFIGURED,STRIPE_SECRET_KEY_INVALID, non-mutation on Stripe failure, and successfulcheckoutUrlresponse all passed under the test suite.Codex Task