feat(api): change subscription product options and catalog endpoints to use GET method

This commit is contained in:
CaIon
2026-06-18 17:15:05 +08:00
parent b8f5ba4a31
commit 50784c10ee
4 changed files with 10 additions and 19 deletions
+5 -14
View File
@@ -103,11 +103,6 @@ func getWaffoPancakeBuyerEmail(user *model.User) string {
// the body and fall back to persisted creds when the body is blank (see
// resolveWaffoPancakeAdminCreds). Only SaveWaffoPancake writes to OptionMap.
type waffoPancakeCredsRequest struct {
MerchantID string `json:"merchant_id"`
PrivateKey string `json:"private_key"`
}
type saveWaffoPancakeRequest struct {
MerchantID string `json:"merchant_id"`
PrivateKey string `json:"private_key"`
@@ -221,15 +216,11 @@ func CreateWaffoPancakePair(c *gin.Context) {
// Doubles as a credential probe (a successful 200 proves the resolved creds
// authenticate). See resolveWaffoPancakeAdminCreds for credential resolution.
func ListWaffoPancakeCatalog(c *gin.Context) {
var req waffoPancakeCredsRequest
// An empty body means "use persisted creds"; only fail on malformed JSON.
if c.Request.ContentLength > 0 {
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "参数错误"})
return
}
}
merchantID, privateKey := resolveWaffoPancakeAdminCreds(req.MerchantID, req.PrivateKey)
// Missing query creds mean "use persisted creds".
merchantID, privateKey := resolveWaffoPancakeAdminCreds(
strings.TrimSpace(c.Query("merchant_id")),
strings.TrimSpace(c.Query("private_key")),
)
if merchantID == "" || privateKey == "" {
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "Waffo Pancake 凭证未配置"})
return