refactor: extract simpler methods

This commit is contained in:
Vlad Stan 2023-03-06 18:01:05 +02:00
parent 35298a4f44
commit 1b317b1b9b
2 changed files with 46 additions and 52 deletions

View file

@ -256,6 +256,7 @@ class OrderContact(BaseModel):
nostr: Optional[str]
phone: Optional[str]
email: Optional[str]
address: Optional[str]
class PartialOrder(BaseModel):
@ -307,15 +308,3 @@ class PaymentRequest(BaseModel):
id: str
message: Optional[str]
payment_options: List[PaymentOption]
def to_nostr_event(self, author_pubkey: str, to_pubkey: str) -> NostrEvent:
event = NostrEvent(
pubkey=author_pubkey,
created_at=round(time.time()),
kind=4,
tags=[["p", to_pubkey]],
content=json.dumps(self.dict(), separators=(",", ":"), ensure_ascii=False),
)
event.id = event.event_id
return event