aboutsummaryrefslogtreecommitdiffstats
path: root/thallium-backend/src/dto/orders.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-09-13 19:38:02 +0100
committerGravatar Chris Lovering <[email protected]>2024-09-13 19:38:02 +0100
commit1cf3fce85817d4520cd9e98c5c456bf693cc787b (patch)
treeb8def6a2164ac53401d74f7a3ad654aba556246b /thallium-backend/src/dto/orders.py
parentAlso accept a quantity for order items (diff)
Set the external_id of the printful order to the voucher id
Diffstat (limited to 'thallium-backend/src/dto/orders.py')
-rw-r--r--thallium-backend/src/dto/orders.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/thallium-backend/src/dto/orders.py b/thallium-backend/src/dto/orders.py
index f4864ab..848e7fc 100644
--- a/thallium-backend/src/dto/orders.py
+++ b/thallium-backend/src/dto/orders.py
@@ -2,6 +2,8 @@ from decimal import Decimal
from pydantic import BaseModel
+from src.dto import Voucher
+
class OrderRecipient(BaseModel):
"""Information about the recipient of the order."""
@@ -35,9 +37,10 @@ class OrderCreate(BaseModel):
recipient: OrderRecipient
items: list[OrderItem]
- def as_printful_payload(self) -> dict:
+ def as_printful_payload(self, voucher: Voucher) -> dict:
"""Return this order in the format used by Printful's API."""
return {
+ "external_id": voucher.id,
"recipient": self.recipient.model_dump(),
"items": [item.model_dump() for item in self.items],
}