-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
129 lines (101 loc) · 3.22 KB
/
Copy pathmodels.py
File metadata and controls
129 lines (101 loc) · 3.22 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
from datetime import datetime, timezone
from pydantic import BaseModel, Field
class Switch(BaseModel):
amount: float = 0.0
duration: int = 0
pin: int = 0
comment: bool = False
variable: bool = False
label: str | None = None
class CreateZapBox(BaseModel):
title: str
wallet: str
currency: str
switches: list[Switch]
password: str | None = None
disabled: bool = False
disposable: bool = True
teach_pin: str | None = None
touch_enabled: bool = True
auth_enabled: bool = True
tagid_base_url: str | None = None
tagid_api_key: str | None = None
class ZapBox(BaseModel):
id: str
title: str
wallet: str
currency: str
switches: list[Switch]
password: str | None = None
disabled: bool = False
disposable: bool = True
teach_pin: str | None = None
touch_enabled: bool = True
auth_enabled: bool = True
tagid_base_url: str | None = None
tagid_api_key: str | None = None
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
# obsolete field, do not use anymore
# should be deleted from the database in the future
key: str = ""
class ZapBoxPublic(BaseModel):
title: str
switches: list[Switch]
class MiniPosInvoiceRequest(BaseModel):
amount: float
currency: str
device_id: str
pin: int # relay GPIO to fire on settlement — the device's primary channel
class MiniPosPayment(BaseModel):
id: str # payment_hash
zapbox_id: str
wallet: str
sats: int
amount: float
currency: str
bolt11: str = "" # kept so a Bolt Card tap can pay this pending invoice
paid: bool = False
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
class AuthKey(BaseModel):
id: str
zapbox_id: str
pubkey: str # domain-specific linking key, hex (33-byte compressed)
label: str | None = None
enabled: bool = True
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
class CreateAuthKey(BaseModel):
zapbox_id: str
pubkey: str
label: str | None = None
enabled: bool = True
class UpdateAuthKey(BaseModel):
label: str | None = None
enabled: bool | None = None
class NfcIdentity(BaseModel):
id: str
zapbox_id: str
card_id: str
label: str | None = None
enabled: bool = True
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
class CreateNfcIdentity(BaseModel):
zapbox_id: str
card_id: str
label: str | None = None
enabled: bool = True
class UpdateNfcIdentity(BaseModel):
label: str | None = None
enabled: bool | None = None
class ZapBoxPayment(BaseModel):
id: str
zapbox_id: str
payment_hash: str
pin: int
sats: int
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
# TODO: deprecated do not use this field anymore
# should be deleted from the database in the future
payload: str = ""