Repository: planetlabs/planet-client-python
Issue: Webhook configurations removed

Hi, 

I am trying to create order requests and pass a webhook url along. 
By using the below code I receive a dictionary that includes the notification info. 
```python
if notification:
            notifications = order_request.notifications(
                webhook_per_order=True,
                webhook_url="https://gvh6r5vpajgsyx5gtgfcww2wgu0jkkzr.lambda-url.eu-central-1.on.aws/",
                email=False,
            )

        request = order_request.build_request(
            order_uuid,
            products=products,
            tools=tools,
            notifications=notifications if notifications else None,
        )
```

Here is the output
```
{'name': '85d30923-a7fe-4827-b1f2-dfe41b204100',
 'products': [{'item_ids': ['20230315_010037_23_2479',
    '20230315_010039_44_2479',
    '20230315_002318_33_241d'],
   'item_type': 'PSScene',
   'product_bundle': 'analytic_8b_sr_udm2'}],
 'notifications': {'webhook_url': '<placeholder>',
  'webhook_per_order': True},
 'tools': [{'clip': {'aoi': {'type': 'Polygon',
     'coordinates': (((140.3887524, 35.6184291),
       (140.3886867, 35.6179788),
       (140.3886813, 35.6179189),
       (140.3890716, 35.6178775),
       (140.3891265, 35.6182612),
       (140.3890541, 35.6182688),
       (140.3890662, 35.6183953),
       (140.3887524, 35.6184291)),)}}}]}
```

Once I submit the order request the response is missing the notification settings
```
{'_links': {'_self': 'https://api.planet.com/compute/ops/orders/v2/7e73a5b7-c9c1-46be-a811-0519b095648e'},
 'created_on': '2023-04-12T12:39:14.249Z',
 'error_hints': [],
 'id': '7e73a5b7-c9c1-46be-a811-0519b095648e',
 'last_message': 'Preparing order',
 'last_modified': '2023-04-12T12:39:14.249Z',
 'name': '85d30923-a7fe-4827-b1f2-dfe41b204100',
 'notifications': {},
 'products': [{'item_ids': ['20230315_010037_23_2479',
    '20230315_010039_44_2479',
    '20230315_002318_33_241d'],
   'item_type': 'PSScene',
   'product_bundle': 'analytic_8b_sr_udm2'}],
 'state': 'queued',
 'tools': [{'clip': {'aoi': {'coordinates': [[[140.3887524, 35.6184291],
       [140.3886867, 35.6179788],
       [140.3886813, 35.6179189],
       [140.3890716, 35.6178775],
       [140.3891265, 35.6182612],
       [140.3890541, 35.6182688],
       [140.3890662, 35.6183953],
       [140.3887524, 35.6184291]]],
     'type': 'Polygon'}}}]}
```

When I manually add them like this 
```python
request['notifications'] ={"webhook":{
         "per_order": False,
         "url":"https://gvh6r5vpajgsyx5gtgfcww2wgu0jkkzr.lambda-url.eu-central-1.on.aws/"
      }}
```

the notification settings are accepted and kept in the submission response. Not sure if I am making a mistake or this is a bug.

Thanks for looking into it. 


Changed files:
tests/unit/test_order_request.py, planet/order_request.py

diff --git a/planet/order_request.py b/planet/order_request.py
index 4f5410c..f7ab105 100644
--- a/planet/order_request.py
+++ b/planet/order_request.py
@@ -15,7 +15,7 @@
 """Functionality for preparing order details for use in creating an order"""
 from __future__ import annotations  # https://stackoverflow.com/a/33533514
 import logging
-from typing import Optional, Any, Dict, List
+from typing import Optional, Any, Dict, List, Union
 
 from . import geojson, specs
 from .exceptions import ClientError
@@ -143,7 +143,23 @@ def notifications(email: Optional[bool] = None,
         webhook_per_order: Request a single webhook call per order instead
             of one call per each delivered item.
     '''
-    return dict((k, v) for k, v in locals().items() if v)
+    notifications_dict: Dict[str, Union[dict, bool]] = {}
+
+    if webhook_url:
+        webhook_dict: Dict[str, Union[str, bool]] = {
+            'url': webhook_url,
+        }
+        if webhook_per_order is not None:
+            wpo: bool = webhook_per_order
+            webhook_dict['per_order'] = wpo
+
+        notifications_dict['webhook'] = webhook_dict
+
+    if email is not None:
+        val: bool = email
+        notifications_dict['email'] = val
+
+    return notifications_dict
 
 
 def delivery(archive_type: Optional[str] = None,
diff --git a/tests/unit/test_order_request.py b/tests/unit/test_order_request.py
index 48f3be0..1b21c22 100644
--- a/tests/unit/test_order_request.py
+++ b/tests/unit/test_order_request.py
@@ -46,9 +46,9 @@ def test_build_request():
         }
     }
     notifications = {
-        'email': 'email',
-        'webhook_url': 'webhookurl',
-        'webhook_per_order': True
+        'email': 'email', 'webhook': {
+            'url': 'webhookurl', 'per_order': True
+        }
     }
     order_type = 'partial'
     tool = {'bandmath': 'jsonstring'}
@@ -119,11 +119,11 @@ def test_product():
 
 def test_notifications():
     notifications_config = order_request.notifications(
-        email='email', webhook_url='webhookurl', webhook_per_order=True)
+        email=True, webhook_url='webhookurl', webhook_per_order=True)
     expected = {
-        'email': 'email',
-        'webhook_url': 'webhookurl',
-        'webhook_per_order': True
+        'email': True, 'webhook': {
+            'url': 'webhookurl', 'per_order': True
+        }
     }
     assert notifications_config == expected