932953bafe
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package pay
|
|
|
|
import "github.com/wangjia/pangolin/server/internal/codes"
|
|
|
|
// CatalogItem 是可购档位。SKU 与 pay 侧 products.biz_code 一一对应
|
|
// (webhook product_biz_code 原样回带);PriceMinor 仅展示(CNY 分),
|
|
// 实际扣款以 pay 侧 ProductPrice/price 为准——一致性列入联调 checklist。
|
|
type CatalogItem struct {
|
|
SKU string `json:"sku"`
|
|
Plan string `json:"plan"`
|
|
Days int `json:"days"`
|
|
PriceMinor int64 `json:"price_minor"`
|
|
Currency string `json:"currency"`
|
|
}
|
|
|
|
// Catalog 三档单源。时长取宽松口径(31/92/366 覆盖大月与最长季)。
|
|
var Catalog = []CatalogItem{
|
|
{SKU: "pro_month", Plan: string(codes.PlanPro), Days: 31, PriceMinor: 2999, Currency: "CNY"},
|
|
{SKU: "pro_quarter", Plan: string(codes.PlanPro), Days: 92, PriceMinor: 6888, Currency: "CNY"},
|
|
{SKU: "pro_year", Plan: string(codes.PlanPro), Days: 366, PriceMinor: 19999, Currency: "CNY"},
|
|
}
|
|
|
|
func CatalogBySKU(sku string) (CatalogItem, bool) {
|
|
for _, it := range Catalog {
|
|
if it.SKU == sku {
|
|
return it, true
|
|
}
|
|
}
|
|
return CatalogItem{}, false
|
|
}
|