epusdt

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusWaitPay = 1
	StatusPaid    = 2
	StatusExpired = 3
)
View Source
const Name = `epusdt`

Variables

View Source
var (
	URLCreateOrder = `/api/v1/order/create-transaction`
	URLQueryOrder  = `/api/v1/order/query-transaction`
)

Functions

func GenerateSign

func GenerateSign(data url.Values, token string) string

func MappingStatus

func MappingStatus(status int, result *config.Result)

MappingStatus Order Status

func New

func New() payment.Driver

Types

type CreateTransactionRequest

type CreateTransactionRequest struct {
	OrderId     string  `json:"order_id" validate:"required|maxLen:32"`
	Amount      float64 `json:"amount" validate:"required|isFloat|gt:0.01"`
	NotifyUrl   string  `json:"notify_url" validate:"required"`
	Signature   string  `json:"signature" validate:"required"`
	RedirectUrl string  `json:"redirect_url"`
	Timestamp   int64   `json:"timestamp" validate:"required"`
}

CreateTransactionRequest 创建交易请求

func (*CreateTransactionRequest) URLValues

func (c *CreateTransactionRequest) URLValues() url.Values

type CreateTransactionResponse

type CreateTransactionResponse struct {
	TradeId        string  `json:"trade_id"`        // epusdt订单号
	OrderId        string  `json:"order_id"`        // 客户交易id
	Amount         float64 `json:"amount"`          // 订单金额,保留4位小数
	ActualAmount   float64 `json:"actual_amount"`   // 订单实际需要支付的金额,保留4位小数
	Token          string  `json:"token"`           // 收款钱包地址
	ExpirationTime int64   `json:"expiration_time"` // 过期时间 时间戳
	PaymentUrl     string  `json:"payment_url"`     // 收银台地址
}

CreateTransactionResponse 创建订单成功返回

type EPUSDT

type EPUSDT struct {
	// contains filtered or unexported fields
}

func (*EPUSDT) Client

func (a *EPUSDT) Client() *resty.Request

func (*EPUSDT) IsSupported

func (a *EPUSDT) IsSupported(s config.Support) bool

func (*EPUSDT) Pay

func (a *EPUSDT) Pay(ctx echo.Context, cfg *config.Pay) (*config.PayResponse, error)

Pay documentation

func (*EPUSDT) PayNotify

func (a *EPUSDT) PayNotify(ctx echo.Context) error

PayNotify 付款回调处理

func (*EPUSDT) PayQuery

func (a *EPUSDT) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)

PayQuery documentation

func (*EPUSDT) Refund

func (a *EPUSDT) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error)

Refund 退款

func (*EPUSDT) RefundNotify

func (a *EPUSDT) RefundNotify(ctx echo.Context) error

RefundNotify 退款回调处理

func (*EPUSDT) RefundQuery

func (a *EPUSDT) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)

RefundQuery 退款查询

func (*EPUSDT) SetAccount

func (a *EPUSDT) SetAccount(account *config.Account) payment.Driver

func (*EPUSDT) SetNotifyCallback

func (a *EPUSDT) SetNotifyCallback(callback func(echo.Context) error) payment.Driver

func (*EPUSDT) VerifySign

func (a *EPUSDT) VerifySign(ctx echo.Context) error

type OrderNotifyResponse

type OrderNotifyResponse struct {
	TradeId            string  `json:"trade_id"`             //  epusdt订单号
	OrderId            string  `json:"order_id"`             //  客户交易id
	Amount             float64 `json:"amount"`               //  订单金额,保留4位小数
	ActualAmount       float64 `json:"actual_amount"`        //  订单实际需要支付的金额,保留4位小数
	Token              string  `json:"token"`                //  收款钱包地址
	BlockTransactionId string  `json:"block_transaction_id"` // 区块id
	Signature          string  `json:"signature"`            // 签名
	Status             int     `json:"status"`               //  1:等待支付,2:支付成功,3:已过期
}

OrderNotifyResponse 订单异步回调结构体

func (*OrderNotifyResponse) URLValues

func (c *OrderNotifyResponse) URLValues() url.Values

func (*OrderNotifyResponse) Verify

func (c *OrderNotifyResponse) Verify(token string) bool

type QueryTransactionRequest added in v0.4.1

type QueryTransactionRequest struct {
	TradeId   string `json:"trade_id" validate:"required|maxLen:32"`
	Timestamp int64  `json:"timestamp" validate:"required"`
	Signature string `json:"signature"  validate:"required"`
}

QueryTransactionRequest 查询交易请求

func (*QueryTransactionRequest) URLValues added in v0.4.1

func (c *QueryTransactionRequest) URLValues() url.Values

type QueryTransactionResponse added in v0.4.1

type QueryTransactionResponse struct {
	TradeId        string  `json:"trade_id"`        // epusdt订单号
	Status         int     `json:"status"`          // 状态
	Currency       string  `json:"currency"`        // 支付币种
	Amount         float64 `json:"amount"`          // 订单金额,保留4位小数
	ActualCurrency string  `json:"actual_currency"` // 实付币种
	ActualAmount   float64 `json:"actual_amount"`   // 订单实际需要支付的金额,保留4位小数
}

type Response

type Response struct {
	StatusCode int         `json:"status_code"`
	Message    string      `json:"message"`
	Data       interface{} `json:"data"`
	RequestID  string      `json:"request_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL