mirror of
https://github.com/Such-Software/wowcheckout.git
synced 2026-10-17 05:51:45 +02:00
fix(profile): accept 'wownero' for default_qr_logo (was xmrcheckout literal)
ProfileResponse schema's default_qr_logo literal was inherited from xmrcheckout: Literal["monero", "none", "custom"]. The DB column (models.py) defaults to "wownero" and main.py's migration backfills NULL → ... but the backfill also wrote "monero", contradicting the column default. End result: new users got default_qr_logo="wownero" (from the column default), but GET /api/core/profile blew up with a Pydantic ResponseValidationError on serialization because "wownero" isn't in the literal. UI showed "Unavailable" for both Store ID and Primary Address because the entire profile response 500'd, leaving profileData null on the dashboard. API key + webhook secret rendered fine because those come from cookies, not profileData. Fix: - schemas.py: QrLogoMode now Literal["wownero", "monero", "none", "custom"] (keep "monero" for backward compat with any rows from before the migration ran) - schemas.py: ProfileResponse.default_qr_logo default → "wownero" - main.py: backfill UPDATE → 'wownero' (was 'monero'); migration column DEFAULT already correct as 'wownero' - ui/dashboard/page.tsx: TS type for default_qr_logo widened to include "wownero"; fallback default → "wownero" - ui/dashboard/actions.ts: DefaultQrLogoState.logo type widened; validation in updateDefaultQrLogo + initialMetadataPayload now accepts "wownero" Suchshop didn't hit this because their wowcheckout user row was created back when this UI path wasn't being used (they were provisioned via direct SQL/API). The new shop.wowne.ro merchant created via the UI today triggered the column default → exposed the schema mismatch.
This commit is contained in:
+6
-2
@@ -18,7 +18,11 @@ from .formatting import format_xmr_amount
|
||||
|
||||
InvoiceStatus = Literal["pending", "payment_detected", "confirmed", "expired", "invalid"]
|
||||
BtcpayCheckoutStyle = Literal["standard", "btcpay_classic"]
|
||||
QrLogoMode = Literal["monero", "none", "custom"]
|
||||
# "wownero" is the wowcheckout default; "monero" kept as an accepted
|
||||
# value for backward compat with any rows written before the
|
||||
# fork-rename. New rows are created with "wownero" (see models.py
|
||||
# server_default + main.py migration backfill).
|
||||
QrLogoMode = Literal["wownero", "monero", "none", "custom"]
|
||||
|
||||
|
||||
class InvoiceCreate(BaseModel):
|
||||
@@ -200,7 +204,7 @@ class ProfileResponse(BaseModel):
|
||||
id: UUID
|
||||
payment_address: str
|
||||
default_confirmation_target: conint(ge=0, le=10) = 1
|
||||
default_qr_logo: QrLogoMode = "monero"
|
||||
default_qr_logo: QrLogoMode = "wownero"
|
||||
default_qr_logo_data_url: str | None = None
|
||||
btcpay_checkout_style: BtcpayCheckoutStyle = "btcpay_classic"
|
||||
created_at: datetime
|
||||
|
||||
Reference in New Issue
Block a user