互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

package test
import (
"fmt"
"github.com/chanxuehong/wechat/mch/core"
pay_service "hudongzhuanjia/services/pay"
"testing"
"time"
)
var openId = "o9XM41s_NN8Y0QK6_MbM-aYMV3TE"
func TestTransfer(t *testing.T) {
res, err := pay_service.Transfer("欧轩互动-转账测试", "127.0.0.1", openId, 0.30*10)
fmt.Println(err)
fmt.Printf("%+v\n", res)
}
func TestSendRedPack(t *testing.T) {
res, err := pay_service.SendRedPack("欧轩互动-红包测试", openId, "你好测试", "192.168.1.103", "tommy",
"哈哈哈哈哈", 1, 1, 1)
fmt.Println(err)
fmt.Printf("%+v\n", res)
}
func TestQueryOrder(t *testing.T) {
//outTradeNo := "Dn13Gl6A6dB6aOae7syqtXSwUvCZ3mta"
outTradeNo := "jGrqipGJdcxQz4uwSTQqrtnJ4rJE6Mx9"
res, err := pay_service.OrderQuery(outTradeNo)
fmt.Println(err)
fmt.Printf("%+v\n", res)
}
func TestClose(t *testing.T) {
pay_service.Close("jGrqipGJdcxQz4uwSTQqrtnJ4rJE6Mx9")
}
func TestTimeExpire(t *testing.T) {
now := time.Now()
t1 := "202004174430"
t2 := core.FormatTime(time.Now())
t3, _ := core.ParseTime(t1)
fmt.Println(t1, t2)
fmt.Println(t1 > t2)
fmt.Println(t3.Unix() > now.Unix())
fmt.Println(t1, t2, core.FormatTime(t3))
fmt.Println(t3.Unix(), now.Unix())
}