🎨 优化规范部分代码

This commit is contained in:
Binary Wang
2020-08-22 17:13:35 +08:00
parent bd100bf846
commit aca8dbabbc
11 changed files with 813 additions and 804 deletions

View File

@@ -10,18 +10,16 @@ import com.github.binarywang.wxpay.exception.WxPayException;
* @author zhouyongshen
*/
public interface Applyment4SubService {
/**
* 提交申请单API
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_1.shtml
* 接口链接https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/
*
* @param request 请求对象
* @return WxPayApplymentCreateResult 响应结果
* @throws WxPayException the wx pay exception
*/
WxPayApplymentCreateResult createApply(WxPayApplyment4SubCreateRequest request) throws WxPayException;
/**
* 提交申请单API
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_1.shtml
* 接口链接https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/
*
* @param request 请求对象
* @return WxPayApplymentCreateResult 响应结果
* @throws WxPayException the wx pay exception
*/
WxPayApplymentCreateResult createApply(WxPayApplyment4SubCreateRequest request) throws WxPayException;
/**
* 通过业务申请编号查询申请状态
@@ -29,11 +27,13 @@ public interface Applyment4SubService {
* 接口链接https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/business_code/{business_code}
*
* @param businessCode 业务申请编号
* 1、只能由数字、字母或下划线组成建议前缀为服务商商户号。
* 2、服务商自定义的唯一编号。
* 3、每个编号对应一个申请单每个申请单审核通过后生成一个微信支付商户号。
* 4、若申请单被驳回可填写相同的“业务申请编号”即可覆盖修改原申请单信息。
* 示例值1900013511_10000
* 1、只能由数字、字母或下划线组成建议前缀为服务商商户号。
* 2、服务商自定义的唯一编号。
* 3、每个编号对应一个申请单每个申请单审核通过后生成一个微信支付商户号。
* 4、若申请单被驳回可填写相同的“业务申请编号”即可覆盖修改原申请单信息。
* 示例值1900013511_10000
* @return the applyment state query result
* @throws WxPayException the wx pay exception
*/
ApplymentStateQueryResult queryApplyStatusByBusinessCode(String businessCode) throws WxPayException;
@@ -43,6 +43,8 @@ public interface Applyment4SubService {
* 接口链接https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/applyment_id/{applyment_id}
*
* @param applymentId 微信支付分的申请单号。示例值2000001234567890
* @return the applyment state query result
* @throws WxPayException the wx pay exception
*/
ApplymentStateQueryResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException;
@@ -52,6 +54,8 @@ public interface Applyment4SubService {
* 接口链接https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/settlement
*
* @param subMchid 本服务商进件、已签约的特约商户号。
* @return the settlement info result
* @throws WxPayException the wx pay exception
*/
SettlementInfoResult querySettlementBySubMchid(String subMchid) throws WxPayException;
@@ -59,9 +63,11 @@ public interface Applyment4SubService {
* 修改结算帐号
* 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/applyment4sub/chapter3_3.shtml
* 接口链接https://api.mch.weixin.qq.com/v3/apply4sub/sub_merchants/{sub_mchid}/modify-settlement
*
* @param subMchid 特约商户号
* @param request 修改结算账户请求对象信息
* @param request 修改结算账户请求对象信息
* @throws WxPayException the wx pay exception
*/
void modifySettlement(String subMchid,ModifySettlementRequest request) throws WxPayException;
void modifySettlement(String subMchid, ModifySettlementRequest request) throws WxPayException;
}

View File

@@ -24,7 +24,8 @@ public interface EcommerceService {
* </pre>
*
* @param request 请求对象
* @return .
* @return . applyments result
* @throws WxPayException the wx pay exception
*/
ApplymentsResult createApply(ApplymentsRequest request) throws WxPayException;
@@ -36,7 +37,8 @@ public interface EcommerceService {
* </pre>
*
* @param applymentId 申请单ID
* @return .
* @return . applyments status result
* @throws WxPayException the wx pay exception
*/
ApplymentsStatusResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException;
@@ -48,7 +50,8 @@ public interface EcommerceService {
* </pre>
*
* @param outRequestNo 业务申请编号
* @return .
* @return . applyments status result
* @throws WxPayException the wx pay exception
*/
ApplymentsStatusResult queryApplyStatusByOutRequestNo(String outRequestNo) throws WxPayException;

View File

@@ -9,21 +9,14 @@ import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.v3.util.RsaCryptoUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.RequiredArgsConstructor;
import java.net.URI;
@RequiredArgsConstructor
public class EcommerceServiceImpl implements EcommerceService {
private static final Gson GSON = new GsonBuilder().create();
private WxPayService payService;
/**
*
* @param payService
*/
public EcommerceServiceImpl(WxPayService payService) {
this.payService = payService;
}
private final WxPayService payService;
@Override
public ApplymentsResult createApply(ApplymentsRequest request) throws WxPayException {

View File

@@ -128,10 +128,10 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
//v3已经改为通过状态码判断200 204 成功
int statusCode = response.getStatusLine().getStatusCode();
String responseString="{}";
String responseString = "{}";
HttpEntity entity = response.getEntity();
if(entity!=null){
responseString= EntityUtils.toString(entity, StandardCharsets.UTF_8);
if (entity != null) {
responseString = EntityUtils.toString(entity, StandardCharsets.UTF_8);
}
if (HttpStatus.SC_OK == statusCode || HttpStatus.SC_NO_CONTENT == statusCode) {
@@ -261,7 +261,7 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
}
SSLConnectionSocketFactory connectionSocketFactory = new SSLConnectionSocketFactory(sslContext,
new DefaultHostnameVerifier());
new DefaultHostnameVerifier());
httpClientBuilder.setSSLSocketFactory(connectionSocketFactory);
}