From 04cf3fa9524988dc2016c6195a9fe98493bf4512 Mon Sep 17 00:00:00 2001 From: Nicolae Natrapeiu Date: Thu, 30 Jun 2022 14:22:46 +0300 Subject: [PATCH] Forwarding processing directives only for ANY_OFFER_CHANGED notifications (only this notification type supports it now) --- sp_api/api/notifications/notifications.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sp_api/api/notifications/notifications.py b/sp_api/api/notifications/notifications.py index 18573d146..4d4632b61 100644 --- a/sp_api/api/notifications/notifications.py +++ b/sp_api/api/notifications/notifications.py @@ -50,9 +50,14 @@ def create_subscription(self, notification_type: NotificationType or str, destin 'destinationId': kwargs.pop('destinationId', destination_id), 'payloadVersion': kwargs.pop('payload_version', '1.0') } - return self._request(fill_query_params(kwargs.pop('path'), - notification_type if isinstance(notification_type, - str) else notification_type.value), + # Forwarding processing directives only for ANY_OFFER_CHANGED notifications + notification_type = notification_type if isinstance(notification_type, str)\ + else notification_type.value + processing_directive = kwargs.pop('processing_directive', None) + if processing_directive and notification_type == NotificationType.ANY_OFFER_CHANGED: + data['processingDirective'] = processing_directive + + return self._request(fill_query_params(kwargs.pop('path'), notification_type), data={**kwargs, **data}) @sp_endpoint('/notifications/v1/subscriptions/{}')