import Link from "next/link"; import type { Metadata } from "next"; import { formatMoney } from "@salixcommerce/core"; import { OrderCancelButton } from "@/components/order-cancel-button"; import { PaymentCheckoutButton } from "@/components/payment-checkout-button"; import { CartLine } from "@/components/storefront"; import { EmptyState, Hero, Notification, PageContainer, StatusBadge } from "@/components/ui"; import { applicationConfiguration } from "@/config/public"; import { loadCurrentOrder } from "@/server/commerce/current-commerce"; import { loadCurrentPayment } from "@/server/payments/current-payment"; import { paymentEnabled } from "@/server/payments/payments"; export const metadata: Metadata = { title: "Order status" }; export const dynamic = "force-dynamic"; export default async function OrderConfirmationPage({ searchParams, }: Readonly<{ searchParams: Promise> }>) { const params = await searchParams; const reference = typeof params.reference === "string" ? params.reference : ""; const [order, payment] = await Promise.all([ loadCurrentOrder(reference), loadCurrentPayment(reference), ]); if (order === null) { return ( Return to shop } description="Guest orders are available only to the browser that created them." title="No authorized order" /> ); } return (
{order.status.replaceAll("_", " ")}

Contact: {order.contactEmail}

Merchandise subtotal:{" "} {formatMoney(order.merchandiseSubtotal, applicationConfiguration.business.locale)}

SC07 certifies merchandise-subtotal payments only. Tax and shipping remain outside this amount.

{payment === null ? null : (

Payment: {payment.status.replaceAll("_", " ")}

)} {order.status === "pending_payment" && payment?.status !== "pending" ? ( ) : null}
{order.items.map((item) => ( {item.variantName} ยท Quantity {item.quantity}

} formattedPrice={formatMoney(item.lineTotal, applicationConfiguration.business.locale)} key={item.sourceVariantId} name={item.productName} /> ))}
{order.status === "pending_payment" ? ( {payment?.status === "pending" ? (

Payment verification may take a moment.
Continue payment if checkout is unfinished.

) : paymentEnabled ? ( <>

Continue to the configured secure payment provider.

) : (

Configure a server payment provider to enable checkout. Payments default to off.

)}
) : order.status === "paid" ? (

The signed provider event was applied and the reserved inventory was consumed once.

) : null} Return to shop
); }