87f92987b2
前端: - 集成 in_app_purchase 插件,实现 IAP 支付流程 - 添加支付模块 (payments/) 处理产品获取、购买、验证 - 积分中心页面集成 Apple Pay 购买入口 - 设置页面重构: 关于/隐私/协议直接展示,删除 legal_center 子页面 - 修复欢迎引导页滚动检测阈值问题 - 修复解卦结果页 iOS 侧滑返回手势被阻止的问题 - 邀请码绑定按钮临时禁用(待后端实现) 后端: - 新增 apple_iap_transactions 表记录交易 - 实现 Apple 服务器端验证 (App Store Server API) - 支付成功后自动发放积分 - 支持 Sandbox/Production 环境切换 - 添加退款处理和交易状态机 协议: - 更新积分流水协议,支持 purchase/refund 类型 - 新增 PAYMENT_* 错误码
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class PointsBalanceResponse(BaseModel):
|
|
model_config = ConfigDict(populate_by_name=True, serialize_by_alias=True)
|
|
|
|
balance: int = Field(ge=0)
|
|
frozen_balance: int = Field(alias="frozenBalance", ge=0)
|
|
available_balance: int = Field(alias="availableBalance", ge=0)
|
|
run_cost: int = Field(alias="runCost", gt=0)
|
|
can_run: bool = Field(alias="canRun")
|
|
|
|
|
|
class PackageInfo(BaseModel):
|
|
model_config = ConfigDict(populate_by_name=True, serialize_by_alias=True)
|
|
|
|
product_code: str = Field(alias="productCode", min_length=1, max_length=128)
|
|
app_store_product_id: str = Field(
|
|
alias="appStoreProductId", min_length=1, max_length=256
|
|
)
|
|
type: Literal["starter", "regular"]
|
|
price: float = Field(ge=0)
|
|
credits: int = Field(ge=1)
|
|
is_starter: bool = Field(alias="isStarter")
|
|
starter_eligible: bool = Field(alias="starterEligible")
|
|
sort_order: int = Field(alias="sortOrder", ge=0)
|
|
|
|
|
|
class PackagesResponse(BaseModel):
|
|
model_config = ConfigDict(populate_by_name=True, serialize_by_alias=True)
|
|
|
|
region: str = Field(min_length=1, max_length=8)
|
|
currency: str = Field(min_length=1, max_length=8)
|
|
packages: list[PackageInfo]
|