diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ApplymentsStatusResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ApplymentsStatusResult.java index 7defd2145..b3704d652 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ApplymentsStatusResult.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ApplymentsStatusResult.java @@ -7,6 +7,10 @@ import lombok.NoArgsConstructor; import java.io.Serializable; import java.util.List; +/** + * 二级商户进件 查询申请状态结果响应 + * + */ @Data @NoArgsConstructor public class ApplymentsStatusResult implements Serializable { diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsJsResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsJsResult.java index f8f826cbe..7a33ec840 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsJsResult.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsJsResult.java @@ -6,10 +6,24 @@ import lombok.NoArgsConstructor; import java.io.Serializable; +/** + * 合单支付 JSAPI支付结果响应 + */ @Data @NoArgsConstructor public class CombineTransactionsJsResult implements Serializable { + /** + *
+ * 字段名:预支付交易会话标识 + * 变量名:prepay_id + * 是否必填:是 + * 类型:string(64) + * 描述: + * 数字和字母。微信生成的预支付会话标识,用于后续接口调用使用。 + * 示例值:wx201410272009395522657a690389285100 + *+ */ @SerializedName("prepay_id") private String prepayId; diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java index 5c86306b9..066fe372c 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java @@ -1,8 +1,6 @@ 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.exception.WxPayException; /** @@ -55,4 +53,15 @@ public interface EcommerceService { */ ApplymentsStatusResult queryApplyStatusByOutRequestNo(String outRequestNo) throws WxPayException; + /** + *
+ * 合单下单-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 + *+ * + * @param request 请求对象 + * @return 预支付交易会话标识, 数字和字母。微信生成的预支付会话标识,用于后续接口调用使用。 + */ + CombineTransactionsJsResult combineTransactions(CombineTransactionsJsRequest request) throws WxPayException; } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java index 963163127..fe916819e 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java @@ -1,8 +1,6 @@ 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.exception.WxPayException; import com.github.binarywang.wxpay.service.EcommerceService; import com.github.binarywang.wxpay.service.WxPayService; @@ -41,5 +39,12 @@ public class EcommerceServiceImpl implements EcommerceService { return GSON.fromJson(result, ApplymentsStatusResult.class); } + @Override + public CombineTransactionsJsResult combineTransactions(CombineTransactionsJsRequest request) throws WxPayException { + String url = String.format("%s/v3/combine-transactions/jsapi", this.payService.getPayBaseUrl()); + String response = this.payService.postV3(url, GSON.toJson(request)); + return GSON.fromJson(response, CombineTransactionsJsResult.class); + } + }