donation item, shop soft open
All checks were successful
Deploy / build-deploy (push) Successful in 4m11s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-08-17 11:04:03 +02:00
commit abbd616b40
23 changed files with 2898 additions and 209 deletions

View file

@ -64,6 +64,13 @@ export namespace Catcrafts::Server {
std::int64_t shippingMinor = 0;
std::int64_t totalMinor = 0;
bool vatIncluded = false;
// A donation: buyer-named amount, nothing ships, no VAT, and — the
// consequences downstream — no invoice number is ever assigned, the
// mailer sends a thank-you without an attachment (or nothing, when no
// email was given), and /financials counts it under donations rather
// than sales. Additive ledger key: absent reads false, so every order
// written before donations existed stays a sale.
bool donation = false;
std::string status = "awaiting_payment"; // -> paid -> shipped | cancelled
std::string payChoice; // Form::kPayBank | Form::kPayCrypto; which
// rail issued the link, and so which one
@ -118,11 +125,15 @@ export namespace Catcrafts::Server {
//
// /financials shows lifetime sales as two integers: how many orders were
// ever paid, and what they summed to. Ever-paid on purpose — a refund is
// an expense on that page, it does not un-happen the sale. Pure and
// exported for the self-test.
// an expense on that page, it does not un-happen the sale. Donations paid
// through the shop land in the same ledger but are NOT sales — they fold
// into their own pair here and join the bank-side donations on the page.
// Pure and exported for the self-test.
struct SalesSummary {
std::int64_t count = 0;
std::int64_t totalMinor = 0;
std::int64_t donationCount = 0;
std::int64_t donationsMinor = 0;
};
SalesSummary SummarizeSales(std::span<const OrderRecord> orders);