From 7dfa59a0f955febbfad89039976f6f154dc7daea Mon Sep 17 00:00:00 2001 From: William Stein Date: Tue, 10 Dec 2024 21:57:52 +0000 Subject: [PATCH] student pay via link -- this is good enough --- src/packages/frontend/purchases/payments.tsx | 2 +- src/packages/next/pages/token/[id].tsx | 21 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/packages/frontend/purchases/payments.tsx b/src/packages/frontend/purchases/payments.tsx index 8aa4164dbc..756b1a6529 100644 --- a/src/packages/frontend/purchases/payments.tsx +++ b/src/packages/frontend/purchases/payments.tsx @@ -469,7 +469,7 @@ function InvoiceLink({ invoice }) { type="link" target="_blank" > - Invoice{" "} + Invoice and Receipt{" "} {isExpired ? " (expired)" : undefined} ); diff --git a/src/packages/next/pages/token/[id].tsx b/src/packages/next/pages/token/[id].tsx index 6f85ff3200..126c78e1d2 100644 --- a/src/packages/next/pages/token/[id].tsx +++ b/src/packages/next/pages/token/[id].tsx @@ -29,6 +29,7 @@ import getAccountId from "lib/account/get-account"; import InPlaceSignInOrUp from "components/auth/in-place-sign-in-or-up"; import StripePayment from "@cocalc/frontend/purchases/stripe-payment"; import { LineItemsTable } from "@cocalc/frontend/purchases/line-items"; +import A from "components/misc/A"; const STYLE = { margin: "30px auto", maxWidth: "750px", fontSize: "14pt" }; @@ -167,7 +168,7 @@ function Dialog({ } function HandleToken({ token }) { - const { calling, result, error, call } = useAPI("token-action", { token }); + const { calling, result, error } = useAPI("token-action", { token }); return (
@@ -178,16 +179,16 @@ function HandleToken({ token }) { )} {error && } {!calling && result != null && !error && ( - + )}
); } -function RenderResult({ data, call }) { +function RenderResult({ data }) { const [finishedPaying, setFinishedPaying] = useState(false); - if (data?.pay != null) { + if (data?.pay != null && !finishedPaying) { return (
@@ -196,10 +197,6 @@ function RenderResult({ data, call }) { {...data.pay} onFinished={() => { setFinishedPaying(true); - call(); - // wait a little then check again to see if the payment went through. - // if not user should see a message about processing. - setTimeout(call, 5000); }} />
@@ -211,7 +208,13 @@ function RenderResult({ data, call }) { showIcon style={STYLE} type="success" - message="Thank you." + message={ + <> + Thank you for your payment! Please visit{" "} + the payments page to ensure your + payment is completed successfully and download a receipt. + + } description={data?.text ? : undefined} /> );