Skip to content

Commit 63a2e77

Browse files
committed
update README for JitPack.io
1 parent cb3a0f9 commit 63a2e77

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

README.md

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,61 @@
88

99
## 项目状态
1010

11-
当前版本为测试版,尚没经过严格的功能和兼容性测试。请商户的专业技术人员在使用时注意系统和软件的正确性和兼容性。由此带来的风险,由商户自行承担。
11+
当前版本`0.1.4-SNAPSHOT`为预览版,尚没经过严格的功能和兼容性测试。请商户的专业技术人员在使用时注意系统和软件的正确性和兼容性。由此带来的风险,由商户自行承担。
1212

1313
## 环境要求
1414

15-
我们开发和测试使用的环境如下。
16-
1715
+ Java 1.8
18-
+ Apache HttpClient 4.5.8
1916

20-
根据所依赖的接口,Apache HttpClient的版本大于4.3.1即可以使用,建议使用4.4以上版本。
17+
## 安装
18+
19+
### Gradle
20+
21+
在你的`build.gradle`文件中加入如下的信息
22+
23+
```groovy
24+
repositories {
25+
...
26+
maven { url 'https://jitpack.io' }
27+
}
28+
...
29+
dependencies {
30+
implementation 'com.github.wechatpay-apiv3:wechatpay-apache-httpclient:0.1.4-SNAPSHOT'
31+
...
32+
}
33+
```
34+
35+
### Maven
36+
37+
加入JitPack仓库
38+
39+
```xml
40+
<repositories>
41+
<repository>
42+
<id>jitpack.io</id>
43+
<url>https://jitpack.io</url>
44+
</repository>
45+
</repositories>
46+
```
47+
48+
加入以下依赖
49+
50+
```xml
51+
<dependency>
52+
<groupId>com.github.wechatpay-apiv3</groupId>
53+
<artifactId>wechatpay-apache-httpclient</artifactId>
54+
<version>0.1.4-SNAPSHOT</version>
55+
</dependency>
56+
```
2157

2258
## 开始
2359

2460
如果你使用的是`HttpClientBuilder`或者`HttpClients#custom()`来构造`HttpClient`,你可以直接替换为`WechatPayHttpClientBuilder`。我们提供相应的方法,可以方便的传入商户私钥和微信支付平台证书等信息。
2561

2662
```java
63+
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
64+
65+
//...
2766
WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
2867
.withMerchant(merchantId, merchantSerialNumber, merchantPrivateKey)
2968
.withWechatpay(wechatpayCertificates);
@@ -41,6 +80,10 @@ HttpResponse response = httpClient.execute(...);
4180
当默认的本地签名和验签方式不适合你的系统时,你可以通过实现`Signer`或者`Verifier`来定制签名和验签。比如,你的系统把商户私钥集中存储,业务系统需通过远程调用进行签名,你可以这样做。
4281

4382
```java
83+
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
84+
import com.wechat.pay.contrib.apache.httpclient.Credentials;
85+
86+
// ...
4487
Credentials credentials = new WechatPay2Credentials(merchantId, new Signer() {
4588
@Override
4689
public Signer.SignatureResult sign(byte[] message) {
@@ -67,6 +110,10 @@ CloseableHttpClient httpClient = WechatPayHttpClientBuilder.create()
67110

68111
**注意**:业务请求请使用标准的初始化流程,务必验证应答签名。
69112

113+
### 证书和回调解密需要的AesGcm解密在哪里?
114+
115+
请参考[AesUtil.Java](https://github.com/wechatpay-apiv3/wechatpay-apache-httpclient/blob/master/src/main/java/com/wechat/pay/contrib/apache/httpclient/util/AesUtil.java)
116+
70117
## 联系我们
71118

72119
如果你发现了**BUG**或者有任何疑问,请通过issue进行反馈。

0 commit comments

Comments
 (0)