portal: dues = the co-op's share, not the donor's OC total
ci/woodpecker/push/woodpecker Pipeline was canceled
ci/woodpecker/push/woodpecker Pipeline was canceled
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.
This commit is contained in:
1 parent
a814a5f7f9
commit
f7f6946207
1 file changed
+6
-4
+6
-4
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user