mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 10:16:15 +00:00
938396d82b
- Add multi-currency exchange rate API integration (GetRateForCoin) - Implement native TRX transfer detection alongside TRC20 USDT transfers - Replace deprecated Tronscan API with Trongrid API for better reliability - Add TRON Grid API key configuration support - Refactor order service to support multiple tokens and currencies - Update wallet address locking/unlocking to track token type - Add base58 and gjson dependencies for crypto operations - Optimize SQLite connection with WAL mode and busy timeout - Remove deprecated USDT rate job (replaced by dynamic rate API) - Update order data model to include currency and receive address fields - Enhance TRC20 callback with improved error handling and logging
31 lines
948 B
Go
31 lines
948 B
Go
package service
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/assimon/luuu/config"
|
|
"github.com/assimon/luuu/model/data"
|
|
"github.com/assimon/luuu/model/mdb"
|
|
"github.com/assimon/luuu/model/response"
|
|
)
|
|
|
|
// GetCheckoutCounterByTradeId 获取收银台详情,通过订单
|
|
func GetCheckoutCounterByTradeId(tradeId string) (*response.CheckoutCounterResponse, error) {
|
|
orderInfo, err := data.GetOrderInfoByTradeId(tradeId)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if orderInfo.ID <= 0 || orderInfo.Status != mdb.StatusWaitPay {
|
|
return nil, errors.New("不存在待支付订单或已过期!")
|
|
}
|
|
resp := &response.CheckoutCounterResponse{
|
|
TradeId: orderInfo.TradeId,
|
|
ActualAmount: orderInfo.ActualAmount,
|
|
ReceiveAddress: orderInfo.ReceiveAddress,
|
|
Token: orderInfo.Token,
|
|
ExpirationTime: orderInfo.CreatedAt.AddMinutes(config.GetOrderExpirationTime()).TimestampMilli(),
|
|
RedirectUrl: orderInfo.RedirectUrl,
|
|
}
|
|
return resp, nil
|
|
}
|