add payment type field (alipay/wxpay) to EPay config

This commit is contained in:
Ember Moth
2025-10-15 20:55:57 +08:00
committed by Leif Draven
parent 643d234a88
commit 8b48286365
6 changed files with 26 additions and 19 deletions
+11 -7
View File
@@ -14,9 +14,10 @@ import (
)
type Client struct {
Pid string
Url string
Key string
Pid string
Url string
Key string
Type string
}
type Order struct {
@@ -37,11 +38,12 @@ type queryOrderStatusResponse struct {
Status int `json:"status"`
}
func NewClient(pid, url, key string) *Client {
func NewClient(pid, url, key string, Type string) *Client {
return &Client{
Pid: pid,
Url: url,
Key: key,
Pid: pid,
Url: url,
Key: key,
Type: Type,
}
}
@@ -53,6 +55,7 @@ func (c *Client) CreatePayUrl(order Order) string {
params.Set("notify_url", order.NotifyUrl)
params.Set("out_trade_no", order.OrderNo)
params.Set("pid", c.Pid)
params.Set("type", c.Type)
params.Set("return_url", order.ReturnUrl)
// Generate the sign using the CreateSign function
@@ -117,6 +120,7 @@ func (c *Client) structToMap(order Order) map[string]string {
result["notify_url"] = order.NotifyUrl
result["out_trade_no"] = order.OrderNo
result["pid"] = c.Pid
result["type"] = c.Type
result["return_url"] = order.ReturnUrl
return result
}