Skip to content

Implement Merchant model #39

Description

@codebestia

The Python Merchant model must mirror the Shade backend's Prisma schema exactly. Field names are converted from camelCase (Prisma/JSON) to snake_case (Python). The merchant_id field (from merchantId: Int) is the numeric identifier stored by the Soroban contract on every invoice, making it the bridge between the backend and the on-chain world.

Proposed Steps:

  • Create src/shade/models/merchant.py.
  • Define Merchant(ShadeObject) with Pydantic Field(alias=...) for camelCase ↔ snake_case mapping.
  • Fields: id: str, merchant_id: int, address: str, account: Optional[str], email: Optional[str], first_name: Optional[str], last_name: Optional[str], business_name: Optional[str], category: Optional[str], description: Optional[str], logo: Optional[str], webhook: Optional[str], active: bool, verified: bool.
  • Add display_name computed property: returns business_name if set, else "{first_name} {last_name}".strip(), else email.
  • Validate address is a valid Stellar public key (starts with G, 56 chars).

Acceptance Criteria:

  • Merchant.from_dict(api_response) correctly maps camelCase fields to snake_case attributes.
  • merchant.merchant_id is an int.
  • A non-Stellar address raises InvalidRequestError on construction.
  • merchant.display_name returns the most informative available name.
  • The model has no generic settings dict — all fields are explicitly typed.

Activity

  1. GBOYEE commented on Jul 20, 2026

    @GBOYEE

    Hi maintainers, I can handle this one. I'll implement it to spec and add tests. I'll open a PR referencing this shortly once assigned.

  2. giftexceed commented on Jul 20, 2026

    @giftexceed
    Contributor

    I'd like to work on this issue.

    I'm a backend and blockchain developer with experience in smart contract security, system architecture, and technical documentation. I've worked on threat modeling, access control, event-driven systems, and documenting security assumptions for blockchain applications.

    For this issue, I will produce a comprehensive STRIDE threat model covering all specified trust boundaries, include clear data flow diagrams, severity assessments, and mitigation mappings, and identify any unmitigated high-risk findings with links to corresponding GitHub issues. I'll ensure the document is well-structured, reviewable, and linked from the project README to support future security audits.

  3. davieslennox0 commented on Jul 20, 2026

    @davieslennox0

    Let me get my hands on this for a quick resolve.

  4. grantfox-oss commented on Jul 22, 2026

    @grantfox-oss

    🦊 GrantFox — @giftexceed has been assigned to this issue as part of the Official Campaign | FWC26 campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #39)
    2. Your PR will be reviewed by the ShadeProtocol maintainers

    Good luck! Track your progress on GrantFox.

  5. grantfox-oss commented on Jul 24, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign | FWC26 campaign!

    @giftexceed's PR #45 was approved and merged by @codebestia.

    🏆 @giftexceed: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (592 total points). Track your full progress on GrantFox.

    👏 Great work, @giftexceed! Keep contributing to ShadeProtocol.

  6. added a commit that references this issue on Jul 24, 2026
    7652f14
  7. added a commit that references this issue on Jul 24, 2026
    ff6c8da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions