feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -27,7 +27,7 @@ func SubscriptionRequestStripePay(c *gin.Context) {
|
||||
|
||||
var req SubscriptionStripePayRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil || req.PlanId <= 0 {
|
||||
common.ApiErrorMsg(c, "参数错误")
|
||||
common.ApiErrorT(c, "Invalid parameters")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -37,19 +37,19 @@ func SubscriptionRequestStripePay(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if !plan.Enabled {
|
||||
common.ApiErrorMsg(c, "套餐未启用")
|
||||
common.ApiErrorT(c, "Subscription plan is not enabled")
|
||||
return
|
||||
}
|
||||
if plan.StripePriceId == "" {
|
||||
common.ApiErrorMsg(c, "该套餐未配置 StripePriceId")
|
||||
common.ApiErrorT(c, "StripePriceId is not configured for this plan")
|
||||
return
|
||||
}
|
||||
if !strings.HasPrefix(setting.StripeApiSecret, "sk_") && !strings.HasPrefix(setting.StripeApiSecret, "rk_") {
|
||||
common.ApiErrorMsg(c, "Stripe 未配置或密钥无效")
|
||||
common.ApiErrorT(c, "Stripe is not configured or key is invalid")
|
||||
return
|
||||
}
|
||||
if setting.StripeWebhookSecret == "" {
|
||||
common.ApiErrorMsg(c, "Stripe Webhook 未配置")
|
||||
common.ApiErrorT(c, "Stripe webhook is not configured")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func SubscriptionRequestStripePay(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if user == nil {
|
||||
common.ApiErrorMsg(c, "用户不存在")
|
||||
common.ApiErrorT(c, "User does not exist")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func SubscriptionRequestStripePay(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if count >= int64(plan.MaxPurchasePerUser) {
|
||||
common.ApiErrorMsg(c, "已达到该套餐购买上限")
|
||||
common.ApiErrorT(c, "Purchase limit for this plan has been reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -81,8 +81,8 @@ func SubscriptionRequestStripePay(c *gin.Context) {
|
||||
|
||||
payLink, err := genStripeSubscriptionLink(referenceId, user.StripeCustomer, user.Email, plan.StripePriceId)
|
||||
if err != nil {
|
||||
logger.LogError(c.Request.Context(), fmt.Sprintf("Stripe 订阅支付链接创建失败 trade_no=%s plan_id=%d error=%q", referenceId, plan.Id, err.Error()))
|
||||
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "拉起支付失败"})
|
||||
logger.LogError(c.Request.Context(), common.LogText("Stripe failed to create subscription payment link trade_no=%s plan_id=%d error=%q", referenceId, plan.Id, err.Error()))
|
||||
paymentError(c, common.NewMessage("Failed to start payment"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func SubscriptionRequestStripePay(c *gin.Context) {
|
||||
Status: common.TopUpStatusPending,
|
||||
}
|
||||
if err := order.Insert(); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"message": "error", "data": "创建订单失败"})
|
||||
paymentError(c, common.NewMessage("Failed to create order"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user