新增银行类型枚举还有更新命名规范
This commit is contained in:
parent
6f892ebbf4
commit
9dbc95a2dd
@ -31,13 +31,13 @@ import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
*/
|
||||
public class CouponApi {
|
||||
|
||||
private final WeixinRequestExecutor weixinClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
|
||||
private final WeixinPayAccount weixinAccount;
|
||||
|
||||
public CouponApi(WeixinPayAccount weixinAccount) {
|
||||
this.weixinAccount = weixinAccount;
|
||||
this.weixinClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +115,7 @@ public class CouponApi {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_COUPONSTOCKQUERY_URL, param);
|
||||
return response.getAsObject(new TypeReference<CouponStock>() {
|
||||
});
|
||||
@ -139,7 +139,7 @@ public class CouponApi {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_COUPONDETAILQUERY_URL, param);
|
||||
return response.getAsObject(new TypeReference<CouponDetail>() {
|
||||
});
|
||||
|
||||
@ -53,13 +53,13 @@ import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
*/
|
||||
public class Pay3Api {
|
||||
|
||||
private final WeixinRequestExecutor weixinClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
|
||||
private final WeixinPayAccount weixinAccount;
|
||||
|
||||
public Pay3Api(WeixinPayAccount weixinAccount) {
|
||||
this.weixinAccount = weixinAccount;
|
||||
this.weixinClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,7 +84,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_ORDERQUERY_URL, param);
|
||||
return ListsuffixResultDeserializer.deserialize(response.getAsString(),
|
||||
Order.class);
|
||||
@ -253,7 +253,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_SHORTURL_URL, param);
|
||||
map = XmlStream.xml2map(response.getAsString());
|
||||
return map.get("short_url");
|
||||
@ -280,7 +280,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_CLOSEORDER_URL, param);
|
||||
return response.getAsObject(new TypeReference<ApiResult>() {
|
||||
});
|
||||
@ -328,7 +328,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_DOWNLOADBILL_URL, param);
|
||||
|
||||
BufferedReader reader = null;
|
||||
@ -384,7 +384,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_REFUNDQUERY_URL, param);
|
||||
return ListsuffixResultDeserializer.deserialize(response.getAsString(),
|
||||
RefundRecord.class);
|
||||
@ -425,7 +425,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_PAYREPORT_URL, param);
|
||||
return response.getAsXmlResult();
|
||||
}
|
||||
@ -448,7 +448,7 @@ public class Pay3Api {
|
||||
String sign = PayUtil.paysignMd5(map, weixinAccount.getPaySignKey());
|
||||
map.put("sign", sign);
|
||||
String param = XmlStream.map2xml(map);
|
||||
WeixinResponse response = weixinClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
PayURLConsts.MCH_AUTHCODE_OPENID_URL, param);
|
||||
return response.getAsObject(new TypeReference<AuthCodeOpenIdResult>() {
|
||||
});
|
||||
|
||||
@ -46,6 +46,15 @@ import com.foxinmy.weixin4j.http.entity.HttpEntity;
|
||||
import com.foxinmy.weixin4j.model.Consts;
|
||||
import com.foxinmy.weixin4j.util.StringUtil;
|
||||
|
||||
/**
|
||||
* Apache HttpComponent 3.x
|
||||
*
|
||||
* @className HttpComponent3
|
||||
* @author jy
|
||||
* @date 2015年8月18日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public class HttpComponent3 extends AbstractHttpClient implements HttpClient {
|
||||
|
||||
private final org.apache.commons.httpclient.HttpClient httpClient;
|
||||
|
||||
@ -10,6 +10,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.payment.coupon.CouponInfo;
|
||||
import com.foxinmy.weixin4j.type.BankType;
|
||||
import com.foxinmy.weixin4j.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.type.TradeState;
|
||||
import com.foxinmy.weixin4j.type.TradeType;
|
||||
@ -136,7 +137,8 @@ public class Order extends ApiResult {
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public TradeState getFormatTradeState() {
|
||||
return tradeState != null ? TradeState.valueOf(tradeState.toUpperCase()) : null;
|
||||
return tradeState != null ? TradeState
|
||||
.valueOf(tradeState.toUpperCase()) : null;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
@ -154,13 +156,20 @@ public class Order extends ApiResult {
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public TradeType getFormatTradeType() {
|
||||
return tradeType != null ? TradeType.valueOf(tradeType.toUpperCase()) : null;
|
||||
return tradeType != null ? TradeType.valueOf(tradeType.toUpperCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
public String getBankType() {
|
||||
return bankType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public BankType getFormatBankType() {
|
||||
return bankType != null ? BankType.valueOf(bankType.toUpperCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
public int getTotalFee() {
|
||||
return totalFee;
|
||||
}
|
||||
@ -209,7 +218,8 @@ public class Order extends ApiResult {
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CurrencyType getFormatFeeType() {
|
||||
return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase()) : null;
|
||||
return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
public String getTradeState() {
|
||||
|
||||
@ -0,0 +1,260 @@
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
|
||||
/**
|
||||
* 银行类型
|
||||
*
|
||||
* @className BankType
|
||||
* @author jy
|
||||
* @date 2015年8月19日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public enum BankType {
|
||||
/**
|
||||
* 工商银行(借记卡)
|
||||
*/
|
||||
ICBC_DEBIT("工商银行(借记卡)"),
|
||||
/**
|
||||
* 工商银行(信用卡)
|
||||
*/
|
||||
ICBC_CREDIT("工商银行(信用卡)"),
|
||||
/**
|
||||
* 农业银行(借记卡)
|
||||
*/
|
||||
ABC_DEBIT("农业银行(借记卡)"),
|
||||
/**
|
||||
* 农业银行 (信用卡)
|
||||
*/
|
||||
ABC_CREDIT("农业银行 (信用卡)"),
|
||||
/**
|
||||
* 邮政储蓄(借记卡)
|
||||
*/
|
||||
PSBC_DEBIT("邮政储蓄(借记卡)"),
|
||||
/**
|
||||
* 邮政储蓄 (信用卡)
|
||||
*/
|
||||
PSBC_CREDIT("邮政储蓄 (信用卡)"),
|
||||
/**
|
||||
* 建设银行(借记卡)
|
||||
*/
|
||||
CCB_DEBIT("建设银行(借记卡)"),
|
||||
/**
|
||||
* 建设银行 (信用卡)
|
||||
*/
|
||||
CCB_CREDIT("建设银行 (信用卡)"),
|
||||
/**
|
||||
* 招商银行(借记卡)
|
||||
*/
|
||||
CMB_DEBIT("招商银行(借记卡)"),
|
||||
/**
|
||||
* 招商银行(信用卡)
|
||||
*/
|
||||
CMB_CREDIT("招商银行(信用卡)"),
|
||||
/**
|
||||
* 交通银行(借记卡)
|
||||
*/
|
||||
COMM_DEBIT("交通银行(借记卡)"),
|
||||
/**
|
||||
* 中国银行(信用卡)
|
||||
*/
|
||||
BOC_CREDIT("中国银行(信用卡)"),
|
||||
/**
|
||||
* 浦发银行(借记卡)
|
||||
*/
|
||||
SPDB_DEBIT("浦发银行(借记卡)"),
|
||||
/**
|
||||
* 浦发银行 (信用卡)
|
||||
*/
|
||||
SPDB_CREDIT("浦发银行 (信用卡)"),
|
||||
/**
|
||||
* 广发银行(借记卡)
|
||||
*/
|
||||
GDB_DEBIT("广发银行(借记卡)"),
|
||||
/**
|
||||
* 广发银行(信用卡)
|
||||
*/
|
||||
GDB_CREDIT("广发银行(信用卡)"),
|
||||
/**
|
||||
* 民生银行(借记卡)
|
||||
*/
|
||||
CMBC_DEBIT("民生银行(借记卡)"),
|
||||
/**
|
||||
* 民生银行(信用卡)
|
||||
*/
|
||||
CMBC_CREDIT("民生银行(信用卡)"),
|
||||
/**
|
||||
* 平安银行(借记卡)
|
||||
*/
|
||||
PAB_DEBIT("平安银行(借记卡)"),
|
||||
/**
|
||||
* 平安银行(信用卡)
|
||||
*/
|
||||
PAB_CREDIT("平安银行(信用卡)"),
|
||||
/**
|
||||
* 光大银行(借记卡)
|
||||
*/
|
||||
CEB_DEBIT("光大银行(借记卡)"),
|
||||
/**
|
||||
* 光大银行(信用卡)
|
||||
*/
|
||||
CEB_CREDIT("光大银行(信用卡)"),
|
||||
/**
|
||||
* 兴业银行 (借记卡)
|
||||
*/
|
||||
CIB_DEBIT("兴业银行 (借记卡)"),
|
||||
/**
|
||||
* 兴业银行(信用卡)
|
||||
*/
|
||||
CIB_CREDIT("兴业银行(信用卡)"),
|
||||
/**
|
||||
* 中信银行(借记卡)
|
||||
*/
|
||||
CITIC_DEBIT("中信银行(借记卡)"),
|
||||
/**
|
||||
* 中信银行(信用卡)
|
||||
*/
|
||||
CITIC_CREDIT("中信银行(信用卡)"),
|
||||
/**
|
||||
* 深发银行(信用卡)
|
||||
*/
|
||||
SDB_CREDIT("深发银行(信用卡)"),
|
||||
/**
|
||||
* 上海银行(借记卡)
|
||||
*/
|
||||
BOSH_DEBIT("上海银行(借记卡)"),
|
||||
/**
|
||||
* 上海银行 (信用卡)
|
||||
*/
|
||||
BOSH_CREDIT("上海银行 (信用卡)"),
|
||||
/**
|
||||
* 华润银行(借记卡)
|
||||
*/
|
||||
CRB_DEBIT("华润银行(借记卡)"),
|
||||
/**
|
||||
* 杭州银行(借记卡)
|
||||
*/
|
||||
HZB_DEBIT("杭州银行(借记卡)"),
|
||||
/**
|
||||
* 杭州银行(信用卡)
|
||||
*/
|
||||
HZB_CREDIT("杭州银行(信用卡)"),
|
||||
/**
|
||||
* 包商银行(借记卡)
|
||||
*/
|
||||
BSB_DEBIT("包商银行(借记卡)"),
|
||||
/**
|
||||
* 包商银行 (信用卡)
|
||||
*/
|
||||
BSB_CREDIT("包商银行 (信用卡)"),
|
||||
/**
|
||||
* 重庆银行(借记卡)
|
||||
*/
|
||||
CQB_DEBIT("重庆银行(借记卡)"),
|
||||
/**
|
||||
* 顺德农商行 (借记卡)
|
||||
*/
|
||||
SDEB_DEBIT("顺德农商行 (借记卡)"),
|
||||
/**
|
||||
* 深圳农商银行(借记卡)
|
||||
*/
|
||||
SZRCB_DEBIT("深圳农商银行(借记卡)"),
|
||||
/**
|
||||
* 哈尔滨银行(借记卡)
|
||||
*/
|
||||
HRBB_DEBIT("哈尔滨银行(借记卡)"),
|
||||
/**
|
||||
* 成都银行(借记卡)
|
||||
*/
|
||||
BOCD_DEBIT("成都银行(借记卡)"),
|
||||
/**
|
||||
* 南粤银行 (借记卡)
|
||||
*/
|
||||
GDNYB_DEBIT("南粤银行 (借记卡)"),
|
||||
/**
|
||||
* 南粤银行 (信用卡)
|
||||
*/
|
||||
GDNYB_CREDIT("南粤银行 (信用卡)"),
|
||||
/**
|
||||
* 广州银行(信用卡)
|
||||
*/
|
||||
GZCB_CREDIT("广州银行(信用卡)"),
|
||||
/**
|
||||
* 江苏银行(借记卡)
|
||||
*/
|
||||
JSB_DEBIT("江苏银行(借记卡)"),
|
||||
/**
|
||||
* 江苏银行(信用卡)
|
||||
*/
|
||||
JSB_CREDIT("江苏银行(信用卡)"),
|
||||
/**
|
||||
* 宁波银行(借记卡)
|
||||
*/
|
||||
NBCB_DEBIT("宁波银行(借记卡)"),
|
||||
/**
|
||||
* 宁波银行(信用卡)
|
||||
*/
|
||||
NBCB_CREDIT("宁波银行(信用卡)"),
|
||||
/**
|
||||
* 南京银行(借记卡)
|
||||
*/
|
||||
NJCB_DEBIT("南京银行(借记卡)"),
|
||||
/**
|
||||
* 青岛银行(借记卡)
|
||||
*/
|
||||
QDCCB_DEBIT("青岛银行(借记卡)"),
|
||||
/**
|
||||
* 浙江泰隆银行(借记卡)
|
||||
*/
|
||||
ZJTLCB_DEBIT("浙江泰隆银行(借记卡)"),
|
||||
/**
|
||||
* 西安银行(借记卡)
|
||||
*/
|
||||
XAB_DEBIT("西安银行(借记卡)"),
|
||||
/**
|
||||
* 常熟农商银行 (借记卡)
|
||||
*/
|
||||
CSRCB_DEBIT("常熟农商银行 (借记卡)"),
|
||||
/**
|
||||
* 齐鲁银行(借记卡)
|
||||
*/
|
||||
QLB_DEBIT("齐鲁银行(借记卡)"),
|
||||
/**
|
||||
* 龙江银行(借记卡)
|
||||
*/
|
||||
LJB_DEBIT("龙江银行(借记卡)"),
|
||||
/**
|
||||
* 华夏银行(借记卡)
|
||||
*/
|
||||
HXB_DEBIT("华夏银行(借记卡)"),
|
||||
/**
|
||||
* 测试银行借记卡快捷支付 (借记卡)
|
||||
*/
|
||||
CS_DEBIT("测试银行借记卡快捷支付 (借记卡)"),
|
||||
/**
|
||||
* AE (信用卡)
|
||||
*/
|
||||
AE_CREDIT("AE (信用卡)"),
|
||||
/**
|
||||
* JCB (信用卡)
|
||||
*/
|
||||
JCB_CREDIT("JCB (信用卡)"),
|
||||
/**
|
||||
* MASTERCARD (信用卡)
|
||||
*/
|
||||
MASTERCARD_CREDIT("MASTERCARD (信用卡)"),
|
||||
/**
|
||||
* VISA (信用卡)
|
||||
*/
|
||||
VISA_CREDIT("VISA (信用卡)");
|
||||
|
||||
private String desc;
|
||||
|
||||
BankType(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
||||
|
||||
private final String appid;
|
||||
private final TokenHolder weixinTokenHolder;
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
|
||||
/**
|
||||
* jssdk
|
||||
@ -37,7 +37,7 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
||||
public WeixinJSTicketCreator(String appid, TokenHolder weixinTokenHolder) {
|
||||
this.appid = appid;
|
||||
this.weixinTokenHolder = weixinTokenHolder;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,7 +47,7 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
||||
|
||||
@Override
|
||||
public Token createToken() throws WeixinException {
|
||||
WeixinResponse response = httpClient.get(String.format(
|
||||
WeixinResponse response = weixinExecutor.get(String.format(
|
||||
URLConsts.JS_TICKET_URL, weixinTokenHolder.getToken()
|
||||
.getAccessToken()));
|
||||
JSONObject result = response.getAsJson();
|
||||
|
||||
@ -21,7 +21,7 @@ import com.foxinmy.weixin4j.token.TokenCreator;
|
||||
*/
|
||||
public class WeixinTokenCreator implements TokenCreator {
|
||||
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
private final String appid;
|
||||
private final String secret;
|
||||
|
||||
@ -35,7 +35,7 @@ public class WeixinTokenCreator implements TokenCreator {
|
||||
public WeixinTokenCreator(String appid, String secret) {
|
||||
this.appid = appid;
|
||||
this.secret = secret;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,7 +47,7 @@ public class WeixinTokenCreator implements TokenCreator {
|
||||
public Token createToken() throws WeixinException {
|
||||
String tokenUrl = String.format(URLConsts.ASSESS_TOKEN_URL, appid,
|
||||
secret);
|
||||
WeixinResponse response = httpClient.get(tokenUrl);
|
||||
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
||||
Token token = response.getAsObject(new TypeReference<Token>() {
|
||||
});
|
||||
token.setTime(System.currentTimeMillis());
|
||||
|
||||
@ -22,7 +22,7 @@ import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
*/
|
||||
public class WeixinSuitePreCodeCreator implements TokenCreator {
|
||||
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
private final TokenHolder suiteTokenHolder;
|
||||
private final String suiteId;
|
||||
|
||||
@ -37,7 +37,7 @@ public class WeixinSuitePreCodeCreator implements TokenCreator {
|
||||
String suiteId) {
|
||||
this.suiteTokenHolder = suiteTokenHolder;
|
||||
this.suiteId = suiteId;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,7 +47,7 @@ public class WeixinSuitePreCodeCreator implements TokenCreator {
|
||||
|
||||
@Override
|
||||
public Token createToken() throws WeixinException {
|
||||
WeixinResponse response = httpClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
String.format(URLConsts.SUITE_PRE_CODE_URL,
|
||||
suiteTokenHolder.getAccessToken()),
|
||||
String.format("{\"suite_id\":\"%s\"}", suiteId));
|
||||
|
||||
@ -21,7 +21,7 @@ import com.foxinmy.weixin4j.token.TokenCreator;
|
||||
*/
|
||||
public class WeixinSuiteTokenCreator implements TokenCreator {
|
||||
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
private final SuiteTicketHolder ticketHolder;
|
||||
|
||||
/**
|
||||
@ -31,7 +31,7 @@ public class WeixinSuiteTokenCreator implements TokenCreator {
|
||||
*/
|
||||
public WeixinSuiteTokenCreator(SuiteTicketHolder ticketHolder) {
|
||||
this.ticketHolder = ticketHolder;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,7 +45,7 @@ public class WeixinSuiteTokenCreator implements TokenCreator {
|
||||
obj.put("suite_id", ticketHolder.getSuiteId());
|
||||
obj.put("suite_secret", ticketHolder.getSuiteSecret());
|
||||
obj.put("suite_ticket", ticketHolder.getTicket());
|
||||
WeixinResponse response = httpClient.post(URLConsts.SUITE_TOKEN_URL,
|
||||
WeixinResponse response = weixinExecutor.post(URLConsts.SUITE_TOKEN_URL,
|
||||
obj.toJSONString());
|
||||
obj = response.getAsJson();
|
||||
Token token = new Token(obj.getString("suite_access_token"));
|
||||
|
||||
@ -22,7 +22,7 @@ import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
*/
|
||||
public class WeixinTokenSuiteCreator implements TokenCreator {
|
||||
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
private final String authCorpid;
|
||||
private final SuitePerCodeHolder perCodeHolder;
|
||||
private final TokenHolder suiteTokenHolder;
|
||||
@ -41,7 +41,7 @@ public class WeixinTokenSuiteCreator implements TokenCreator {
|
||||
this.authCorpid = authCorpid;
|
||||
this.perCodeHolder = perCodeHolder;
|
||||
this.suiteTokenHolder = suiteTokenHolder;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,7 +55,7 @@ public class WeixinTokenSuiteCreator implements TokenCreator {
|
||||
obj.put("suite_id", perCodeHolder.getSuiteId());
|
||||
obj.put("auth_corpid", authCorpid);
|
||||
obj.put("permanent_code", perCodeHolder.getPermanentCode());
|
||||
WeixinResponse response = httpClient.post(
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
String.format(URLConsts.TOKEN_SUITE_URL,
|
||||
suiteTokenHolder.getAccessToken()), obj.toJSONString());
|
||||
obj = response.getAsJson();
|
||||
|
||||
@ -24,7 +24,7 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
||||
|
||||
private final String corpid;
|
||||
private final TokenHolder weixinTokenHolder;
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -36,7 +36,7 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
||||
public WeixinJSTicketCreator(String corpid, TokenHolder weixinTokenHolder) {
|
||||
this.corpid = corpid;
|
||||
this.weixinTokenHolder = weixinTokenHolder;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,7 +46,7 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
||||
|
||||
@Override
|
||||
public Token createToken() throws WeixinException {
|
||||
WeixinResponse response = httpClient.get(String.format(
|
||||
WeixinResponse response = weixinExecutor.get(String.format(
|
||||
URLConsts.JS_TICKET_URL, weixinTokenHolder.getToken()
|
||||
.getAccessToken()));
|
||||
JSONObject result = response.getAsJson();
|
||||
|
||||
@ -21,7 +21,7 @@ import com.foxinmy.weixin4j.token.TokenCreator;
|
||||
*/
|
||||
public class WeixinProviderTokenCreator implements TokenCreator {
|
||||
|
||||
private final WeixinRequestExecutor httpClient;
|
||||
private final WeixinRequestExecutor weixinExecutor;
|
||||
private final String corpid;
|
||||
private final String providersecret;
|
||||
|
||||
@ -35,7 +35,7 @@ public class WeixinProviderTokenCreator implements TokenCreator {
|
||||
public WeixinProviderTokenCreator(String corpid, String providersecret) {
|
||||
this.corpid = corpid;
|
||||
this.providersecret = providersecret;
|
||||
this.httpClient = new WeixinRequestExecutor();
|
||||
this.weixinExecutor = new WeixinRequestExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,7 +48,7 @@ public class WeixinProviderTokenCreator implements TokenCreator {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("corpid", corpid);
|
||||
obj.put("provider_secret", providersecret);
|
||||
WeixinResponse response = httpClient.post(URLConsts.PROVIDER_TOKEN_URL,
|
||||
WeixinResponse response = weixinExecutor.post(URLConsts.PROVIDER_TOKEN_URL,
|
||||
obj.toJSONString());
|
||||
obj = response.getAsJson();
|
||||
Token token = new Token(obj.getString("provider_access_token"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user