Skip to content

Commit

Permalink
2.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
liyiorg committed Mar 28, 2017
1 parent b4752f1 commit e733a54
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ weixin-popular 已支持的微信平台
<dependency>
<groupId>com.github.liyiorg</groupId>
<artifactId>weixin-popular</artifactId>
<version>2.8.6</version>
<version>2.8.7</version>
</dependency>
```
* [升级注意事项](https://github.com/liyiorg/weixin-popular/wiki/jar_update)
Expand Down Expand Up @@ -86,9 +86,9 @@ weixin-popular 已支持的微信平台
## support
* [TokenManager token 自动刷新](https://github.com/liyiorg/weixin-popular/wiki/TokenManager-token-自动刷新)
* [TicketManager ticket 自动刷新](https://github.com/liyiorg/weixin-popular/wiki/TicketManager-ticket-自动刷新)
* [设置API HttpClient 请求池大小](https://github.com/liyiorg/weixin-popular/wiki/设置API HttpClient 请求池大小)
* [设置API HttpClient 请求池大小](https://github.com/liyiorg/weixin-popular/wiki/设置API%20HttpClient%20请求池大小)
* [设置API HttpClient 超时及异常重试](https://github.com/liyiorg/weixin-popular/wiki/超时及异常重试)
* [设置API MCH KeyStore](https://github.com/liyiorg/weixin-popular/wiki/设置API MCH KeyStore)
* [设置API MCH KeyStore](https://github.com/liyiorg/weixin-popular/wiki/设置API%20MCH%20KeyStore)
* [排除重复的异步通知](https://github.com/liyiorg/weixin-popular/wiki/排除重复的异步通知)

## 参考资料
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ WEIXIN-POPULAR CHANGELOG
===========================
https://github.com/liyiorg/weixin-popular

Changes in version 2.8.7 (2017-03-28)
-------------------------------------
* 修复问题 #67 (CardAPI codeConsume和codeDecrypt方法返回类型错误)
* 修复问题 #69 (微信支付统一下单加入detail字段时签名错误)
* #70 LocalHttpClient.initMchKeyStore 支持inputStream流参数

Changes in version 2.8.6 (2017-02-14)
-------------------------------------
* MediaAPI 添加高清语音接口
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.liyiorg</groupId>
<artifactId>weixin-popular</artifactId>
<version>2.8.6</version>
<version>2.8.7</version>

<name>weixin-popular</name>
<description>The weixin-popular is a JAVA SDK for weixin. Weixin web url is https://mp.weixin.qq.com.</description>
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/weixin/popular/api/CardAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static CodeCheckCodeResult codeCheckCode(String accessToken, String postJ
* @param codeConsume codeConsume
* @return result
*/
public static CodeDecryptResult codeConsume(String accessToken, CodeConsume codeConsume) {
public static CodeConsumeResult codeConsume(String accessToken, CodeConsume codeConsume) {
return codeConsume(accessToken, JsonUtil.toJSONString(codeConsume));
}

Expand All @@ -138,7 +138,7 @@ public static CodeDecryptResult codeConsume(String accessToken, CodeConsume code
* @param postJson postJson
* @return result
*/
public static CodeDecryptResult codeConsume(String accessToken, String postJson) {
public static CodeConsumeResult codeConsume(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
.post()
.setHeader(jsonHeader)
Expand All @@ -147,7 +147,7 @@ public static CodeDecryptResult codeConsume(String accessToken, String postJson)
.setEntity(new StringEntity(postJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,
CodeDecryptResult.class);
CodeConsumeResult.class);
}

/**
Expand All @@ -160,7 +160,7 @@ public static CodeDecryptResult codeConsume(String accessToken, String postJson)
* @param codeDecrypt codeDecrypt
* @return result
*/
public static CodeConsumeResult codeDecrypt(String accessToken, CodeDecrypt codeDecrypt) {
public static CodeDecryptResult codeDecrypt(String accessToken, CodeDecrypt codeDecrypt) {
return codeDecrypt(accessToken, JsonUtil.toJSONString(codeDecrypt));
}

Expand All @@ -174,7 +174,7 @@ public static CodeConsumeResult codeDecrypt(String accessToken, CodeDecrypt code
* @param postJson postJson
* @return result
*/
public static CodeConsumeResult codeDecrypt(String accessToken, String postJson) {
public static CodeDecryptResult codeDecrypt(String accessToken, String postJson) {
HttpUriRequest httpUriRequest = RequestBuilder
.post()
.setHeader(jsonHeader)
Expand All @@ -183,7 +183,7 @@ public static CodeConsumeResult codeDecrypt(String accessToken, String postJson)
.setEntity(new StringEntity(postJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,
CodeConsumeResult.class);
CodeDecryptResult.class);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/weixin/popular/api/PayMchAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import weixin.popular.bean.paymch.Unifiedorder;
import weixin.popular.bean.paymch.UnifiedorderResult;
import weixin.popular.client.LocalHttpClient;
import weixin.popular.util.JsonUtil;
import weixin.popular.util.MapUtil;
import weixin.popular.util.SignatureUtil;
import weixin.popular.util.XMLConverUtil;
Expand Down Expand Up @@ -113,6 +114,10 @@ private static String baseURI(){
*/
public static UnifiedorderResult payUnifiedorder(Unifiedorder unifiedorder,String key){
Map<String,String> map = MapUtil.objectToMap(unifiedorder);
//@since 2.8.7 detail 字段签名处理
if(map.containsKey("detail")){
map.put("detail",JsonUtil.toJSONString(unifiedorder.getDetail()));
}
if(key != null){
String sign = SignatureUtil.generateSign(map,unifiedorder.getSign_type(),key);
unifiedorder.setSign(sign);
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/weixin/popular/bean/paymch/GoodsDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class GoodsDetail {
private Integer quantity; // 必填 32 商品数量

private Integer price; // 必填 32 商品单价,如果商户有优惠,需传输商户优惠后的单价

private String goods_category; //类目

private String body; //名称

public String getGoods_id() {
return goods_id;
Expand Down Expand Up @@ -52,4 +56,20 @@ public void setPrice(Integer price) {
this.price = price;
}

public String getGoods_category() {
return goods_category;
}

public void setGoods_category(String goods_category) {
this.goods_category = goods_category;
}

public String getBody() {
return body;
}

public void setBody(String body) {
this.body = body;
}

}
22 changes: 18 additions & 4 deletions src/main/java/weixin/popular/client/LocalHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -83,10 +84,23 @@ public static void init(int maxTotal,int maxPerRoute){
*/
public static void initMchKeyStore(String mch_id,String keyStoreFilePath){
try {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream instream = new FileInputStream(new File(keyStoreFilePath));
keyStore.load(instream,mch_id.toCharArray());
instream.close();
initMchKeyStore(mch_id, new FileInputStream(new File(keyStoreFilePath)));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}

/**
* 初始化 MCH HttpClient KeyStore
* @since 2.8.7
* @param mch_id mch_id
* @param inputStream p12 文件流
*/
public static void initMchKeyStore(String mch_id, InputStream inputStream) {
try {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(inputStream,mch_id.toCharArray());
inputStream.close();
CloseableHttpClient httpClient = HttpClientFactory.createKeyMaterialHttpClient(keyStore, mch_id,timeout,retryExecutionCount);
httpClient_mchKeyStore.put(mch_id, httpClient);
} catch (KeyStoreException e) {
Expand Down

0 comments on commit e733a54

Please sign in to comment.