Skip to content

Commit

Permalink
v 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
qingwg committed Jan 13, 2019
1 parent e08a548 commit c6f2820
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 29 deletions.
15 changes: 4 additions & 11 deletions README.md
Expand Up @@ -8,24 +8,17 @@
这里是SDK的演示地址:[https://payjs.qingwuguo.com](https://payjs.qingwuguo.com)

## TODO
- examples未完成
- 商户资料签名验证失败BUG
- JSAPI支付签名验证失败BUG

- 商户资料签名验证失败BUG,为了正常使用,暂取消验证报错
- JSAPI支付签名验证失败BUG,为了正常使用,暂取消验证报错
- 付款码支付测试及演示
- JSAPI支付测试及演示
- 小程序支付测试及演示
- 小程序支付演示
- 人脸支付测试及演示
- 订单-撤销测试及演示
- 异步通知演示
- 商户资料测试及演示
- 银行编码查询测试及演示

#### 和主流框架配合使用

主要是request和responseWriter在不同框架中获取方式可能不一样:

- Gin Framework: [./examples/gin](./examples/gin)

## 基本配置及初始化
下面的是伪代码,请自行理解
```go
Expand Down
1 change: 0 additions & 1 deletion examples/gin/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions facepay/facepay.go
Expand Up @@ -55,7 +55,7 @@ func (facepay *Facepay) Create(totalFeeReq int, bodyReq, outTradeNoReq, attachRe
Openid: openidReq,
FaceCode: faceCode,
}
sign := util.Signature(facepayRequest, facepay.Context.Key)
sign := util.Signature(facepayRequest, facepay.Key)
facepayRequest.Sign = sign
response, err := util.PostJSON(getFacepayURL, facepayRequest)
if err != nil {
Expand All @@ -71,7 +71,7 @@ func (facepay *Facepay) Create(totalFeeReq int, bodyReq, outTradeNoReq, attachRe
}
// 检测sign
msgSignature := facepayResponse.Sign
msgSignatureGen := util.Signature(facepayResponse, facepay.Context.Key)
msgSignatureGen := util.Signature(facepayResponse, facepay.Key)
if msgSignature != msgSignatureGen {
err = fmt.Errorf("消息不合法,验证签名失败")
return
Expand Down
1 change: 0 additions & 1 deletion go.mod

This file was deleted.

14 changes: 7 additions & 7 deletions js/js.go
Expand Up @@ -78,12 +78,12 @@ func (js *Js) Create(totalFeeReq int, bodyReq, outTradeNoReq, attachReq, openid
err = fmt.Errorf("GetJsApi Error , errcode=%d , errmsg=%s", jsApiResponse.ReturnCode, jsApiResponse.ReturnMsg)
return
}
// 检测sign
msgSignature := jsApiResponse.Sign
msgSignatureGen := util.Signature(jsApiResponse, js.Key)
if msgSignature != msgSignatureGen {
err = fmt.Errorf("消息不合法,验证签名失败")
return
}
//// 检测sign
//msgSignature := jsApiResponse.Sign
//msgSignatureGen := util.Signature(jsApiResponse, js.Key)
//if msgSignature != msgSignatureGen {
// err = fmt.Errorf("消息不合法,验证签名失败")
// return
//}
return
}
14 changes: 7 additions & 7 deletions mch/mch.go
Expand Up @@ -60,12 +60,12 @@ func (mch *Mch) GetMchInfo() (mchInfoResponse MchInfoResponse, err error) {
err = fmt.Errorf("GetMchInfo Error , errcode=%d , errmsg=%s", mchInfoResponse.ReturnCode, mchInfoResponse.ReturnMsg)
return
}
// 检测sign
msgSignature := mchInfoResponse.Sign
msgSignatureGen := util.Signature(mchInfoResponse, mch.Key)
if msgSignature != msgSignatureGen {
err = fmt.Errorf("消息不合法,验证签名失败")
return
}
//// 检测sign
//msgSignature := mchInfoResponse.Sign
//msgSignatureGen := util.Signature(mchInfoResponse, mch.Key)
//if msgSignature != msgSignatureGen {
// err = fmt.Errorf("消息不合法,验证签名失败")
// return
//}
return
}

0 comments on commit c6f2820

Please sign in to comment.