当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 98

flanche/微信Go SDK
暂停

forked from bozz/微信Go SDK
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
client_test.go 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
leexs 提交于 2019-08-25 16:59 . 微信找零接口的对接
package wechat
import (
"fmt"
"os"
"testing"
)
var (
testAppId = os.Getenv("AppID")
testSubAppId = os.Getenv("SubAppID")
testMchId = os.Getenv("MchID")
testSubMchId = os.Getenv("SubMchID")
testApiKey = os.Getenv("ApiKey")
testCertPath = os.Getenv("CertFilepath")
)
var testClient = NewClient(true, false, ServiceTypeFacilitatorDomestic, testApiKey, testCertPath, Config{
AppId: testAppId,
SubAppId: testSubAppId,
MchId: testMchId,
SubMchId: testSubMchId,
})
func TestAll(t *testing.T) {
fmt.Println("ApiKey", testApiKey)
fmt.Println("CertFile", testCertPath)
fmt.Println("AppId", testAppId)
fmt.Println("MchId", testMchId)
if testClient.isFacilitator() {
fmt.Println("SubAppId", testSubAppId)
fmt.Println("SubMchId", testSubMchId)
}
var (
outTradeNo string
transactionId string
)
// 付款码支付-撤销
transactionId, outTradeNo = testMicropay(t)
testQueryOrder(t, outTradeNo)
testReverse(t, outTradeNo)
// 付款码支付-关闭
transactionId, outTradeNo = testMicropay(t)
testQueryOrder(t, outTradeNo)
testCloseOrder(t, outTradeNo)
// 付款码支付-退款
transactionId, outTradeNo = testMicropay(t)
testQueryOrder(t, outTradeNo)
testRefund(t, outTradeNo, transactionId)
testQueryRefund(t, outTradeNo)
// 统一下单支付-撤销
outTradeNo = testUnifiedOrder(t)
testQueryOrder(t, outTradeNo)
testReverse(t, outTradeNo)
// 统一下单支付-关闭
outTradeNo = testUnifiedOrder(t)
testQueryOrder(t, outTradeNo)
testCloseOrder(t, outTradeNo)
// 统一下单支付-退款
outTradeNo = testUnifiedOrder(t)
testQueryOrder(t, outTradeNo)
testRefund(t, outTradeNo, "")
testQueryRefund(t, outTradeNo)
// 单一接口测试
testDownloadBill(t)
testReportMicropay(t)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/flanche/wechat.git
git@gitee.com:flanche/wechat.git
flanche
wechat
微信Go SDK
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385