mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-18 06:06:23 +08:00
🆕 #1744 微信支付增加电商收付通-普通支付相关接口
* new:电商收付通普通支付 Co-authored-by: 曾浩 <epdcgsi@dingtalk.com>
This commit is contained in:
@@ -56,14 +56,26 @@ public interface EcommerceService {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 合单下单-JS支付API.
|
||||
* 合单支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
|
||||
* 请求URL:https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_2.shtml
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param tradeType 支付方式
|
||||
* @param request 请求对象
|
||||
* @return 预支付交易会话标识, 数字和字母。微信生成的预支付会话标识,用于后续接口调用使用。
|
||||
* @return 调起支付需要的参数
|
||||
*/
|
||||
<T> T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
|
||||
* 请求URL:https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/transactions_sl.shtml
|
||||
* </pre>
|
||||
* @param tradeType 支付方式
|
||||
* @param request 请求对象
|
||||
* @return 调起支付需要的参数
|
||||
*/
|
||||
<T> T partnerTransactions(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.github.binarywang.wxpay.v3.util.RsaCryptoUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
@@ -45,10 +44,17 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
public <T> T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException {
|
||||
String url = this.payService.getPayBaseUrl() + tradeType.getCombineUrl();
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
CombineTransactionsResult result = GSON.fromJson(response, CombineTransactionsResult.class);
|
||||
TransactionsResult result = GSON.fromJson(response, TransactionsResult.class);
|
||||
return result.getPayInfo(tradeType, request.getCombineAppid(),
|
||||
request.getCombineMchid(), payService.getConfig().getPrivateKey());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T partnerTransactions(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException {
|
||||
String url = this.payService.getPayBaseUrl() + tradeType.getPartnerUrl();
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
TransactionsResult result = GSON.fromJson(response, TransactionsResult.class);
|
||||
return result.getPayInfo(tradeType, request.getSpAppid(),
|
||||
request.getSpMchid(), payService.getConfig().getPrivateKey());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user