From 7098ac75cbe234372b5d81cb84e3728a8fc1a71d Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Thu, 20 Aug 2026 03:08:30 +0200 Subject: [PATCH] crypto payment message --- shared/interfaces/Catcrafts.Shared-Views.cppm | 24 +++++++++---------- tests/ShouldProcessCheckout/main.cpp | 22 ++++++++++++----- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/shared/interfaces/Catcrafts.Shared-Views.cppm b/shared/interfaces/Catcrafts.Shared-Views.cppm index a1ce16f..d206738 100644 --- a/shared/interfaces/Catcrafts.Shared-Views.cppm +++ b/shared/interfaces/Catcrafts.Shared-Views.cppm @@ -1399,8 +1399,15 @@ export RenderedPage RenderOrderStatus(const OrderView& o, std::string_view indic // No badge when paid: the confirmation notice below carries the state, // and two green "paid" pills stacked read as a rendering bug. + // + // An awaiting order whose payment has been SEEN in flight says so in the + // badge itself, not only in the note below: the badge is where a buyer + // who just paid looks first, and "awaiting payment" there reads as "your + // money did not arrive" no matter what a paragraph underneath explains. + const bool inFlight = awaiting && o.cryptoPay && o.cryptoPay->seen; SafeHtml statusLine = - awaiting ? Raw(R"(awaiting payment)") + inFlight ? Raw(R"(payment detected, awaiting network confirmation)") + : awaiting ? Raw(R"(awaiting payment)") : o.status == "paid" ? SafeHtml{} : o.status == "shipped" ? Raw(R"(shipped)") : Raw(R"(cancelled)"); @@ -1458,16 +1465,9 @@ export RenderedPage RenderOrderStatus(const OrderView& o, std::string_view indic R"(info@catcrafts.net )" R"(and it will be settled by hand.

)"); - // The in-flight acknowledgement: the rail has SEEN the full amount on - // the network, finality is the only thing missing. Rendered first, - // because a buyer who just paid scans for exactly this sentence. - const SafeHtml seenLine = pay.seen && pay.minutesLeft > 0 - ? Raw(R"(

Your payment is on its way. )" - R"(It is visible on the network and is being finalized: this )" - R"(usually takes 10 to 25 minutes, and this page will confirm )" - R"(it automatically.

)") - : SafeHtml{}; - + // The in-flight state renders as the status badge up top + // ("confirming payment"), where a buyer who just paid looks first; + // this block keeps only the standing instructions. SafeHtml indicativeLine = indicative.empty() ? SafeHtml{} : Format( R"(

{}, indicative only. The charge is )" R"(the euro amount above.

)", @@ -1476,7 +1476,6 @@ export RenderedPage RenderOrderStatus(const OrderView& o, std::string_view indic payBlock = Format( R"(
)" R"(

Pay with EURC

)" - R"({})" R"(

Send {} EURC to this address. One )" R"(network, one payment:

)" R"(

{}

)" @@ -1490,7 +1489,6 @@ export RenderedPage RenderOrderStatus(const OrderView& o, std::string_view indic R"(order reference is {}.

)" R"({})" R"(
)", - seenLine, Escape(pay.amount), Escape(pay.address), Join(items), diff --git a/tests/ShouldProcessCheckout/main.cpp b/tests/ShouldProcessCheckout/main.cpp index 8dcadaa..0dde9a6 100644 --- a/tests/ShouldProcessCheckout/main.cpp +++ b/tests/ShouldProcessCheckout/main.cpp @@ -567,12 +567,22 @@ void DonationLifecycle(TestServer& srv) { "the awaiting page states the confirmation timing"); WriteFile(std::filesystem::path( srv.Orders().string() + ".fake-paid.seen"), ""); - const std::string page = - srv.WaitForBody(seenPath, "Your payment is on its way"); - Check(page.find("Your payment is on its way") != std::string::npos, - "an in-flight payment is acknowledged on the order page"); - Check(page.find("awaiting payment") != std::string::npos, - "an in-flight payment is still awaiting, not paid"); + // The badge is where the buyer looks first, so it carries the + // state itself: "awaiting payment" under a wallet that said + // success reads as "your money did not arrive". "Detected" and + // not "received": the shop has seen the transfer, it does not + // yet trust it, and the badge should not outrun the rail. The + // waiting half uses the words every exchange deposit screen has + // taught buyers: "awaiting network confirmation". + const std::string page = srv.WaitForBody( + seenPath, ">payment detected, awaiting network confirmation<"); + Check(page.find(">payment detected, awaiting network confirmation<") + != std::string::npos, + "the badge flips to detected-awaiting-confirmation in flight"); + Check(page.find(">awaiting payment<") == std::string::npos, + "the awaiting badge is replaced, not doubled"); + Check(page.find("Thank you") == std::string::npos, + "an in-flight payment is not yet confirmed as paid"); std::error_code ec; std::filesystem::remove(std::filesystem::path( srv.Orders().string() + ".fake-paid.seen"), ec);