-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathpay_test.go
51 lines (45 loc) · 914 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
package gopay
import (
"fmt"
"github.com/guidao/gopay/client"
"github.com/guidao/gopay/common"
"github.com/guidao/gopay/constant"
"net/http"
"testing"
)
func TestPay(t *testing.T) {
initClient()
initHandle()
charge := new(common.Charge)
charge.PayMethod = constant.WECHAT
charge.MoneyFee = 1
charge.Describe = "test pay"
charge.TradeNum = "1111111111"
fdata, err := Pay(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{}) {
}