mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-17 05:48:12 +08:00
🎨 #1733 微信支付服务商配置优化,增加服务商合单支付接口
* art:微信服务商配置优化 * new:jsapi合单支付 * new:合单支付 Co-authored-by: 曾浩 <epdcgsi@dingtalk.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
package com.github.binarywang.wxpay.service;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsRequest;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.*;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
|
||||
/**
|
||||
@@ -55,4 +54,16 @@ public interface EcommerceService {
|
||||
*/
|
||||
ApplymentsStatusResult queryApplyStatusByOutRequestNo(String outRequestNo) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 合单下单-JS支付API.
|
||||
* 请求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
|
||||
* </pre>
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @return 预支付交易会话标识, 数字和字母。微信生成的预支付会话标识,用于后续接口调用使用。
|
||||
*/
|
||||
<T> T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.github.binarywang.wxpay.service.impl;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsRequest;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.*;
|
||||
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.EcommerceService;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
@@ -10,6 +9,7 @@ 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;
|
||||
|
||||
@@ -41,5 +41,14 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
return GSON.fromJson(result, ApplymentsStatusResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
return result.getPayInfo(tradeType, request.getCombineAppid(),
|
||||
request.getCombineMchid(), payService.getConfig().getPrivateKey());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user