|
@@ -23,6 +23,7 @@ from jinja2 import Environment, PackageLoader, select_autoescape
|
|
|
|
|
|
from .. import errors
|
|
from .. import errors
|
|
from ..messaging import create_message, parse_message
|
|
from ..messaging import create_message, parse_message
|
|
|
|
+from ..utils import generate_id
|
|
|
|
|
|
class VTNService:
|
|
class VTNService:
|
|
|
|
|
|
@@ -49,11 +50,15 @@ class VTNService:
|
|
response_type, response_payload = result
|
|
response_type, response_payload = result
|
|
else:
|
|
else:
|
|
response_type, response_payload = 'oadrResponse', {}
|
|
response_type, response_payload = 'oadrResponse', {}
|
|
|
|
+
|
|
response_payload['vtn_id'] = self.vtn_id
|
|
response_payload['vtn_id'] = self.vtn_id
|
|
|
|
+ if 'ven_id' in message_payload:
|
|
|
|
+ response_payload['ven_id'] = message_payload['ven_id']
|
|
|
|
|
|
response_payload['response'] = {'request_id': message_payload.get('request_id', None),
|
|
response_payload['response'] = {'request_id': message_payload.get('request_id', None),
|
|
'response_code': 200,
|
|
'response_code': 200,
|
|
'response_description': 'OK'}
|
|
'response_description': 'OK'}
|
|
|
|
+ response_payload['request_id'] = generate_id()
|
|
|
|
|
|
# Create the XML response
|
|
# Create the XML response
|
|
msg = self._create_message(response_type, **response_payload)
|
|
msg = self._create_message(response_type, **response_payload)
|
|
@@ -63,8 +68,10 @@ class VTNService:
|
|
|
|
|
|
else:
|
|
else:
|
|
msg = self._create_message('oadrResponse',
|
|
msg = self._create_message('oadrResponse',
|
|
|
|
+ ven_id=message_payload.get('ven_id'),
|
|
status_code=errorcodes.COMPLIANCE_ERROR,
|
|
status_code=errorcodes.COMPLIANCE_ERROR,
|
|
status_description=f"A message of type {message_type} should not be sent to this endpoint")
|
|
status_description=f"A message of type {message_type} should not be sent to this endpoint")
|
|
|
|
+
|
|
response = web.Response(
|
|
response = web.Response(
|
|
text=msg,
|
|
text=msg,
|
|
status=HTTPStatus.BAD_REQUEST,
|
|
status=HTTPStatus.BAD_REQUEST,
|