Raise PeppolServiceError when missing sender or recipient for Peppyrus submission

Closes #14999
(grafted from 53f956b55465ca2c1d0c60445ba2b65c359b1da1)

--HG--
branch : 8.0
This commit is contained in:
Cédric Krier
2026-08-06 15:59:39 +02:00
parent 9ae6333656
commit 0565805d5b
@@ -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': (