MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / RequestAmount

Method RequestAmount

controller/topup_stripe.go:36–53  ·  view source on GitHub ↗
(c *gin.Context, req *StripePayRequest)

Source from the content-addressed store, hash-verified

34}
35
36func (*StripeAdaptor) RequestAmount(c *gin.Context, req *StripePayRequest) {
37 if req.Amount < getStripeMinTopup() {
38 c.JSON(200, gin.H{"message": "error", "data": fmt.Sprintf("充值数量不能小于 %d", getStripeMinTopup())})
39 return
40 }
41 id := c.GetInt("id")
42 group, err := model.GetUserGroup(id, true)
43 if err != nil {
44 c.JSON(200, gin.H{"message": "error", "data": "获取用户分组失败"})
45 return
46 }
47 payMoney := getStripePayMoney(float64(req.Amount), group)
48 if payMoney <= 0.01 {
49 c.JSON(200, gin.H{"message": "error", "data": "充值金额过低"})
50 return
51 }
52 c.JSON(200, gin.H{"message": "success", "data": strconv.FormatFloat(payMoney, 'f', 2, 64)})
53}
54
55func (*StripeAdaptor) RequestPay(c *gin.Context, req *StripePayRequest) {
56 if req.PaymentMethod != PaymentMethodStripe {

Callers 1

RequestStripeAmountFunction · 0.80

Calls 3

GetUserGroupFunction · 0.92
getStripeMinTopupFunction · 0.85
getStripePayMoneyFunction · 0.85

Tested by

no test coverage detected