voucher
This commit is contained in:
parent
f206764800
commit
7dccb67de3
|
|
@ -56,13 +56,9 @@ func marketingFJxw() *marketing2.Marketing {
|
||||||
//openssl x509 -in xxx.pem -noout -serial
|
//openssl x509 -in xxx.pem -noout -serial
|
||||||
|
|
||||||
mchId := "1652465541"
|
mchId := "1652465541"
|
||||||
wechatPayPublicKeyId := "PUB_KEY_ID_0117109533612025031800326400002563"
|
wechatPayPublicKeyId := " PUB_KEY_ID_0116524655412025070900181741001803"
|
||||||
certificateSerialNo := "1E3F2CE013203BA9C3DEFC5782FCD3329C3DAC1C"
|
certificateSerialNo := "1E3F2CE013203BA9C3DEFC5782FCD3329C3DAC1C"
|
||||||
|
|
||||||
//mchId := "1652465541"
|
|
||||||
//wechatPayPublicKeyId := ""
|
|
||||||
//certificateSerialNo := "1E3F2CE013203BA9C3DEFC5782FCD3329C3DAC1C"
|
|
||||||
|
|
||||||
filePath := fmt.Sprintf("%s/cert/wechat/%s", parentDir, mchId)
|
filePath := fmt.Sprintf("%s/cert/wechat/%s", parentDir, mchId)
|
||||||
|
|
||||||
c, err := utils.CreateMchConfig(
|
c, err := utils.CreateMchConfig(
|
||||||
|
|
@ -84,20 +80,6 @@ func MarketingSend() {
|
||||||
openId := "oSNb4ftgnWC22Z0cWTjsQebdr2Yk"
|
openId := "oSNb4ftgnWC22Z0cWTjsQebdr2Yk"
|
||||||
appId := "wx619991cc795028f5"
|
appId := "wx619991cc795028f5"
|
||||||
|
|
||||||
//195516196845312409613
|
|
||||||
//openId := "ocuH-0Nymo4sJLRNabIBbg9H2XCo"
|
|
||||||
//appId := "wx5d3e839568f24b2b"
|
|
||||||
//respBody={"coupon_id":"116076813524"}
|
|
||||||
|
|
||||||
//openId := "ocZ-njugTd_fgCJMHTG8PukPAVm4"
|
|
||||||
//appId := "wxd9137161bc8f9ca9"
|
|
||||||
//respBody={"coupon_id":"117888124542"}
|
|
||||||
|
|
||||||
//195516196845312409613
|
|
||||||
//1958100775326560252
|
|
||||||
//1958100775326560251
|
|
||||||
//19581007753265602565
|
|
||||||
//19581007753265602564
|
|
||||||
request := &marketing2.SendReq{
|
request := &marketing2.SendReq{
|
||||||
ActivityId: utils.String("11941580000000012"),
|
ActivityId: utils.String("11941580000000012"),
|
||||||
StockId: utils.String("20964154"),
|
StockId: utils.String("20964154"),
|
||||||
|
|
@ -128,13 +110,6 @@ func MarketingSend() {
|
||||||
fmt.Printf("请求成功: %s\n", *response.CouponId)
|
fmt.Printf("请求成功: %s\n", *response.CouponId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MarketingQuery(appId, openId, couponId string) {
|
func MarketingQuery(appId, openId, couponId string) (response *marketing2.SendResp, err error) {
|
||||||
|
return marketingFJxw().Query(appId, openId, couponId)
|
||||||
response, err := marketing().Query(appId, openId, couponId)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Print(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("请求成功: %+v\n", response)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,24 @@ func Test_MarketingQuery(t *testing.T) {
|
||||||
name: "查询绑定多笔立减活动的代金券详情", // 查询的商户非创建方商户 查询商户要为创建方商户
|
name: "查询绑定多笔立减活动的代金券详情", // 查询的商户非创建方商户 查询商户要为创建方商户
|
||||||
appId: "wx619991cc795028f5",
|
appId: "wx619991cc795028f5",
|
||||||
openId: "oSNb4ftgnWC22Z0cWTjsQebdr2Yk",
|
openId: "oSNb4ftgnWC22Z0cWTjsQebdr2Yk",
|
||||||
couponId: "122529292094",
|
couponId: "139923450432",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
MarketingQuery(tt.appId, tt.openId, tt.couponId)
|
resp, err := MarketingQuery(tt.appId, tt.openId, tt.couponId)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("MarketingQuery() error = %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Logf("MarketingQuery() = %v", resp)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 合单订单就是没有核销回调通知的
|
||||||
|
// {"code":"APPID_MCHID_NOT_MATCH","message":"商户号与AppID不匹配"}
|
||||||
|
// APPID_MCHID_NOT_MATCH 商户号与AppID不匹配 调用接口的商户号需与接口传入的AppID有绑定关系
|
||||||
|
|
||||||
|
//openid不是自己的appid下的喔,这也能查询到吗”
|
||||||
|
//不行的,需要是在自己appid下的才能查到
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,15 @@ var bc = &conf.Bootstrap{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bc2 = &conf.Bootstrap{
|
||||||
|
Wechat: &conf.Wechat{
|
||||||
|
MchID: "1652465541", // notifyUrl https://nsall.86698.cn/wechatPay/coupon_notify/fjxingwang
|
||||||
|
MchCertificateSerialNumber: "1E3F2CE013203BA9C3DEFC5782FCD3329C3DAC1C",
|
||||||
|
WechatPayPublicKeyID: "PUB_KEY_ID_0116524655412025070900181741001803",
|
||||||
|
Name: "福建兴旺",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
func SendCoupon() {
|
func SendCoupon() {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
@ -94,8 +103,8 @@ func QueryCoupon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
appId := "wx619991cc795028f5"
|
appId := "wx619991cc795028f5"
|
||||||
openId := "oSNb4ftgnWC22Z0cWTjsQebdr2Yk"
|
openId := "oSNb4fulXAleiammvWXnz1pRghAE"
|
||||||
couponId := "122529292094"
|
couponId := "142388354994"
|
||||||
|
|
||||||
req := cashcoupons.QueryCouponRequest{
|
req := cashcoupons.QueryCouponRequest{
|
||||||
CouponId: core.String(couponId),
|
CouponId: core.String(couponId),
|
||||||
|
|
@ -148,8 +157,8 @@ func QueryProduct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
req := cashcoupons.QueryStockRequest{
|
req := cashcoupons.QueryStockRequest{
|
||||||
StockId: core.String("20965520"),
|
StockId: core.String("21386505"),
|
||||||
StockCreatorMchid: core.String("1652465541"),
|
StockCreatorMchid: core.String("1715349578"),
|
||||||
}
|
}
|
||||||
|
|
||||||
svc := cashcoupons.StockApiService{Client: client}
|
svc := cashcoupons.StockApiService{Client: client}
|
||||||
|
|
@ -226,9 +235,9 @@ func QueryCallback() {
|
||||||
parentDir := filepath.Dir(dir)
|
parentDir := filepath.Dir(dir)
|
||||||
|
|
||||||
server := data.Server{
|
server := data.Server{
|
||||||
MchID: bc.Wechat.MchID,
|
MchID: bc2.Wechat.MchID,
|
||||||
MchCertificateSerialNumber: bc.Wechat.MchCertificateSerialNumber,
|
MchCertificateSerialNumber: bc2.Wechat.MchCertificateSerialNumber,
|
||||||
WechatPayPublicKeyID: bc.Wechat.WechatPayPublicKeyID,
|
WechatPayPublicKeyID: bc2.Wechat.WechatPayPublicKeyID,
|
||||||
Dir: parentDir,
|
Dir: parentDir,
|
||||||
}
|
}
|
||||||
client, err := data.GetClient(ctx, server)
|
client, err := data.GetClient(ctx, server)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue