update payment ui and change api route path
This commit is contained in:
@@ -7,19 +7,12 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// LegecyCreateTransaction 创建交易
|
||||
func (c *BaseCommController) LegecyCreateTransaction(ctx echo.Context) (err error) {
|
||||
// CreateTransaction 创建交易
|
||||
func (c *BaseCommController) CreateTransaction(ctx echo.Context) (err error) {
|
||||
req := new(request.CreateTransactionRequest)
|
||||
if err = ctx.Bind(req); err != nil {
|
||||
return c.FailJson(ctx, constant.ParamsMarshalErr)
|
||||
}
|
||||
// 兼容旧版本插件:如果未传递 token 和 currency,使用默认值
|
||||
if req.Token == "" {
|
||||
req.Token = "usdt"
|
||||
}
|
||||
if req.Currency == "" {
|
||||
req.Currency = "cny"
|
||||
}
|
||||
if err = c.ValidateStruct(ctx, req); err != nil {
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
|
||||
@@ -11,23 +11,31 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// LegecyCheckoutCounter 收银台
|
||||
func (c *BaseCommController) LegecyCheckoutCounter(ctx echo.Context) (err error) {
|
||||
// CheckoutCounter 收银台
|
||||
func (c *BaseCommController) CheckoutCounter(ctx echo.Context) (err error) {
|
||||
tradeId := ctx.Param("trade_id")
|
||||
resp, err := service.GetCheckoutCounterByTradeId(tradeId)
|
||||
if err != nil {
|
||||
if err == service.ErrOrder {
|
||||
tmpl, err := template.ParseFiles(filepath.Join(config.StaticFilePath, "index.html"))
|
||||
if err != nil {
|
||||
return ctx.String(http.StatusOK, err.Error())
|
||||
}
|
||||
emptyResp := response.CheckoutCounterResponse{}
|
||||
return tmpl.Execute(ctx.Response(), emptyResp)
|
||||
}
|
||||
return ctx.String(http.StatusOK, err.Error())
|
||||
}
|
||||
tmpl, err := template.ParseFiles(filepath.Join(config.StaticFilePath, "index.html"))
|
||||
if err != nil {
|
||||
return ctx.String(http.StatusOK, err.Error())
|
||||
}
|
||||
resp.Token = resp.ReceiveAddress // only for legacy checkout counter, token is the receive address
|
||||
resp.Network = "TRON"
|
||||
return tmpl.Execute(ctx.Response(), resp)
|
||||
}
|
||||
|
||||
// LegecyCheckStatus 支付状态检测
|
||||
func (c *BaseCommController) LegecyCheckStatus(ctx echo.Context) (err error) {
|
||||
// CheckStatus 支付状态检测
|
||||
func (c *BaseCommController) CheckStatus(ctx echo.Context) (err error) {
|
||||
tradeId := ctx.Param("trade_id")
|
||||
order, err := service.GetOrderInfoByTradeId(tradeId)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user