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: