fix: 回退签名修改,保留钱包地址获取增强
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,7 @@ func NewPaymentHandler() *PaymentHandler {
|
|||||||
type BepUsdtCreateRequest struct {
|
type BepUsdtCreateRequest struct {
|
||||||
TradeType string `json:"trade_type,omitempty"`
|
TradeType string `json:"trade_type,omitempty"`
|
||||||
OrderID string `json:"order_id"`
|
OrderID string `json:"order_id"`
|
||||||
Amount string `json:"amount"`
|
Amount float64 `json:"amount"`
|
||||||
NotifyURL string `json:"notify_url"`
|
NotifyURL string `json:"notify_url"`
|
||||||
RedirectURL string `json:"redirect_url,omitempty"`
|
RedirectURL string `json:"redirect_url,omitempty"`
|
||||||
Signature string `json:"signature"`
|
Signature string `json:"signature"`
|
||||||
@@ -90,12 +90,9 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
|
|||||||
notifyURL := fmt.Sprintf("%s/api/payment/bepusdt/notify", baseURL)
|
notifyURL := fmt.Sprintf("%s/api/payment/bepusdt/notify", baseURL)
|
||||||
redirectURL := fmt.Sprintf("%s/orders/%d", baseURL, order.ID)
|
redirectURL := fmt.Sprintf("%s/orders/%d", baseURL, order.ID)
|
||||||
|
|
||||||
// 格式化amount,确保签名和请求中的格式一致
|
|
||||||
amountStr := strconv.FormatFloat(order.TotalAmount, 'f', 2, 64)
|
|
||||||
|
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"order_id": strconv.Itoa(int(order.ID)),
|
"order_id": strconv.Itoa(int(order.ID)),
|
||||||
"amount": amountStr,
|
"amount": fmt.Sprint(order.TotalAmount),
|
||||||
"notify_url": notifyURL,
|
"notify_url": notifyURL,
|
||||||
"redirect_url": redirectURL,
|
"redirect_url": redirectURL,
|
||||||
}
|
}
|
||||||
@@ -111,7 +108,7 @@ func (h *PaymentHandler) CreatePayment(c *gin.Context) {
|
|||||||
reqBody := BepUsdtCreateRequest{
|
reqBody := BepUsdtCreateRequest{
|
||||||
TradeType: tradeType,
|
TradeType: tradeType,
|
||||||
OrderID: strconv.Itoa(int(order.ID)),
|
OrderID: strconv.Itoa(int(order.ID)),
|
||||||
Amount: amountStr,
|
Amount: order.TotalAmount,
|
||||||
NotifyURL: notifyURL,
|
NotifyURL: notifyURL,
|
||||||
RedirectURL: redirectURL,
|
RedirectURL: redirectURL,
|
||||||
Signature: signature,
|
Signature: signature,
|
||||||
|
|||||||
Reference in New Issue
Block a user