Keep dunning a bounced debit out of the direct-debit track

Once the direct debit bounced and the board sent the Rücklastschrift reminder,
the claim is expected as a transfer by the deadline that letter states. Three
places still treated it as a claim the mandate covers, and the housekeeper's was
the one the board kept running into: after the reminder's deadline lapsed, the
finding went back to "Lastschrift überfällig -- Einzug prüfen, eine postalische
Mahnung ist hier nicht vorgesehen", for a claim that had just been dunned.

The rule now asks whether the claim was dunned before treating it as one for the
direct debit. If it was, it continues in the ordinary dunning sequence: the
running deadline shows as the usual "Frist läuft noch" note, and once that has
passed the next dunning level comes due. The SEPA-specific pending-reminder
detour that used to cover the deadline window is gone with it -- the ordinary
path reports the same thing.

The SEPA run now skips a dunned claim as well, instead of quietly collecting the
money the letter asked the member to transfer (which can bounce a second time,
with a second fee). The skip is reported like the incomplete mandates are, so
nothing disappears from the run without saying why; the dialog's wording is no
longer specific to mandates.

And a dunning mail asks for a transfer even from a member with an active
mandate. The shipped template spells the bank details out, but the ready-made
{{payment.instructions}} paragraph, offered by the template editor for exactly
this mail, told them "wir ziehen den Betrag ein, du musst nichts weiter tun" --
in the letter demanding payment.

Reverting the sent reminder is what puts the claim back into the direct-debit
run; the read of "dunned" is a sent reminder, not a draft.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Marcel Peterkau
2026-09-05 00:16:26 +02:00
co-authored by Claude Opus 5
parent 31c1646571
commit f80b17c443
11 changed files with 218 additions and 87 deletions
+16
View File
@@ -160,6 +160,22 @@ def reminder_items_total(reminder: dict[str, Any]) -> Decimal:
)
def claim_was_dunned(data: ContributionData, claim: dict[str, Any]) -> bool:
"""True once a reminder for this claim has actually gone out. Such a claim has
left the direct-debit track: the collection failed (or never happened), the member
was asked in writing to pay it, and the money is expected as a transfer by the
stated deadline. Quietly collecting it a second time is exactly what the dunning
letter says will not happen, so both the SEPA run and the housekeeper ask this
before treating a claim as one the mandate still covers."""
claim_id = str(claim.get("claim_id", ""))
if not claim_id:
return False
return any(
str(reminder.get("claim_id", "")) == claim_id and str(reminder.get("status", "")) == "sent"
for reminder in data.reminders
)
def contribution_override_covers_month(override: dict[str, Any], month: str) -> bool:
valid_from = str(override.get("valid_from", ""))
valid_until = str(override.get("valid_until", "") or "")