feat: update shipping zone when re-issuing invoice

This commit is contained in:
Vlad Stan 2023-07-04 18:13:17 +03:00
parent b5aed1224a
commit 02d9fcfbfd
5 changed files with 100 additions and 30 deletions

View file

@ -45,6 +45,7 @@ class MerchantConfig(MerchantProfile):
active: bool = False
restore_in_progress: Optional[bool] = False
class PartialMerchant(BaseModel):
private_key: str
public_key: str
@ -400,6 +401,11 @@ class OrderStatusUpdate(BaseModel):
shipped: Optional[bool]
class OrderReissue(BaseModel):
id: str
shipping_id: Optional[str] = None
class PaymentOption(BaseModel):
type: str
link: str
@ -414,14 +420,15 @@ class PaymentRequest(BaseModel):
######################################## MESSAGE ########################################
class DirectMessageType(Enum):
"""Various types os direct messages."""
PLAIN_TEXT = -1
CUSTOMER_ORDER = 0
PAYMENT_REQUEST = 1
ORDER_PAID_OR_SHIPPED = 2
class PartialDirectMessage(BaseModel):
event_id: Optional[str]
event_created_at: Optional[int]
@ -437,7 +444,7 @@ class PartialDirectMessage(BaseModel):
msg_json = json.loads(msg)
if "type" in msg_json:
return DirectMessageType(msg_json["type"]), msg_json
return DirectMessageType.PLAIN_TEXT, None
except Exception:
return DirectMessageType.PLAIN_TEXT, None
@ -452,7 +459,6 @@ class DirectMessage(PartialDirectMessage):
return dm
######################################## CUSTOMERS ########################################
@ -471,5 +477,7 @@ class Customer(BaseModel):
@classmethod
def from_row(cls, row: Row) -> "Customer":
customer = cls(**dict(row))
customer.profile = CustomerProfile(**json.loads(row["meta"])) if "meta" in row else None
customer.profile = (
CustomerProfile(**json.loads(row["meta"])) if "meta" in row else None
)
return customer