feat/e-commerce-stripe-v2#54
Merged
Merged
Conversation
…ument finalize_order context
…lidate, aria-current
…fetch, stop heart click propagation
…rd stays a server component
… poll orders table on success page
…ishlist, admin fulfillment
There was a problem hiding this comment.
11 issues found across 22 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="e-commerce/lib/store-actions.ts">
<violation number="1" location="e-commerce/lib/store-actions.ts:140">
P1: The new checkout-success poll path only reads `orders.payment_status` and no longer finalizes paid sessions, so paid checkouts can remain unfinalized when the projection/webhook update is delayed or missed.</violation>
</file>
<file name="e-commerce/lib/store.ts">
<violation number="1" location="e-commerce/lib/store.ts:743">
P1: Stripe checkout session omits shipping/tax from the charged amount, so customers can be charged less than `orders.total_cents`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| export async function pollOrderPaymentAction(payload: { orderId: string }) { | ||
| const { viewer, accessToken } = await requireSession(); | ||
| const result = await getOrderPaymentState({ |
There was a problem hiding this comment.
P1: The new checkout-success poll path only reads orders.payment_status and no longer finalizes paid sessions, so paid checkouts can remain unfinalized when the projection/webhook update is delayed or missed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At e-commerce/lib/store-actions.ts, line 140:
<comment>The new checkout-success poll path only reads `orders.payment_status` and no longer finalizes paid sessions, so paid checkouts can remain unfinalized when the projection/webhook update is delayed or missed.</comment>
<file context>
@@ -119,3 +134,38 @@ export async function setDefaultAddressAction(
+
+export async function pollOrderPaymentAction(payload: { orderId: string }) {
+ const { viewer, accessToken } = await requireSession();
+ const result = await getOrderPaymentState({
+ accessToken,
+ userId: viewer.id,
</file context>
|
|
||
| const { data: session, error: sessionError } = await insforge.payments.createCheckoutSession('test', { | ||
| mode: 'payment', | ||
| lineItems, |
There was a problem hiding this comment.
P1: Stripe checkout session omits shipping/tax from the charged amount, so customers can be charged less than orders.total_cents.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At e-commerce/lib/store.ts, line 743:
<comment>Stripe checkout session omits shipping/tax from the charged amount, so customers can be charged less than `orders.total_cents`.</comment>
<file context>
@@ -603,6 +673,143 @@ export async function placeOrderForUser(args: {
+
+ const { data: session, error: sessionError } = await insforge.payments.createCheckoutSession('test', {
+ mode: 'payment',
+ lineItems,
+ successUrl: `${args.successOrigin}/checkout/success?order_id=${args.orderId}&session_id={CHECKOUT_SESSION_ID}`,
+ cancelUrl: `${args.successOrigin}/cart`,
</file context>
…ence, no-oversell trigger, demo url)
There was a problem hiding this comment.
2 issues found across 7 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="e-commerce/lib/store-actions.ts">
<violation number="1" location="e-commerce/lib/store-actions.ts:140">
P1: The new checkout-success poll path only reads `orders.payment_status` and no longer finalizes paid sessions, so paid checkouts can remain unfinalized when the projection/webhook update is delayed or missed.</violation>
</file>
<file name="e-commerce/lib/store.ts">
<violation number="1" location="e-commerce/lib/store.ts:743">
P1: Stripe checkout session omits shipping/tax from the charged amount, so customers can be charged less than `orders.total_cents`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
… to surface oversell rather than silent skip
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.
Summary by cubic
Add real Stripe Checkout via InsForge Payments, a wishlist, and an order status timeline with admin fulfillment. Checkout now redirects to Stripe, then back to a success page that polls and routes to the order; inventory is finalized via a payment trigger that uses greatest(0, ...) to surface oversells and avoid silent errors.
New Features
/checkout/successpolls until paid and redirects to the order. Finalization happens via a database trigger onpayments.payment_historythat decrements inventory withgreatest(0, ...). UsesNEXT_PUBLIC_APP_URLfor redirects and handles timeouts/errors./account/wishlist.stripe_price_idsupport; missing-price errors are surfaced clearly. Parallelized data fetch and resilient wishlist lookups.Migration
order_status_events,wishlists, Stripe columns on products/variants and orders, RLS, admin RPCs, and a payments trigger that finalizes paid orders and safely decrements inventory).@insforge/sdkto^1.3.1.stripe_price_idto matchingproducts/product_variantsrows.NEXT_PUBLIC_APP_URLfor production.Written for commit 539206e. Summary will update on new commits.