Represents a Shade payment resource returned by the API. All monetary amounts should be stored as Decimal to avoid floating-point precision issues.
Proposed Steps:
- Create
src/shade/models/payment.py.
- Fields:
id: str, status: str, amount: Decimal, currency: str, description: Optional[str], merchant_id: str, stellar_tx_hash: Optional[str], payment_address: str, created_at: datetime, updated_at: datetime.
- Add a
PaymentStatus StrEnum with values: pending, completed, cancelled, expired, partially_paid.
- Validate that
amount > 0.
Acceptance Criteria:
Payment.from_dict(api_response) constructs the model without error.
payment.amount is a Decimal, not a float.
payment.status is a PaymentStatus enum value.
- Invalid status strings raise a clear validation error.
Represents a Shade payment resource returned by the API. All monetary amounts should be stored as
Decimalto avoid floating-point precision issues.Proposed Steps:
src/shade/models/payment.py.id: str,status: str,amount: Decimal,currency: str,description: Optional[str],merchant_id: str,stellar_tx_hash: Optional[str],payment_address: str,created_at: datetime,updated_at: datetime.PaymentStatusStrEnumwith values:pending,completed,cancelled,expired,partially_paid.amount > 0.Acceptance Criteria:
Payment.from_dict(api_response)constructs the model without error.payment.amountis aDecimal, not afloat.payment.statusis aPaymentStatusenum value.