Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 17
Implement Merchant model #39
Copy link
Copy link
Closed
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Campaign: Official Campaign | FWC26area:modelspriority:p1type:feature
Description
Metadata
Metadata
Assignees
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Campaign: Official Campaign | FWC26area:modelspriority:p1type:feature
The Python
Merchantmodel must mirror the Shade backend's Prisma schema exactly. Field names are converted fromcamelCase(Prisma/JSON) tosnake_case(Python). Themerchant_idfield (frommerchantId: 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:
src/shade/models/merchant.py.Merchant(ShadeObject)with PydanticField(alias=...)for camelCase ↔ snake_case mapping.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.display_namecomputed property: returnsbusiness_nameif set, else"{first_name} {last_name}".strip(), elseemail.addressis a valid Stellar public key (starts withG, 56 chars).Acceptance Criteria:
Merchant.from_dict(api_response)correctly maps camelCase fields to snake_case attributes.merchant.merchant_idis anint.addressraisesInvalidRequestErroron construction.merchant.display_namereturns the most informative available name.settingsdict — all fields are explicitly typed.