This commit is contained in:
ziming 2025-04-22 17:52:30 +08:00
parent be5fcdf414
commit 19a3ecc0df
1 changed files with 37 additions and 0 deletions

View File

@ -44,3 +44,40 @@ func TestGetClient(t *testing.T) {
t.Log(response)
}
func TestCoupon(t *testing.T) {
server := Server{
MchID: "1710953361", // 证书所属商户 蓝色兄弟服务商立减金配置
MchCertificateSerialNumber: "6006B8208815DB5EAC5BF2E783CB9D34082C3772",
}
ctx := context.Background()
client, err := GetClient(ctx, server)
if err != nil {
t.Error(err)
return
}
req := cashcoupons.SendCouponRequest{
OutRequestNo: core.String("123456"),
// 微信为发券方商户分配的公众账号ID接口传入的所有appid应该为公众号的appid在mp.weixin.qq.com申请的不能为APP的appid在open.weixin.qq.com申请的
Appid: core.String("wx619991cc795028f5"),
Openid: core.String("oSNb4ftgnWC22Z0cWTjsQebdr2Yk"),
StockId: core.String("20395589"),
StockCreatorMchid: core.String("1652465541"),
}
svc := cashcoupons.CouponApiService{Client: client}
resp, result, err := svc.SendCoupon(ctx, req)
if err != nil {
t.Error(err)
return
}
t.Logf("\nresp:%+v\n result:%+v", resp, result)
return
}