From 2fc9a7591c3c9f8a3d056f7676be790ca3246989 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 22 Apr 2026 21:23:18 +0000 Subject: [PATCH] Add `clear` to the valid values for the `tag` parameter Part of STF-190. The `clear` tag retracts a previously reported fraud report tag on a transaction, restoring its label to "unknown" (distinct from the positive `not_fraud` signal). The backend support was added in STF-15; this exposes the new value through the client library. Co-Authored-By: Claude Opus 4.7 (1M context) --- HISTORY.rst | 2 ++ src/minfraud/validation.py | 2 +- tests/test_validation.py | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f194dcd..ffa55e5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,6 +12,8 @@ History linking. * Added ``banquest``, ``fat_zebra``, ``summit_payments``, and ``yaadpay`` to the ``/payment/processor`` validation. +* Added ``clear`` to the valid values for the ``tag`` parameter on the + Report Transaction API. * The version is now retrieved from package metadata at runtime using ``importlib.metadata``. This reduces the chance of version inconsistencies during releases. diff --git a/src/minfraud/validation.py b/src/minfraud/validation.py index e206920..18d7a1b 100644 --- a/src/minfraud/validation.py +++ b/src/minfraud/validation.py @@ -408,7 +408,7 @@ def _maxmind_id(s: str | None) -> str: raise ValueError -_tag = In(["chargeback", "not_fraud", "spam_or_abuse", "suspected_fraud"]) +_tag = In(["chargeback", "clear", "not_fraud", "spam_or_abuse", "suspected_fraud"]) def _uuid(s: str) -> str: diff --git a/tests/test_validation.py b/tests/test_validation.py index e89a21d..30e77ad 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -470,7 +470,13 @@ def test_strings(self) -> None: self.check_report_str_type(key) def test_tag(self) -> None: - for good in ("chargeback", "not_fraud", "spam_or_abuse", "suspected_fraud"): + for good in ( + "chargeback", + "clear", + "not_fraud", + "spam_or_abuse", + "suspected_fraud", + ): self.check_report({"tag": good}) for bad in ("risky_business", "", None): self.check_invalid_report({"tag": bad})