Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sp_api/api/notifications/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/{}')
Expand Down