mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-04 06:07:59 +08:00
优化部分代码
This commit is contained in:
@ -24,7 +24,7 @@ import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
public class EntPayRequest extends BaseWxPayRequest {
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:公众账号appid
|
||||
* 字段名:公众账号appid.
|
||||
* 变量名:mch_appid
|
||||
* 是否必填:是
|
||||
* 示例值:wx8888888888888888
|
||||
@ -37,7 +37,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户号
|
||||
* 字段名:商户号.
|
||||
* 变量名:mchid
|
||||
* 是否必填:是
|
||||
* 示例值:1900000109
|
||||
@ -50,7 +50,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:设备号
|
||||
* 字段名:设备号.
|
||||
* 变量名:device_info
|
||||
* 是否必填:否
|
||||
* 示例值:13467007045764
|
||||
@ -63,7 +63,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户订单号
|
||||
* 字段名:商户订单号.
|
||||
* 变量名:partner_trade_no
|
||||
* 是否必填:是
|
||||
* 示例值:10000098201411111234567890
|
||||
@ -77,7 +77,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:需保持唯一性 用户openid
|
||||
* 字段名:需保持唯一性 用户openid.
|
||||
* 变量名:openid
|
||||
* 是否必填:是
|
||||
* 示例值:oxTWIuGaIt6gTKsQRLau2M0yL16E
|
||||
@ -91,7 +91,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:校验用户姓名选项
|
||||
* 字段名:校验用户姓名选项.
|
||||
* 变量名:check_name
|
||||
* 是否必填:是
|
||||
* 示例值:OPTION_CHECK
|
||||
@ -107,7 +107,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:收款用户姓名
|
||||
* 字段名:收款用户姓名.
|
||||
* 变量名:re_user_name
|
||||
* 是否必填:可选
|
||||
* 示例值:马花花
|
||||
@ -121,7 +121,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:金额
|
||||
* 字段名:金额.
|
||||
* 变量名:amount
|
||||
* 是否必填:是
|
||||
* 示例值:10099
|
||||
@ -135,7 +135,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:企业付款描述信息
|
||||
* 字段名:企业付款描述信息.
|
||||
* 变量名:desc
|
||||
* 是否必填:是
|
||||
* 示例值:理赔
|
||||
@ -149,7 +149,7 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:Ip地址
|
||||
* 字段名:Ip地址.
|
||||
* 变量名:spbill_create_ip
|
||||
* 是否必填:是
|
||||
* 示例值:192.168.0.1
|
||||
@ -191,4 +191,8 @@ public class EntPayRequest extends BaseWxPayRequest {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean ignoreSignType() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
package com.github.binarywang.wxpay.bean.request;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
/**
|
||||
* 请使用 {@link EntPayQueryRequest}
|
||||
*/
|
||||
@XStreamAlias("xml")
|
||||
@Deprecated
|
||||
public class WxEntPayQueryRequest extends EntPayQueryRequest {
|
||||
}
|
||||
@ -1,149 +0,0 @@
|
||||
package com.github.binarywang.wxpay.bean.request;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款请求对象
|
||||
* 请使用 {@link EntPayRequest}
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("xml")
|
||||
@Deprecated
|
||||
public class WxEntPayRequest extends EntPayRequest {
|
||||
|
||||
private WxEntPayRequest(Builder builder) {
|
||||
setAppid(builder.appid);
|
||||
setMchId(builder.mchId);
|
||||
setSubAppId(builder.subAppId);
|
||||
setSubMchId(builder.subMchId);
|
||||
setNonceStr(builder.nonceStr);
|
||||
setSign(builder.sign);
|
||||
setSignType(builder.signType);
|
||||
setMchAppid(builder.mchAppid);
|
||||
setMchId(builder.mchId);
|
||||
setDeviceInfo(builder.deviceInfo);
|
||||
setPartnerTradeNo(builder.partnerTradeNo);
|
||||
setOpenid(builder.openid);
|
||||
setCheckName(builder.checkName);
|
||||
setReUserName(builder.reUserName);
|
||||
setAmount(builder.amount);
|
||||
setDescription(builder.description);
|
||||
setSpbillCreateIp(builder.spbillCreateIp);
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private String appid;
|
||||
private String mchId;
|
||||
private String deviceInfo;
|
||||
private String partnerTradeNo;
|
||||
private String openid;
|
||||
private String checkName;
|
||||
private String reUserName;
|
||||
private Integer amount;
|
||||
private String description;
|
||||
private String spbillCreateIp;
|
||||
private String subAppId;
|
||||
private String subMchId;
|
||||
private String nonceStr;
|
||||
private String sign;
|
||||
private String signType;
|
||||
private String mchAppid;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder appid(String appid) {
|
||||
this.appid = appid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mchId(String mchId) {
|
||||
this.mchId = mchId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deviceInfo(String deviceInfo) {
|
||||
this.deviceInfo = deviceInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder partnerTradeNo(String partnerTradeNo) {
|
||||
this.partnerTradeNo = partnerTradeNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder openid(String openid) {
|
||||
this.openid = openid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder checkName(String checkName) {
|
||||
this.checkName = checkName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder reUserName(String reUserName) {
|
||||
this.reUserName = reUserName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder amount(Integer amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder spbillCreateIp(String spbillCreateIp) {
|
||||
this.spbillCreateIp = spbillCreateIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxEntPayRequest build() {
|
||||
return new WxEntPayRequest(this);
|
||||
}
|
||||
|
||||
public Builder subAppId(String subAppId) {
|
||||
this.subAppId = subAppId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder subMchId(String subMchId) {
|
||||
this.subMchId = subMchId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder nonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sign(String sign) {
|
||||
this.sign = sign;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder signType(String signType) {
|
||||
this.signType = signType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mchAppid(String mchAppid) {
|
||||
this.mchAppid = mchAppid;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@ package com.github.binarywang.wxpay.service;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.WxPayApiData;
|
||||
import com.github.binarywang.wxpay.bean.coupon.*;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.request.*;
|
||||
@ -208,18 +207,6 @@ public interface WxPayService {
|
||||
*/
|
||||
WxPayRedpackQueryResult queryRedpack(String mchBillNo) throws WxPayException;
|
||||
|
||||
/**
|
||||
* 请使用this.getEntPayService().entPay()方法{@link EntPayService#entPay(EntPayRequest)}
|
||||
*/
|
||||
@Deprecated
|
||||
WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* 请使用this.getEntPayService().queryEntPay()方法 {@link EntPayService#queryEntPay(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 扫码支付模式一生成二维码的方法
|
||||
|
||||
@ -345,18 +345,6 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
return payInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException {
|
||||
return WxEntPayResult.createFrom(this.getEntPayService().entPay(request));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException {
|
||||
return WxEntPayQueryResult.createFrom(this.getEntPayService().queryEntPay(partnerTradeNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer sideLength) {
|
||||
String content = this.createScanPayQrcodeMode1(productId);
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
package com.github.binarywang.wxpay.service.impl;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayBankRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayBankResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxEntPayRequest;
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||
import com.github.binarywang.wxpay.constant.WxPayConstants.CheckNameOption;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.github.binarywang.wxpay.testbase.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.annotations.*;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -30,37 +28,20 @@ public class EntPayServiceImplTest {
|
||||
@Inject
|
||||
private WxPayService payService;
|
||||
|
||||
@Test
|
||||
public void testEntPay_old() throws WxPayException {
|
||||
this.logger.info(this.payService.entPay(WxEntPayRequest.builder()
|
||||
.partnerTradeNo("Eb6Aep7uVTdbkJqrP4")
|
||||
.openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP4")
|
||||
.amount(1)
|
||||
.spbillCreateIp("10.10.10.10")
|
||||
.checkName(WxPayConstants.CheckNameOption.NO_CHECK)
|
||||
.description("描述信息")
|
||||
.build()).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntPay() throws WxPayException {
|
||||
EntPayRequest request = EntPayRequest.newBuilder()
|
||||
.partnerTradeNo("Eb6Aep7uVTdbkJqrP4")
|
||||
.openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP4")
|
||||
.amount(1)
|
||||
.openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP5")
|
||||
.amount(100)
|
||||
.spbillCreateIp("10.10.10.10")
|
||||
.checkName(WxPayConstants.CheckNameOption.NO_CHECK)
|
||||
.checkName(CheckNameOption.NO_CHECK)
|
||||
.description("描述信息")
|
||||
.build();
|
||||
|
||||
this.logger.info(this.payService.getEntPayService().entPay(request).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryEntPay_old() throws WxPayException {
|
||||
this.logger.info(this.payService.queryEntPay("11212121").toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryEntPay() throws WxPayException {
|
||||
this.logger.info(this.payService.getEntPayService().queryEntPay("11212121").toString());
|
||||
|
||||
Reference in New Issue
Block a user