Repository navigation
Expand file tree
/
Copy pathapi_notifications.py
More file actions
72 lines (50 loc) · 1.96 KB
/
Copy pathapi_notifications.py
File metadata and controls
72 lines (50 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from enum import Enum
from typing import Any, Literal
from pydantic import BaseModel
from helloasso_api_wrapper.models.forms import FormPublicModel
from helloasso_api_wrapper.models.statistics import OrderDetail, PaymentDetail
class ApiNotificationType(str, Enum):
Payment = "Payment"
Order = "Order"
Form = "Form"
Organization = "Organization"
class PostApiUrlNotificationBody(BaseModel):
url: str
notificationType: ApiNotificationType | None = None
class ApiUrlNotificationModel(BaseModel):
url: str | None = None
apiNotificationType: ApiNotificationType | None = None
class OrganizationNotificationResultData(BaseModel):
old_slug_organization: str
new_slug_organization: str
class OrganizationNotificationResultContent(BaseModel):
eventType: Literal[ApiNotificationType.Organization]
data: OrganizationNotificationResultData
metadata: None = None # not sure
class OrderNotificationResultContent(BaseModel):
"""
metadata should contain the metadata sent while creating the checkout intent in `InitCheckoutBody`
"""
eventType: Literal[ApiNotificationType.Order]
data: OrderDetail
metadata: dict[str, Any] | None = None
class PayementNotificationResultContent(BaseModel):
"""
metadata should contain the metadata sent while creating the checkout intent in `InitCheckoutBody`
"""
eventType: Literal[ApiNotificationType.Payment]
data: PaymentDetail
metadata: dict[str, Any] | None = None
class FormNotificationResultContent(BaseModel):
eventType: Literal[ApiNotificationType.Form]
data: FormPublicModel
metadata: dict[str, Any] | None = None # not sure
NotificationResultContent = (
OrganizationNotificationResultContent
| OrderNotificationResultContent
| PayementNotificationResultContent
| FormNotificationResultContent
)
"""
When a new content is available, HelloAsso will call the notification URL callback with the corresponding data in the body.
"""