|
15 | 15 | """Functionality for preparing order details for use in creating an order""" |
16 | 16 | from __future__ import annotations # https://stackoverflow.com/a/33533514 |
17 | 17 | import logging |
18 | | -from typing import Optional, Any, Dict, List |
| 18 | +from typing import Optional, Any, Dict, List, Union |
19 | 19 |
|
20 | 20 | from . import geojson, specs |
21 | 21 | from .exceptions import ClientError |
@@ -143,7 +143,23 @@ def notifications(email: Optional[bool] = None, |
143 | 143 | webhook_per_order: Request a single webhook call per order instead |
144 | 144 | of one call per each delivered item. |
145 | 145 | ''' |
146 | | - return dict((k, v) for k, v in locals().items() if v) |
| 146 | + notifications_dict: Dict[str, Union[dict, bool]] = {} |
| 147 | + |
| 148 | + if webhook_url: |
| 149 | + webhook_dict: Dict[str, Union[str, bool]] = { |
| 150 | + 'url': webhook_url, |
| 151 | + } |
| 152 | + if webhook_per_order is not None: |
| 153 | + wpo: bool = webhook_per_order |
| 154 | + webhook_dict['per_order'] = wpo |
| 155 | + |
| 156 | + notifications_dict['webhook'] = webhook_dict |
| 157 | + |
| 158 | + if email is not None: |
| 159 | + val: bool = email |
| 160 | + notifications_dict['email'] = val |
| 161 | + |
| 162 | + return notifications_dict |
147 | 163 |
|
148 | 164 |
|
149 | 165 | def delivery(archive_type: Optional[str] = None, |
|
0 commit comments