From 46f522ea68413622bb8b847b8e5e25367768fde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 6 Aug 2026 15:59:39 +0200 Subject: [PATCH] Raise PeppolServiceError when missing sender or recipient for Peppyrus submission Closes #14999 --- modules/edocument_peppol_peppyrus/edocument.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/edocument_peppol_peppyrus/edocument.py b/modules/edocument_peppol_peppyrus/edocument.py index 4981f3975a..afc462030d 100644 --- a/modules/edocument_peppol_peppyrus/edocument.py +++ b/modules/edocument_peppol_peppyrus/edocument.py @@ -138,11 +138,15 @@ class PeppolService(metaclass=PoolMeta): @peppyrus_api def _post_peppyrus(self, document): tree = etree.parse(BytesIO(document.data)) + if not (sender := self._peppyrus_sender(document.type, tree)): + raise PeppolServiceError("Missing sender") + if not (recipient := self._peppyrus_recipient(document.type, tree)): + raise PeppolServiceError("Missing recipient") response = requests.post( urljoin(URLS[self.peppyrus_server], 'message'), json={ - 'sender': self._peppyrus_sender(document.type, tree), - 'recipient': self._peppyrus_recipient(document.type, tree), + 'sender': sender, + 'recipient': recipient, 'processType': ( self._peppyrus_process_type(document.type, tree)), 'documentType': (