From f7f6946207441c018a963a4b028655a2af4c9a02 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Tue, 17 Nov 2026 09:08:58 +0000 Subject: [PATCH] portal: dues = the co-op's share, not the donor's OC total MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit totalAmount includes the buyer's optional Open Collective tip, so a member who tips showed a higher dues level than they pay us. Use amount.value — the base contribution that reaches the co-op — and fetch it alongside totalAmount. The webhook credit-pack path made this same mistake and already resolves it via the public order API. --- app/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 8d761b8..3e0fefb 100644 --- a/app/main.py +++ b/app/main.py @@ -7365,7 +7365,7 @@ async def fetch_member_orders() -> dict[str, list[dict]]: query = ( '{ collective(slug: "%s") { orders(limit: 200) { totalCount nodes { ' "frequency status createdAt lastChargedAt nextChargeDate " - "fromAccount { slug } totalAmount { value currency } } } } }" + "fromAccount { slug } amount { value currency } totalAmount { value currency } } } } }" % OC_COLLECTIVE_SLUG ) async with httpx.AsyncClient(timeout=30.0) as client: @@ -7402,8 +7402,10 @@ def _current_dues(orders: list[dict]) -> tuple[float | None, str | None]: ONE-TIME order is a credit purchase and never sets dues; * only a LIVE one (ACTIVE or PROCESSING) counts — a CANCELLED subscription is not what the member currently pays; - * the amount is the order's per-charge total (`totalAmount.value`), the - same figure OC bills each cycle; + * the amount is the co-op's share — `amount.value`, the base contribution. + `totalAmount` adds the buyer's optional Open Collective tip, which never + reaches us (the webhook path made this same mistake once — see the + comment at the top of this file); * no live recurrence, an unparseable amount, or a non-positive amount → (None, None). NEVER guess and NEVER fall back to the $15 allowance. """ @@ -7414,7 +7416,7 @@ def _current_dues(orders: list[dict]) -> tuple[float | None, str | None]: if freq not in ("MONTHLY", "YEARLY") or status not in ("ACTIVE", "PROCESSING"): continue try: - amt = float((o.get("totalAmount") or {}).get("value")) + amt = float((o.get("amount") or {}).get("value")) except (TypeError, ValueError): continue if amt <= 0: