diff --git a/Changelog.md b/Changelog.md index f0d2343624349deb3c8e8a882e0f1a5ce0ee3b8f..aa2c00a7ecdc20c1f4960d559cf1f22f00c972be 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,10 @@ All notable changes to this project will be documented in this file. -## [0.16] - 2025-02-12 +## [0.17] - 2025-04-22 + - Introduce ERROR_REPORT_IGNORE_REGISTRATION_TYPES setting to configure error report ignore list + +## [0.16] - 2025-04-14 - Exclude void invoices from possbile error report - Limit max invoice due date and set maximum date for allowing bank transfers diff --git a/config-example.json b/config-example.json index 43e4b0d6d57a79828be2a28a8ce5f5f71ceb59de..48260f9fd1a8d9cd4d62d197a6c86e79510202ca 100644 --- a/config-example.json +++ b/config-example.json @@ -7,5 +7,13 @@ "VISIT_EXPO_ID": "18lm2fafttito", "SEND_ERROR_EMAILS_TO": [], "MAX_INVOICE_DUE_DATE": "2025-05-23", - "MAX_BANK_TRANSFER_ALLOWED_DATE": "2025-05-12" + "MAX_BANK_TRANSFER_ALLOWED_DATE": "2025-05-12", + "ERROR_REPORT_IGNORE_REGISTRATION_TYPES": [ + "VIP", + "Staff", + "FTP", + "Partner", + "Online Participant", + "E-NREN" + ] } \ No newline at end of file diff --git a/setup.py b/setup.py index 42f1c8e39df35575aec35bfb5f9c8436c0802b53..00cccd0336a320e2a227b2f2f182406c06f76176 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="stripe-checkout", - version="0.16", + version="0.17", author="GEANT", author_email="swd@geant.org", description="Stripe custom checkout support service", diff --git a/stripe_checkout/stripe_checkout/compare_visit_stripe.py b/stripe_checkout/stripe_checkout/compare_visit_stripe.py index 41163bb82c49097f4252721c246d80ee5e80085d..3e52b5fb5130aa0420d7ddad1b0935e2c50b9006 100644 --- a/stripe_checkout/stripe_checkout/compare_visit_stripe.py +++ b/stripe_checkout/stripe_checkout/compare_visit_stripe.py @@ -1,3 +1,5 @@ +from typing import Collection +from django.conf import settings import stripe from stripe_checkout.stripe_checkout import visit @@ -36,10 +38,13 @@ class VisitorWrapper(StripeWrapper): class PossibleErrorReporter(CSVReporter): def iter_report_items(self, data): + ignore_registration_types = set( + getattr(settings, "ERROR_REPORT_IGNORE_REGISTRATION_TYPES", []) + ) seen = set() for obj in super().iter_report_items(data): seen.add(obj["Email address"]) - if self._is_suspect(obj): + if self._is_suspect(obj, ignore_registration_types): yield obj unseen_invoices: dict[str, list[dict]] = {} for obj_id, obj in data["stripe"].items(): @@ -60,8 +65,8 @@ class PossibleErrorReporter(CSVReporter): } @staticmethod - def _is_suspect(obj: dict): - if obj["Registration Type"] in {"VIP", "Staff"}: + def _is_suspect(obj: dict, ignore_registration_types: Collection[str]): + if obj["Registration Type"] in ignore_registration_types: return False return obj["Invoice Count"] != 1