Skip to content

Implement Payment model #37

Description

@codebestia

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions