feat: add unified checkout template

This commit is contained in:
v03413
2026-06-21 01:24:12 +08:00
parent c350868195
commit 5e598cd2f3
130 changed files with 2331 additions and 8277 deletions
+7 -10
View File
@@ -7,7 +7,7 @@
# BEpusdt (Better Easy Payment USDT)
<p align="center">
<img src="./static/payment/assets/img/tether.svg" width="15%" alt="tether">
<img src="./static/checkout/official/assets/img/bepusdt.svg" width="15%" alt="tether">
</p>
<p align="center">
<a href="https://www.gnu.org/licenses/gpl-3.0.html">
@@ -31,6 +31,8 @@
缘起于`Epusdt`,但不仅限于此,加入了一些新特性,致力于成为一款更好用的个人`加密货币`收款网关。
> 请须知:原始 EPusdt 项目已被转手,与本项目没任何联系、两个项目完全独立运营,[具体说明](./docs/faq/epusdt.md)。
## 🎉 新特性
### 🌟 目前支持收款网络
@@ -42,13 +44,8 @@
- ️✅ 支持主流区块网络 不仅限于`USDT`
- ✅ 支持主流法定货币 汇率自动更新
- ✅ 轻依赖 单体二进制文件 部署便捷
- ✅ 支持非订单交易监控 余额变动通知
- ✅ 支持自定义支付精度与递增颗粒度
- ✅ 底层区块扫描 安全确认 速度稳定
- ✅ 支持波场能量代理 回收实时监控
- ✅ 原生兼容`易支付`收单 接入便捷
- ✅ 完整独立WEB后台 方便配置管理
- ✅ 收银台支持多语言适配 助力出海需求
- ✅ 地址独占模式 底层支持不定额收款
- ✅ 支持MQTT消息发布 交易信息即时广播
- ✅ 快速迭代期 超多实用特性功能等你发现
@@ -65,13 +62,13 @@ docker run -d --restart=unless-stopped -p 8080:8080 v03413/bepusdt:latest
- 安装:[Docker](docs/docker/docker.md) [Linux](docs/linux/install.md) [1Panel](./docs/1panel/README.md) [宝塔](./docs/bt_panel/README.md)
- 开发:[API对接](docs/api/api.md) [订单回调](docs/notify/readme.md) [Python](https://github.com/luoyanglang/bepusdt-python-sdk) [PHP](https://github.com/v03413/bepusdt-php-sdk)
- 对接:[独角Next](docs/api/dujiao-next/dujiao-next.md) [彩虹易支付](https://github.com/v03413/Epay-BEpusdt) [whmcs](https://github.com/v03413/whmcs-gateway-epusdt) [其它](docs/api/other.md)
- 其它:[https 配置](./docs/ssl.md) [时钟同步](docs/linux/systemd-timesyncd.md) [收银台修改](docs/payment-template/README.md)
- 其它:[https 配置](./docs/ssl.md) [时钟同步](docs/linux/systemd-timesyncd.md) [收银台修改](docs/checkout/README.md)
## 🖼 功能截图
| 前台收银 | 后台订单 | Telegram 通知 |
|-------------------------------------------------|--------------------------------------------------|--------------------------------------------------------|
| <img src=./docs/images/1.png alt=收银台 width=300> | <img src=./docs/images/2.png alt=后台订单 width=300> | <img src=./docs/images/3.png alt=Telegram通知 width=300> |
| 前台收银 | 后台订单 | 订单通知 |
|--------------------------------------------------------|------------------------------------------------------|---------------------------------------------------------------|
| <img src=./docs/images/checkout.png alt=收银台 width=300> | <img src=./docs/images/admin.png alt=后台订单 width=300> | <img src=./docs/images/telegram.png alt=Telegram通知 width=300> |
## ❓ 常见问题
+5 -1
View File
@@ -6,7 +6,11 @@ const (
)
const Debug = false
const Api = "https://api.bepusdt.online"
const (
Pid = "1000" // 暂时固定易支付商户ID
Api = "https://api.bepusdt.online"
)
const (
Ton = "ton" // The Open Network
+4 -26
View File
@@ -2,7 +2,6 @@ package admin
import (
"encoding/json"
"fmt"
"strings"
"time"
@@ -108,12 +107,6 @@ func (Conf) Sets(ctx *gin.Context) {
data = append(data, model.Conf{K: model.ConfKey(k), V: v})
}
if err := validateConfSets(data); err != nil {
base.BadRequest(ctx, err.Error())
return
}
model.Db.Where("k IN ?", keys).Delete(&model.Conf{})
model.Db.Create(&data)
@@ -122,25 +115,6 @@ func (Conf) Sets(ctx *gin.Context) {
base.Ok(ctx, "配置成功")
}
func validateConfSets(data []model.Conf) error {
for _, v := range data {
if v.K == model.PaymentStaticPath && v.V != "" && !utils.IsExist(v.V) {
return fmt.Errorf("静态资源路径不存在,请确认后重新配置:%s", v.V)
}
if v.K == model.PaymentTemplate && !model.IsValidPaymentTemplateMode(v.V) {
return fmt.Errorf("收银台模板模式不支持:%s", v.V)
}
if v.K == model.PaymentTemplateLanguage && !model.IsValidPaymentTemplateLanguage(v.V) {
return fmt.Errorf("收银台默认语言不支持:%s", v.V)
}
if v.K == model.ApiAuthToken {
return fmt.Errorf("安全考虑,不允许自定义修改 API 对接令牌")
}
}
return nil
}
func (Conf) Rpc(ctx *gin.Context) {
var keys = []model.ConfKey{
model.RpcEndpointPlasma,
@@ -199,6 +173,10 @@ func (Conf) NotifierTest(ctx *gin.Context) {
base.Ok(ctx, "发送测试成功")
}
func (Conf) CheckoutList(ctx *gin.Context) {
base.Ok(ctx, model.CheckoutList())
}
func (Conf) ResetApiAuthToken(ctx *gin.Context) {
model.SetK(model.ApiAuthToken, strings.ToUpper(utils.Md5String(utils.StrSha256(time.Now().String()))))
-69
View File
@@ -1,69 +0,0 @@
package admin
import (
"path/filepath"
"testing"
"github.com/v03413/bepusdt/app/model"
)
func TestValidateConfSetsRejectsInvalidPaymentTemplate(t *testing.T) {
err := validateConfSets([]model.Conf{
{K: model.PaymentTemplate, V: "modern"},
})
if err == nil {
t.Fatal("expected invalid payment template to be rejected")
}
}
func TestValidateConfSetsAllowsKnownPaymentTemplates(t *testing.T) {
for _, mode := range []string{"official", "wolf", "custom"} {
t.Run(mode, func(t *testing.T) {
err := validateConfSets([]model.Conf{
{K: model.PaymentTemplate, V: mode},
})
if err != nil {
t.Fatalf("validateConfSets(%q) returned error: %v", mode, err)
}
})
}
}
func TestValidateConfSetsRejectsInvalidPaymentTemplateLanguage(t *testing.T) {
err := validateConfSets([]model.Conf{
{K: model.PaymentTemplateLanguage, V: "de"},
})
if err == nil {
t.Fatal("expected invalid payment template language to be rejected")
}
}
func TestValidateConfSetsAllowsKnownPaymentTemplateLanguages(t *testing.T) {
for _, language := range []string{"auto", "zh", "zh-Hant", "en", "ru", "vi", "tr", "ja", "ko"} {
t.Run(language, func(t *testing.T) {
err := validateConfSets([]model.Conf{
{K: model.PaymentTemplateLanguage, V: language},
})
if err != nil {
t.Fatalf("validateConfSets(%q) returned error: %v", language, err)
}
})
}
}
func TestValidateConfSetsKeepsExistingGuards(t *testing.T) {
err := validateConfSets([]model.Conf{
{K: model.ApiAuthToken, V: "manual-token"},
})
if err == nil {
t.Fatal("expected api token changes to be rejected")
}
missing := filepath.Join(t.TempDir(), "missing-payment-assets")
err = validateConfSets([]model.Conf{
{K: model.PaymentStaticPath, V: missing},
})
if err == nil {
t.Fatal("expected missing static path to be rejected")
}
}
+1 -1
View File
@@ -71,7 +71,7 @@ func (Order) Create(ctx *gin.Context) {
}
// NotifyURL RedirectURL 同为付款链接
url := model.CheckoutCashier(host, order.TradeId)
url := model.CheckoutUrl(host, order.TradeId)
// Update order with generated URLs
hostUri := model.GetK(model.ApiAppUri)
+1 -11
View File
@@ -5,7 +5,6 @@ import (
"encoding/hex"
"fmt"
"net/http"
"net/url"
"sort"
"github.com/gin-gonic/gin"
@@ -112,7 +111,7 @@ func (e Epay) Submit(ctx *gin.Context) {
host = "https://" + ctx.Request.Host
}
ctx.Redirect(http.StatusFound, model.CheckoutCounter(host, order.TradeId))
ctx.Redirect(http.StatusFound, model.CheckoutUrl(host, order.TradeId))
}
// verify 验证请求参数
@@ -186,12 +185,3 @@ func (e Epay) sign(data map[string]string, token string) string {
return md5sum
}
func BuildNotifyParams(order model.Order) string {
var signStr = utils.Md5String(fmt.Sprintf("money=%s&name=%s&out_trade_no=%s&pid=%s&trade_no=%s&trade_status=TRADE_SUCCESS&type=%s",
cast.ToString(order.Money), order.Name, order.OrderId, Pid, order.TradeId, order.TradeType) + model.AuthToken())
var params = fmt.Sprintf("money=%s&name=%s&out_trade_no=%s&pid=%s&trade_no=%s&trade_status=TRADE_SUCCESS&type=%s",
cast.ToString(order.Money), url.QueryEscape(order.Name), url.QueryEscape(order.OrderId), Pid, order.TradeId, order.TradeType)
return fmt.Sprintf("%s&sign=%s", params, signStr)
}
+79 -277
View File
@@ -4,16 +4,11 @@ import (
"bytes"
"encoding/json"
"fmt"
"html/template"
"io"
"net/url"
"sort"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
"github.com/v03413/bepusdt/app/handler/epay"
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model"
"github.com/v03413/bepusdt/app/utils"
@@ -58,59 +53,15 @@ type cancelReq struct {
Signature string `json:"signature" binding:"required"`
}
type infoReq struct {
TradeID string `json:"trade_id" binding:"required"`
}
type methodsReq struct {
TradeID string `json:"trade_id" binding:"required"`
Currency string `json:"currency"`
}
type PaymentItem struct {
Amount string `json:"amount"`
ActualAmount string `json:"actual_amount"`
Fiat string `json:"fiat"`
ExchangeRate string `json:"exchange_rate"`
Currency string `json:"currency"`
Network string `json:"network"`
TokenNetName string `json:"token_net_name"`
TokenCustomName string `json:"token_custom_name"`
IsPopular bool `json:"is_popular"`
}
func (Epusdt) SignVerify(ctx *gin.Context) {
rawData, err := ctx.GetRawData()
if err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据读取错误 %s", err.Error())))
ctx.Abort()
return
}
m := make(map[string]any)
if err = json.Unmarshal(rawData, &m); err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据解析错误 %s", err.Error())))
ctx.Abort()
return
}
sign, ok := m["signature"]
if !ok {
ctx.JSON(200, respFailJson("签名丢失"))
ctx.Abort()
return
}
if utils.EpusdtSign(m, model.AuthToken()) != sign {
ctx.JSON(200, respFailJson("签名错误"))
ctx.Abort()
return
}
ctx.Request.Body = io.NopCloser(bytes.NewBuffer(rawData)) // 回写数据
ctx.Next()
}
func (Epusdt) Notify(ctx *gin.Context) {
rawData, err := ctx.GetRawData()
if err != nil {
@@ -138,7 +89,6 @@ func (Epusdt) Notify(ctx *gin.Context) {
ctx.String(200, "ok")
}
// CreateOrder Order creation API
func (Epusdt) CreateOrder(ctx *gin.Context) {
var req createOrderReq
if err := ctx.ShouldBindJSON(&req); err != nil {
@@ -196,12 +146,11 @@ func (Epusdt) CreateOrder(ctx *gin.Context) {
"status": order.Status,
"amount": order.Money,
"expiration_time": uint64(order.ExpiredAt.Sub(time.Now()).Seconds()),
"payment_url": model.CheckoutCashier(host, order.TradeId),
"network": GetPaymentItem("", order),
"payment_url": model.CheckoutUrl(host, order.TradeId),
"network": order.GetMethods(""),
}))
}
// UpdateOrder 更新订单,返回付款链接。更新订单不需要签名,因为创建订单时已经验证,只需要提交参数更新订单即可。
func (Epusdt) UpdateOrder(ctx *gin.Context) {
// 接收 trade_id, currency, network 三个参数
var req updateOrderReq
@@ -261,7 +210,7 @@ func (Epusdt) UpdateOrder(ctx *gin.Context) {
"actual_amount": newOrder.Amount,
"token": newOrder.Address,
"expiration_time": uint64(newOrder.ExpiredAt.Sub(time.Now()).Seconds()),
"payment_url": model.CheckoutCounter(host, newOrder.TradeId),
"payment_url": model.CheckoutUrl(host, newOrder.TradeId),
}))
}
@@ -324,7 +273,7 @@ func (Epusdt) CreateTransaction(ctx *gin.Context) {
"actual_amount": order.Amount,
"token": order.Address,
"expiration_time": uint64(order.ExpiredAt.Sub(time.Now()).Seconds()),
"payment_url": model.CheckoutCounter(utils.GetRequestHost(ctx.Request), order.TradeId),
"payment_url": model.CheckoutUrl(utils.GetRequestHost(ctx.Request), order.TradeId),
}))
}
@@ -358,255 +307,109 @@ func (Epusdt) CancelTransaction(ctx *gin.Context) {
ctx.JSON(200, respSuccJson(gin.H{"trade_id": req.TradeID}))
}
func (Epusdt) CheckoutCounter(ctx *gin.Context) {
func (Epusdt) Checkout(ctx *gin.Context) {
tradeId := ctx.Param("trade_id")
order, ok := model.GetTradeOrder(tradeId)
if !ok {
ctx.String(200, "订单不存在")
return
}
uri, err := url.ParseRequestURI(order.ReturnUrl)
if err != nil {
ctx.String(200, "同步地址错误")
log.Error("同步地址解析错误", err.Error())
return
}
ctx.HTML(200, checkoutCounterTemplateName(model.GetPaymentTemplateMode(), order.TradeType), gin.H{
"http_host": uri.Host,
"amount": order.Amount,
"address": order.Address,
"expire": int64(order.ExpiredAt.Sub(time.Now()).Seconds()),
"return_url": order.ReturnUrl,
"usdt_rate": order.Rate,
"trade_id": tradeId,
"order_id": order.OrderId,
"trade_type": order.TradeType,
"name": order.Name,
"money": order.Money,
"fiat": order.Fiat,
"default_language": string(model.GetPaymentTemplateLanguage()),
"network": jsonScript(GetPaymentItem("", order)),
"selected_payment": jsonScript(GetSelectedPayment(order)),
})
}
func (Epusdt) CheckoutCashier(ctx *gin.Context) {
tradeId := ctx.Param("trade_id")
order, ok := model.GetTradeOrder(tradeId)
if !ok {
if _, ok := model.GetTradeOrder(tradeId); !ok {
ctx.String(200, "order not found")
return
}
uri, err := url.ParseRequestURI(order.ReturnUrl)
if err != nil {
ctx.String(200, "sync address error")
log.Error("CheckoutCashier: sync address error: ", err.Error())
// 收银台模板
tmpl := model.GetC(model.PaymentCheckout) + "/checkout.html"
return
}
ctx.HTML(200, checkoutCashierTemplateName(model.GetPaymentTemplateMode()), gin.H{
"http_host": uri.Host,
"amount": order.Amount,
"expire": int64(order.ExpiredAt.Sub(time.Now()).Seconds()),
"return_url": order.ReturnUrl,
"trade_id": tradeId,
"order_id": order.OrderId,
"name": order.Name,
"money": order.Money,
"fiat": order.Fiat,
"default_language": string(model.GetPaymentTemplateLanguage()),
"network": jsonScript(GetPaymentItem("", order)),
"selected_payment": jsonScript(GetSelectedPayment(order)),
})
ctx.HTML(200, tmpl, gin.H{"trade_id": tradeId})
}
func checkoutCashierTemplateName(mode model.PaymentTemplateMode) string {
if mode == model.PaymentTemplateWolf {
return "wolf.cashier.html"
}
return "cashier.html"
}
func checkoutCounterTemplateName(mode model.PaymentTemplateMode, tradeType model.TradeType) string {
if mode == model.PaymentTemplateWolf {
return "wolf.checkout.html"
}
return string(tradeType + ".html")
}
func GetSelectedPayment(order model.Order) gin.H {
if order.TradeType == "" || order.Address == "" {
return nil
}
conf, ok := model.GetAllTradeConfig()[string(order.TradeType)]
if !ok {
return nil
}
return gin.H{
"actual_amount": order.Amount,
"currency": string(conf.Crypto),
"network": string(conf.Network),
"token_net_name": conf.NetworkName,
"address": order.Address,
"token": order.Address,
}
}
func jsonScript(value any) template.JS {
data, err := json.Marshal(value)
if err != nil {
return template.JS("null")
}
return template.JS(data)
}
func (Epusdt) CheckStatus(ctx *gin.Context) {
tradeId := ctx.Param("trade_id")
order, ok := model.GetTradeOrder(tradeId)
if !ok {
ctx.JSON(200, respFailJson("订单不存在"))
return
}
var returnUrl string
if order.Status == model.OrderStatusSuccess {
returnUrl = order.ReturnUrl
if order.ApiType == model.OrderApiTypeEpay {
// 易支付兼容
returnUrl = fmt.Sprintf("%s?%s", returnUrl, epay.BuildNotifyParams(order))
}
}
// 返回响应数据
ctx.JSON(200, gin.H{
"trade_id": tradeId,
"trade_hash": order.RefHash,
"status": order.Status,
"return_url": returnUrl,
})
}
func (Epusdt) GetPaymentMethods(ctx *gin.Context) {
func (Epusdt) GetMethods(ctx *gin.Context) {
var req methodsReq
if err := ctx.ShouldBindJSON(&req); err != nil {
ctx.JSON(500, respFailJson(fmt.Sprintf("request error: %s", err.Error())))
ctx.JSON(200, respFailJson(fmt.Sprintf("request error: %s", err.Error())))
return
}
order, ok := model.GetTradeOrder(req.TradeID)
if !ok {
ctx.JSON(400, respFailJson("order not found"))
ctx.JSON(200, respFailJson("order not found"))
return
}
if order.Status == model.OrderStatusExpired {
ctx.JSON(400, respFailJson("order expired"))
ctx.JSON(200, respFailJson("order expired"))
return
}
ctx.JSON(200, respSuccJson(gin.H{
"methods": GetPaymentItem(model.Crypto(req.Currency), order),
"methods": order.GetMethods(model.Crypto(req.Currency)),
}))
}
func GetPaymentItem(crypto model.Crypto, order model.Order) []PaymentItem {
fiat := order.Fiat
var methods = make([]PaymentItem, 0)
allTrades := model.GetAllTradeConfig()
// 解析限定币种
var whitelist = make(map[string]bool)
var blacklist = make(map[string]bool)
if order.CurrencyLimit != "" {
for _, c := range strings.Split(order.CurrencyLimit, ",") {
c = strings.TrimSpace(c)
if strings.HasPrefix(c, "-") {
blacklist[strings.ToUpper(strings.TrimPrefix(c, "-"))] = true
} else {
whitelist[strings.ToUpper(c)] = true
}
}
func (Epusdt) Info(ctx *gin.Context) {
var req infoReq
if err := ctx.ShouldBindJSON(&req); err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("参数错误:%s", err.Error())))
return
}
for tradeTypeStr, conf := range allTrades {
// 如果指定了货币,则进行过滤
if crypto != "" && conf.Crypto != crypto {
continue
}
// Check blacklist
if len(blacklist) > 0 && blacklist[string(conf.Crypto)] {
continue
}
// Check whitelist
if len(whitelist) > 0 && !whitelist[string(conf.Crypto)] {
continue
}
// 检查是否有可用钱包
count := len(model.GetAvailableWallets(model.TradeType(tradeTypeStr)))
if count == 0 {
continue
}
// 获取汇率配置的浮动语法
syntax := model.GetK(model.ConfKey(fmt.Sprintf("rate_float_%s_%s", conf.Crypto, fiat)))
// 获取汇率
rate, err := model.GetOrderRate(conf.Crypto, fiat, syntax)
if err != nil {
log.Error(fmt.Sprintf("GetPaymentMethods: get order rate error: %s", err.Error()))
continue
}
// 计算实际支付金额 (加密货币)
// Money 是法币金额
moneyDecimal, _ := decimal.NewFromString(order.Money)
// 计算精度
atom, precision := model.GetAtomicity(model.TradeType(tradeTypeStr))
actualAmount := moneyDecimal.DivRound(rate, precision)
if actualAmount.LessThan(atom) {
actualAmount = atom
}
methods = append(methods, PaymentItem{
Amount: order.Money,
ActualAmount: actualAmount.String(),
Fiat: string(fiat),
ExchangeRate: rate.String(),
Currency: string(conf.Crypto),
Network: string(conf.Network),
TokenNetName: conf.NetworkName,
TokenCustomName: "", // 暂为空
IsPopular: false, // 暂为 false
})
order, ok := model.GetTradeOrder(req.TradeID)
if !ok {
ctx.JSON(200, respFailJson("订单不存在"))
return
}
// Sort by Currency A-Z
sort.Slice(methods, func(i, j int) bool {
if methods[i].Currency != methods[j].Currency {
return methods[i].Currency < methods[j].Currency
}
return methods[i].Network < methods[j].Network
})
ctx.JSON(200, respSuccJson(gin.H{
"network": order.Network(), // 网络信息
"trade_id": order.TradeId, // 交易编号
"order_id": order.OrderId, // 商户订单
"trade_type": order.TradeType, // 交易类型
"status": order.Status, // 订单状态
"money": order.Money, // 订单金额
"actual_amount": order.Amount, // 实付数额
"token": order.Address, // 收款地址
"fiat": order.Fiat, // 法币类型
"name": order.Name, // 商品名称
"expired_at": order.ExpiredAt.Unix(), // 截止时间
"created_at": order.CreatedAt.Time().Unix(), // 创建时间
"trade_url": order.GetTxUrl(), // 链上详情
"support_url": model.GetC(model.PaymentSupportUrl), // 客服链接
"redirect_url": order.RedirectUrl(), // 跳转地址
}))
}
return methods
func (Epusdt) SignVerify(ctx *gin.Context) {
rawData, err := ctx.GetRawData()
if err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据读取错误 %s", err.Error())))
ctx.Abort()
return
}
m := make(map[string]any)
if err = json.Unmarshal(rawData, &m); err != nil {
ctx.JSON(200, respFailJson(fmt.Sprintf("json 数据解析错误 %s", err.Error())))
ctx.Abort()
return
}
sign, ok := m["signature"]
if !ok {
ctx.JSON(200, respFailJson("签名丢失"))
ctx.Abort()
return
}
if utils.EpusdtSign(m, model.AuthToken()) != sign {
ctx.JSON(200, respFailJson("签名错误"))
ctx.Abort()
return
}
ctx.Request.Body = io.NopCloser(bytes.NewBuffer(rawData)) // 回写数据
ctx.Next()
}
func respFailJson(message string) gin.H {
@@ -615,6 +418,5 @@ func respFailJson(message string) gin.H {
}
func respSuccJson(data interface{}) gin.H {
return gin.H{"status_code": 200, "message": "success", "data": data, "request_id": ""}
}
-64
View File
@@ -1,64 +0,0 @@
package epusdt
import (
"strings"
"testing"
"github.com/v03413/bepusdt/app/model"
)
func TestCheckoutCashierTemplateName(t *testing.T) {
tests := []struct {
name string
mode model.PaymentTemplateMode
want string
}{
{name: "official uses upstream cashier", mode: model.PaymentTemplateOfficial, want: "cashier.html"},
{name: "wolf uses LangGe cashier", mode: model.PaymentTemplateWolf, want: "wolf.cashier.html"},
{name: "custom uses custom cashier filename", mode: model.PaymentTemplateCustom, want: "cashier.html"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := checkoutCashierTemplateName(tt.mode); got != tt.want {
t.Fatalf("checkoutCashierTemplateName(%q) = %q, want %q", tt.mode, got, tt.want)
}
})
}
}
func TestJSONScriptEscapesHTMLSensitiveCharacters(t *testing.T) {
got := string(jsonScript(map[string]string{
"name": "</script><img src=x onerror=alert(1)>&",
}))
for _, unsafe := range []string{"</script>", "<img", ">", "&"} {
if strings.Contains(got, unsafe) {
t.Fatalf("jsonScript output contains unsafe substring %q: %s", unsafe, got)
}
}
if !strings.Contains(got, `\u003c/script\u003e`) {
t.Fatalf("jsonScript output does not contain escaped script close tag: %s", got)
}
}
func TestCheckoutCounterTemplateName(t *testing.T) {
tests := []struct {
name string
mode model.PaymentTemplateMode
tradeType model.TradeType
want string
}{
{name: "official uses trade template", mode: model.PaymentTemplateOfficial, tradeType: model.UsdtTrc20, want: "usdt.trc20.html"},
{name: "wolf uses universal LangGe checkout", mode: model.PaymentTemplateWolf, tradeType: model.UsdtTrc20, want: "wolf.checkout.html"},
{name: "custom uses trade template", mode: model.PaymentTemplateCustom, tradeType: model.UsdtTrc20, want: "usdt.trc20.html"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := checkoutCounterTemplateName(tt.mode, tt.tradeType); got != tt.want {
t.Fatalf("checkoutCounterTemplateName(%q, %q) = %q, want %q", tt.mode, tt.tradeType, got, tt.want)
}
})
}
}
+19
View File
@@ -0,0 +1,19 @@
package model
type Checkout struct {
Name string `json:"name"`
Author string `json:"author"`
Desc string `json:"desc"`
Link string `json:"link"`
}
var checkoutMap = make(map[string]Checkout)
// RegisterCheckout 注册收银台模板
func RegisterCheckout(name string, checkout Checkout) {
checkoutMap[name] = checkout
}
func CheckoutList() map[string]Checkout {
return checkoutMap
}
+5 -94
View File
@@ -41,10 +41,10 @@ var defaultConf = map[ConfKey]string{
NotifyMaxRetry: "10",
BlockHeightMaxDiff: "1000",
BlockOffsetConfirm: "0",
PaymentTimeout: "1200", // 20分钟
PaymentTemplate: string(PaymentTemplateOfficial),
PaymentTemplateLanguage: string(PaymentTemplateLanguageAuto),
PaymentTimeout: "1200", // 20分钟
PaymentCheckout: "official", // 官方模板
PaymentMatchMode: string(Classic),
PaymentSupportUrl: "",
SystemInstallLock: "0",
RateSyncCoingeckoApiUrl: "https://api.coingecko.com",
RateSyncHistoryDays: "30",
@@ -132,102 +132,13 @@ func RefreshC() {
}
}
func CheckoutCounter(host, id string) string {
func CheckoutUrl(host, id string) string {
uri := GetK(ApiAppUri)
if uri == "" {
uri = host
}
return fmt.Sprintf("%s/pay/checkout-counter/%s", uri, id)
}
func CheckoutCashier(host, id string) string {
uri := GetK(ApiAppUri)
if uri == "" {
uri = host
}
return fmt.Sprintf("%s/pay/cashier/%s", uri, id)
}
func NormalizePaymentTemplateMode(value string) PaymentTemplateMode {
switch PaymentTemplateMode(strings.ToLower(strings.TrimSpace(value))) {
case PaymentTemplateWolf:
return PaymentTemplateWolf
case PaymentTemplateCustom:
return PaymentTemplateCustom
case PaymentTemplateOfficial:
return PaymentTemplateOfficial
default:
return PaymentTemplateOfficial
}
}
func IsValidPaymentTemplateMode(value string) bool {
switch PaymentTemplateMode(strings.ToLower(strings.TrimSpace(value))) {
case "", PaymentTemplateOfficial, PaymentTemplateWolf, PaymentTemplateCustom:
return true
default:
return false
}
}
func GetPaymentTemplateMode() PaymentTemplateMode {
return NormalizePaymentTemplateMode(GetK(PaymentTemplate))
}
func NormalizePaymentTemplateLanguage(value string) PaymentTemplateLanguageMode {
switch strings.ToLower(strings.TrimSpace(value)) {
case string(PaymentTemplateLanguageZh):
return PaymentTemplateLanguageZh
case "zh-hant":
return PaymentTemplateLanguageZhHant
case string(PaymentTemplateLanguageEn):
return PaymentTemplateLanguageEn
case string(PaymentTemplateLanguageRu):
return PaymentTemplateLanguageRu
case string(PaymentTemplateLanguageVi):
return PaymentTemplateLanguageVi
case string(PaymentTemplateLanguageTr):
return PaymentTemplateLanguageTr
case string(PaymentTemplateLanguageJa):
return PaymentTemplateLanguageJa
case string(PaymentTemplateLanguageKo):
return PaymentTemplateLanguageKo
case "", string(PaymentTemplateLanguageAuto):
return PaymentTemplateLanguageAuto
default:
return PaymentTemplateLanguageAuto
}
}
func IsValidPaymentTemplateLanguage(value string) bool {
switch strings.ToLower(strings.TrimSpace(value)) {
case "", string(PaymentTemplateLanguageAuto), string(PaymentTemplateLanguageZh), "zh-hant",
string(PaymentTemplateLanguageEn), string(PaymentTemplateLanguageRu), string(PaymentTemplateLanguageVi),
string(PaymentTemplateLanguageTr), string(PaymentTemplateLanguageJa), string(PaymentTemplateLanguageKo):
return true
default:
return false
}
}
func GetPaymentTemplateLanguage() PaymentTemplateLanguageMode {
return NormalizePaymentTemplateLanguage(GetK(PaymentTemplateLanguage))
}
func UseCustomPaymentAssets() bool {
customPath := strings.TrimSpace(GetK(PaymentStaticPath))
if customPath == "" {
return false
}
rawMode := strings.TrimSpace(GetK(PaymentTemplate))
if rawMode == "" {
return true
}
return NormalizePaymentTemplateMode(rawMode) == PaymentTemplateCustom
return fmt.Sprintf("%s/pay/checkout/%s", uri, id)
}
func ConfInit() {
+7 -26
View File
@@ -8,8 +8,6 @@ type CoinId string
type Crypto string
type TradeType string
type MatchMode string
type PaymentTemplateMode string
type PaymentTemplateLanguageMode string
type Network string
type Range struct {
MinAmount decimal.Decimal
@@ -47,14 +45,13 @@ const (
AtomETH ConfKey = "atom_eth"
AtomGRAM ConfKey = "atom_gram"
MonitorMinAmount ConfKey = "monitor_min_amount" // 监控最小金额,低于此金额的入账不进行通知
PaymentMinAmount ConfKey = "payment_min_amount"
PaymentMaxAmount ConfKey = "payment_max_amount"
PaymentTimeout ConfKey = "payment_timeout" // 订单支付超时时间,单位秒
PaymentStaticPath ConfKey = "payment_static_path" // 收银台静态资源路径
PaymentTemplate ConfKey = "payment_template" // 收银台模板模式
PaymentTemplateLanguage ConfKey = "payment_template_language" // 收银台模板默认语言
PaymentMatchMode ConfKey = "payment_match_mode" // 订单金额匹配模式
MonitorMinAmount ConfKey = "monitor_min_amount" // 监控最小金额,低于此金额的入账不进行通知
PaymentMinAmount ConfKey = "payment_min_amount"
PaymentMaxAmount ConfKey = "payment_max_amount"
PaymentTimeout ConfKey = "payment_timeout" // 订单支付超时时间,单位秒
PaymentCheckout ConfKey = "payment_checkout" // 收银台模板
PaymentMatchMode ConfKey = "payment_match_mode" // 订单金额匹配模式
PaymentSupportUrl ConfKey = "payment_support_url" // 订单支付客服链接
RpcEndpointPlasma ConfKey = "rpc_endpoint_plasma" // Plasma RPC节点
RpcEndpointBsc ConfKey = "rpc_endpoint_bsc" // BSC RPC节点
@@ -112,22 +109,6 @@ const (
HasPrefix MatchMode = "has_prefix" // 前缀匹配,允许多付
RoundOff MatchMode = "round_off" // 数值修约,四舍五入,允许容错
)
const (
PaymentTemplateOfficial PaymentTemplateMode = "official" // 官方默认模板
PaymentTemplateWolf PaymentTemplateMode = "wolf" // 狼哥设计模板
PaymentTemplateCustom PaymentTemplateMode = "custom" // 自定义静态模板
)
const (
PaymentTemplateLanguageAuto PaymentTemplateLanguageMode = "auto" // 跟随浏览器
PaymentTemplateLanguageZh PaymentTemplateLanguageMode = "zh" // 简体中文
PaymentTemplateLanguageZhHant PaymentTemplateLanguageMode = "zh-Hant" // 繁体中文
PaymentTemplateLanguageEn PaymentTemplateLanguageMode = "en"
PaymentTemplateLanguageRu PaymentTemplateLanguageMode = "ru"
PaymentTemplateLanguageVi PaymentTemplateLanguageMode = "vi"
PaymentTemplateLanguageTr PaymentTemplateLanguageMode = "tr"
PaymentTemplateLanguageJa PaymentTemplateLanguageMode = "ja"
PaymentTemplateLanguageKo PaymentTemplateLanguageMode = "ko"
)
// USD 交易类型常见扫描范围
var usdGeneralRange = Range{
+149
View File
@@ -4,11 +4,17 @@ import (
"errors"
"fmt"
"math"
"net/url"
"sort"
"strings"
"time"
"github.com/shopspring/decimal"
"github.com/spf13/cast"
"github.com/v03413/bepusdt/app/api"
"github.com/v03413/bepusdt/app/conf"
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/utils"
)
const (
@@ -83,6 +89,18 @@ type Order struct {
AutoTimeAt
}
type MethodItem struct {
Amount string `json:"amount"`
ActualAmount string `json:"actual_amount"`
Fiat string `json:"fiat"`
ExchangeRate string `json:"exchange_rate"`
Currency string `json:"currency"`
Network string `json:"network"`
TokenNetName string `json:"token_net_name"`
TokenCustomName string `json:"token_custom_name"`
IsPopular bool `json:"is_popular"`
}
func (o *Order) SetCanceled() error {
api.New()
o.Status = OrderStatusCanceled
@@ -164,6 +182,137 @@ func (o *Order) GetTxUrl() string {
return GetTxUrl(o.TradeType, o.RefHash)
}
func (o *Order) RedirectUrl() string {
var redirect = o.ReturnUrl
if o.Status == OrderStatusSuccess && o.ApiType == OrderApiTypeEpay {
redirect = fmt.Sprintf("%s?%s", redirect, o.BuildNotifyParams())
}
return redirect
}
func (o *Order) BuildNotifyParams() string {
var signStr = utils.Md5String(fmt.Sprintf("money=%s&name=%s&out_trade_no=%s&pid=%s&trade_no=%s&trade_status=TRADE_SUCCESS&type=%s",
cast.ToString(o.Money), o.Name, o.OrderId, conf.Pid, o.TradeId, o.TradeType) + AuthToken())
var params = fmt.Sprintf("money=%s&name=%s&out_trade_no=%s&pid=%s&trade_no=%s&trade_status=TRADE_SUCCESS&type=%s",
cast.ToString(o.Money), url.QueryEscape(o.Name), url.QueryEscape(o.OrderId), conf.Pid, o.TradeId, o.TradeType)
return fmt.Sprintf("%s&sign=%s", params, signStr)
}
func (o *Order) GetMethods(crypto Crypto) []MethodItem {
var items = make([]MethodItem, 0)
if o.TradeType != "" {
// 已经选好了付款网络,没必要再给出可选项
return items
}
allTrades := GetAllTradeConfig()
// 解析限定币种
var whitelist = make(map[string]bool)
var blacklist = make(map[string]bool)
if o.CurrencyLimit != "" {
for _, c := range strings.Split(o.CurrencyLimit, ",") {
c = strings.TrimSpace(c)
if strings.HasPrefix(c, "-") {
blacklist[strings.ToUpper(strings.TrimPrefix(c, "-"))] = true
} else {
whitelist[strings.ToUpper(c)] = true
}
}
}
for tradeTypeStr, typeConf := range allTrades {
// 如果指定了货币,则进行过滤
if crypto != "" && typeConf.Crypto != crypto {
continue
}
// Check blacklist
if len(blacklist) > 0 && blacklist[string(typeConf.Crypto)] {
continue
}
// Check whitelist
if len(whitelist) > 0 && !whitelist[string(typeConf.Crypto)] {
continue
}
// 检查是否有可用钱包
count := len(GetAvailableWallets(TradeType(tradeTypeStr)))
if count == 0 {
continue
}
// 获取汇率配置的浮动语法
syntax := GetK(ConfKey(fmt.Sprintf("rate_float_%s_%s", typeConf.Crypto, o.Fiat)))
// 获取汇率
rate, err := GetOrderRate(typeConf.Crypto, o.Fiat, syntax)
if err != nil {
log.Error(fmt.Sprintf("GetPaymentMethods: get order rate error: %s", err.Error()))
continue
}
// 计算实际支付金额 (加密货币)
// Money 是法币金额
moneyDecimal, _ := decimal.NewFromString(o.Money)
// 计算精度
atom, precision := GetAtomicity(TradeType(tradeTypeStr))
actualAmount := moneyDecimal.DivRound(rate, precision)
if actualAmount.LessThan(atom) {
actualAmount = atom
}
items = append(items, MethodItem{
Amount: o.Money,
ActualAmount: actualAmount.String(),
Fiat: string(o.Fiat),
ExchangeRate: rate.String(),
Currency: string(typeConf.Crypto),
Network: string(typeConf.Network),
TokenNetName: typeConf.NetworkName,
TokenCustomName: "", // 暂为空
IsPopular: false, // 暂为 false
})
}
// Sort by Currency A-Z
sort.Slice(items, func(i, j int) bool {
if items[i].Currency != items[j].Currency {
return items[i].Currency < items[j].Currency
}
return items[i].Network < items[j].Network
})
return items
}
func (o *Order) Network() any {
type network struct {
Alias string `json:"alias"`
Name string `json:"name"`
Crypto Crypto `json:"crypto"`
Network Network `json:"network"`
}
var net = network{}
info, ok := registry[o.TradeType]
if !ok {
return net
}
net.Name = info.NetworkName
net.Alias = info.Alias
net.Crypto = info.Crypto
net.Network = info.Network
return net
}
func (o *Order) TableName() string {
return "bep_order"
}
+6 -6
View File
@@ -54,7 +54,7 @@ var registry = map[TradeType]TradeTypeConf{
},
UsdtTrc20: {
Alias: "USDT・TRC20",
NetworkName: "TRC20",
NetworkName: "Tron",
Network: conf.Tron,
Crypto: USDT,
Contract: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", // 占位,目前实际没使用
@@ -66,7 +66,7 @@ var registry = map[TradeType]TradeTypeConf{
},
UsdtErc20: {
Alias: "USDT・ERC20",
NetworkName: "ERC20",
NetworkName: "Ethereum",
Network: conf.Ethereum,
Crypto: USDT,
Contract: conf.UsdtErc20,
@@ -77,7 +77,7 @@ var registry = map[TradeType]TradeTypeConf{
},
UsdtBep20: {
Alias: "USDT・BEP20",
NetworkName: "BEP20",
NetworkName: "Bsc",
Network: conf.Bsc,
Crypto: USDT,
Contract: conf.UsdtBep20,
@@ -144,7 +144,7 @@ var registry = map[TradeType]TradeTypeConf{
},
UsdcErc20: {
Alias: "USDC・ERC20",
NetworkName: "ERC20",
NetworkName: "Ethereum",
Network: conf.Ethereum,
Crypto: USDC,
Contract: conf.UsdcErc20,
@@ -155,7 +155,7 @@ var registry = map[TradeType]TradeTypeConf{
},
UsdcBep20: {
Alias: "USDC・BEP20",
NetworkName: "BEP20",
NetworkName: "Bsc",
Network: conf.Bsc,
Crypto: USDC,
Contract: conf.UsdcBep20,
@@ -210,7 +210,7 @@ var registry = map[TradeType]TradeTypeConf{
},
UsdcTrc20: {
Alias: "USDC・TRC20",
NetworkName: "TRC20",
NetworkName: "Tron",
Network: conf.Tron,
Crypto: USDC,
Contract: "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8", // 占位,目前实际没使用
+1
View File
@@ -17,6 +17,7 @@ func adminInit(e *gin.Engine) {
PostRegister(confRtr, "/sets", true, confHdr.Sets)
PostRegister(confRtr, "/notifier", true, confHdr.Notifier)
PostRegister(confRtr, "/notifier_test", true, confHdr.NotifierTest)
PostRegister(confRtr, "/checkout_list", true, confHdr.CheckoutList)
PostRegister(confRtr, "/reset_api_auth_token", true, confHdr.ResetApiAuthToken)
}
+6 -7
View File
@@ -9,9 +9,7 @@ func epusdtInit(engine *gin.Engine) {
epGrp := engine.Group("/pay")
epHdr := new(epusdt.Epusdt)
{
epGrp.GET("/checkout-counter/:trade_id", epHdr.CheckoutCounter)
epGrp.GET("/cashier/:trade_id", epHdr.CheckoutCashier)
epGrp.GET("/check-status/:trade_id", epHdr.CheckStatus)
epGrp.GET("/checkout/:trade_id", epHdr.Checkout)
}
orderGrp := engine.Group("/api/v1/order")
@@ -22,10 +20,11 @@ func epusdtInit(engine *gin.Engine) {
orderGrp.POST("/create-order", epHdr.CreateOrder)
}
payApiGrp := engine.Group("/api/v1/pay")
payGrp := engine.Group("/api/v1/pay")
{
payApiGrp.POST("/methods", epHdr.GetPaymentMethods)
payApiGrp.POST("/update-order", epHdr.UpdateOrder)
payApiGrp.POST("/notify", epHdr.Notify)
payGrp.POST("/info", epHdr.Info)
payGrp.POST("/notify", epHdr.Notify)
payGrp.POST("/methods", epHdr.GetMethods)
payGrp.POST("/update-order", epHdr.UpdateOrder)
}
}
+92 -27
View File
@@ -1,53 +1,118 @@
package router
import (
"encoding/json"
"errors"
"fmt"
"html/template"
"io/fs"
"net/http"
"path/filepath"
"path"
"strings"
"github.com/gin-gonic/gin"
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model"
"github.com/v03413/bepusdt/app/utils"
"github.com/v03413/bepusdt/static"
)
func staticInit(e *gin.Engine) {
customPath := model.GetK(model.PaymentStaticPath)
if model.UseCustomPaymentAssets() && utils.IsExist(customPath) {
initCustomPayment(e, customPath)
return
}
initDefaultPayment(e)
}
func initCustomPayment(e *gin.Engine, path string) {
tmpl := template.New("customer")
template.Must(tmpl.ParseGlob(filepath.Join(path, "views", "*.html")))
template.Must(tmpl.ParseFS(static.Secure, "secure/secure.html"))
e.SetHTMLTemplate(tmpl)
e.StaticFS("/payment/assets", http.Dir(filepath.Join(path, "assets")))
e.StaticFS("/secure/assets", http.FS(subFS(static.Secure, "secure/assets")))
log.Info("成功注册自定义静态资源路径:", path)
}
func initDefaultPayment(e *gin.Engine) {
tmpl := template.New("default")
template.Must(tmpl.ParseFS(static.Secure, "secure/secure.html"))
template.Must(tmpl.ParseFS(static.Payment, "payment/views/*.html"))
e.SetHTMLTemplate(tmpl)
// 注册收银台模板和静态资源
entries, err := fs.ReadDir(static.Checkout, "checkout")
if err != nil {
panic(errors.New(fmt.Sprintf("收银台模板读取异常:%v", err)))
}
for _, entry := range entries {
if !entry.IsDir() {
continue
}
name := entry.Name()
dir := path.Join("checkout", name)
checkout, err := readCheckoutInfoFromFS(static.Checkout, dir)
if err != nil {
panic(err)
}
if registerTemplatesFromFS(tmpl, static.Checkout, dir, name) {
model.RegisterCheckout(name, checkout)
log.Info("前台收银模板注册成功:", name)
}
registerAssetsFromFS(e, static.Checkout, dir, "/checkout/"+name+"/assets")
}
e.SetHTMLTemplate(tmpl)
e.StaticFS("/payment/assets", http.FS(subFS(static.Payment, "payment/assets")))
e.StaticFS("/secure/assets", http.FS(subFS(static.Secure, "secure/assets")))
}
func readCheckoutInfoFromFS(src fs.FS, baseDir string) (model.Checkout, error) {
infoPath := path.Join(baseDir, "checkout.json")
data, err := fs.ReadFile(src, infoPath)
if err != nil {
return model.Checkout{}, fmt.Errorf("checkout.json 不存在或读取失败: %w", err)
}
var checkout model.Checkout
if err := json.Unmarshal(data, &checkout); err != nil {
return model.Checkout{}, fmt.Errorf("解析 checkout.json 失败: %w", err)
}
return checkout, nil
}
func registerTemplatesFromFS(tmpl *template.Template, src fs.FS, baseDir, namePrefix string) bool {
viewsDir := path.Join(baseDir, "views")
files, err := fs.ReadDir(src, viewsDir)
if err != nil {
log.Error("读取模板目录失败:", err.Error())
return false
}
registered := false
for _, f := range files {
if f.IsDir() || !strings.HasSuffix(f.Name(), ".html") {
continue
}
content, rErr := fs.ReadFile(src, path.Join(viewsDir, f.Name()))
if rErr != nil {
log.Error("读取模板文件失败:", rErr.Error())
continue
}
name := f.Name()
if namePrefix != "" {
name = namePrefix + "/" + name
}
if _, pErr := tmpl.New(name).Parse(string(content)); pErr != nil {
log.Error("解析模板失败:", pErr.Error())
continue
}
registered = true
}
return registered
}
func registerAssetsFromFS(e *gin.Engine, src fs.FS, baseDir, routePath string) {
assetsDir := path.Join(baseDir, "assets")
if _, err := fs.Stat(src, assetsDir); err != nil {
return
}
e.StaticFS(routePath, http.FS(subFS(src, assetsDir)))
}
func subFS(src fs.FS, dir string) fs.FS {
sub, _ := fs.Sub(src, dir)
-14
View File
@@ -1,14 +0,0 @@
package router
import (
"html/template"
"testing"
"github.com/v03413/bepusdt/static"
)
func TestEmbeddedPaymentTemplatesParse(t *testing.T) {
if _, err := template.New("payment").ParseFS(static.Payment, "payment/views/*.html"); err != nil {
t.Fatalf("parse embedded payment templates: %v", err)
}
}
+1 -2
View File
@@ -12,7 +12,6 @@ import (
"github.com/spf13/cast"
"github.com/v03413/bepusdt/app"
epay2 "github.com/v03413/bepusdt/app/handler/epay"
"github.com/v03413/bepusdt/app/log"
"github.com/v03413/bepusdt/app/model"
"github.com/v03413/bepusdt/app/notifier"
@@ -60,7 +59,7 @@ func Handle(order model.Order) error {
func epay(ctx context.Context, order model.Order) error {
var client = http.Client{Timeout: time.Second * 5}
var notifyUrl = fmt.Sprintf("%s?%s", order.NotifyUrl, epay2.BuildNotifyParams(order))
var notifyUrl = fmt.Sprintf("%s?%s", order.NotifyUrl, order.BuildNotifyParams())
postReq, err2 := http.NewRequestWithContext(ctx, "GET", notifyUrl, nil)
if err2 != nil {
+178
View File
@@ -0,0 +1,178 @@
# 收银台模板开发指南
本文档面向开发者,介绍收银台模板的**目录结构与开发规范**,帮助你完成两类任务:
- **修改默认模板**:在官方内置模板的基础上调整样式或逻辑
- **新增自定义模板**:从零创建一套独立的收银台主题
---
## 模板目录结构
每套模板放在 `static/checkout/` 下的一个子目录中,目录名即模板的唯一标识。结构如下:
```
<模板目录名>/
├── checkout.json # 【必须】模板元数据
├── views/
│ └── checkout.html # 【必须】主模板 HTML
└── assets/ # 【可选】静态资源
├── css/
├── js/
├── img/
└── locales/
```
BEpusdt 启动时会扫描该目录,自动注册所有合法模板,并在后台「收银台模板」下拉框中展示。
---
## checkout.json
模板的元数据配置文件,用于在后台展示模板信息:
```json
{
"name": "模板显示名称",
"author": "作者或团队",
"desc": "一句话描述",
"link": "模板主页或仓库地址"
}
```
`name` 为必填项,其余可选。
---
## views/checkout.html
标准的 Go `html/template` 文件。服务端只注入一个变量:
```
{{ .trade_id }} // 当前订单的交易 ID
```
**所有订单数据均通过前端 AJAX 请求获取**,不在服务端渲染。可以用任意前端框架或原生 JS 实现交互逻辑,参考官方模板
`static/checkout/official/assets/js/checkout.js` 的写法。
---
## assets 静态资源
`assets/` 下的文件会被挂载到 `/checkout/<模板目录名>/assets/` 路由,在 HTML 中**必须使用绝对路径**引用:
```html
<link rel="stylesheet" href="/checkout/my-theme/assets/css/style.css">
<script src="/checkout/my-theme/assets/js/main.js"></script>
```
第三方 JS 库建议本地化放入 `assets/js/`,避免依赖外部 CDN。
---
## 任务一:修改默认模板
默认模板 `official` 的源文件位于 `static/checkout/official/`,直接在该目录下修改即可。
**1. 克隆源码**
```bash
git clone https://github.com/v03413/BEpusdt.git
cd BEpusdt
```
**2. 按需修改**
- 品牌色 → `static/checkout/official/assets/css/checkout.css` 中的 CSS 变量
- Logo / 图标 → 替换 `static/checkout/official/assets/img/` 下的图片并更新引用
- 页面结构 → 编辑 `static/checkout/official/views/checkout.html`
- 交互逻辑 → 编辑 `static/checkout/official/assets/js/checkout.js`
- 多语言文案 → 编辑 `static/checkout/official/assets/locales/zh.json`、`en.json`
**3. 重新编译**(见[部署与验证](#部署与验证))
---
## 任务二:新增自定义模板
**1. 创建目录**
```bash
mkdir -p my-theme/views my-theme/assets/{css,js,img}
```
**2. 编写 checkout.json**
```json
{
"name": "My Theme",
"author": "yourname",
"desc": "简洁风格收银台",
"link": ""
}
```
**3. 编写 views/checkout.html**
从 `{{ .trade_id }}` 获取交易 ID,通过 AJAX 调用后端接口拉取订单数据,轮询检测支付状态,完成后跳转。可直接参考官方模板的
`checkout.js` 逻辑复用。
静态资源路径前缀为 `/checkout/my-theme/assets/`。
**4. 放置静态资源**
将 CSS、JS、图片等放入 `assets/` 对应子目录。
---
## 部署与验证
`static/checkout/` 目录通过 Go `//go:embed` 在**编译时**打包进程序二进制。这意味着:
- 新增或修改模板后,必须**重新编译**才能生效
- 运行时无法热加载,不存在"上传到服务器某个路径"这种方式
### 步骤
**1. 将模板目录放入源码**
把你的模板目录放到 `static/checkout/` 下:
```
static/checkout/
├── official/ # 内置官方模板
└── my-theme/ # 你的模板
├── checkout.json
├── views/
│ └── checkout.html
└── assets/
```
**2. 重新编译**
```bash
go build -o bepusdt ./main
```
或使用项目已有的构建脚本/Dockerfile。
**3. 验证注册结果**
启动程序后查看日志,出现以下内容说明模板注册成功:
```
前台收银模板注册成功: my-theme
```
**4. 在后台切换模板**
进入 **系统管理 → 基本设置 → API 设置**,在「收银台模板」中选择对应模板名称并保存。
---
## 注意事项
- `checkout.json` 缺失或 JSON 格式有误会导致程序启动失败
- `views/checkout.html` 缺失时该模板会被跳过,不影响其他模板加载
- 目录名会出现在 URL 中,建议用小写字母与连字符,如 `my-theme`
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 KiB

Before

Width:  |  Height:  |  Size: 509 KiB

After

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

-155
View File
@@ -1,155 +0,0 @@
# 收银台模板配置与自定义指南
## 概述
本文档介绍 BEpusdt 收银台模板模式、内置 LangGe design 模板,以及如何自定义修改收银台网页模板。自定义模板部分假设您已具备基本的 Linux/Docker 和前端开发知识。
## 获取默认资源文件
收银台的网页资源文件位于官方仓库:
https://github.com/v03413/BEpusdt/tree/main/static/payment
## 模板模式
后台 **系统管理** → **基本设置** → **API 设置** 中的「收银台模板」支持三种模式:
| 配置值 | 后台展示 | 说明 |
| ------ | -------- | ---- |
| `official` | 官方默认 | 使用 BEpusdt 默认收银台模板和各币种直接付款模板 |
| `wolf` | 狼哥设计 | 使用内置 LangGe design 收银台模板,页面品牌仍为 BEpusdt |
| `custom` | 自定义模板 | 从「收银台静态资源」路径加载自定义模板和资源 |
`official` 和 `wolf` 都是内置模板。模板文件在程序启动时已经从内置资源中加载,保存后新打开的收银台页面会按当前配置选择模板,无需为了切换这两个内置模式而重启服务。
`custom` 模式会从磁盘路径加载模板和资源;新增、删除或修改该路径下的模板文件后,需要重启服务让 Gin 重新解析磁盘模板。历史配置兼容规则保持不变:如果旧版本只配置了 `payment_static_path` 且没有 `payment_template`,系统仍会按自定义模板处理。
## LangGe design
LangGe design 内置支持 `zh`、`zh-Hant`、`en`、`ru`、`vi`、`tr`、`ja`、`ko` 八种语言,并使用本地静态资源,不依赖外部 CDN。
选择 `wolf` 模式时,后台会显示「默认语言」设置。默认值 `auto` 表示跟随浏览器语言;如果商户设置为具体语言,新打开的 LangGe design 收银台会优先使用该语言。用户通过页面语言菜单手动切换后,浏览器本地选择优先于后台默认值;URL 参数 `?lang=` 仍拥有最高优先级。
默认语言支持以下配置值:
| 配置值 | 说明 |
| ------ | ---- |
| `auto` | 跟随浏览器语言 |
| `zh` | 简体中文 |
| `zh-Hant` | 繁體中文 |
| `en` | English |
| `ru` | Русский |
| `vi` | Tiếng Việt |
| `tr` | Türkçe |
| `ja` | 日本語 |
| `ko` | 한국어 |
> 开发提示:模板中通过 `<script>` 注入的结构化数据必须使用 HTML-safe JSON 序列化。Go 的 `json.Marshal` 默认会转义 `<`、`>`、`&` 等字符;不要关闭该行为,也不要用字符串拼接生成 `network` 或 `selected_payment` 这类 JSON 数据。
## 目录结构
```bash
./payment
├── assets
│ ├── css # 样式文件
│ ├── i18n # 国际化配置
│ ├── img # 图片资源
│ ├── js # JavaScript 文件
│ └── locales # 多语言文件
└── views
├── bsc.bnb.html
├── ethereum.eth.html
├── index.html
├── installed.html
├── tron.trx.html
├── wolf.cashier.html
├── wolf.checkout.html
├── usdc.aptos.html
├── usdc.arbitrum.html
├── usdc.base.html
└── ...
```
**目录说明:**
- **assets** - 静态资源文件(CSS、JavaScript、图片、国际化文件)
- **views** - 各币种对应的收银台 HTML 模板文件,每个 HTML 文件对应一个币种的收银台页面
- **views/wolf.cashier.html** - LangGe design 收银台选择页
- **views/wolf.checkout.html** - LangGe design 直接付款页
## LangGe design screenshots
Light mode - payment method selection
![Light mode payment method selection](./screenshots/langge-light-select.png)
Light mode - payment QR/address
![Light mode payment QR/address](./screenshots/langge-light-checkout.png)
Dark mode - payment method selection
![Dark mode payment method selection](./screenshots/langge-dark-select.png)
Dark mode - payment QR/address
![Dark mode payment QR/address](./screenshots/langge-dark-checkout.png)
## 修改步骤
### 1. 修改网页模板
在 `views` 目录下编辑相应的 HTML 文件进行自定义修改。
### 2. 上传资源文件到服务器
#### Linux 直接部署
将修改后的整个 `payment` 目录上传到服务器指定路径:
```bash
# 示例:上传到 /root/test/payment/
scp -r ./payment user@server:/root/test/
```
#### Docker 部署
**选项 A:使用 Volume 挂载(推荐)**
在启动容器时挂载本地目录,避免每次都复制文件:
```bash
docker run -v /root/test/payment:/app/static/payment <image_id>
```
**选项 B:复制到运行中的容器**
```bash
docker cp payment/ <container_id>:/app/static/
```
### 3. 配置静态资源路径
![API设置](./1.png)
1. 登录 BEpusdt 后台管理系统
2. 进入 **系统管理** → **基本设置** → **API 设置**
3. 将「收银台模板」切换为 **自定义模板**
4. 在**静态资源路径**字段中填入完整目录路径
5. 点击保存
### 4. 重启服务并验证
重启 BEpusdt 服务:
```bash
# Linux 直接部署
systemctl restart bepusdt
# Docker 部署
docker restart <container_id>
```
查看服务日志,确认出现资源注册成功提示(如下图所示),则表示配置正确。之后访问当请求到对应的交易类型收银台时便能看到修改效果。
![成功注册](2.png)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

@@ -0,0 +1,624 @@
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
--color-bg: #f0f2f5;
--color-card: #fff;
--color-border: #e8eaed;
--color-text-primary: #0d0d0d;
--color-text-secondary: #6b7280;
--color-text-muted: #9ca3af;
--color-accent: #00b26a;
--color-danger: #ef4444;
--color-btn: #0d0d0d;
--color-btn-hover: #1a1a1a;
--radius-card: 20px;
--radius-input: 14px;
--radius-btn: 14px;
--shadow-card: 0 4px 32px rgba(0, 0, 0, .08);
}
html, body { height: 100%; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
background: var(--color-bg);
min-height: 100vh;
display: flex;
align-items: flex-start;
justify-content: center;
padding: 24px 16px 40px;
-webkit-font-smoothing: antialiased;
}
.checkout-card {
background: var(--color-card);
border-radius: var(--radius-card);
box-shadow: var(--shadow-card);
width: 100%;
max-width: 480px;
margin-top: 8px;
position: relative;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 24px 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
width: 40px;
height: 40px;
background: var(--color-btn);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.brand-logo svg { width: 32px; height: 32px; }
.brand-name {
font-size: 17px;
font-weight: 700;
color: var(--color-text-primary);
letter-spacing: -.3px;
}
.help-btn {
width: 32px;
height: 32px;
border-radius: 50%;
border: 1.5px solid var(--color-border);
background: transparent;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-text-secondary);
transition: all .2s;
}
.help-btn:hover { border-color: var(--color-text-secondary); color: var(--color-text-primary); }
.amount-block { padding: 20px 24px 0; }
.amount-fiat {
font-size: 32px;
font-weight: 800;
color: var(--color-text-primary);
letter-spacing: -1px;
line-height: 1.1;
}
.amount-crypto-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.amount-crypto-value {
font-size: 22px;
font-weight: 800;
color: var(--color-accent);
letter-spacing: -.5px;
}
.amount-crypto-value:hover { color: #009a5c; }
.copy-trigger {
display: inline-flex;
align-items: center;
gap: 6px;
cursor: pointer;
border-radius: 6px;
padding: 2px 4px;
transition: background .15s;
text-decoration: none;
}
.copy-trigger:hover { background: rgba(0, 178, 106, .07); }
.copy-trigger:hover .copy-trigger-icon { color: var(--color-accent); }
.copy-trigger-icon {
color: #c4c7cc;
flex-shrink: 0;
transition: color .15s, opacity .15s;
display: flex;
align-items: center;
}
.copy-trigger-icon.copied { color: var(--color-accent); }
.amount-network-line {
margin-top: 4px;
font-size: 13px;
color: var(--color-text-muted);
display: flex;
align-items: center;
gap: 5px;
}
.network-tag { font-weight: 500; color: var(--color-text-muted); }
.fee-notice {
display: inline-flex;
align-items: center;
gap: 5px;
background: #e8f4ff;
color: #2563eb;
border-radius: 20px;
padding: 5px 10px;
font-size: 12px;
font-weight: 500;
white-space: nowrap;
flex-shrink: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.fee-notice svg { flex-shrink: 0; width: 13px; height: 13px; }
.timer-badge-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.timer-badge {
display: inline-flex;
align-items: center;
gap: 6px;
border-radius: 8px;
padding: 6px 14px;
font-size: 12px;
font-weight: 600;
color: var(--color-text-primary);
white-space: nowrap;
background: #fff;
position: relative;
z-index: 1;
}
.timer-ring {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
pointer-events: none;
z-index: 2;
}
.timer-ring-track,
.timer-ring-bar {
width: calc(100% - 1.5px);
height: calc(100% - 1.5px);
fill: none;
stroke-width: 1.5;
vector-effect: non-scaling-stroke;
}
.timer-ring-track { stroke: #e5e7eb; }
.timer-ring-bar {
stroke: var(--color-accent);
stroke-linecap: round;
stroke-dasharray: 100;
stroke-dashoffset: 0;
transition: stroke-dashoffset .6s linear, stroke .4s ease;
}
.timer-ring-bar.warn { stroke: #f59e0b; }
.timer-ring-bar.danger { stroke: #ef4444; }
.timer-text {
color: var(--color-accent);
font-variant-numeric: tabular-nums;
letter-spacing: .3px;
font-size: 13px;
font-weight: 700;
transition: color .4s ease;
}
.timer-text.warn { color: #f59e0b; }
.timer-text.danger { color: #ef4444; }
.timer-label { font-size: 12px; color: var(--color-text-primary); font-weight: 500; }
.divider { height: 1px; background: var(--color-border); margin: 20px 24px 0; opacity: .7; }
.order-info { padding: 0 24px; margin-top: 16px; }
.order-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 0;
font-size: 13.5px;
}
.order-row:not(:last-child) { border-bottom: 1px solid #f3f4f6; padding-bottom: 8px; margin-bottom: 4px; }
.order-label { color: var(--color-text-muted); font-weight: 400; }
.order-value {
color: var(--color-text-primary);
font-weight: 600;
text-align: right;
max-width: 60%;
word-break: break-word;
}
.form-section { padding: 20px 24px 0; }
.form-label {
font-size: 12px;
font-weight: 600;
color: var(--color-text-muted);
text-transform: uppercase;
letter-spacing: .06em;
margin-bottom: 8px;
display: block;
}
.custom-select { position: relative; margin-bottom: 14px; }
.select-trigger {
display: flex;
align-items: center;
gap: 10px;
padding: 13px 16px;
border: 1.5px solid var(--color-border);
border-radius: var(--radius-input);
cursor: pointer;
background: #fff;
transition: all .2s;
user-select: none;
}
.select-trigger:hover { border-color: #c4c7cc; background: #fafafa; }
.select-trigger.open { border-color: var(--color-btn); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.select-img {
width: 28px;
height: 28px;
object-fit: contain;
flex-shrink: 0;
display: block;
}
.select-text { flex: 1; font-size: 15px; font-weight: 600; color: var(--color-text-primary); }
.select-text.placeholder { font-weight: 400; }
.select-chevron { color: var(--color-text-primary); transition: transform .2s; flex-shrink: 0; }
.select-trigger.open .select-chevron { transform: rotate(180deg); }
.select-dropdown {
position: absolute;
top: calc(100% + 6px);
left: 0;
right: 0;
background: #fff;
border: 1.5px solid var(--color-border);
border-radius: var(--radius-input);
box-shadow: 0 8px 32px rgba(0, 0, 0, .12);
z-index: 200;
opacity: 0;
visibility: hidden;
transform: translateY(-8px);
transition: all .18s cubic-bezier(.16, 1, .3, 1);
overflow: hidden;
}
.select-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-search-wrap {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
background: #f8f9fa;
border-bottom: 1px solid var(--color-border);
}
.dropdown-search-icon { color: var(--color-text-muted); flex-shrink: 0; }
.dropdown-search {
flex: 1;
border: none;
background: transparent;
outline: none;
font-size: 14px;
color: var(--color-text-primary);
font-family: inherit;
}
.dropdown-search::placeholder { color: var(--color-text-muted); }
.dropdown-list { max-height: 240px; overflow-y: auto; }
.dropdown-list::-webkit-scrollbar { width: 4px; }
.dropdown-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.dropdown-list::-webkit-scrollbar-track { background: transparent; }
.dropdown-item {
display: flex;
align-items: center;
gap: 12px;
padding: 11px 16px;
cursor: pointer;
transition: background .1s;
}
.dropdown-item:hover { background: #f8f9fa; }
.dropdown-item.selected { background: #f0fdf4; }
.dropdown-item.selected .item-label { color: var(--color-accent); }
.item-img {
width: 28px;
height: 28px;
object-fit: contain;
flex-shrink: 0;
display: block;
}
.item-label { flex: 1; font-size: 14px; font-weight: 600; color: var(--color-text-primary); }
.item-badge {
font-size: 11px;
padding: 2px 8px;
border-radius: 20px;
background: #fff3cd;
color: #92400e;
font-weight: 600;
border: 1px solid #fde68a;
}
.item-check-icon {
width: 16px;
height: 16px;
flex-shrink: 0;
color: var(--color-accent);
opacity: 0;
transition: opacity .15s;
}
.dropdown-item.selected .item-check-icon { opacity: 1; }
.pay-btn-wrap { padding: 16px 24px 20px; }
.pay-btn {
width: 100%;
padding: 11px;
background: var(--color-btn);
color: #fff;
border: none;
border-radius: var(--radius-btn);
font-size: 15px;
font-weight: 700;
cursor: pointer;
transition: background .2s, transform .15s, box-shadow .2s;
letter-spacing: -.2px;
}
.pay-btn:hover:not(:disabled) {
background: var(--color-btn-hover);
transform: translateY(-1px);
box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
.pay-btn:active:not(:disabled) { transform: translateY(0); }
.pay-btn:disabled { background: #d1d5db; cursor: not-allowed; transform: none; box-shadow: none; }
.card-footer {
padding: 12px 24px 16px;
text-align: center;
border-top: 1px solid var(--color-border);
background: #f0f2f5;
border-bottom-left-radius: var(--radius-card);
border-bottom-right-radius: var(--radius-card);
}
.footer-powered {
font-size: 12px;
color: var(--color-text-muted);
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
}
.footer-powered a {
color: #667eea;
text-decoration: none;
font-weight: 600;
transition: color .15s;
}
.footer-powered a:hover { color: #5a6fd6; }
.footer-github {
display: flex;
align-items: center;
color: var(--color-text-muted) !important;
font-weight: normal !important;
transition: color .15s;
}
.footer-github:hover { color: var(--color-text-primary) !important; }
.qr-stage { padding: 20px 24px 0; }
.qr-wrapper {
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 16px;
padding: 12px;
border: 1.5px solid var(--color-border);
border-radius: 16px;
width: fit-content;
background: #fff;
}
.qr-wrapper canvas { display: block; }
.address-card { background: #f8f9fa; border-radius: 12px; padding: 8px 12px; margin-bottom: 16px; }
.address-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.address-label {
font-size: 12px;
color: var(--color-text-muted);
font-weight: 500;
text-transform: uppercase;
letter-spacing: .05em;
}
.address-value {
font-size: 13.5px;
font-weight: 600;
color: var(--color-text-primary);
word-break: break-all;
line-height: 1.5;
}
.toast {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%) translateY(-80px);
background: #0d0d0d;
color: #fff;
padding: 10px 22px;
border-radius: 24px;
font-size: 14px;
font-weight: 500;
box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
z-index: 9999;
opacity: 0;
transition: all .3s cubic-bezier(.34, 1.56, .64, 1);
white-space: nowrap;
pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--color-accent); }
.toast.error { background: var(--color-danger); }
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, .5);
display: flex;
align-items: center;
justify-content: center;
z-index: 9998;
backdrop-filter: blur(3px);
animation: fadeIn .2s ease;
padding: 16px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
background: #fff;
border-radius: 20px;
max-width: 420px;
width: 100%;
overflow: hidden;
box-shadow: 0 24px 64px rgba(0, 0, 0, .2);
animation: slideUp .28s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes slideUp {
from { transform: translateY(32px) scale(.95); opacity: 0; }
to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-body { padding: 32px 28px 24px; text-align: center; }
.success-icon-wrap {
width: 72px;
height: 72px;
background: linear-gradient(135deg, #26a17b, #38cf91);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 16px;
box-shadow: 0 6px 20px rgba(38, 161, 123, .3);
}
.success-checkmark { width: 36px; height: 36px; }
.success-checkmark-circle {
stroke: rgba(255, 255, 255, .5);
stroke-width: 2;
stroke-dasharray: 166;
stroke-dashoffset: 166;
animation: strokeCircle .6s .1s cubic-bezier(.65, 0, .45, 1) forwards;
}
.success-checkmark-check {
stroke: #fff;
stroke-width: 3;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 48;
stroke-dashoffset: 48;
animation: strokeCheck .4s .55s cubic-bezier(.65, 0, .45, 1) forwards;
}
@keyframes strokeCircle { to { stroke-dashoffset: 0; } }
@keyframes strokeCheck { to { stroke-dashoffset: 0; } }
.modal-title {
font-size: 22px;
font-weight: 800;
color: var(--color-text-primary);
margin: 0 0 6px;
letter-spacing: -.4px;
}
.modal-subtitle { font-size: 14px; color: var(--color-text-secondary); margin: 0 0 20px; }
.tx-hash-card {
background: #fff;
border: 1.5px solid var(--color-border);
border-radius: 12px;
padding: 12px 14px;
margin-bottom: 20px;
text-align: left;
}
.tx-hash-label {
display: flex;
align-items: center;
gap: 5px;
font-size: 11px;
color: var(--color-text-muted);
text-transform: uppercase;
letter-spacing: .06em;
margin-bottom: 8px;
}
.tx-hash-value {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
padding: 4px 6px;
border-radius: 6px;
transition: background .15s;
}
.tx-hash-value:hover { background: #edf2f7; }
.tx-hash-text {
font-family: 'SFMono-Regular', Menlo, monospace;
font-size: 12px;
color: #4a5568;
word-break: break-all;
flex: 1;
}
.tx-copy-icon { flex-shrink: 0; color: #a0aec0; transition: color .15s; }
.tx-hash-value:hover .tx-copy-icon { color: #667eea; }
.return-btn {
display: block;
width: 100%;
background: var(--color-btn);
color: #fff;
border: none;
border-radius: 12px;
padding: 10px;
font-size: 15px;
font-weight: 700;
text-decoration: none;
text-align: center;
cursor: pointer;
transition: background .2s, transform .15s;
}
.return-btn:hover { background: #1a1a1a; transform: translateY(-1px); }
.modal-footer {
padding: 12px 20px;
border-top: 1px solid #f0f0f0;
background: #f0f2f5;
font-size: 12px;
color: #b0b8c8;
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
}
.modal-footer a { color: #667eea; text-decoration: none; font-weight: 600; transition: color .15s; }
.modal-footer a:hover { color: #5a6fd6; }
.modal-footer-github {
display: flex;
align-items: center;
color: var(--color-text-muted) !important;
font-weight: normal !important;
transition: color .15s;
}
.modal-footer-github:hover { color: var(--color-text-primary) !important; }
.confirming-spinner {
width: 56px;
height: 56px;
border: 4px solid #e2e8f0;
border-top-color: var(--color-accent);
border-radius: 50%;
animation: spin .9s linear infinite;
margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.confirming-note { font-size: 13px; color: var(--color-text-muted); margin-top: 12px; }
@media (max-width: 520px) {
body { padding: 12px 10px 32px; }
.checkout-card { margin-top: 0; }
.amount-fiat { font-size: 26px; }
.card-header,
.amount-block,
.form-section,
.pay-btn-wrap,
.qr-stage,
.order-info { padding-left: 18px; padding-right: 18px; }
.divider { margin-left: 18px; margin-right: 18px; }
}
@media (max-width: 360px) {
.amount-fiat { font-size: 22px; }
}
@@ -0,0 +1,5 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="#0d0d0d">
<path d="M17.06 11.57c.59-.69.94-1.58.94-2.57 0-2.21-1.79-4-4-4H7v14h7.5c2.49 0 4.5-2.01 4.5-4.5 0-1.33-.58-2.52-1.5-3.35l.56-.58zM9 7h4.5c.83 0 1.5.67 1.5 1.5S14.33 10 13.5 10H9V7zm5.5 10H9v-3h5.5c.83 0 1.5.67 1.5 1.5S15.33 17 14.5 17z"/>
<path d="M10 3.5V2h1.5v1.5H10zM13 3.5V2h1.5v1.5H13zM10 22v-1.5h1.5V22H10zM13 22v-1.5h1.5V22H13z"/>
</svg>

After

Width:  |  Height:  |  Size: 431 B

@@ -0,0 +1,585 @@
(function () {
'use strict';
var i18nReady = false;
var lang = 'zh';
var SVG_C = '<svg width="W" height="W" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
var SVG_K = '<svg width="W" height="W" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
var WEB3 = '/checkout/official/assets/web3icons';
var iconCache = {};
var methods = [];
var selCur = '', selMethod = null;
var cfg = {}, tradeId = '';
var cdTimer = null, stTimer = null;
function detectLang() {
try {
return ((navigator.language || navigator.userLanguage || 'en').toLowerCase().indexOf('zh') === 0) ? 'zh' : 'en';
} catch (e) { return 'en'; }
}
function initI18n() {
lang = detectLang();
return new Promise(function (resolve) {
if (typeof i18next === 'undefined') return resolve();
i18next.init({ lng: lang, debug: false, resources: {} }, function (err) {
if (err) return resolve();
fetch('/checkout/official/assets/locales/' + lang + '.json')
.then(function (r) { return r.json(); })
.then(function (d) {
i18next.addResourceBundle(lang, 'translation', d);
i18nReady = true;
applyI18n();
resolve();
})
.catch(function () { resolve(); });
});
});
}
function t(key, def) {
if (i18nReady && typeof i18next !== 'undefined') {
var v = i18next.t(key);
if (v && v !== key) return v;
}
return def != null ? def : key;
}
function applyI18n() {
if (!i18nReady || typeof i18next === 'undefined') return;
document.querySelectorAll('[data-i18n]').forEach(function (el) {
var k = el.getAttribute('data-i18n');
if (!k) return;
if (k.charAt(0) === '[') {
var m = k.match(/\[(.+?)\](.+)/);
if (!m) return;
var v = i18next.t(m[2]);
if (m[1] === 'html') el.innerHTML = v;
else el.setAttribute(m[1], v);
return;
}
var tr = i18next.t(k);
if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA') el.placeholder = tr;
else el.innerHTML = tr;
});
try {
document.title = i18next.t('pageTitle');
document.documentElement.lang = lang === 'zh' ? 'zh-CN' : 'en';
} catch (e) {}
}
function switchLang(l) {
if (l !== 'zh' && l !== 'en') { console.warn('Use "zh" or "en"'); return; }
if (typeof i18next === 'undefined') return;
lang = l;
fetch('/checkout/official/assets/locales/' + l + '.json')
.then(function (r) { return r.json(); })
.then(function (d) {
i18next.addResourceBundle(l, 'translation', d, true, true);
return i18next.changeLanguage(l);
})
.then(function () { applyI18n(); console.log('✓ Language: ' + l); })
.catch(function (e) { console.error(e); });
}
function showToast(msg, type) {
var el = document.getElementById('cmusToast');
if (!el) return;
el.textContent = msg;
el.className = 'toast ' + (type || '');
el.classList.add('show');
clearTimeout(el._t);
el._t = setTimeout(function () { el.classList.remove('show'); }, 3000);
}
function copyText(text, msg, iconEl, sm) {
if (!text) return;
var sz = sm ? 14 : 16;
var ok = function () {
showToast(msg || t('toastCopied'), 'success');
if (iconEl) {
iconEl.innerHTML = SVG_K.replace(/W/g, sz);
iconEl.classList.add('copied');
clearTimeout(iconEl._r);
iconEl._r = setTimeout(function () {
iconEl.innerHTML = SVG_C.replace(/W/g, sz);
iconEl.classList.remove('copied');
}, 1500);
}
};
var fb = function () {
var ta = document.createElement('textarea');
ta.value = text;
ta.style.cssText = 'position:fixed;opacity:0;top:0;left:0;';
document.body.appendChild(ta);
ta.select();
try { document.execCommand('copy'); ok(); }
catch (e) { showToast(t('toastCopyFailed', '复制失败'), 'error'); }
document.body.removeChild(ta);
};
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(ok).catch(fb);
} else fb();
}
function buildDropdown(id, items, onSelect) {
var w = document.getElementById(id);
if (!w) return;
var trigger = w.querySelector('.select-trigger');
var dd = w.querySelector('.select-dropdown');
if (!trigger || !dd) return;
dd.innerHTML =
'<div class="dropdown-search-wrap">' +
'<svg class="dropdown-search-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>' +
'<input class="dropdown-search" type="text" placeholder="' + t('searchPlaceholder', '搜索') + '" autocomplete="off">' +
'</div><div class="dropdown-list"></div>';
var search = dd.querySelector('.dropdown-search');
var list = dd.querySelector('.dropdown-list');
function render(filter) {
list.innerHTML = '';
var arr = filter ? items.filter(function (it) { return it.label.toLowerCase().indexOf(filter.toLowerCase()) !== -1; }) : items;
arr.forEach(function (it) {
var el = document.createElement('div');
el.className = 'dropdown-item';
el.dataset.value = it.value;
el.innerHTML =
'<img src="' + it.iconSrc + '" alt="' + it.label + '" class="item-img" onerror="this.style.visibility=\'hidden\'">' +
'<span class="item-label">' + it.label + '</span>' +
(it.badge ? '<span class="item-badge">' + it.badge + '</span>' : '') +
'<svg class="item-check-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
el.addEventListener('click', function (e) {
e.stopPropagation();
list.querySelectorAll('.dropdown-item').forEach(function (d) { d.classList.remove('selected'); });
el.classList.add('selected');
var txt = trigger.querySelector('.select-text');
var oldImg = trigger.querySelector('.select-img');
if (oldImg) oldImg.remove();
var img = document.createElement('img');
img.className = 'select-img';
img.src = it.iconSrc;
img.alt = it.label;
img.addEventListener('error', function () { img.style.visibility = 'hidden'; });
trigger.insertBefore(img, trigger.firstChild);
if (txt) { txt.textContent = it.label; txt.classList.remove('placeholder'); }
dd.classList.remove('open');
trigger.classList.remove('open');
if (onSelect) onSelect(it.value, it);
});
list.appendChild(el);
});
}
render('');
search.addEventListener('input', function () { render(this.value); });
search.addEventListener('click', function (e) { e.stopPropagation(); });
if (!trigger.dataset.bound) {
trigger.dataset.bound = '1';
trigger.addEventListener('click', function (e) {
e.stopPropagation();
var open = dd.classList.contains('open');
document.querySelectorAll('.select-dropdown').forEach(function (d) { d.classList.remove('open'); });
document.querySelectorAll('.select-trigger').forEach(function (tt) { tt.classList.remove('open'); });
if (!open) {
dd.classList.add('open');
trigger.classList.add('open');
var s = dd.querySelector('.dropdown-search');
if (s) { s.value = ''; render(''); s.focus(); }
}
});
}
}
function resetTrigger(id, ph) {
var w = document.getElementById(id);
if (!w) return;
var trigger = w.querySelector('.select-trigger');
if (!trigger) return;
var img = trigger.querySelector('.select-img');
if (img) img.remove();
var txt = trigger.querySelector('.select-text');
if (txt) { txt.textContent = ph; txt.classList.add('placeholder'); }
var list = w.querySelector('.dropdown-list');
if (list) list.querySelectorAll('.dropdown-item').forEach(function (d) { d.classList.remove('selected'); });
}
function tokenIcon(c) { return WEB3 + '/token/' + (c || '').toUpperCase() + '.svg'; }
function netIcon(n) { return WEB3 + '/network/' + (n || '').toLowerCase() + '.svg'; }
function preloadIcons(srcs, cb) {
var pending = srcs.length;
if (!pending) return cb();
srcs.forEach(function (src) {
if (iconCache[src]) { if (--pending === 0) cb(); return; }
fetch(src)
.then(function (r) { return r.ok ? r.blob() : null; })
.then(function (blob) {
if (blob) {
var reader = new FileReader();
reader.onload = function () { iconCache[src] = reader.result; if (--pending === 0) cb(); };
reader.readAsDataURL(blob);
} else { iconCache[src] = src; if (--pending === 0) cb(); }
})
.catch(function () { iconCache[src] = src; if (--pending === 0) cb(); });
});
}
function cached(src) { return iconCache[src] || src; }
function initSelectionUI() {
if (!methods.length) return;
var currencies = Array.from(new Set(methods.map(function (m) { return m.currency; })));
var srcs = currencies.map(tokenIcon).concat(methods.map(function (m) { return netIcon(m.network); }));
preloadIcons(srcs, function () {
buildDropdown('currencySelect', currencies.map(function (c) {
return { value: c, label: c, iconSrc: cached(tokenIcon(c)), badge: '' };
}), function (val) {
selCur = val;
selMethod = null;
resetTrigger('networkSelect', t('selectNetwork', '选择网络'));
updateNetworkDropdown();
updateAmount();
updatePayBtn();
});
buildDropdown('networkSelect', [], function () {});
updateAmount();
updatePayBtn();
});
}
function updateNetworkDropdown() {
var arr = methods.filter(function (m) { return m.currency === selCur; });
buildDropdown('networkSelect', arr.map(function (m) {
return {
value: m.token_net_name,
label: m.token_net_name.toUpperCase(),
iconSrc: cached(netIcon(m.network)),
badge: m.is_popular ? t('hotBadge', '热门') : '',
fullData: m
};
}), function (_, item) {
selMethod = item.fullData;
updateAmount();
updatePayBtn();
});
}
function updateAmount() {
var aEl = document.getElementById('payAmountCrypto');
var nEl = document.getElementById('payNetworkTag');
var lineEl = document.getElementById('networkTagSep');
var rowEl = aEl ? aEl.closest('.amount-crypto-row') : null;
if (!aEl) return;
if (selMethod) {
aEl.textContent = selMethod.actual_amount + ' ' + selMethod.currency;
if (nEl) nEl.textContent = t('networkPrefix', '区块网络 · ') + selMethod.token_net_name;
if (lineEl) lineEl.style.display = 'flex';
if (rowEl) rowEl.style.display = '';
} else {
aEl.textContent = '--';
if (nEl) nEl.textContent = '';
if (lineEl) lineEl.style.display = 'none';
if (rowEl) rowEl.style.display = 'none';
}
}
function updatePayBtn() {
var b = document.getElementById('payBtn');
if (b) b.disabled = !selMethod;
}
function startStatusCheck() {
if (stTimer) clearInterval(stTimer);
stTimer = setInterval(checkStatus, 5000);
checkStatus();
}
function checkStatus() {
if (!tradeId) return;
fetch('/api/v1/pay/info', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ trade_id: tradeId })
})
.then(function (r) { return r.json(); })
.then(function (res) {
if (res.status_code !== 200) return;
var d = res.data;
if (d.status === 5) showConfirming();
else if (d.status === 2) {
clearInterval(stTimer);
if (cdTimer) clearInterval(cdTimer);
hideConfirming();
showSuccess(d);
}
})
.catch(function (e) { console.error(e); });
}
function startCountdown(timerEl, expiredAt, createdAt, onExpire) {
if (cdTimer) clearInterval(cdTimer);
var total = expiredAt - createdAt;
if (total <= 0) total = 1;
var wrap = timerEl ? timerEl.closest('.timer-badge-wrap') : null;
var bar = wrap ? wrap.querySelector('.timer-ring-bar') : null;
function tick() {
var rem = Math.max(0, expiredAt - Math.floor(Date.now() / 1000));
var hh = Math.floor(rem / 3600);
var mm = Math.floor((rem % 3600) / 60);
var ss = rem % 60;
if (timerEl) timerEl.textContent = ('0' + hh).slice(-2) + ':' + ('0' + mm).slice(-2) + ':' + ('0' + ss).slice(-2);
var pct = rem / total;
if (bar) {
bar.style.strokeDashoffset = (1 - pct) * 100;
bar.classList.toggle('danger', pct <= 0.10);
bar.classList.toggle('warn', pct > 0.10 && pct <= 0.30);
}
if (timerEl) {
timerEl.classList.toggle('danger', pct <= 0.10);
timerEl.classList.toggle('warn', pct > 0.10 && pct <= 0.30);
}
if (rem <= 0) {
clearInterval(cdTimer);
if (onExpire) onExpire();
}
}
tick();
cdTimer = setInterval(tick, 1000);
}
function showConfirming() {
var m = document.getElementById('confirmingModal');
if (m && m.style.display === 'none') m.style.display = 'flex';
}
function hideConfirming() {
var m = document.getElementById('confirmingModal');
if (m) m.style.display = 'none';
}
function showSuccess(data) {
var modal = document.getElementById('successModal');
if (!modal) return;
modal.style.display = 'flex';
if (data.trade_url) {
var sec = document.getElementById('txHashSection');
if (sec) sec.style.display = 'block';
var link = document.getElementById('txHashLink');
if (link) link.href = data.trade_url;
var disp = document.getElementById('txHashDisplayText');
if (disp) {
var u = data.trade_url;
disp.textContent = u.length > 40 ? u.slice(0, 20) + '...' + u.slice(-16) : u;
}
}
var ret = data.redirect_url || (cfg && cfg.return_url) || '';
var btn = document.getElementById('returnBtn');
if (btn) {
if (ret) btn.href = ret;
else btn.style.display = 'none';
}
showToast(t('paymentSuccessToast', '支付成功'), 'success');
}
function showTimeout() {
if (document.getElementById('timeoutModal')) return;
var ret = cfg.return_url || '/';
var ov = document.createElement('div');
ov.id = 'timeoutModal';
ov.className = 'modal-overlay';
ov.innerHTML =
'<div class="modal-card"><div class="modal-body">' +
'<div style="margin-bottom:16px;display:flex;justify-content:center;">' +
'<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' +
'<circle cx="12" cy="12" r="10"/>' +
'<polyline points="12 6 12 12 16 14"/>' +
'</svg>' +
'</div>' +
'<div class="modal-title" style="color:#ef4444;">' + t('timeoutTitle', '支付已超时') + '</div>' +
'<p class="modal-subtitle">' + t('timeoutMessage', '很抱歉,支付时间已超时。<br>请重新发起支付。') + '</p>' +
'<a href="' + ret + '" class="return-btn">' + t('returnBtn', '返回商户平台') + '</a>' +
'</div></div>';
document.body.appendChild(ov);
}
function createTransaction() {
if (!selMethod) return;
fetch('/api/v1/pay/update-order', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ trade_id: tradeId, currency: selMethod.currency, network: selMethod.network })
})
.then(function (r) { return r.json(); })
.then(function (res) {
if (res.status_code === 200 && res.data && res.data.payment_url) {
window.location.href = res.data.payment_url;
} else showToast(res.message || t('toastCreateFailed', '创建交易失败'), 'error');
})
.catch(function () { showToast(t('toastNetworkError', '网络错误'), 'error'); });
}
window.Payment = {
init: function (config) {
cfg = config || {};
tradeId = cfg.trade_id;
document.addEventListener('click', function () {
document.querySelectorAll('.select-dropdown').forEach(function (d) { d.classList.remove('open'); });
document.querySelectorAll('.select-trigger').forEach(function (x) { x.classList.remove('open'); });
});
startCountdown(document.getElementById('timerDisplay'), parseInt(cfg.expired_at) || 0, parseInt(cfg.created_at) || 0, showTimeout);
startStatusCheck();
var payBtn = document.getElementById('payBtn');
if (payBtn) payBtn.addEventListener('click', createTransaction);
var caBtn = document.getElementById('copyAmountBtn');
var caIcon = document.getElementById('copyAmountIcon');
if (caBtn) caBtn.addEventListener('click', function () {
if (selMethod) copyText(selMethod.actual_amount, t('toastAmountCopied', '金额已复制'), caIcon, false);
});
fetch('/api/v1/pay/methods', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ trade_id: tradeId })
})
.then(function (r) { return r.json(); })
.then(function (res) {
if (res.status_code === 200 && res.data && Array.isArray(res.data.methods) && res.data.methods.length) {
methods = res.data.methods;
initSelectionUI();
} else {
methods = [];
showToast(res.message || t('toastLoadFailed', '无法加载付款网络'), 'error');
}
})
.catch(function () { showToast(t('toastNetworkError', '网络错误'), 'error'); });
},
initQrPage: function (config) {
cfg = config || {};
tradeId = cfg.trade_id;
startCountdown(document.getElementById('timerDisplayQ'), parseInt(cfg.expired_at) || 0, parseInt(cfg.created_at) || 0, showTimeout);
startStatusCheck();
var caBtn = document.getElementById('copyAmountQBtn');
var caIcon = document.getElementById('copyAmountQIcon');
if (caBtn) caBtn.addEventListener('click', function () {
if (window._qrAmount) copyText(window._qrAmount, t('toastAmountCopied', '金额已复制'), caIcon, false);
});
var adBtn = document.getElementById('copyAddressBtn');
var adIcon = document.getElementById('copyAddressIcon');
if (adBtn) adBtn.addEventListener('click', function () {
var el = document.getElementById('walletAddress');
if (el && el.textContent !== '--') copyText(el.textContent, t('toastAddressCopied', '地址已复制'), adIcon, true);
});
},
initI18n: initI18n,
applyI18n: applyI18n,
t: t,
switchLang: switchLang
};
})();
(function () {
var orderData = null, gTradeId = '';
window._qrAmount = '';
function _t(k, d) { return (window.Payment && window.Payment.t) ? window.Payment.t(k, d) : d; }
function showSelection() {
document.getElementById('selectionStage').style.display = 'block';
document.getElementById('paymentStage').style.display = 'none';
var d = orderData;
document.getElementById('orderMoneyS').textContent = d.money || '--';
document.getElementById('orderFiatS').textContent = d.fiat || '';
document.getElementById('orderIdS').textContent = d.order_id || '--';
bindHelp('helpBtnS', d.support_url);
Payment.init({
expired_at: d.expired_at,
created_at: d.created_at,
trade_id: d.trade_id,
return_url: d.redirect_url
});
}
function showPayment() {
document.getElementById('selectionStage').style.display = 'none';
document.getElementById('paymentStage').style.display = 'block';
var d = orderData;
var currency = (d.network && d.network.crypto) ? d.network.crypto : (d.selected_payment ? d.selected_payment.currency : 'USDT');
var netName = (d.network && d.network.name) ? d.network.name : (d.selected_payment ? d.selected_payment.token_net_name : '');
var amount = d.actual_amount || '--';
window._qrAmount = amount;
document.getElementById('orderMoneyQ').textContent = d.money || '--';
document.getElementById('orderFiatQ').textContent = d.fiat || '';
document.getElementById('payAmountQ').textContent = amount + ' ' + currency;
document.getElementById('payNetworkQ').textContent = _t('networkPrefix', '区块网络 · ') + netName;
document.getElementById('orderIdQ').textContent = d.order_id || '--';
document.getElementById('walletAddress').textContent = d.token || d.address || '--';
var addr = document.getElementById('addressLabelQ');
if (addr) addr.textContent = _t('receivingAddress', '收款地址');
$('#qrcode').empty().qrcode({ text: d.token || d.address || '', width: 200, height: 200 });
bindHelp('helpBtnQ', d.support_url);
Payment.initQrPage({
expired_at: d.expired_at,
created_at: d.created_at,
trade_id: d.trade_id,
return_url: d.redirect_url
});
}
function bindHelp(id, url) {
var el = document.getElementById(id);
if (!el) return;
if (url) {
el.href = url;
el.removeAttribute('aria-disabled');
el.style.pointerEvents = '';
el.style.opacity = '';
} else {
el.href = '#';
el.setAttribute('aria-disabled', 'true');
el.style.pointerEvents = 'none';
el.style.opacity = '0.35';
}
}
function loadOrder() {
fetch('/api/v1/pay/info', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ trade_id: gTradeId })
})
.then(function (r) { return r.json(); })
.then(function (res) {
if (res.status_code !== 200) {
var t = document.getElementById('cmusToast');
if (t) {
t.textContent = res.message || _t('toastLoadOrderFailed', '加载订单失败');
t.className = 'toast error show';
}
return;
}
orderData = res.data;
if (!orderData.trade_type || !orderData.token) showSelection();
else showPayment();
})
.catch(function (e) {
var t = document.getElementById('cmusToast');
if (t) {
t.textContent = _t('toastNetworkError', '网络错误') + ': ' + e.message;
t.className = 'toast error show';
}
});
}
document.addEventListener('DOMContentLoaded', function () {
var parts = window.location.pathname.split('/');
gTradeId = parts[parts.length - 1];
if (!gTradeId) return;
var ready = (window.Payment && Payment.initI18n) ? Payment.initI18n() : Promise.resolve();
ready.then(loadOrder);
});
})();
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
{
"pageTitle": "BEpusdt - Better Personal Cryptocurrency Payment Gateway",
"brandName": "BEpusdt",
"helpTitle": "Support",
"feeNotice": "Please pay the exact amount shown",
"timerLabel": "Expires in",
"merchantOrder": "Merchant Order",
"selectCurrency": "Select currency",
"currencyLabel": "Currency",
"networkLabel": "Network",
"selectNetwork": "Select network",
"searchPlaceholder": "Search",
"hotBadge": "Popular",
"payBtn": "Continue Payment",
"poweredBy": "Powered by",
"copyAmountTitle": "Copy amount",
"networkPrefix": "Network · ",
"receivingAddress": "Receiving Address",
"copyAddressTitle": "Copy address",
"toastCopied": "Copied",
"toastAmountCopied": "Amount copied",
"toastAddressCopied": "Address copied",
"toastHashCopied": "Hash copied",
"toastCopyFailed": "Copy failed",
"toastNetworkError": "Network error",
"toastCreateFailed": "Failed to create transaction",
"toastLoadFailed": "Failed to load payment network",
"toastLoadOrderFailed": "Failed to load order",
"paymentSuccess": "Payment Successful!",
"paymentSuccessSubtitle": "Your payment has been confirmed, transaction complete",
"onChainDetails": "On-chain Details",
"returnBtn": "Return to Merchant",
"confirmingTitle": "Confirming Transaction",
"confirmingSubtitle": "Payment detected, awaiting blockchain confirmation...",
"confirmingNote": "Estimated confirmation time: 1-3 minutes",
"timeoutTitle": "Payment Expired",
"timeoutMessage": "Sorry, the payment time has expired.<br>Please initiate a new payment.",
"paymentSuccessToast": "Payment successful"
}
@@ -0,0 +1,39 @@
{
"pageTitle": "BEpusdt 一款更好用的个人加密货币收款网关",
"brandName": "BEpusdt",
"helpTitle": "联系客服",
"feeNotice": "请严格按照数额进行付款",
"timerLabel": "到期时间",
"merchantOrder": "商户订单",
"selectCurrency": "选择货币",
"currencyLabel": "货币",
"networkLabel": "网络",
"selectNetwork": "选择网络",
"searchPlaceholder": "搜索",
"hotBadge": "热门",
"payBtn": "继续付款",
"poweredBy": "Powered by",
"copyAmountTitle": "复制金额",
"networkPrefix": "区块网络 · ",
"receivingAddress": "收款地址",
"copyAddressTitle": "复制地址",
"toastCopied": "已复制",
"toastAmountCopied": "金额已复制",
"toastAddressCopied": "地址已复制",
"toastHashCopied": "哈希已复制",
"toastCopyFailed": "复制失败",
"toastNetworkError": "网络错误",
"toastCreateFailed": "创建交易失败",
"toastLoadFailed": "无法加载付款网络",
"toastLoadOrderFailed": "加载订单失败",
"paymentSuccess": "支付成功!",
"paymentSuccessSubtitle": "您的付款已确认,交易已完成",
"onChainDetails": "链上详情",
"returnBtn": "返回商户平台",
"confirmingTitle": "交易确认中",
"confirmingSubtitle": "检测到付款,区块链网络确认中...",
"confirmingNote": "预计确认时间:1-3 分钟",
"timeoutTitle": "支付已超时",
"timeoutMessage": "很抱歉,支付时间已超时。<br>请重新发起支付。",
"paymentSuccessToast": "支付成功"
}
@@ -1,4 +1,4 @@
# Third-Party Icon Notices
# Web3 Icons
This payment template includes a small subset of SVG icons from Web3 Icons.
@@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.3358 9.02074C15.1513 9.02074 14.9754 8.94122 14.8526 8.80304L14.2096 8.07662C14.1139 7.96856 13.9756 7.90603 13.8313 7.90603C13.6869 7.90603 13.5488 7.96778 13.453 8.07662L12.9011 8.70037C12.7204 8.90417 12.461 9.02151 12.1885 9.02151H3.5071C3.26008 9.7263 3.09873 10.4705 3.03467 11.2432H11.2305C11.3748 11.2432 11.5124 11.1845 11.6119 11.0803L12.3754 10.2844C12.4703 10.1848 12.6023 10.1285 12.7397 10.1285H12.7714C12.9157 10.1285 13.0539 10.1902 13.1496 10.2991L13.7927 11.0255C13.9154 11.1637 14.0907 11.2432 14.276 11.2432H20.9656C20.9017 10.4705 20.7404 9.7263 20.4933 9.02151L15.3358 9.02074Z" fill="black"/>
<path d="M7.99453 15.9135C8.13888 15.9135 8.27629 15.8548 8.37587 15.7506L9.13933 14.9546C9.23429 14.8551 9.36628 14.7988 9.5037 14.7988H9.53535C9.67971 14.7988 9.81791 14.8605 9.91365 14.9693L10.5567 15.6958C10.6794 15.8339 10.8546 15.9135 11.0398 15.9135H20.1058C20.4454 15.2118 20.694 14.4583 20.8422 13.6702H12.1406C11.9561 13.6702 11.7802 13.5906 11.6575 13.4525L11.0145 12.7261C10.9187 12.618 10.7806 12.5554 10.6361 12.5554C10.4917 12.5554 10.3536 12.6172 10.2579 12.7261L9.70595 13.3498C9.52531 13.5536 9.26593 13.671 8.99343 13.671H3.1582C3.30642 14.4599 3.55498 15.2125 3.89465 15.9143L7.99453 15.9135Z" fill="black"/>
<path d="M14.4263 6.59423C14.5706 6.59423 14.708 6.53557 14.8077 6.43135L15.5711 5.63547C15.6661 5.53588 15.798 5.47953 15.9355 5.47953H15.9671C16.1114 5.47953 16.2496 5.54128 16.3454 5.65014L16.9885 6.37654C17.1112 6.51473 17.2864 6.59423 17.4717 6.59423H19.1954C17.5535 4.41191 14.942 3 12.0009 3C9.05964 3 6.4481 4.41191 4.80615 6.59423H14.4263Z" fill="black"/>
<path d="M8.60571 18.1377C8.42122 18.1377 8.24521 18.0581 8.12247 17.9199L7.47943 17.1936C7.38371 17.0855 7.24552 17.0229 7.10117 17.0229C6.95681 17.0229 6.81864 17.0847 6.72291 17.1936L6.17097 17.8173C5.99033 18.0211 5.73095 18.1384 5.45844 18.1384H5.42139C7.06411 19.8985 9.40238 21 12.0001 21C14.5976 21 16.9359 19.8985 18.5787 18.1384L8.60571 18.1377Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,9 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.51514 8.47125V15.5274C4.51514 15.9779 4.75959 16.3944 5.15552 16.6189L11.3599 20.1477C11.7558 20.3722 12.2432 20.3722 12.6392 20.1477L18.8435 16.6189C19.2394 16.3944 19.4839 15.9779 19.4839 15.5274V8.47125C19.4839 8.02072 19.2394 7.60418 18.8435 7.37966L12.6392 3.85086C12.2432 3.62634 11.7558 3.62634 11.3599 3.85086L5.15401 7.37966C4.75809 7.60418 4.51514 8.02072 4.51514 8.47125Z" fill="#213147"/>
<path d="M13.3531 13.3677L12.4682 15.7577C12.4442 15.8241 12.4442 15.8965 12.4682 15.963L13.9905 20.0752L15.7511 19.0738L13.638 13.3677C13.59 13.2363 13.401 13.2363 13.3531 13.3677Z" fill="#12AAFF"/>
<path d="M15.1273 9.3485C15.0793 9.21704 14.8903 9.21704 14.8423 9.3485L13.9575 11.7384C13.9334 11.8049 13.9334 11.8773 13.9575 11.9437L16.4515 18.6764L18.2122 17.6749L15.1273 9.3485Z" fill="#12AAFF"/>
<path d="M11.9984 4.11521C12.0419 4.11521 12.0854 4.12703 12.1244 4.14771L18.8387 7.96602C18.9166 8.01033 18.9647 8.09305 18.9647 8.1802V15.8153C18.9647 15.904 18.9166 15.9852 18.8387 16.0295L12.1244 19.8479C12.0869 19.87 12.0419 19.8803 11.9984 19.8803C11.955 19.8803 11.9114 19.8685 11.8725 19.8479L5.15817 16.0325C5.08019 15.9881 5.0322 15.9055 5.0322 15.8183V8.18167C5.0322 8.09305 5.08019 8.01181 5.15817 7.9675L11.8725 4.14919C11.9114 4.12703 11.955 4.11521 11.9984 4.11521ZM11.9984 3C11.76 3 11.52 3.06056 11.3056 3.18316L4.59277 6.99999C4.16386 7.24371 3.8999 7.69423 3.8999 8.18167V15.8168C3.8999 16.3043 4.16386 16.7548 4.59277 16.9985L11.3071 20.8168C11.5215 20.938 11.76 21 11.9999 21C12.2384 21 12.4783 20.9395 12.6928 20.8168L19.407 16.9985C19.836 16.7548 20.0999 16.3043 20.0999 15.8168V8.18167C20.0999 7.69423 19.836 7.24371 19.407 6.99999L12.6913 3.18316C12.4768 3.06056 12.2369 3 11.9984 3Z" fill="#9DCCED"/>
<path d="M7.55859 18.6854L8.17649 17.0192L9.41975 18.0369L8.25747 19.0827L7.55859 18.6854Z" fill="#213147"/>
<path d="M11.4334 7.63513H9.73114C9.60366 7.63513 9.48969 7.71342 9.44619 7.83158L5.79736 17.6838L7.55804 18.6854L11.5758 7.83602C11.6133 7.73853 11.5398 7.63513 11.4334 7.63513Z" fill="white"/>
<path d="M14.4117 7.63513H12.7095C12.582 7.63513 12.468 7.71342 12.4245 7.83158L8.2583 19.0812L10.019 20.0827L14.5542 7.83602C14.5902 7.73853 14.5166 7.63513 14.4117 7.63513Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.0009 4.70623C3.0009 4.12129 3.0009 3.82882 3.11069 3.60474C3.21598 3.38966 3.39056 3.21508 3.60564 3.10979C3.82972 3 4.12219 3 4.70623 3H19.2938C19.8787 3 20.1703 3 20.3953 3.10979C20.6103 3.21508 20.784 3.39056 20.8893 3.60474C21 3.82972 21 4.12219 21 4.70623V19.2938C21 19.8787 21 20.1703 20.8893 20.3953C20.784 20.6103 20.6094 20.784 20.3953 20.8893C20.1703 21 19.8778 21 19.2938 21H4.70623C4.12129 21 3.82972 21 3.60474 20.8893C3.38966 20.784 3.21598 20.6094 3.11069 20.3953C3 20.1703 3 19.8778 3 19.2938V4.70623H3.0009Z" fill="#0000FF"/>
</svg>

After

Width:  |  Height:  |  Size: 658 B

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.09 5.75501L12 3L16.91 5.75501L15.1099 6.77501L12 5.03501L8.895 6.77501L7.09 5.75501ZM16.91 9.23501L15.1099 8.215L12 9.95504L8.895 8.215L7.09 9.23501V11.27L10.19 13.01V16.485L12 17.505L13.805 16.485V13.01L16.91 11.27V9.23501ZM16.91 14.75V12.71L15.1099 13.7301V15.7651L16.91 14.75ZM18.195 15.47L15.09 17.2051V19.245L20.0001 16.485V10.9751L18.195 11.9901V15.47ZM16.39 7.495L18.19 8.51501V10.55L20.0001 9.53501V7.495L18.195 6.47503L16.39 7.50001V7.495ZM10.19 17.9449V19.9799L12 21L13.805 19.9799V17.95L12 18.965L10.195 17.9449H10.19ZM7.09 14.745L8.89001 15.7651V13.7301L7.09 12.71V14.75V14.745ZM10.19 7.495L12 8.51501L13.805 7.495L12 6.47503L10.195 7.50001L10.19 7.495ZM5.80499 8.51501L7.61 7.495L5.80999 6.47503L4 7.50001V9.54002L5.80499 10.555V8.52001V8.51501ZM5.80499 11.9901L4 10.9751V16.485L8.91 19.245V17.2L5.80999 15.465V11.9851L5.80499 11.9901Z" fill="#F0B90B"/>
</svg>

After

Width:  |  Height:  |  Size: 982 B

@@ -0,0 +1,10 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 3V9.65149L17.6247 12.1672L12 3Z" fill="#8FFCF3"/>
<path d="M11.9996 3L6.375 12.1662L11.9996 9.65255V3Z" fill="#CABCF8"/>
<path d="M12 16.4778V21L17.6247 13.2156L12 16.4778Z" fill="#CBA7F5"/>
<path d="M11.9996 21V16.4778L6.375 13.2156L11.9996 21Z" fill="#74A0F3"/>
<path d="M12 15.4295L17.6247 12.1673L12 9.65158V15.4295Z" fill="#CBA7F5"/>
<path d="M6.375 12.1673L11.9996 15.4295V9.65158L6.375 12.1673Z" fill="#74A0F3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9996 15.4294L6.375 12.1672L11.9996 3L17.6242 12.1662L11.9996 15.4294ZM6.74774 11.9016L11.9093 3.49138V9.60635L6.74774 11.9016ZM6.67109 12.1305L11.9093 9.80374V15.168L6.67109 12.1305ZM12.0889 9.80374V15.168L17.3229 12.1305L12.0889 9.80374ZM12.0889 9.60635L17.2505 11.9016L12.0889 3.49138V9.60635Z" fill="#202699"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9996 16.4064L6.375 13.2114L11.9996 20.9999L17.6242 13.2103L11.9996 16.4064ZM7.00498 13.7731L11.9093 16.5639V20.5684L7.00498 13.7731ZM12.0889 16.5639V20.5684L16.9942 13.7731L12.0889 16.5639Z" fill="#202699"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.6 KiB

@@ -0,0 +1,10 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.3644 15.217L20.6338 12.7816C20.8601 12.6521 21 12.4122 21 12.1547V7.2838C21 7.02631 20.8601 6.7864 20.6338 6.65702L16.3644 4.22156C16.138 4.09218 15.8569 4.09344 15.6319 4.22156L11.3623 6.65702C11.136 6.7864 10.9961 7.02631 10.9961 7.2838V15.9882L8.00191 17.6951L5.00763 15.9882V12.5729L8.00191 10.866L9.97646 11.9927V9.70168L8.36809 8.78352C8.25748 8.72071 8.13032 8.68679 8.00191 8.68679C7.87349 8.68679 7.74634 8.72071 7.63573 8.78352L3.36617 11.2191C3.13986 11.3484 3 11.5882 3 11.8457V16.7167C3 16.9742 3.13986 17.2141 3.36617 17.3434L7.63573 19.779C7.86205 19.907 8.14177 19.907 8.36809 19.779L12.6376 17.3434C12.864 17.2141 13.0039 16.9742 13.0039 16.7167V8.01231L13.0571 7.98216L15.9968 6.30534L18.9911 8.01231V11.4275L15.9968 13.1344L14.0247 12.0103V14.3013L15.6306 15.217C15.857 15.345 16.1379 15.345 16.3629 15.217H16.3644Z" fill="url(#paint0_linear_328_59720)"/>
<defs>
<linearGradient id="paint0_linear_328_59720" x1="2.94151" y1="17.194" x2="20.1188" y2="7.10065" gradientUnits="userSpaceOnUse">
<stop stop-color="#A726C1"/>
<stop offset="0.88" stop-color="#803BDF"/>
<stop offset="1" stop-color="#7B3FE4"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,19 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.4128 7.90222C18.3006 8.00534 18.1544 8.06331 18.002 8.06496H3.57973C3.06788 8.06496 2.80933 7.47961 3.16368 7.13707L5.53262 4.85345C5.64271 4.74715 5.78907 4.68664 5.94209 4.68414H20.4208C20.9379 4.68414 21.1912 5.27474 20.8316 5.61859L18.4128 7.90222Z" fill="url(#paint0_linear_328_59991)"/>
<path d="M18.4128 19.1584C18.2999 19.2595 18.1536 19.3156 18.002 19.3159H3.57973C3.06788 19.3159 2.80933 18.7357 3.16368 18.3932L5.53262 16.1031C5.643 15.998 5.78972 15.9396 5.94209 15.9403H20.4208C20.9379 15.9403 21.1912 16.5256 20.8316 16.8682L18.4128 19.1584Z" fill="url(#paint1_linear_328_59991)"/>
<path d="M18.4128 10.4727C18.2999 10.3716 18.1536 10.3155 18.002 10.3152H3.57973C3.06788 10.3152 2.80933 10.8954 3.16368 11.2379L5.53262 13.5281C5.64442 13.6308 5.79021 13.6889 5.94209 13.6909H20.4208C20.9379 13.6909 21.1912 13.1055 20.8316 12.763L18.4128 10.4727Z" fill="url(#paint2_linear_328_59991)"/>
<defs>
<linearGradient id="paint0_linear_328_59991" x1="3.00094" y1="55.0406" x2="21.4588" y2="54.8714" gradientUnits="userSpaceOnUse">
<stop stop-color="#599DB0"/>
<stop offset="1" stop-color="#47F8C3"/>
</linearGradient>
<linearGradient id="paint1_linear_328_59991" x1="3.00094" y1="9.16751" x2="21.3414" y2="9.02716" gradientUnits="userSpaceOnUse">
<stop stop-color="#C44FE2"/>
<stop offset="1" stop-color="#73B0D0"/>
</linearGradient>
<linearGradient id="paint2_linear_328_59991" x1="4.03645" y1="12.003" x2="20.3027" y2="12.003" gradientUnits="userSpaceOnUse">
<stop stop-color="#778CBF"/>
<stop offset="1" stop-color="#5DCDC9"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.0777 3H5.9216C3.68652 3 2.2699 5.41095 3.3943 7.35991L10.8966 20.3632C11.3862 21.2123 12.6131 21.2123 13.1027 20.3632L20.6065 7.35991C21.7294 5.41402 20.3128 3 18.0792 3H18.0777ZM10.8906 16.4637L9.25667 13.3017L5.31426 6.2508C5.05423 5.79949 5.37549 5.2212 5.92007 5.2212H10.889V16.4653L10.8906 16.4637ZM18.682 6.24926L14.7412 13.3032L13.1073 16.4637V5.21975H18.0762C18.6208 5.21975 18.9421 5.79796 18.682 6.24926Z" fill="#0098EA"/>
</svg>

After

Width:  |  Height:  |  Size: 549 B

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.41958 3.18579C4.48795 3.11039 4.5754 3.05483 4.67269 3.02495C4.76997 2.99507 4.87352 2.99196 4.97243 3.01598L16.8757 5.93028C16.9472 5.94689 17.0145 5.97827 17.0732 6.02242L19.4952 7.7889C19.6129 7.87561 19.6924 8.00447 19.7171 8.14848C19.7419 8.29251 19.71 8.44047 19.6281 8.56157L11.2959 20.7531C11.2373 20.8395 11.1559 20.9078 11.0608 20.9506C10.9655 20.9932 10.8604 21.0088 10.7569 20.9952C10.6534 20.9818 10.5558 20.9398 10.4749 20.874C10.3939 20.8083 10.3327 20.7213 10.2982 20.6228L4.30638 3.75311C4.27274 3.65729 4.26548 3.55418 4.28542 3.45459C4.30532 3.35501 4.35167 3.26262 4.41958 3.1871M6.3835 6.2304L10.543 17.9415L11.2275 11.8734L6.3835 6.2304ZM12.3411 12.0682L11.6461 18.2429L17.53 9.63303L12.3411 12.0682ZM18.0604 8.13772L14.2682 9.91736L16.81 7.22684L18.0604 8.13772ZM15.6648 6.79509L6.41115 4.53105L11.8369 10.8493L15.6648 6.79509Z" fill="#C4342B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,11 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.8208 14.3415V19.0143H19.0953C19.2674 19.0143 19.4069 18.8748 19.4069 18.7029V14.653C19.4069 14.481 19.2674 14.3415 19.0953 14.3415H17.8208Z" fill="black" fill-opacity="0.5"/>
<path d="M17.8208 4.98566V9.65853H19.0953C19.2674 9.65853 19.4069 9.51903 19.4069 9.34698V5.29719C19.4069 5.12513 19.2674 4.98566 19.0953 4.98566H17.8208Z" fill="black" fill-opacity="0.5"/>
<path d="M20.209 4.98566V9.65853H20.6859C20.8579 9.65853 20.9974 9.51903 20.9974 9.34698V5.29719C20.9974 5.12513 20.8579 4.98566 20.6859 4.98566H20.209Z" fill="black" fill-opacity="0.3"/>
<path d="M20.2114 14.3415V19.0143H20.6883C20.8603 19.0143 20.9998 18.8748 20.9998 18.7029V14.653C20.9998 14.481 20.8603 14.3415 20.6883 14.3415H20.2114Z" fill="black" fill-opacity="0.3"/>
<path d="M12.0263 9.66925H7.9956C7.82434 9.66925 7.68555 9.80706 7.68555 9.97705V13.9788C7.68555 14.1488 7.82434 14.2867 7.9956 14.2867H12.0263C12.1974 14.2867 12.3363 14.1488 12.3363 13.9788V9.97705C12.3363 9.80706 12.1974 9.66925 12.0263 9.66925Z" fill="black"/>
<path d="M7.36136 4.98566H3.31153C3.13948 4.98566 3 5.12513 3 5.29719V9.34698C3 9.51903 3.13948 9.65853 3.31153 9.65853H7.36136C7.53342 9.65853 7.67288 9.51903 7.67288 9.34698V5.29719C7.67288 5.12513 7.53342 4.98566 7.36136 4.98566Z" fill="black"/>
<path d="M16.7051 4.98566H12.6553C12.4832 4.98566 12.3438 5.12513 12.3438 5.29719V9.34698C12.3438 9.51903 12.4832 9.65853 12.6553 9.65853H16.7051C16.8772 9.65853 17.0167 9.51903 17.0167 9.34698V5.29719C17.0167 5.12513 16.8772 4.98566 16.7051 4.98566Z" fill="black"/>
<path d="M7.36136 14.3309H3.31153C3.13948 14.3309 3 14.4703 3 14.6425V18.6922C3 18.8644 3.13948 19.0037 3.31153 19.0037H7.36136C7.53342 19.0037 7.67288 18.8644 7.67288 18.6922V14.6425C7.67288 14.4703 7.53342 14.3309 7.36136 14.3309Z" fill="black"/>
<path d="M16.7051 14.3309H12.6553C12.4832 14.3309 12.3438 14.4703 12.3438 14.6425V18.6922C12.3438 18.8644 12.4832 19.0037 12.6553 19.0037H16.7051C16.8772 19.0037 17.0167 18.8644 17.0167 18.6922V14.6425C17.0167 14.4703 16.8772 14.3309 16.7051 14.3309Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.09 5.75501L12 3L16.91 5.75501L15.11 6.77501L12 5.03501L8.895 6.77501L7.09 5.75501ZM16.91 9.23501L15.11 8.215L12 9.95504L8.895 8.215L7.09 9.23501V11.27L10.19 13.01V16.485L12 17.505L13.8051 16.485V13.01L16.91 11.27V9.23501ZM16.91 14.75V12.71L15.11 13.7301V15.7651L16.91 14.75ZM18.195 15.47L15.09 17.2051V19.245L20.0001 16.485V10.9751L18.195 11.9901V15.47ZM16.3901 7.495L18.19 8.51501V10.55L20.0001 9.53501V7.495L18.195 6.47503L16.3901 7.50001V7.495ZM10.19 17.9449V19.9799L12 21L13.8051 19.9799V17.95L12 18.965L10.195 17.9449H10.19ZM7.09 14.745L8.89001 15.7651V13.7301L7.09 12.71V14.75V14.745ZM10.19 7.495L12 8.51501L13.8051 7.495L12 6.47503L10.195 7.50001L10.19 7.495ZM5.805 8.51501L7.61 7.495L5.80999 6.47503L4 7.50001V9.54002L5.805 10.555V8.52001V8.51501ZM5.805 11.9901L4 10.9751V16.485L8.91 19.245V17.2L5.80999 15.465V11.9851L5.805 11.9901Z" fill="#F0B90B"/>
</svg>

After

Width:  |  Height:  |  Size: 975 B

@@ -0,0 +1,10 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.0001 3V9.65073L17.6249 12.1661L12.0001 3Z" fill="#8FFCF3"/>
<path d="M11.9999 3L6.37512 12.1661L11.9999 9.65073V3Z" fill="#CABCF8"/>
<path d="M12.0001 16.477V20.9993L17.6249 13.2146L12.0001 16.477Z" fill="#CBA7F5"/>
<path d="M11.9999 20.9993V16.477L6.37512 13.2146L11.9999 20.9993Z" fill="#74A0F3"/>
<path d="M12.0001 15.4291L17.6249 12.1668L12.0001 9.65137V15.4291Z" fill="#CBA7F5"/>
<path d="M6.37512 12.1668L11.9999 15.4291V9.65137L6.37512 12.1668Z" fill="#74A0F3"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9999 15.4285L6.37512 12.1661L11.9999 3L17.6248 12.1661L11.9999 15.4285ZM6.74861 11.9006L11.9099 3.49048V9.60573L6.74861 11.9006ZM6.67211 12.1301L11.9099 9.80373V15.1675L6.67211 12.1301ZM12.0899 9.80373V15.1675L17.3232 12.1301L12.0899 9.80373ZM12.0899 9.60573L17.2512 11.9006L12.0899 3.49048V9.60573Z" fill="#202699"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9999 16.4057L6.37512 13.2109L11.9999 21L17.6248 13.2109L11.9999 16.4057ZM7.0051 13.7734L11.9099 16.5632V20.5681L7.0051 13.7734ZM12.0899 16.5632V20.5681L16.9948 13.7734L12.0899 16.5632Z" fill="#202699"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20.6612 7.21947L12.8153 19.7135C12.7198 19.8645 12.5876 19.9886 12.4313 20.0747C12.2748 20.1608 12.0991 20.2059 11.9206 20.2059C11.7406 20.2063 11.5636 20.1608 11.4061 20.0737C11.2486 19.9867 11.1159 19.8609 11.0205 19.7083L3.32824 7.21418C3.11275 6.86398 2.99909 6.46066 3.00001 6.04947C3.00976 5.44241 3.25994 4.86401 3.69566 4.4412C4.13139 4.01838 4.71703 3.78568 5.32412 3.79417H18.6865C19.9624 3.79417 21 4.80006 21 6.04417C21 6.45712 20.8835 6.86476 20.6612 7.21947ZM5.21824 6.80123L10.9411 15.6266V5.91182H5.81647C5.22353 5.91182 4.95883 6.30359 5.21824 6.80123ZM13.0588 15.6266L18.7818 6.80123C19.0465 6.30359 18.7765 5.91182 18.1835 5.91182H13.0588V15.6266Z" fill="#0088CC"/>
</svg>

After

Width:  |  Height:  |  Size: 798 B

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.41836 3.186C4.48661 3.11044 4.57404 3.05477 4.67138 3.02487C4.7687 2.99497 4.87233 2.99197 4.97122 3.01619L16.8749 5.9306C16.9464 5.94809 17.0136 5.97968 17.0733 6.02256L19.4953 7.78835C19.6137 7.87479 19.6938 8.00391 19.7187 8.14839C19.7435 8.2929 19.7112 8.44138 19.6284 8.56235L11.2959 20.7537C11.2372 20.8399 11.1558 20.9079 11.0606 20.9506C10.9655 20.9932 10.8605 21.0087 10.7571 20.9953C10.6537 20.9819 10.5561 20.9401 10.475 20.8744C10.3941 20.8089 10.3327 20.7222 10.298 20.624L4.30552 3.75354C4.27144 3.65765 4.26394 3.55432 4.2838 3.45451C4.30366 3.35469 4.35016 3.26155 4.41836 3.186ZM6.38273 6.23073L10.5428 17.9425L11.227 11.8728L6.38273 6.23073ZM12.3401 12.0686L11.6451 18.2437L17.5292 9.63308L12.3401 12.0686ZM18.0601 8.13812L14.2673 9.91807L16.81 7.22702L18.0601 8.13812ZM15.6647 6.79601L6.40982 4.52981L11.8359 10.8494L15.6647 6.79601Z" fill="#C4342B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 21C16.9706 21 21 16.9706 21 12C21 7.02943 16.9706 3 12 3C7.02943 3 3 7.02943 3 12C3 16.9706 7.02943 21 12 21Z" fill="#0B53BF"/>
<path d="M13.6201 5.45V6.60874C15.9319 7.30624 17.625 9.45495 17.625 12.003C17.625 14.5511 15.9319 16.6999 13.6201 17.3973V18.5561C16.5675 17.8361 18.75 15.1755 18.75 12.003C18.75 8.83059 16.5675 6.16999 13.6201 5.45Z" fill="white"/>
<path d="M6.37499 12.003C6.37499 9.45495 8.06809 7.30624 10.3799 6.60874V5.45C7.43247 6.16999 5.25 8.83059 5.25 12.003C5.25 15.1755 7.43247 17.8361 10.3799 18.5561V17.3973C8.06809 16.7055 6.37499 14.5511 6.37499 12.003Z" fill="white"/>
<path d="M14.4188 13.2575C14.4188 10.9569 10.8132 11.9019 10.8132 10.6306C10.8132 10.175 11.1788 9.8825 11.8763 9.8825C12.7088 9.8825 12.9957 10.2875 13.0857 10.8331H14.2331C14.1308 9.80916 13.5431 9.16262 12.5626 8.97002V8.06565H11.4376V8.93774C10.3634 9.07454 9.6882 9.70009 9.6882 10.6306C9.6882 12.9425 13.2994 12.0762 13.2994 13.325C13.2994 13.7974 12.8438 14.1124 12.0732 14.1124C11.0663 14.1124 10.7344 13.6681 10.6107 13.055H9.49133C9.56385 14.1765 10.2554 14.8784 11.4376 15.0536V15.9405H12.5626V15.0654C13.7163 14.9164 14.4188 14.2452 14.4188 13.2575Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.9999 19.1998L3 10.3213L6.43349 4.7998H17.5665L21 10.3213L11.9999 19.1998ZM12.9 11.0998V10.0018C14.5199 10.0828 16.0319 10.3977 16.5 10.8072C15.9555 11.2843 14.007 11.6308 11.9999 11.6308C9.99297 11.6308 8.04449 11.2843 7.49998 10.8072C7.96349 10.3977 9.47999 10.0873 11.1 9.99729V11.0998H12.9ZM7.49998 10.8028V11.4643C7.96349 11.8738 9.47548 12.1843 11.1 12.2743V14.6998H12.9V12.2698C14.5199 12.1888 16.0364 11.8738 16.5 11.4643V10.1458C16.0364 9.73625 14.5199 9.42126 12.9 9.33579V8.3998H15.6V7.0498H8.39999V8.3998H11.1V9.33579C9.47548 9.42126 7.96349 9.73625 7.49998 10.1458V10.8028Z" fill="#009393"/>
</svg>

After

Width:  |  Height:  |  Size: 720 B

+6
View File
@@ -0,0 +1,6 @@
{
"name": "官方默认",
"author": "官方",
"desc": "默认自带模板,适合大多数商户使用,功能完善界面简洁。",
"link": "https://github.com/v03413/BEpusdt"
}
@@ -0,0 +1,271 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BEpusdt 一款更好用的个人加密货币收款网关</title>
<link rel="shortcut icon" href="/checkout/official/assets/img/bepusdt.svg">
<link rel="stylesheet" href="/checkout/official/assets/css/checkout.css">
<script src="/checkout/official/assets/js/jquery.min.js"></script>
<script src="/checkout/official/assets/js/jquery.qrcode.min.js"></script>
<script src="/checkout/official/assets/js/i18next.min.js"></script>
<script src="/checkout/official/assets/js/checkout.js"></script>
</head>
<body>
<div class="checkout-card" id="selectionStage" style="display:none;">
<div class="card-header">
<div class="brand">
<div class="brand-logo">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="white">
<path d="M17.06 11.57c.59-.69.94-1.58.94-2.57 0-2.21-1.79-4-4-4H7v14h7.5c2.49 0 4.5-2.01 4.5-4.5 0-1.33-.58-2.52-1.5-3.35l.56-.58zM9 7h4.5c.83 0 1.5.67 1.5 1.5S14.33 10 13.5 10H9V7zm5.5 10H9v-3h5.5c.83 0 1.5.67 1.5 1.5S15.33 17 14.5 17z"/>
<path d="M10 3.5V2h1.5v1.5H10zM13 3.5V2h1.5v1.5H13zM10 22v-1.5h1.5V22H10zM13 22v-1.5h1.5V22H13z"/>
</svg>
</div>
<span class="brand-name" data-i18n="brandName">BEpusdt</span>
</div>
<a id="helpBtnS" href="#" class="help-btn" data-i18n="[title]helpTitle" title="联系客服" target="_blank">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
<line x1="12" y1="17" x2="12.01" y2="17"/>
</svg>
</a>
</div>
<div class="amount-block">
<div class="amount-fiat">
<span id="orderMoneyS">--</span>&nbsp;<span id="orderFiatS">--</span>
</div>
<div class="amount-crypto-row" style="display:none;">
<span class="amount-crypto-value" id="payAmountCrypto"></span>
<span class="copy-trigger" id="copyAmountBtn" data-i18n="[title]copyAmountTitle" title="复制金额">
<span class="copy-trigger-icon" id="copyAmountIcon">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
</span>
</span>
</div>
<div class="amount-network-line" id="networkTagSep" style="display:none;">
<span class="network-tag" id="payNetworkTag"></span>
</div>
</div>
<div style="padding: 12px 24px 0; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;">
<div class="fee-notice">
<svg viewBox="0 0 16 16" fill="currentColor">
<path d="M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm.75 10.5h-1.5v-5h1.5v5zm0-6.5h-1.5V3.5h1.5V5z"/>
</svg>
<span data-i18n="feeNotice">请严格按照数额进行付款</span>
</div>
<div class="timer-badge-wrap">
<div class="timer-badge">
<span class="timer-label" data-i18n="timerLabel">到期时间</span>
<span class="timer-text" id="timerDisplay">--:--:--</span>
</div>
<svg class="timer-ring" aria-hidden="true">
<rect class="timer-ring-track" x="0.75" y="0.75" rx="7.25" ry="7.25" pathLength="100"/>
<rect class="timer-ring-bar" x="0.75" y="0.75" rx="7.25" ry="7.25" pathLength="100"/>
</svg>
</div>
</div>
<div class="divider"></div>
<div class="order-info">
<div class="order-row">
<span class="order-label" data-i18n="merchantOrder">商户订单</span>
<span class="order-value" id="orderIdS">--</span>
</div>
</div>
<div class="divider"></div>
<div class="form-section">
<label class="form-label" data-i18n="currencyLabel">货币</label>
<div class="custom-select" id="currencySelect">
<div class="select-trigger">
<span class="select-text placeholder" data-i18n="selectCurrency">选择货币</span>
<svg class="select-chevron" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="6 9 12 15 18 9"/>
</svg>
</div>
<div class="select-dropdown"></div>
</div>
<label class="form-label" data-i18n="networkLabel">网络</label>
<div class="custom-select" id="networkSelect">
<div class="select-trigger">
<span class="select-text placeholder" data-i18n="selectNetwork">选择网络</span>
<svg class="select-chevron" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="6 9 12 15 18 9"/>
</svg>
</div>
<div class="select-dropdown"></div>
</div>
</div>
<div class="pay-btn-wrap">
<button class="pay-btn" id="payBtn" disabled data-i18n="payBtn">继续付款</button>
</div>
<div class="card-footer">
<div class="footer-powered">
<span data-i18n="poweredBy">Powered by</span><a href="https://github.com/v03413/BEpusdt" target="_blank">BEpusdt</a>
<a href="https://github.com/v03413/BEpusdt" target="_blank" class="footer-github" title="GitHub">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.071 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"/>
</svg>
</a>
</div>
</div>
</div>
<div class="checkout-card" id="paymentStage" style="display:none;">
<div class="card-header">
<div class="brand">
<div class="brand-logo">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="white">
<path d="M17.06 11.57c.59-.69.94-1.58.94-2.57 0-2.21-1.79-4-4-4H7v14h7.5c2.49 0 4.5-2.01 4.5-4.5 0-1.33-.58-2.52-1.5-3.35l.56-.58zM9 7h4.5c.83 0 1.5.67 1.5 1.5S14.33 10 13.5 10H9V7zm5.5 10H9v-3h5.5c.83 0 1.5.67 1.5 1.5S15.33 17 14.5 17z"/>
<path d="M10 3.5V2h1.5v1.5H10zM13 3.5V2h1.5v1.5H13zM10 22v-1.5h1.5V22H10zM13 22v-1.5h1.5V22H13z"/>
</svg>
</div>
<span class="brand-name" data-i18n="brandName">BEpusdt</span>
</div>
<a id="helpBtnQ" href="#" class="help-btn" data-i18n="[title]helpTitle" title="联系客服" target="_blank">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
<line x1="12" y1="17" x2="12.01" y2="17"/>
</svg>
</a>
</div>
<div class="amount-block">
<div class="amount-fiat">
<span id="orderMoneyQ">--</span>&nbsp;<span id="orderFiatQ">--</span>
</div>
<div class="amount-crypto-row">
<span class="amount-crypto-value" id="payAmountQ"></span>
<span class="copy-trigger" id="copyAmountQBtn" data-i18n="[title]copyAmountTitle" title="复制金额">
<span class="copy-trigger-icon" id="copyAmountQIcon">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
</span>
</span>
</div>
<div class="amount-network-line">
<span class="network-tag" id="payNetworkQ">--</span>
</div>
</div>
<div style="padding: 12px 24px 0; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;">
<div class="fee-notice">
<svg viewBox="0 0 16 16" fill="currentColor">
<path d="M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm.75 10.5h-1.5v-5h1.5v5zm0-6.5h-1.5V3.5h1.5V5z"/>
</svg>
<span data-i18n="feeNotice">请严格按照数额进行付款</span>
</div>
<div class="timer-badge-wrap">
<div class="timer-badge">
<span class="timer-label" data-i18n="timerLabel">到期时间</span>
<span class="timer-text" id="timerDisplayQ">--:--:--</span>
</div>
<svg class="timer-ring" aria-hidden="true">
<rect class="timer-ring-track" x="0.75" y="0.75" rx="7.25" ry="7.25" pathLength="100"/>
<rect class="timer-ring-bar" x="0.75" y="0.75" rx="7.25" ry="7.25" pathLength="100"/>
</svg>
</div>
</div>
<div class="divider"></div>
<div class="order-info">
<div class="order-row">
<span class="order-label" data-i18n="merchantOrder">商户订单</span>
<span class="order-value" id="orderIdQ">--</span>
</div>
</div>
<div class="divider"></div>
<div class="qr-stage">
<div class="qr-wrapper">
<div id="qrcode"></div>
</div>
<div class="address-card">
<div class="address-label-row">
<span class="address-label" id="addressLabelQ" data-i18n="receivingAddress">收款地址</span>
<span class="copy-trigger" id="copyAddressBtn" data-i18n="[title]copyAddressTitle" title="复制地址">
<span class="copy-trigger-icon" id="copyAddressIcon">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
</span>
</span>
</div>
<div class="address-value" id="walletAddress">--</div>
</div>
</div>
<div class="card-footer">
<div class="footer-powered">
<span data-i18n="poweredBy">Powered by</span><a href="https://github.com/v03413/BEpusdt" target="_blank">BEpusdt</a>
<a href="https://github.com/v03413/BEpusdt" target="_blank" class="footer-github" title="GitHub">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.071 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"/>
</svg>
</a>
</div>
</div>
</div>
<div id="cmusToast" class="toast"></div>
<div id="successModal" class="modal-overlay" style="display:none;">
<div class="modal-card">
<div class="modal-body">
<div class="success-icon-wrap">
<svg class="success-checkmark" viewBox="0 0 52 52">
<circle class="success-checkmark-circle" cx="26" cy="26" r="25" fill="none"/>
<path class="success-checkmark-check" fill="none" d="M14 27 l8 8 l16-16"/>
</svg>
</div>
<h2 class="modal-title" data-i18n="paymentSuccess">支付成功!</h2>
<p class="modal-subtitle" data-i18n="paymentSuccessSubtitle">您的付款已确认,交易已完成</p>
<div id="txHashSection" class="tx-hash-card" style="display:none;">
<div class="tx-hash-label">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<line x1="2" y1="12" x2="22" y2="12"/>
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
</svg>
<span data-i18n="onChainDetails">链上详情</span>
</div>
<a id="txHashLink" href="#" target="_blank" class="tx-hash-value" style="text-decoration:none;">
<span class="tx-hash-text" id="txHashDisplayText"></span>
<svg class="tx-copy-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="7" y1="17" x2="17" y2="7"/>
<polyline points="7 7 17 7 17 17"/>
</svg>
</a>
</div>
<a href="#" id="returnBtn" class="return-btn" data-i18n="returnBtn">返回商户平台</a>
</div>
<div class="modal-footer">
<span data-i18n="poweredBy">Powered by</span>
<a href="https://github.com/v03413/BEpusdt" target="_blank">BEpusdt</a>
<a href="https://github.com/v03413/BEpusdt" target="_blank" class="modal-footer-github" title="GitHub">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.071 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"/>
</svg>
</a>
</div>
</div>
</div>
<div id="confirmingModal" class="modal-overlay" style="display:none;">
<div class="modal-card">
<div class="modal-body">
<div class="confirming-spinner"></div>
<h2 class="modal-title" data-i18n="confirmingTitle">交易确认中</h2>
<p class="modal-subtitle" data-i18n="confirmingSubtitle">检测到付款,区块链网络确认中...</p>
<p class="confirming-note" data-i18n="confirmingNote">预计确认时间:1-3 分钟</p>
</div>
<div class="modal-footer">
<span data-i18n="poweredBy">Powered by</span>
<a href="https://github.com/v03413/BEpusdt" target="_blank">BEpusdt</a>
<a href="https://github.com/v03413/BEpusdt" target="_blank" class="modal-footer-github" title="GitHub">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.071 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"/>
</svg>
</a>
</div>
</div>
</div>
</body>
</html>
+3
View File
@@ -9,3 +9,6 @@ var Secure embed.FS
//go:embed payment/*
var Payment embed.FS
//go:embed checkout
var Checkout embed.FS
-201
View File
@@ -1,201 +0,0 @@
.selector-section {
display: flex;
flex-direction: column;
background: white !important;
padding: 32px !important;
gap: 32px;
margin-bottom: 32px !important;
border-radius: 7px !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
.selector-content {
display: flex;
flex-direction: column;
gap: 32px;
width: 100%;
}
.selector-container {
display: flex;
flex-direction: column;
gap: 16px;
}
.coin-select {
outline: 1px solid #e8e8e8;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 18px 22px 18px 16px;
}
.coin-select span {
margin: 0;
color: #000;
}
.pay-button {
cursor: pointer;
font-family: Golos, sans-serif;
padding: 18px;
width: 100%;
border: none;
background: #667eea;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.pay-button:hover {
background-color: #5a67d8;
transform: translateY(-1px);
}
.pay-button p {
color: #fff;
margin: 0;
height: 20px;
font-weight: 500;
font-size: 16px;
line-height: 20px;
letter-spacing: -.12px;
display: flex;
align-items: center;
column-gap: 10px;
}
/* Dropdown Styles */
.selector-container {
display: flex;
gap: 10px;
margin-top: 15px;
}
.coin-select {
position: relative;
flex: 1;
background: var(--bg-card-light, #f8f9fa);
/* Fallback or use variable if exists */
border: 1px solid var(--border-color, #e9ecef);
border-radius: 12px;
padding: 12px 16px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: space-between;
transition: all 0.2s ease;
user-select: none;
}
.coin-select:hover {
border-color: var(--primary-color, #2d60e0);
background: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.coin-select.active {
border-color: var(--primary-color, #2d60e0);
background: #fff;
box-shadow: 0 0 0 3px rgba(45, 96, 224, 0.1);
}
.coin-select span {
margin: 0;
font-weight: 600;
color: #4a5568;
font-size: 15px;
}
.coin-select svg {
color: var(--text-secondary, #8590a6);
transition: transform 0.3s ease;
}
.coin-select.active svg {
transform: rotate(180deg);
color: var(--primary-color, #2d60e0);
}
/* Options Dropdown */
.options-list {
position: absolute;
top: calc(100% + 8px);
left: 0;
width: 100%;
background: #fff;
border: 1px solid var(--border-color, #e9ecef);
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
z-index: 100;
max-height: 280px;
overflow-y: auto;
opacity: 0;
visibility: hidden;
transform: translateY(-10px);
transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
padding: 6px;
}
.coin-select.active .options-list {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.option-item {
padding: 10px 12px;
border-radius: 8px;
cursor: pointer;
transition: background 0.15s ease;
display: flex;
align-items: center;
justify-content: space-between;
}
.option-item:hover {
background: var(--bg-hover, #f5f7fa);
}
.option-item.selected {
background: rgba(45, 96, 224, 0.08);
color: var(--primary-color, #2d60e0);
font-weight: 600;
}
.option-item .option-text {
font-size: 14px;
}
.option-item .option-badge {
font-size: 12px;
padding: 2px 6px;
background: #edf2f7;
border-radius: 4px;
color: #718096;
}
/* Scrollbar styling */
.options-list::-webkit-scrollbar {
width: 6px;
}
.options-list::-webkit-scrollbar-thumb {
background-color: #cbd5e0;
border-radius: 3px;
}
.options-list::-webkit-scrollbar-track {
background: transparent;
}
.pay-button:disabled {
background: #bdbdbd; /* 灰色背景 */
color: #f5f5f5;
cursor: not-allowed;
box-shadow: none;
outline: none;
transform: none;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#000" d="M15.336 9.02a.65.65 0 0 1-.483-.217l-.643-.726a.507.507 0 0 0-.757 0l-.552.623a.95.95 0 0 1-.713.322h-8.68a9 9 0 0 0-.473 2.221h8.196a.53.53 0 0 0 .38-.163l.764-.796a.5.5 0 0 1 .365-.155h.031c.145 0 .283.061.379.17l.643.726a.65.65 0 0 0 .483.218h6.69a9 9 0 0 0-.473-2.221zm-7.341 6.894a.53.53 0 0 0 .38-.163l.764-.796a.5.5 0 0 1 .365-.156h.031c.145 0 .283.062.379.17l.643.727a.65.65 0 0 0 .483.218h9.066c.34-.702.588-1.456.736-2.244h-8.701a.65.65 0 0 1-.483-.217l-.643-.727a.507.507 0 0 0-.757 0l-.552.624a.95.95 0 0 1-.713.321H3.158c.148.789.397 1.542.737 2.243zm6.431-9.32a.53.53 0 0 0 .382-.163l.763-.796a.5.5 0 0 1 .364-.155h.032c.144 0 .283.061.378.17l.643.727a.65.65 0 0 0 .484.217h1.723A8.99 8.99 0 0 0 12.001 3a8.99 8.99 0 0 0-7.195 3.594zm-5.82 11.544a.65.65 0 0 1-.484-.218l-.643-.726a.507.507 0 0 0-.756 0l-.552.623a.95.95 0 0 1-.713.321h-.037A8.97 8.97 0 0 0 12.001 21a8.97 8.97 0 0 0 6.578-2.862z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

@@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#213147" d="M4.515 8.471v7.056c0 .45.245.867.64 1.092l6.205 3.529a1.3 1.3 0 0 0 1.28 0l6.203-3.53c.396-.224.64-.64.64-1.09V8.47c0-.45-.244-.867-.64-1.091L12.64 3.85a1.3 1.3 0 0 0-1.28 0L5.155 7.38a1.25 1.25 0 0 0-.639 1.091"/>
<path fill="#12AAFF" d="m13.353 13.368-.885 2.39a.3.3 0 0 0 0 .205l1.523 4.112 1.76-1.001-2.113-5.706a.152.152 0 0 0-.285 0m1.774-4.019a.152.152 0 0 0-.285 0l-.885 2.39a.3.3 0 0 0 0 .205l2.494 6.732 1.761-1.001z"/>
<path fill="#9DCCED" d="M11.998 4.115a.3.3 0 0 1 .126.033l6.715 3.818a.25.25 0 0 1 .126.214v7.635c0 .089-.048.17-.126.214l-6.715 3.819a.25.25 0 0 1-.126.032.3.3 0 0 1-.125-.032l-6.715-3.815a.25.25 0 0 1-.126-.215V8.182c0-.089.048-.17.126-.215l6.715-3.818a.26.26 0 0 1 .125-.034m0-1.115c-.238 0-.478.06-.692.183L4.593 7A1.36 1.36 0 0 0 3.9 8.182v7.635c0 .487.264.938.693 1.181l6.714 3.819a1.41 1.41 0 0 0 1.386 0l6.714-3.818a1.36 1.36 0 0 0 .693-1.182V8.182A1.36 1.36 0 0 0 19.407 7l-6.716-3.817A1.4 1.4 0 0 0 11.998 3"/>
<path fill="#213147" d="m7.559 18.685.617-1.666 1.244 1.018-1.163 1.046z"/>
<path fill="#fff" d="M11.433 7.635H9.731a.3.3 0 0 0-.285.197l-3.649 9.852 1.761 1.001 4.018-10.849a.15.15 0 0 0-.143-.2m2.979-.001h-1.703a.3.3 0 0 0-.284.197l-4.167 11.25 1.761 1 4.535-12.246a.15.15 0 0 0-.142-.2"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#00F" d="M3 4.706c0-.585 0-.877.11-1.101.106-.215.28-.39.496-.495C3.83 3 4.122 3 4.706 3h14.588c.585 0 .876 0 1.101.11.215.105.389.28.494.495.111.225.111.517.111 1.101v14.588c0 .585 0 .876-.11 1.101-.106.215-.28.389-.495.494-.225.111-.517.111-1.101.111H4.706c-.585 0-.876 0-1.101-.11a1.08 1.08 0 0 1-.494-.495C3 20.17 3 19.878 3 19.294z"/>
</svg>

Before

Width:  |  Height:  |  Size: 477 B

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#F0B90B" d="M7.09 5.755 12 3l4.91 2.755-1.8 1.02L12 5.035l-3.105 1.74zm9.82 3.48-1.8-1.02L12 9.955l-3.105-1.74-1.805 1.02v2.035l3.1 1.74v3.475l1.81 1.02 1.805-1.02V13.01l3.105-1.74zm0 5.515v-2.04l-1.8 1.02v2.035zm1.285.72-3.105 1.735v2.04l4.91-2.76v-5.51l-1.805 1.015zM16.39 7.495l1.8 1.02v2.035L20 9.535v-2.04l-1.805-1.02L16.39 7.5zm-6.2 10.45v2.035L12 21l1.805-1.02v-2.03L12 18.965l-1.805-1.02zm-3.1-3.2 1.8 1.02V13.73l-1.8-1.02v2.04zm3.1-7.25L12 8.515l1.805-1.02L12 6.475 10.195 7.5zm-4.385 1.02 1.805-1.02-1.8-1.02L4 7.5v2.04l1.805 1.015zm0 3.475L4 10.975v5.51l4.91 2.76V17.2l-3.1-1.735v-3.48z"/>
</svg>

Before

Width:  |  Height:  |  Size: 738 B

@@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#8FFCF3" d="M12 3v6.651l5.625 2.516z"/>
<path fill="#CABCF8" d="m12 3-5.625 9.166L12 9.653z"/>
<path fill="#CBA7F5" d="M12 16.478V21l5.625-7.784z"/>
<path fill="#74A0F3" d="M12 21v-4.522l-5.625-3.262z"/>
<path fill="#CBA7F5" d="m12 15.43 5.625-3.263L12 9.652z"/>
<path fill="#74A0F3" d="M6.375 12.167 12 15.43V9.652z"/>
<path fill="#202699" fill-rule="evenodd" d="m12 15.43-5.625-3.263L12 3l5.624 9.166zm-5.252-3.528 5.161-8.41v6.114zm-.077.229 5.238-2.327v5.364zm5.418-2.327v5.364l5.234-3.037zm0-.198 5.161 2.296-5.161-8.41z" clip-rule="evenodd"/>
<path fill="#202699" fill-rule="evenodd" d="m12 16.406-5.625-3.195L12 21l5.624-7.79zm-4.995-2.633 4.904 2.79v4.005zm5.084 2.79v4.005l4.905-6.795z" clip-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 883 B

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#000" d="M21 12.048q0 .137-.004.274H16.62v-.2h-4.214l.002-.123-.002-.124h4.214v-.198h4.373q.008.185.008.371m-8.669-.898 4.123-.507.025.198 4.354-.536a9 9 0 0 0-.147-.632l-4.286.528.024.198-4.142.51q.027.12.05.244zm-.215-.798 3.94-.984.049.193 4.182-1.044a10 10 0 0 0-.278-.596l-4.06 1.014.05.193-3.974.993q.048.115.091.233zm-.35-.747 3.685-1.39.07.186 3.898-1.472a9 9 0 0 0-.4-.54l-3.726 1.407.07.186-3.728 1.408q.069.105.132.215m-.483-.69 3.254-1.697.091.178 3.598-1.876a9 9 0 0 0-.515-.46L14.33 6.822l.09.177-3.308 1.725q.087.094.17.19zm-.785-.746 2.946-1.874.107.169 3.251-2.068a9 9 0 0 0-.628-.365l-2.97 1.889.107.168-3.031 1.927q.11.075.218.155zm-.696-.436 2.47-2.024.126.154 2.78-2.282a9 9 0 0 0-.723-.24L11.99 5.363l.127.154-2.56 2.099q.126.056.247.117m-.921-.358 1.95-1.941.14.14 2.477-2.462a9 9 0 0 0-.817-.098L10.52 5.117l.14.14-2.06 2.05q.142.03.283.068m-1.079-.163L9.36 5.327l.153.126L11.536 3a9 9 0 0 0-.91.089L9.013 5.043l.154.126-1.684 2.042a5 5 0 0 1 .32 0m-.932.056 1.198-1.854.167.108L9.684 3.28q-.498.129-.97.312L7.694 5.17l.167.109-1.327 2.054q.166-.039.336-.066zm-1.035.288.862-1.615.175.094 1.14-2.137q-.55.268-1.054.605L6.303 5.73l.176.094-1.014 1.9a5 5 0 0 1 .37-.168zm-.743.38.367-1.04.187.066.712-2.021a9 9 0 0 0-1.014.937l-.306.87.187.066-.48 1.361q.169-.127.346-.238zm-.914.744.162-.756.194.041.326-1.522a9 9 0 0 0-.906 1.397l.145.032-.297 1.251a5 5 0 0 1 .376-.443m-.67.884V8.562C3.264 9.202 3.092 10 3 10.78a4.8 4.8 0 0 1 .507-1.216m-.501 3.68a9 9 0 0 0 .494 1.92v-.74a4.8 4.8 0 0 1-.494-1.18m.826 1.675.26 1.21-.145.03q.39.745.906 1.398l-.326-1.522-.194.041-.165-.765a5 5 0 0 1-.336-.394zm.903.9.483 1.368-.188.066.306.87q.472.507 1.015.937l-.712-2.02-.188.066-.368-1.045a5 5 0 0 1-.346-.24zm.72.452 1.017 1.905-.176.094.655 1.228q.506.337 1.055.605l-1.14-2.136-.177.093-.864-1.619a5 5 0 0 1-.371-.17zm1.07.393 1.329 2.057-.167.108 1.02 1.58q.473.181.969.31l-1.448-2.241-.167.108-1.2-1.857a5 5 0 0 1-.337-.066zm.95.125 1.683 2.042-.153.126 1.612 1.954q.448.068.91.089l-2.024-2.455-.154.127-1.555-1.885q-.085.003-.171.002l-.15-.002zm1.116-.096 2.059 2.048-.14.14 2.113 2.103q.416-.03.818-.097l-2.477-2.464-.14.142-1.95-1.94a5 5 0 0 1-.283.068m.96-.306 2.556 2.097-.126.154 2.466 2.023q.369-.105.724-.241l-2.782-2.281-.127.154-2.466-2.024q-.12.063-.246.118m.725-.4 3.027 1.926-.107.168 2.968 1.888q.323-.171.628-.365l-3.25-2.068-.108.168-2.942-1.87a5 5 0 0 1-.218.155zm.834-.709 3.305 1.723-.092.177 3.382 1.762q.267-.22.515-.46l-3.598-1.876-.091.178-3.25-1.694q-.082.099-.17.19zm.523-.667 3.723 1.407-.07.186 3.725 1.407q.21-.263.4-.54l-3.897-1.472-.07.187-3.68-1.39a5 5 0 0 1-.131.215m.39-.73 3.966.99-.048.194L20 16.079q.15-.292.278-.596L16.1 14.44l-.049.193-3.935-.983q-.044.117-.091.232m.258-.787 4.136.508-.025.198 4.286.528q.085-.313.148-.632l-4.354-.536-.025.198-4.117-.507a5 5 0 0 1-.05.244z"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

@@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="url(#polygon__a)" d="m16.364 15.217 4.27-2.435a.73.73 0 0 0 .366-.627V7.284a.72.72 0 0 0-.366-.627l-4.27-2.435a.74.74 0 0 0-.732 0l-4.27 2.435a.72.72 0 0 0-.366.627v8.704l-2.994 1.707-2.994-1.707v-3.415l2.994-1.707 1.974 1.127V9.702l-1.608-.918a.75.75 0 0 0-.732 0l-4.27 2.435a.72.72 0 0 0-.366.627v4.87c0 .258.14.498.366.627l4.27 2.436a.75.75 0 0 0 .732 0l4.27-2.436a.72.72 0 0 0 .366-.626V8.012l.053-.03 2.94-1.677 2.994 1.707v3.415l-2.994 1.707-1.972-1.124v2.291l1.606.916a.75.75 0 0 0 .732 0z"/>
<defs>
<linearGradient id="polygon__a" x1="2.942" x2="20.119" y1="17.194" y2="7.101" gradientUnits="userSpaceOnUse">
<stop stop-color="#A726C1"/>
<stop offset=".88" stop-color="#803BDF"/>
<stop offset="1" stop-color="#7B3FE4"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 951 B

@@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="url(#solana__a)" d="M18.413 7.902a.62.62 0 0 1-.411.163H3.58c-.512 0-.77-.585-.416-.928l2.369-2.284a.6.6 0 0 1 .41-.169H20.42c.517 0 .77.59.41.935z"/>
<path fill="url(#solana__b)" d="M18.413 19.158a.62.62 0 0 1-.411.158H3.58c-.512 0-.77-.58-.416-.923l2.369-2.29a.6.6 0 0 1 .41-.163H20.42c.517 0 .77.586.41.928z"/>
<path fill="url(#solana__c)" d="M18.413 10.473a.62.62 0 0 0-.411-.158H3.58c-.512 0-.77.58-.416.923l2.369 2.29c.111.103.257.16.41.163H20.42c.517 0 .77-.586.41-.928z"/>
<defs>
<linearGradient id="solana__a" x1="3.001" x2="21.459" y1="55.041" y2="54.871" gradientUnits="userSpaceOnUse">
<stop stop-color="#599DB0"/>
<stop offset="1" stop-color="#47F8C3"/>
</linearGradient>
<linearGradient id="solana__b" x1="3.001" x2="21.341" y1="9.168" y2="9.027" gradientUnits="userSpaceOnUse">
<stop stop-color="#C44FE2"/>
<stop offset="1" stop-color="#73B0D0"/>
</linearGradient>
<linearGradient id="solana__c" x1="4.036" x2="20.303" y1="12.003" y2="12.003" gradientUnits="userSpaceOnUse">
<stop stop-color="#778CBF"/>
<stop offset="1" stop-color="#5DCDC9"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#0098EA" d="M18.078 3H5.922C3.687 3 2.27 5.41 3.394 7.36l7.503 13.003c.49.85 1.716.85 2.206 0L20.607 7.36C21.729 5.414 20.313 3 18.079 3zM10.89 16.464l-1.634-3.162L5.314 6.25a.689.689 0 0 1 .606-1.03h4.969v11.244zm7.791-10.215-3.94 7.054-1.635 3.16V5.22h4.97c.544 0 .865.578.605 1.03"/>
</svg>

Before

Width:  |  Height:  |  Size: 424 B

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#C4342B" fill-rule="evenodd" d="M4.42 3.186a.57.57 0 0 1 .552-.17L16.876 5.93a.5.5 0 0 1 .197.092l2.422 1.767a.565.565 0 0 1 .133.773l-8.332 12.191a.563.563 0 0 1-.998-.13L4.306 3.753a.57.57 0 0 1 .114-.566M6.383 6.23l4.16 11.712.684-6.069zm5.958 5.838-.695 6.175 5.884-8.61zm5.72-3.93-3.793 1.78 2.542-2.691zm-2.396-1.343L6.41 4.531l5.426 6.318z" clip-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 507 B

@@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#000" fill-opacity=".5" d="M17.82 14.342v4.672h1.275c.172 0 .312-.14.312-.311v-4.05a.31.31 0 0 0-.312-.312zm0-9.356v4.673h1.275c.172 0 .312-.14.312-.312v-4.05a.31.31 0 0 0-.312-.311z"/>
<path fill="#000" fill-opacity=".3" d="M20.209 4.986v4.673h.477c.172 0 .311-.14.311-.312v-4.05a.31.31 0 0 0-.311-.311zm.002 9.356v4.672h.477c.172 0 .312-.14.312-.311v-4.05a.31.31 0 0 0-.312-.312z"/>
<path fill="#000" d="M12.026 9.67h-4.03a.31.31 0 0 0-.31.307v4.002c0 .17.138.308.31.308h4.03a.31.31 0 0 0 .31-.308V9.977a.31.31 0 0 0-.31-.308M7.361 4.986h-4.05A.31.31 0 0 0 3 5.297v4.05c0 .172.14.312.312.312h4.05c.171 0 .31-.14.31-.312v-4.05a.31.31 0 0 0-.31-.311m9.343 0h-4.05a.31.31 0 0 0-.311.311v4.05c0 .172.14.312.311.312h4.05c.172 0 .312-.14.312-.312v-4.05a.31.31 0 0 0-.312-.311M7.361 14.33h-4.05a.31.31 0 0 0-.311.313v4.05c0 .171.14.31.312.31h4.05a.31.31 0 0 0 .31-.31v-4.05a.31.31 0 0 0-.31-.312m9.343-.001h-4.05a.31.31 0 0 0-.311.313v4.05c0 .171.14.31.311.31h4.05a.31.31 0 0 0 .312-.31v-4.05a.31.31 0 0 0-.312-.312"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

-37
View File
@@ -1,37 +0,0 @@
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="44" height="44" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
<g fill="none" fill-rule="evenodd" stroke-width="2">
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="0s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="0s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
<circle cx="22" cy="22" r="1">
<animate attributeName="r"
begin="-0.9s" dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite" />
<animate attributeName="stroke-opacity"
begin="-0.9s" dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite" />
</circle>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000" width="2500" height="2500"><path d="M1000 0c552.26 0 1000 447.74 1000 1000s-447.76 1000-1000 1000S0 1552.38 0 1000 447.68 0 1000 0" fill="#53ae94"/><path d="M1123.42 866.76V718h340.18V491.34H537.28V718H877.5v148.64C601 879.34 393.1 934.1 393.1 999.7s208 120.36 484.4 133.14v476.5h246V1132.8c276-12.74 483.48-67.46 483.48-133s-207.48-120.26-483.48-133m0 225.64v-.12c-6.94.44-42.6 2.58-122 2.58-63.48 0-108.14-1.8-123.88-2.62v.2C633.34 1081.66 451 1039.12 451 988.22S633.36 894.84 877.62 884v166.1c16 1.1 61.76 3.8 124.92 3.8 75.86 0 114-3.16 121-3.8V884c243.8 10.86 425.72 53.44 425.72 104.16s-182 93.32-425.72 104.18" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1023 B

-3
View File
@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#F0B90B" d="M7.09 5.755 12 3l4.91 2.755-1.8 1.02L12 5.035l-3.105 1.74zm9.82 3.48-1.8-1.02L12 9.955l-3.105-1.74-1.805 1.02v2.035l3.1 1.74v3.475l1.81 1.02 1.805-1.02V13.01l3.105-1.74zm0 5.515v-2.04l-1.8 1.02v2.035zm1.285.72-3.105 1.735v2.04l4.91-2.76v-5.51l-1.805 1.015zM16.39 7.495l1.8 1.02v2.035L20 9.535v-2.04l-1.805-1.02L16.39 7.5zm-6.2 10.45v2.035L12 21l1.805-1.02v-2.03L12 18.965l-1.805-1.02zm-3.1-3.2 1.8 1.02V13.73l-1.8-1.02v2.04zm3.1-7.25L12 8.515l1.805-1.02L12 6.475 10.195 7.5zm-4.385 1.02 1.805-1.02-1.8-1.02L4 7.5v2.04l1.805 1.015zm0 3.475L4 10.975v5.51l4.91 2.76V17.2l-3.1-1.735v-3.48z"/>
</svg>

Before

Width:  |  Height:  |  Size: 738 B

-10
View File
@@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#8FFCF3" d="M12 3v6.65l5.625 2.516z"/>
<path fill="#CABCF8" d="m12 3-5.625 9.166L12 9.651z"/>
<path fill="#CBA7F5" d="M12 16.477v4.522l5.625-7.784z"/>
<path fill="#74A0F3" d="M12 21v-4.523l-5.625-3.262z"/>
<path fill="#CBA7F5" d="m12 15.43 5.625-3.263L12 9.65z"/>
<path fill="#74A0F3" d="M6.375 12.167 12 15.429V9.651z"/>
<path fill="#202699" fill-rule="evenodd" d="m12 15.429-5.625-3.263L12 3l5.625 9.166zM6.749 11.9l5.16-8.41v6.115zm-.077.23 5.238-2.327v5.364zm5.418-2.327v5.364l5.233-3.038zm0-.198 5.16 2.295-5.16-8.41z" clip-rule="evenodd"/>
<path fill="#202699" fill-rule="evenodd" d="M12 16.406 6.375 13.21 12 21l5.625-7.79zm-4.995-2.633 4.905 2.79v4.005zm5.085 2.79v4.005l4.905-6.795z" clip-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 880 B

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#0098EA" d="M18.078 3H5.922C3.687 3 2.27 5.41 3.394 7.36l7.503 13.003c.49.85 1.716.85 2.206 0L20.607 7.36C21.729 5.414 20.313 3 18.079 3zM10.89 16.464l-1.634-3.162L5.314 6.25a.689.689 0 0 1 .606-1.03h4.969v11.244zm7.791-10.215-3.94 7.054-1.635 3.16V5.22h4.97c.544 0 .865.578.605 1.03"/>
</svg>

Before

Width:  |  Height:  |  Size: 424 B

-3
View File
@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#C4342B" fill-rule="evenodd" d="M4.418 3.186a.56.56 0 0 1 .553-.17l11.904 2.915q.108.027.198.092l2.422 1.765a.564.564 0 0 1 .133.774l-8.332 12.192a.563.563 0 0 1-.998-.13L4.306 3.754a.56.56 0 0 1 .112-.568m1.965 3.045 4.16 11.711.684-6.07zm5.957 5.838-.695 6.175 5.884-8.61zm5.72-3.93-3.793 1.78 2.543-2.692zm-2.395-1.343L6.41 4.53l5.426 6.32z" clip-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 504 B

@@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#0B53BF" d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18"/>
<path fill="#fff" d="M13.62 5.45v1.159a5.64 5.64 0 0 1 4.005 5.394 5.64 5.64 0 0 1-4.005 5.394v1.16a6.74 6.74 0 0 0 5.13-6.554 6.74 6.74 0 0 0-5.13-6.553m-7.245 6.553a5.64 5.64 0 0 1 4.005-5.394V5.45a6.74 6.74 0 0 0-5.13 6.553 6.74 6.74 0 0 0 5.13 6.553v-1.159a5.63 5.63 0 0 1-4.005-5.394"/>
<path fill="#fff" d="M14.419 13.258c0-2.301-3.606-1.356-3.606-2.627 0-.456.366-.748 1.063-.748.833 0 1.12.405 1.21.95h1.147c-.102-1.024-.69-1.67-1.67-1.863v-.904h-1.125v.872c-1.075.137-1.75.762-1.75 1.693 0 2.312 3.611 1.445 3.611 2.694 0 .472-.455.787-1.226.787-1.007 0-1.339-.444-1.462-1.057H9.49c.073 1.122.764 1.823 1.947 1.999v.886h1.125v-.875c1.153-.149 1.856-.82 1.856-1.807"/>
</svg>

Before

Width:  |  Height:  |  Size: 874 B

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" class="web3icons">
<path fill="#009393" d="m12 19.2-9-8.88L6.433 4.8h11.134L21 10.32zm.9-8.1v-1.098c1.62.08 3.132.396 3.6.805-.544.477-2.493.824-4.5.824s-3.956-.347-4.5-.824c.463-.41 1.98-.72 3.6-.81V11.1zm-5.4-.297v.661c.463.41 1.975.72 3.6.81V14.7h1.8v-2.43c1.62-.081 3.136-.396 3.6-.806v-1.318c-.464-.41-1.98-.725-3.6-.81V8.4h2.7V7.05H8.4V8.4h2.7v.936c-1.625.085-3.137.4-3.6.81z"/>
</svg>

Before

Width:  |  Height:  |  Size: 491 B

-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="katman_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 800 600" style="enable-background:new 0 0 800 600;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FF060A;}
.st1{fill:#FFFFFF;}
</style>
<path class="st0" d="M399.8,549.7c144.2,0,261-112,261-250.1S544,49.5,399.8,49.5c-144.2,0-261,112-261,250.1
S255.7,549.7,399.8,549.7z"/>
<path class="st1" d="M546.6,254.7c-14.4-12.8-34.4-32.3-50.6-46.1l-1-0.6c-1.6-1.2-3.4-2.2-5.3-2.9l0,0
c-39.2-7-221.6-39.7-225.1-39.3c-1,0.1-2,0.5-2.8,1l-0.9,0.7c-1.1,1.1-2,2.4-2.5,3.9l-0.2,0.6v3.3v0.5
c20.5,54.8,101.6,234.2,117.6,276.4c1,2.9,2.8,8.3,6.2,8.6h0.8c1.8,0,9.6-9.9,9.6-9.9s139.3-161.8,153.4-179
c1.8-2.1,3.4-4.4,4.8-6.8c0.4-1.9,0.2-3.8-0.5-5.6S548.1,256,546.6,254.7L546.6,254.7z M428,273.6l59.4-47.2l34.9,30.8L428,273.6z
M404.9,270.5l-102.3-80.4l165.6,29.3L404.9,270.5z M414.1,291.5l104.7-16.2L399.1,413.6L414.1,291.5z M288.7,198.2l107.7,87.5
l-15.6,128L288.7,198.2z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

-724
View File
@@ -1,724 +0,0 @@
(function () {
'use strict';
let i18nInitialized = false;
let paymentMethods = [];
let selectedCurrency = '';
let selectedNetwork = '';
let selectedMethod = null;
let paymentConfig = {};
// DOM Elements (initialized in init)
let currencySelectEl = null;
let networkSelectEl = null;
let payButton = null;
let amountValue = null;
let networkBadge = null;
// countdown
let countdownTimer = null;
let statusCheckTimer = null;
let totalSeconds = 0;
let tradeId = '';
function initI18n() {
if (i18nInitialized) {
return Promise.resolve();
}
let currentLang = localStorage.getItem('payment_language') || navigator.language.split('-')[0] || 'en';
if (currentLang !== 'zh' && currentLang !== 'en') {
currentLang = 'en';
}
return new Promise(function (resolve, reject) {
if (typeof i18next === 'undefined') {
console.error('i18next is not loaded');
resolve(); // Fail gracefully
return;
}
i18next.init({
lng: currentLang,
debug: false,
resources: {}
}, function (err, t) {
if (err) {
console.error('i18next initialization failed:', err);
resolve(); // Fail gracefully
return;
}
fetch('/payment/assets/locales/' + currentLang + '.json')
.then(function (r) {
return r.json();
})
.then(function (translations) {
i18next.addResourceBundle(currentLang, 'translation', translations);
i18nInitialized = true;
updateContent();
// Update language switcher if it exists
const languageSwitcher = document.getElementById('languageSwitcher');
if (languageSwitcher) {
languageSwitcher.value = currentLang;
}
resolve();
})
.catch(function (error) {
console.error('Failed to load language file:', error);
resolve(); // Fail gracefully
});
});
});
}
function changeLanguage(lang) {
if (!i18next) return;
const hasLanguage = i18next.hasResourceBundle(lang, 'translation');
if (!hasLanguage) {
fetch('/payment/assets/locales/' + lang + '.json')
.then(function (r) {
return r.json();
})
.then(function (translations) {
i18next.addResourceBundle(lang, 'translation', translations);
return i18next.changeLanguage(lang);
})
.then(function () {
localStorage.setItem('payment_language', lang);
updateContent();
})
.catch(function (error) {
console.error('Failed to load language file:', error);
});
} else {
i18next.changeLanguage(lang, function (err, t) {
if (err) {
console.error('Language change failed:', err);
return;
}
localStorage.setItem('payment_language', lang);
updateContent();
});
}
}
function getPaymentConfig() {
return paymentConfig;
}
function replacePlaceholders(text) {
const config = getPaymentConfig();
let token = (config.token || '--').toUpperCase();
let network = selectedMethod ? (selectedMethod.network || '--').toUpperCase() : '--';
let networkName = selectedMethod ? (selectedMethod.token_net_name || '--').toUpperCase() : '--';
if (selectedMethod) {
token = selectedMethod.currency.toUpperCase();
network = selectedMethod.network.toUpperCase();
networkName = selectedMethod.token_net_name.toUpperCase();
} else if (selectedCurrency) {
token = selectedCurrency.toUpperCase();
}
return text
.replace(/\{\{token\}\}/g, token)
.replace(/\{\{network\}\}/g, network)
.replace(/\{\{networkName\}\}/g, networkName);
}
function updateContent() {
if (!i18next) return;
const elements = document.querySelectorAll('[data-i18n]');
elements.forEach(function (element) {
// Special handling for dropdowns to preserve structure
if (element.classList.contains('coin-select')) {
const sp = element.querySelector('span');
if (sp) {
const key = element.getAttribute('data-i18n');
let translation = i18next.t(key);
sp.textContent = translation;
}
return;
}
// Protect dropdowns from internal structure destruction if not caught above
if (element.querySelector('.options-list')) {
return;
}
const key = element.getAttribute('data-i18n');
if (key.startsWith('[')) {
const matches = key.match(/\[(.+?)\](.+)/);
if (matches) {
const attr = matches[1];
const transKey = matches[2];
let translation = i18next.t(transKey);
translation = replacePlaceholders(translation);
if (attr === 'html') {
element.innerHTML = translation;
} else {
element.setAttribute(attr, translation);
}
}
} else {
let translation = i18next.t(key);
translation = replacePlaceholders(translation);
if (element.tagName === 'INPUT' || element.tagName === 'TEXTAREA') {
element.placeholder = translation;
} else {
element.innerHTML = translation;
}
}
});
}
function t(key, defaultValue) {
if (i18nInitialized && i18next) {
let translation = i18next.t(key);
return replacePlaceholders(translation);
}
return defaultValue || key;
}
function setupDropdown(el, onSelectCallback) {
if (!el) return;
el.addEventListener('click', function (e) {
e.stopPropagation();
const otherSelects = document.querySelectorAll('.coin-select');
otherSelects.forEach(function (other) {
if (other !== el) other.classList.remove('active');
});
el.classList.toggle('active');
});
// The logic for populating the list is in renderOptions,
// but the event listener for global click is needed once.
}
function initSelection() {
if (!paymentMethods || paymentMethods.length === 0) return;
// Extract unique currencies
const currencies = [...new Set(paymentMethods.map(function (m) {
return m.currency;
}))];
// Render Currency Options
renderOptions(currencySelectEl, currencies.map(function (c) {
return {value: c, label: c, badge: ''};
}), function (val) {
selectedCurrency = val;
updateNetworkOptions();
// We need to update UI for crypto-icon when currency changes
updateUI();
});
// Default Select First Currency removed to allow "Please select" state
// Initial UI update to ensure consistent state
updateUI();
}
function updateNetworkOptions() {
const networks = paymentMethods
.filter(function (m) {
return m.currency === selectedCurrency;
})
.map(function (m) {
return {
value: m.token_net_name,
label: m.token_net_name.toUpperCase(),
fullData: m
};
});
renderOptions(networkSelectEl, networks, function (val, item) {
selectedNetwork = val;
selectedMethod = item.fullData;
updateUI();
updateContent();
});
// Reset selection but do NOT auto-select
selectedNetwork = '';
selectedMethod = null;
// Reset dropdown UI
if (networkSelectEl) {
const sp = networkSelectEl.querySelector('span');
if (sp) {
sp.setAttribute('data-i18n', 'payment.selectNetwork');
// Let updateContent() handle the text update
}
}
updateUI();
updateContent();
}
function renderOptions(parent, items, onSelect) {
if (!parent) return;
let list = parent.querySelector('.options-list');
if (!list) {
list = document.createElement('div');
list.className = 'options-list';
parent.appendChild(list);
}
list.innerHTML = '';
items.forEach(function (item) {
const itemEl = document.createElement('div');
itemEl.className = 'option-item';
itemEl.setAttribute('data-value', item.value);
let html = '<span class="option-text">' + item.label + '</span>';
if (item.badge) {
html += '<span class="option-badge">' + item.badge + '</span>';
}
itemEl.innerHTML = html;
itemEl.addEventListener('click', function (e) {
e.stopPropagation();
parent.classList.remove('active');
selectOption(parent, item.value);
if (onSelect) onSelect(item.value, item);
});
list.appendChild(itemEl);
});
}
function selectOption(parent, value) {
if (!parent) return;
const items = parent.querySelectorAll('.option-item');
items.forEach(function (item) {
item.classList.remove('selected');
});
let selected = null;
items.forEach(function (item) {
if (item.getAttribute('data-value') === value) selected = item;
});
if (selected) {
selected.classList.add('selected');
const text = selected.querySelector('.option-text').textContent;
const sp = parent.querySelector('span');
if (sp) {
sp.textContent = text || value;
// Avoid i18n overwriting the selected value
sp.removeAttribute('data-i18n');
}
}
}
function updateUI() {
// Update crypto-icon, default to '--' if no selection
const cryptoIcon = document.querySelector('.crypto-icon');
if (cryptoIcon) {
cryptoIcon.textContent = selectedCurrency ? selectedCurrency.toUpperCase() : '--';
}
const subtitleSpan = document.querySelector('.payment-subtitle span[data-i18n]');
const subtitleP = document.querySelector('.payment-subtitle');
let networkBadge = document.querySelector('.network-badge');
if (!selectedMethod) {
if (payButton) payButton.disabled = true;
if (amountValue) amountValue.textContent = '---';
// Revert to subtitle2 (Please select...)
if (subtitleSpan) {
subtitleSpan.setAttribute('data-i18n', 'payment.subtitle2');
}
// Remove badge if exists
if (networkBadge) {
networkBadge.remove();
networkBadge = null; // Clear reference
}
return;
}
// Switch to subtitle (Please use...)
if (subtitleSpan) {
subtitleSpan.setAttribute('data-i18n', 'payment.subtitleCashier');
}
// Inject network badge if missing
if (!networkBadge && subtitleP) {
networkBadge = document.createElement('span');
networkBadge.className = 'network-badge';
networkBadge.setAttribute('data-i18n', 'payment.networkBadge');
subtitleP.appendChild(networkBadge);
}
// Update Amount
if (amountValue) {
amountValue.textContent = selectedMethod.actual_amount + ' ' + selectedMethod.currency;
}
// Update Network Badge
if (networkBadge) {
networkBadge.textContent = selectedMethod.token_net_name;
}
// Enable Pay Button
if (payButton) {
payButton.disabled = false;
}
}
function createTransaction() {
if (!selectedMethod) return;
if (payButton && payButton.disabled) return;
fetch('/api/v1/pay/update-order', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
trade_id: tradeId,
currency: selectedMethod.currency,
network: selectedMethod.network
})
})
.then(function (response) {
return response.json();
})
.then(function (res) {
if (res.status_code === 200 && res.data.payment_url) {
window.location.href = res.data.payment_url;
} else {
showMessage(res.message || t('payment.createTransactionFailed', 'Failed to create transaction'));
}
})
.catch(function (err) {
console.error(err);
showMessage(t('payment.networkError', 'Network error'));
});
}
function showMessage(msg) {
if (window.layer && window.layer.msg) {
window.layer.msg(msg);
} else {
alert(msg);
}
}
function copyToClipboard(text, element, isButton) {
if (!text) return;
navigator.clipboard.writeText(text).then(function () {
showCopySuccess(element, isButton);
}).catch(function (err) {
console.error('复制失败: ', err);
fallbackCopy(text, element, isButton);
});
}
function showCopySuccess(element, isButton) {
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
const translations = {
'payment.copied': '已复制!',
'payment.copySuccess': '✓ 已复制!'
};
return translations[key] || key;
};
if (isButton) {
const originalText = element.textContent;
element.textContent = t('payment.copied');
element.style.background = '#48bb78';
setTimeout(function () {
element.textContent = originalText;
element.style.background = '#667eea';
}, 2000);
} else {
const originalText = element.textContent;
const originalColor = element.style.color;
element.textContent = t('payment.copySuccess');
element.style.color = '#48bb78';
setTimeout(function () {
element.textContent = originalText;
element.style.color = originalColor;
}, 2000);
}
}
function fallbackCopy(text, element, isButton) {
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
const translations = {
'payment.copyFailed': '复制失败,请手动复制'
};
return translations[key] || key;
};
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
showCopySuccess(element, isButton);
} catch (err) {
alert(t('payment.copyFailed'));
}
document.body.removeChild(textArea);
}
function copyAmount() {
const amountEl = document.getElementById('payAmount');
let text = '';
if (selectedMethod && selectedMethod.actual_amount) {
text = selectedMethod.actual_amount;
} else if (amountEl) {
// Fallback to text content if no method selected (though usually it's ---)
const content = amountEl.textContent.trim();
if (content !== '---') {
text = content.split(' ')[0];
}
}
if (text) {
copyToClipboard(text, amountEl, false);
}
}
function startCountdown() {
if (countdownTimer) clearInterval(countdownTimer);
const config = getPaymentConfig();
// Ensure expire is a number
let expireTime = parseInt(config.expire);
if (isNaN(expireTime)) {
expireTime = 0;
}
totalSeconds = expireTime;
const minutesEl = document.getElementById('minutes');
const secondsEl = document.getElementById('seconds');
const countdownBanner = document.querySelector('.countdown-banner');
function updateDisplay() {
if (!minutesEl || !secondsEl) return;
const minutes = Math.floor(Math.max(0, totalSeconds) / 60);
const seconds = Math.max(0, totalSeconds) % 60;
if (totalSeconds <= 0) {
minutesEl.textContent = '00';
secondsEl.textContent = '00';
} else {
minutesEl.textContent = minutes.toString().padStart(2, '0');
secondsEl.textContent = seconds.toString().padStart(2, '0');
}
if (countdownBanner) {
if (totalSeconds <= 300) {
countdownBanner.style.background = 'linear-gradient(135deg, #ff4757, #ff3838)';
}
if (totalSeconds <= 60) {
countdownBanner.style.animation = 'urgentBlink 1s infinite';
}
}
}
updateDisplay(); // Initial display
countdownTimer = setInterval(function () {
totalSeconds--;
updateDisplay();
if (totalSeconds <= 0) {
clearInterval(countdownTimer);
if (statusCheckTimer) clearInterval(statusCheckTimer);
showTimeoutMessage();
}
}, 1000);
}
function showTimeoutMessage() {
// Prevent multiple overlays
if (document.querySelector('.status-overlay')) return;
const overlay = document.createElement('div');
overlay.className = 'status-overlay';
overlay.style.cssText = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; z-index: 9999;';
const modal = document.createElement('div');
modal.style.cssText = 'background: white; padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);';
const config = getPaymentConfig();
modal.innerHTML = '<div style="font-size: 48px; margin-bottom: 20px;">⏰</div>' +
'<h3 style="color: #e53e3e; margin-bottom: 15px;">' + t('payment.paymentTimeout', 'Payment Timeout') + '</h3>' +
'<p style="color: #666; margin-bottom: 25px; line-height: 1.5;">' +
t('payment.timeoutMessage', 'Sorry, the payment time has expired.<br>Please restart payment.') +
'</p>' +
'<button onclick="location.href=\'' + (config.return_url || '/') + '\'" style="background: #667eea; color: white; border: none; padding: 12px 24px; border-radius: 6px; cursor: pointer; font-size: 14px; margin-right: 10px;">' +
t('payment.returnToMerchant', 'Return to Merchant') +
'</button>';
overlay.appendChild(modal);
document.body.appendChild(overlay);
}
function showWaitingConfirmation(data) {
if (document.getElementById('waiting-overlay')) return;
const overlay = document.createElement('div');
overlay.id = 'waiting-overlay';
overlay.style.cssText = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; z-index: 9999;';
const modal = document.createElement('div');
modal.style.cssText = 'background: white; padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);';
modal.innerHTML = '<div style="font-size: 48px; margin-bottom: 20px; animation: spin 2s linear infinite;">⏳</div>' +
'<h3 style="color: #667eea; margin-bottom: 15px;">' + t('payment.waitingConfirmation', 'Waiting for Confirmation') + '</h3>' +
'<p style="color: #666; margin-bottom: 20px; line-height: 1.5;">' +
'<span style="color: #059669; font-weight: 600; background: linear-gradient(135deg, #ecfdf5, #f0fdf4); padding: 8px 12px; border-radius: 6px; border-left: 3px solid #10b981;">' + t('payment.confirmationMessage', 'Payment detected, confirming...') + '</span><br>' +
'<small style="color: #999;">' + t('payment.confirmationNote', 'Please wait patiently') + '</small>' +
'</p>' +
'<div style="display: flex; justify-content: center; margin-bottom: 20px;">' +
'<div style="width: 40px; height: 40px; border: 3px solid #f3f3f3; border-top: 3px solid #667eea; border-radius: 50%; animation: spin 1s linear infinite;"></div>' +
'</div>' +
'<p style="color: #999; font-size: 12px;">' + t('payment.estimatedTime', 'Estimated time: 1-3 mins') + '</p>';
const style = document.createElement('style');
style.textContent = '@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }';
document.head.appendChild(style);
overlay.appendChild(modal);
document.body.appendChild(overlay);
// Ensure we keep checking
if (!statusCheckTimer) {
statusCheckTimer = setInterval(checkPaymentStatus, 5000);
}
}
function showSuccessMessage(data) {
const waitingOverlay = document.getElementById('waiting-overlay');
if (waitingOverlay) waitingOverlay.remove();
// Prevent multiple overlays
if (document.querySelector('.success-overlay')) return;
const overlay = document.createElement('div');
overlay.className = 'success-overlay';
overlay.style.cssText = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; z-index: 9999;';
const modal = document.createElement('div');
modal.style.cssText = 'background: white; padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);';
modal.innerHTML = '<div style="font-size: 48px; margin-bottom: 20px;">✅</div>' +
'<h3 style="color: #48bb78; margin-bottom: 15px;">' + t('payment.paymentSuccess', 'Payment Success!') + '</h3>' +
'<p style="color: #666; margin-bottom: 20px; line-height: 1.5;">' +
t('payment.transactionHash', 'Transaction Hash:') + '<br>' +
'<code style="background: #e6f0fa; color: #2563eb; padding: 4px 8px; border-radius: 4px; font-size: 12px; word-break: break-all;">' +
(data.trade_hash || t('payment.processing', 'Processing...')) +
'</code>' +
'</p>' +
'<button onclick="location.href=\'' + (data.return_url || '/') + '\'" style="background: #48bb78; color: white; border: none; padding: 12px 24px; border-radius: 6px; cursor: pointer; font-size: 14px;">' +
t('payment.returnToMerchant', 'Return to Merchant') +
'</button>';
overlay.appendChild(modal);
document.body.appendChild(overlay);
if (countdownTimer) clearInterval(countdownTimer);
if (statusCheckTimer) clearInterval(statusCheckTimer);
}
function checkPaymentStatus() {
if (!tradeId) return;
fetch('/pay/check-status/' + tradeId)
.then(function (r) {
return r.json();
})
.then(function (data) {
// status: 1=pending, 2=success, 3=expired, 5=waiting_confirmation
if (data.status === 1) {
// Continue polling (timer handles generic polling, waiting confirms uses specific)
// If not in waiting confirmation mode, we rely on the main timer
} else if (data.status === 2) {
showSuccessMessage(data);
} else if (data.status === 3) {
showTimeoutMessage();
} else if (data.status === 5) {
showWaitingConfirmation(data);
}
})
.catch(function (err) {
console.error('Check status error:', err);
});
}
function init(config) {
paymentConfig = config || {};
tradeId = paymentConfig.trade_id;
// Initialize DOM Elements
currencySelectEl = document.getElementById('currency-select');
networkSelectEl = document.getElementById('network-select');
payButton = document.querySelector('.pay-button');
amountValue = document.querySelector('.amount-value');
networkBadge = document.querySelector('.network-badge');
// Close dropdowns when clicking outside
document.addEventListener('click', function () {
const selects = document.querySelectorAll('.coin-select');
selects.forEach(function (el) {
el.classList.remove('active');
});
});
setupDropdown(currencySelectEl);
setupDropdown(networkSelectEl);
if (payButton) {
payButton.addEventListener('click', createTransaction);
}
initI18n().then(function () {
if (paymentConfig.network && Array.isArray(paymentConfig.network) && paymentConfig.network.length > 0) {
paymentMethods = paymentConfig.network;
initSelection();
} else {
showMessage(t('payment.loadPaymentNetworkFailed', 'Failed to load payment network, please check if the wallet has been added'));
}
startCountdown();
// Poll status every 5s
statusCheckTimer = setInterval(checkPaymentStatus, 5000);
// Initial check
checkPaymentStatus();
});
}
// Expose necessary functions
window.copyAmount = copyAmount;
window.changeLanguage = changeLanguage;
window.Payment = {
init: init
};
})();
File diff suppressed because one or more lines are too long
-529
View File
@@ -1,529 +0,0 @@
(function () {
'use strict';
let countdownTimer = null;
let statusCheckTimer = null;
let totalSeconds = null;
let paymentConfig = {};
let i18nInitialized = false;
function initI18n() {
if (i18nInitialized) {
return Promise.resolve();
}
let currentLang = localStorage.getItem('payment_language') || navigator.language.split('-')[0] || 'en';
if (currentLang !== 'zh' && currentLang !== 'en') {
currentLang = 'en';
}
return new Promise(function (resolve, reject) {
i18next.init({
lng: currentLang,
debug: false,
resources: {}
}, function (err, t) {
if (err) {
console.error('i18next initialization failed:', err);
reject(err);
return;
}
// 只加载当前需要的语言文件
fetch('/payment/assets/locales/' + currentLang + '.json')
.then(function (r) {
return r.json();
})
.then(function (translations) {
i18next.addResourceBundle(currentLang, 'translation', translations);
i18nInitialized = true;
updateContent();
const languageSwitcher = document.getElementById('languageSwitcher');
if (languageSwitcher) {
languageSwitcher.value = currentLang;
}
resolve();
})
.catch(function (error) {
console.error('Failed to load language file:', error);
reject(error);
});
});
});
}
function getPaymentConfig() {
const container = document.querySelector('.payment-container');
if (!container) return {};
return {
token: container.getAttribute('data-token') || 'USDT',
network: container.getAttribute('data-network') || 'TRC20',
networkName: container.getAttribute('data-network-name') || 'TRON',
warningToken: container.getAttribute('data-warning-token') || 'TRX'
};
}
function replacePlaceholders(text) {
const config = getPaymentConfig();
return text
.replace(/\{\{token\}\}/g, config.token)
.replace(/\{\{network\}\}/g, config.network)
.replace(/\{\{networkName\}\}/g, config.networkName)
.replace(/\{\{warningToken\}\}/g, config.warningToken);
}
function updateContent() {
document.querySelectorAll('[data-i18n]').forEach(function (element) {
const key = element.getAttribute('data-i18n');
if (key.startsWith('[')) {
const matches = key.match(/\[(.+?)\](.+)/);
if (matches) {
const attr = matches[1];
const transKey = matches[2];
let translation = i18next.t(transKey);
translation = replacePlaceholders(translation);
if (attr === 'html') {
element.innerHTML = translation;
} else {
element.setAttribute(attr, translation);
}
}
} else {
let translation = i18next.t(key);
translation = replacePlaceholders(translation);
if (element.tagName === 'INPUT' || element.tagName === 'TEXTAREA') {
element.placeholder = translation;
} else {
element.innerHTML = translation;
}
}
});
}
function changeLanguage(lang) {
// 检查是否已经加载了该语言包
const hasLanguage = i18next.hasResourceBundle(lang, 'translation');
if (!hasLanguage) {
// 如果没有加载,先加载该语言文件
fetch('/payment/assets/locales/' + lang + '.json')
.then(function (r) {
return r.json();
})
.then(function (translations) {
i18next.addResourceBundle(lang, 'translation', translations);
return i18next.changeLanguage(lang);
})
.then(function () {
localStorage.setItem('payment_language', lang);
updateContent();
})
.catch(function (error) {
console.error('Failed to load language file:', error);
});
} else {
// 如果已经加载,直接切换
i18next.changeLanguage(lang, function (err, t) {
if (err) {
console.error('Language change failed:', err);
return;
}
localStorage.setItem('payment_language', lang);
updateContent();
});
}
}
function initConfig(config) {
paymentConfig = config;
totalSeconds = config.expire;
}
function generateQRCode() {
const qrContainer = document.getElementById('qrcode');
const containerWidth = qrContainer.clientWidth;
const containerHeight = qrContainer.clientHeight || containerWidth;
const measuredSize = Math.floor(Math.min(containerWidth, containerHeight) - 10);
const qrSize = measuredSize > 0 ? measuredSize : 150;
qrContainer.innerHTML = '';
$('#qrcode').qrcode({
text: paymentConfig.address,
width: qrSize,
height: qrSize,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
}
function copyToClipboard(text, element, isButton) {
if (!text) return;
navigator.clipboard.writeText(text).then(function () {
showCopySuccess(element, isButton);
}).catch(function (err) {
console.error('复制失败: ', err);
fallbackCopy(text, element, isButton);
});
}
function showCopySuccess(element, isButton) {
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
const translations = {
'payment.copied': '已复制!',
'payment.copySuccess': '✓ 已复制!'
};
return translations[key] || key;
};
if (isButton) {
const originalText = element.textContent;
element.textContent = t('payment.copied');
element.style.background = '#48bb78';
setTimeout(function () {
element.textContent = originalText;
element.style.background = '#667eea';
}, 2000);
} else {
const originalText = element.textContent;
const originalColor = element.style.color;
element.textContent = t('payment.copySuccess');
element.style.color = '#48bb78';
setTimeout(function () {
element.textContent = originalText;
element.style.color = originalColor;
}, 2000);
}
}
function fallbackCopy(text, element, isButton) {
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
return '复制失败,请手动复制';
};
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
showCopySuccess(element, isButton);
} catch (err) {
alert(t('payment.copyFailed'));
}
document.body.removeChild(textArea);
}
function copyAddress() {
const btn = document.querySelector('.copy-btn');
copyToClipboard(paymentConfig.address, btn, true);
}
function copyAmount() {
const amountEl = document.getElementById('payAmount');
copyToClipboard(paymentConfig.amount, amountEl, false);
}
function startCountdown() {
const minutesEl = document.getElementById('minutes');
const secondsEl = document.getElementById('seconds');
function updateDisplay() {
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
if (totalSeconds <= 0) {
minutesEl.textContent = '00';
secondsEl.textContent = '00';
} else {
minutesEl.textContent = minutes.toString().padStart(2, '0');
secondsEl.textContent = seconds.toString().padStart(2, '0');
}
if (totalSeconds <= 300) {
document.querySelector('.countdown-banner').style.background = 'linear-gradient(135deg, #ff4757, #ff3838)';
}
if (totalSeconds <= 60) {
document.querySelector('.countdown-banner').style.animation = 'urgentBlink 1s infinite';
}
}
countdownTimer = setInterval(function () {
totalSeconds--;
updateDisplay();
if (totalSeconds <= 0) {
clearInterval(countdownTimer);
clearInterval(statusCheckTimer);
showTimeoutMessage();
}
}, 1000);
updateDisplay();
}
function showTimeoutMessage() {
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
const translations = {
'payment.paymentTimeout': '支付时间已过期',
'payment.timeoutMessage': '很抱歉,支付时间已超时。<br>请重新发起支付或联系客服处理。',
'payment.returnToMerchant': '返回商户平台'
};
return translations[key] || key;
};
const overlay = document.createElement('div');
overlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
`;
const modal = document.createElement('div');
modal.style.cssText = `
background: white;
padding: 30px;
border-radius: 12px;
text-align: center;
max-width: 400px;
width: 90%;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
`;
modal.innerHTML = `
<div style="margin-bottom: 20px;">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#e53e3e" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="13" r="8"/><path d="M12 9v4l2 2"/><path d="M5 3 2 6"/><path d="m22 6-3-3"/>
</svg>
</div>
<h3 style="color: #e53e3e; margin-bottom: 15px;">${t('payment.paymentTimeout')}</h3>
<p style="color: #666; margin-bottom: 25px; line-height: 1.5;">
${t('payment.timeoutMessage')}
</p>
<button onclick="location.href='${paymentConfig.return_url}'" style="
background: #667eea;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
margin-right: 10px;
">${t('payment.returnToMerchant')}</button>
`;
overlay.appendChild(modal);
document.body.appendChild(overlay);
}
function showWaitingConfirmation(data) {
if (document.getElementById('waiting-overlay')) {
return;
}
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
const translations = {
'payment.waitingConfirmation': '正在等待网络确认',
'payment.confirmationMessage': '检测到付款请求,区块网络确认中...',
'payment.confirmationNote': '请耐心等待,系统会自动检测确认状态',
'payment.estimatedTime': '预计确认时间:1-3分钟'
};
return translations[key] || key;
};
const overlay = document.createElement('div');
overlay.id = 'waiting-overlay';
overlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
`;
const modal = document.createElement('div');
modal.style.cssText = `
background: white;
padding: 30px;
border-radius: 12px;
text-align: center;
max-width: 400px;
width: 90%;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
`;
modal.innerHTML = `
<div style="margin-bottom: 20px;">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#667eea" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="animation: spin 2s linear infinite;">
<path d="M5 22h14"/><path d="M5 2h14"/>
<path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"/>
<path d="M7 2v4.172a2 2 0 0 1 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"/>
</svg>
</div>
<h3 style="color: #667eea; margin-bottom: 15px;">${t('payment.waitingConfirmation')}</h3>
<p style="color: #666; margin-bottom: 20px; line-height: 1.5;">
<span style="color: #059669; font-weight: 600; background: linear-gradient(135deg, #ecfdf5, #f0fdf4); padding: 8px 12px; border-radius: 6px; border-left: 3px solid #10b981;">${t('payment.confirmationMessage')}</span><br>
<small style="color: #999;">${t('payment.confirmationNote')}</small>
</p>
<div style="display: flex; justify-content: center; margin-bottom: 20px;">
<div style="width: 40px; height: 40px; border: 3px solid #f3f3f3; border-top: 3px solid #667eea; border-radius: 50%; animation: spin 1s linear infinite;"></div>
</div>
<p style="color: #999; font-size: 12px;">
${t('payment.estimatedTime')}
</p>
<div style="margin-top: 15px; padding-top: 12px; border-top: 1px solid #f0f0f0; font-size: 12px; color: #aaa;">
Powered by <a href="https://github.com/v03413/BEpusdt" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">BEpusdt</a> · Github
</div>
`;
const style = document.createElement('style');
style.textContent = `
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`;
document.head.appendChild(style);
overlay.appendChild(modal);
document.body.appendChild(overlay);
statusCheckTimer = setInterval(checkPaymentStatus, 5000);
}
function showSuccessMessage(data) {
const waitingOverlay = document.getElementById('waiting-overlay');
if (waitingOverlay) {
waitingOverlay.remove();
}
const t = window.i18next ? window.i18next.t.bind(window.i18next) : function (key) {
const translations = {
'payment.paymentSuccess': '支付成功!',
'payment.transactionHash': '您的支付已确认,交易哈希:',
'payment.processing': '处理中...',
'payment.returnToMerchant': '返回商户平台'
};
return translations[key] || key;
};
const overlay = document.createElement('div');
overlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
`;
const modal = document.createElement('div');
modal.style.cssText = `
background: white;
padding: 30px;
border-radius: 12px;
text-align: center;
max-width: 400px;
width: 90%;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
`;
modal.innerHTML = `
<div style="margin-bottom: 20px;">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#48bb78" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>
</svg>
</div>
<h3 style="color: #48bb78; margin-bottom: 15px;">${t('payment.paymentSuccess')}</h3>
<p style="color: #666; margin-bottom: 20px; line-height: 1.5;">
${t('payment.transactionHash')}<br>
<code style="background: #e6f0fa; color: #2563eb; padding: 4px 8px; border-radius: 4px; font-size: 12px; word-break: break-all;">
${data.trade_hash || t('payment.processing')}
</code>
</p>
<button onclick="location.href='${data.return_url || '/'}'" style="
background: #48bb78;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
">${t('payment.returnToMerchant')}</button>
<div style="margin-top: 15px; padding-top: 12px; border-top: 1px solid #f0f0f0; font-size: 12px; color: #aaa;">
Powered by <a href="https://github.com/v03413/BEpusdt" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">BEpusdt</a> · Github
</div>
`;
overlay.appendChild(modal);
document.body.appendChild(overlay);
if (countdownTimer) clearInterval(countdownTimer);
if (statusCheckTimer) clearInterval(statusCheckTimer);
}
function checkPaymentStatus() {
$.ajax({
type: "GET",
dataType: "json",
url: "/pay/check-status/" + paymentConfig.trade_id,
success: function (data) {
if (data.status === 1) {
return setTimeout(checkPaymentStatus, 5000);
}
if (data.status === 2) {
return showSuccessMessage(data);
}
if (data.status === 3) {
return showTimeoutMessage();
}
if (data.status === 5) {
return showWaitingConfirmation(data);
}
}
});
}
function init(config) {
initConfig(config);
initI18n().then(function () {
generateQRCode();
startCountdown();
setTimeout(checkPaymentStatus, 2000);
}).catch(function (err) {
console.error('Failed to initialize i18n:', err);
generateQRCode();
startCountdown();
setTimeout(checkPaymentStatus, 2000);
});
}
window.copyAddress = copyAddress;
window.copyAmount = copyAmount;
window.changeLanguage = changeLanguage;
window.Payment = {
init: init
};
})();
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More