-
Notifications
You must be signed in to change notification settings - Fork 7
/
pay_test.go
55 lines (48 loc) · 907 Bytes
/
pay_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package pays_with_go
import (
"fmt"
"./client"
"./common"
"./constant"
"net/http"
"testing"
)
//测试
func TestPay(t *testing.T) {
initClient()
initHandle()
charge := new(common.Charge)
charge.PayMethod = constant.WECHAT
charge.MoneyFee = 1
charge.Describe = "测试订单"
charge.TradeNum = "8888888888"
fdata, err := do(charge)
if err != nil {
t.Error(err)
}
fmt.Println(fdata)
}
//初始化客户端
func initClient() {
client.InitAliAppClient(&client.AliAppClient{
PartnerID: "xxx",
SellerID: "xxxx",
AppID: "xxx",
PrivateKey: nil,
PublicKey: nil,
})
}
//初始化处理
func initHandle() {
http.HandleFunc("callback/aliappcallback", func(w http.ResponseWriter, r *http.Request) {
aliResult, err := AliAppCallback(w, r)
if err != nil {
fmt.Println(err)
//log.xxx
return
}
selfHandler(aliResult)
})
}
func selfHandler(i interface{}) {
}