微信支付:新增查询结算金额、新增查询汇率接口
This commit is contained in:
@@ -33,12 +33,12 @@ import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinSSLRequestExecutor;
|
||||
import com.foxinmy.weixin4j.model.Consts;
|
||||
import com.foxinmy.weixin4j.model.Token;
|
||||
import com.foxinmy.weixin4j.model.WeixinPayOldAccount;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.OrderV2;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.PayPackageV2;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.RefundRecordV2;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.RefundResultV2;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPaymentSignature;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPayAccount;
|
||||
import com.foxinmy.weixin4j.mp.token.WeixinTokenCreator;
|
||||
import com.foxinmy.weixin4j.payment.PayRequest;
|
||||
import com.foxinmy.weixin4j.sign.WeixinPaymentSignature;
|
||||
@@ -69,7 +69,7 @@ import com.foxinmy.weixin4j.xml.ListsuffixResultDeserializer;
|
||||
*/
|
||||
public class PayOldApi extends MpApi {
|
||||
|
||||
private final WeixinPayOldAccount weixinAccount;
|
||||
private final WeixinOldPayAccount weixinAccount;
|
||||
private final TokenHolder tokenHolder;
|
||||
private final WeixinSignature weixinMD5Signature;
|
||||
private final WeixinOldPaymentSignature weixinOldSignature;
|
||||
@@ -79,12 +79,12 @@ public class PayOldApi extends MpApi {
|
||||
*/
|
||||
public PayOldApi() {
|
||||
this(JSON.parseObject(Weixin4jConfigUtil.getValue("account"),
|
||||
WeixinPayOldAccount.class), new FileTokenStorager(
|
||||
WeixinOldPayAccount.class), new FileTokenStorager(
|
||||
Weixin4jConfigUtil.getClassPathValue("weixin4j.tmpdir",
|
||||
System.getProperty("java.io.tmpdir"))));
|
||||
}
|
||||
|
||||
public PayOldApi(WeixinPayOldAccount payAccount) {
|
||||
public PayOldApi(WeixinOldPayAccount payAccount) {
|
||||
this(payAccount, new FileTokenStorager(
|
||||
Weixin4jConfigUtil.getClassPathValue("weixin4j.tmpdir",
|
||||
System.getProperty("java.io.tmpdir"))));
|
||||
@@ -92,10 +92,10 @@ public class PayOldApi extends MpApi {
|
||||
|
||||
public PayOldApi(TokenStorager tokenStorager) {
|
||||
this(JSON.parseObject(Weixin4jConfigUtil.getValue("account"),
|
||||
WeixinPayOldAccount.class), tokenStorager);
|
||||
WeixinOldPayAccount.class), tokenStorager);
|
||||
}
|
||||
|
||||
public PayOldApi(WeixinPayOldAccount weixinAccount,
|
||||
public PayOldApi(WeixinOldPayAccount weixinAccount,
|
||||
TokenStorager tokenStorager) {
|
||||
this.weixinAccount = weixinAccount;
|
||||
this.tokenHolder = new TokenHolder(new WeixinTokenCreator(
|
||||
@@ -106,7 +106,7 @@ public class PayOldApi extends MpApi {
|
||||
this.weixinOldSignature = new WeixinOldPaymentSignature();
|
||||
}
|
||||
|
||||
public WeixinPayOldAccount getPayAccount() {
|
||||
public WeixinOldPayAccount getPayAccount() {
|
||||
return this.weixinAccount;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.model.WeixinPayOldAccount;
|
||||
import com.foxinmy.weixin4j.payment.PayRequest;
|
||||
|
||||
/**
|
||||
@@ -61,7 +60,7 @@ public class NativePayResponseV2 extends PayRequest {
|
||||
* @param payPackage
|
||||
* 订单信息
|
||||
*/
|
||||
public NativePayResponseV2(WeixinPayOldAccount weixinAccount,
|
||||
public NativePayResponseV2(WeixinOldPayAccount weixinAccount,
|
||||
PayPackageV2 payPackage) {
|
||||
super(weixinAccount.getId(), null);
|
||||
this.retCode = "0";
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.foxinmy.weixin4j.mp.oldpayment;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONCreator;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
|
||||
/**
|
||||
* 微信支付账户(2014年10月申请支付的老版本)
|
||||
*
|
||||
* @className WeixinOldPayAccount
|
||||
* @author jy
|
||||
* @date 2015年6月26日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
*/
|
||||
public class WeixinOldPayAccount extends WeixinAccount {
|
||||
|
||||
private static final long serialVersionUID = -2791256176906048632L;
|
||||
/**
|
||||
* 公众号支付请求中用于加密的密钥 Key,可验证商户唯一身份,PaySignKey 对应于支付场景中的 appKey 值
|
||||
*/
|
||||
private String paySignKey;
|
||||
/**
|
||||
* 财付通商户身份的标识
|
||||
*/
|
||||
private String partnerId;
|
||||
/**
|
||||
* 财付通商户权限密钥Key
|
||||
*/
|
||||
private String partnerKey;
|
||||
|
||||
/**
|
||||
* 支付商户信息
|
||||
*
|
||||
* @param appId
|
||||
* 公众号唯一的身份ID(必填)
|
||||
* @param appSecret
|
||||
* 调用接口的凭证(必填)
|
||||
* @param paySignKey
|
||||
* 支付密钥字符串(必填)
|
||||
* @param partnerId
|
||||
* 财付通的商户号(必填)
|
||||
* @param partnerKey
|
||||
* 财付通商户权限密钥Key(必填)
|
||||
*/
|
||||
@JSONCreator
|
||||
public WeixinOldPayAccount(@JSONField(name = "id") String appId,
|
||||
@JSONField(name = "secret") String appSecret,
|
||||
@JSONField(name = "paySignKey") String paySignKey,
|
||||
@JSONField(name = "partnerId") String partnerId,
|
||||
@JSONField(name = "partnerKey") String partnerKey) {
|
||||
super(appId, appSecret);
|
||||
this.paySignKey = paySignKey;
|
||||
this.partnerId = partnerId;
|
||||
this.partnerKey = partnerKey;
|
||||
}
|
||||
|
||||
public String getPaySignKey() {
|
||||
return paySignKey;
|
||||
}
|
||||
|
||||
public String getPartnerId() {
|
||||
return partnerId;
|
||||
}
|
||||
|
||||
public String getPartnerKey() {
|
||||
return partnerKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WeixinOldPayAccount [" + super.toString() + ", paySignKey="
|
||||
+ paySignKey + ", partnerId=" + partnerId + ", partnerKey="
|
||||
+ partnerKey + "]";
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ import java.util.Calendar;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.model.WeixinPayOldAccount;
|
||||
import com.foxinmy.weixin4j.mp.api.PayOldApi;
|
||||
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPayAccount;
|
||||
import com.foxinmy.weixin4j.type.IdQuery;
|
||||
import com.foxinmy.weixin4j.type.IdType;
|
||||
|
||||
@@ -24,9 +24,9 @@ import com.foxinmy.weixin4j.type.IdType;
|
||||
*/
|
||||
public class PayTest {
|
||||
protected final static PayOldApi PAY2;
|
||||
protected final static WeixinPayOldAccount ACCOUNT2;
|
||||
protected final static WeixinOldPayAccount ACCOUNT2;
|
||||
static {
|
||||
ACCOUNT2 = new WeixinPayOldAccount("请填入v2版本的appid",
|
||||
ACCOUNT2 = new WeixinOldPayAccount("请填入v2版本的appid",
|
||||
"请填入v2版本的appSecret", "请填入v2版本的paysignkey", "请填入v2版本的partnerId",
|
||||
"请填入v2版本的partnerKey");
|
||||
PAY2 = new PayOldApi(ACCOUNT2);
|
||||
|
||||
Reference in New Issue
Block a user