From 714b5901e446490704461871d807a1b662f691f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=8E=E9=B9=8F?= Date: Fri, 28 Jun 2024 15:36:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E4=BB=98=E9=80=9A=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E5=AE=9E=E7=8E=B0(#282)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/AppServiceExample.java | 26 --- .../app/AppServiceExtensionExample.java | 17 -- .../h5/H5ServiceExample.java | 26 --- .../jsapi/JsapiServiceExample.java | 25 --- .../jsapi/JsapiServiceExtensionExample.java | 18 --- .../nativepay/NativePayServiceExample.java | 26 --- .../order/OrderServiceExample.java | 71 +++++++++ .../app/AppService.java | 70 -------- .../app/AppServiceExtension.java | 27 ---- .../app/model/CloseSubOrder.java | 62 -------- .../QueryOrderByCombineOutTradeNoRequest.java | 42 ----- .../app/model/Transaction.java | 109 ------------- .../app/package-info.java | 2 +- .../h5/H5Service.java | 70 -------- .../h5/model/CloseOrderRequest.java | 70 -------- .../QueryOrderByCombineOutTradeNoRequest.java | 42 ----- .../h5/package-info.java | 2 +- .../jsapi/JsapiService.java | 70 -------- .../jsapi/JsapiServiceExtension.java | 27 ---- .../jsapi/model/CloseOrderRequest.java | 70 -------- .../jsapi/model/CloseSubOrder.java | 62 -------- .../jsapi/model/CombinePayerInfo.java | 12 ++ .../jsapi/model/Transaction.java | 109 ------------- .../jsapi/package-info.java | 2 +- .../model/TransactionPayer.java | 53 ------- .../nativepay/NativePayService.java | 70 -------- .../nativepay/model/CloseOrderRequest.java | 70 -------- .../nativepay/model/CloseSubOrder.java | 62 -------- .../nativepay/model/CombinePayerInfo.java | 24 --- .../QueryOrderByCombineOutTradeNoRequest.java | 42 ----- .../nativepay/model/Transaction.java | 109 ------------- .../nativepay/package-info.java | 2 +- .../order/OrderService.java | 150 ++++++++++++++++++ .../model/CloseOrderRequest.java | 2 +- .../{h5 => order}/model/CloseSubOrder.java | 2 +- .../{ => order}/model/PromotionDetail.java | 2 +- .../model/PromotionGoodsDetail.java | 2 +- .../QueryOrderByCombineOutTradeNoRequest.java | 2 +- .../order/model/SettleInfo.java | 60 +++++++ .../order/model/StoreInfo.java | 79 +++++++++ .../{ => order}/model/SubOrderDetail.java | 2 +- .../{h5 => order}/model/Transaction.java | 15 +- .../{ => order}/model/TransactionAmount.java | 2 +- .../order/model/TransactionPayer.java | 38 +++++ .../order/model/TransactionSceneInfo.java | 66 ++++++++ .../order/package-info.java | 2 + 46 files changed, 496 insertions(+), 1417 deletions(-) create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderServiceExample.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/QueryOrderByCombineOutTradeNoRequest.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Transaction.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseOrderRequest.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/QueryOrderByCombineOutTradeNoRequest.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseOrderRequest.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseSubOrder.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionPayer.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseOrderRequest.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseSubOrder.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CombinePayerInfo.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/QueryOrderByCombineOutTradeNoRequest.java delete mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Transaction.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderService.java rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{app => order}/model/CloseOrderRequest.java (96%) rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{h5 => order}/model/CloseSubOrder.java (93%) rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{ => order}/model/PromotionDetail.java (98%) rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{ => order}/model/PromotionGoodsDetail.java (96%) rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{jsapi => order}/model/QueryOrderByCombineOutTradeNoRequest.java (93%) create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SettleInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/StoreInfo.java rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{ => order}/model/SubOrderDetail.java (98%) rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{h5 => order}/model/Transaction.java (86%) rename service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/{ => order}/model/TransactionAmount.java (96%) create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionPayer.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionSceneInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/package-info.java diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExample.java index 8e371c17..b948cc46 100644 --- a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExample.java +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExample.java @@ -38,24 +38,6 @@ public static void main(String[] args) { // 初始化服务 service = new AppService.Builder().config(config).build(); // ... 调用接口 - try { - closeOrder(); - } catch (HttpException e) { // 发送HTTP请求失败 - // 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义 - } catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500 - // 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义 - } catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败 - // 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义 - } - } - - /** 关闭订单 */ - public static void closeOrder() { - - CloseOrderRequest request = new CloseOrderRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - service.closeOrder(request); } /** APP支付下单 */ @@ -66,12 +48,4 @@ public static PrepayResponse prepay() { return service.prepay(request); } - /** 商户订单号查询订单 */ - public static Transaction queryOrderByCombineOutTradeNo() { - - QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - return service.queryOrderByCombineOutTradeNo(request); - } } diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtensionExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtensionExample.java index 00197460..ced94549 100644 --- a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtensionExample.java +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtensionExample.java @@ -47,15 +47,6 @@ public static void main(String[] args) { } } - /** 关闭订单 */ - public static void closeOrder() { - - CloseOrderRequest request = new CloseOrderRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - service.closeOrder(request); - } - /** APP支付下单,并返回APP调起支付数据 */ public static PrepayWithRequestPaymentResponse prepayWithRequestPayment() { // 微信开放平台审核通过的移动应用appid @@ -66,12 +57,4 @@ public static PrepayWithRequestPaymentResponse prepayWithRequestPayment() { return service.prepayWithRequestPayment(request, requestPaymentAppid); } - /** 商户订单号查询订单 */ - public static Transaction queryOrderByCombineOutTradeNo() { - - QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - return service.queryOrderByCombineOutTradeNo(request); - } } diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5ServiceExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5ServiceExample.java index 9d43ad6c..55e0780b 100644 --- a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5ServiceExample.java +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5ServiceExample.java @@ -38,24 +38,6 @@ public static void main(String[] args) { // 初始化服务 service = new H5Service.Builder().config(config).build(); // ... 调用接口 - try { - closeOrder(); - } catch (HttpException e) { // 发送HTTP请求失败 - // 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义 - } catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500 - // 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义 - } catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败 - // 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义 - } - } - - /** 关闭订单 */ - public static void closeOrder() { - - CloseOrderRequest request = new CloseOrderRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - service.closeOrder(request); } /** H5支付下单 */ @@ -66,12 +48,4 @@ public static PrepayResponse prepay() { return service.prepay(request); } - /** 商户订单号查询订单 */ - public static Transaction queryOrderByCombineOutTradeNo() { - - QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - return service.queryOrderByCombineOutTradeNo(request); - } } diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExample.java index 2b714618..d3cf05bc 100644 --- a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExample.java +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExample.java @@ -38,25 +38,8 @@ public static void main(String[] args) { // 初始化服务 service = new JsapiService.Builder().config(config).build(); // ... 调用接口 - try { - closeOrder(); - } catch (HttpException e) { // 发送HTTP请求失败 - // 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义 - } catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500 - // 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义 - } catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败 - // 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义 - } } - /** 关闭订单 */ - public static void closeOrder() { - - CloseOrderRequest request = new CloseOrderRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - service.closeOrder(request); - } /** JSAPI支付下单 */ public static PrepayResponse prepay() { @@ -66,12 +49,4 @@ public static PrepayResponse prepay() { return service.prepay(request); } - /** 商户订单号查询订单 */ - public static Transaction queryOrderByCombineOutTradeNo() { - - QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - return service.queryOrderByCombineOutTradeNo(request); - } } diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtensionExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtensionExample.java index c51c64da..b1f97b79 100644 --- a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtensionExample.java +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtensionExample.java @@ -51,15 +51,6 @@ public static void main(String[] args) { } } - /** 关闭订单 */ - public static void closeOrder() { - - CloseOrderRequest request = new CloseOrderRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - service.closeOrder(request); - } - /** JSAPI支付下单,并返回JSAPI调起支付数据 */ public static PrepayWithRequestPaymentResponse prepayWithRequestPayment() { // 商户申请的公众号对应的appid,由微信支付生成,可在公众号后台查看 @@ -70,13 +61,4 @@ public static PrepayWithRequestPaymentResponse prepayWithRequestPayment() { return service.prepayWithRequestPayment(request, requestPaymentAppid); } - /** 商户订单号查询订单 */ - public static Transaction queryOrderByCombineOutTradeNo() { - - QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - return service.queryOrderByCombineOutTradeNo(request); - } - } diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayServiceExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayServiceExample.java index 840c1884..dc0edf7e 100644 --- a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayServiceExample.java +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayServiceExample.java @@ -38,24 +38,6 @@ public static void main(String[] args) { // 初始化服务 service = new NativePayService.Builder().config(config).build(); // ... 调用接口 - try { - closeOrder(); - } catch (HttpException e) { // 发送HTTP请求失败 - // 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义 - } catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500 - // 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义 - } catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败 - // 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义 - } - } - - /** 关闭订单 */ - public static void closeOrder() { - - CloseOrderRequest request = new CloseOrderRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - service.closeOrder(request); } /** Native支付预下单 */ @@ -66,13 +48,5 @@ public static PrepayResponse prepay() { return service.prepay(request); } - /** 商户订单号查询订单 */ - public static Transaction queryOrderByCombineOutTradeNo() { - - QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); - // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 - // 调用接口 - return service.queryOrderByCombineOutTradeNo(request); - } } diff --git a/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderServiceExample.java b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderServiceExample.java new file mode 100644 index 00000000..3a1f9b24 --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderServiceExample.java @@ -0,0 +1,71 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.order; + +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.RSAAutoCertificateConfig; +import com.wechat.pay.java.core.exception.HttpException; +import com.wechat.pay.java.core.exception.MalformedMessageException; +import com.wechat.pay.java.core.exception.ServiceException; +import com.wechat.pay.java.service.ecommercecombinepayments.order.model.CloseOrderRequest; +import com.wechat.pay.java.service.ecommercecombinepayments.order.model.QueryOrderByCombineOutTradeNoRequest; +import com.wechat.pay.java.service.ecommercecombinepayments.order.model.Transaction; + +/** OrderService使用示例 */ +public class OrderServiceExample { + + /** 商户号 */ + public static String merchantId = "190000****"; + + /** 商户API私钥路径 */ + public static String privateKeyPath = "/Users/yourname/your/path/apiclient_key.pem"; + + /** 商户证书序列号 */ + public static String merchantSerialNumber = "5157F09EFDC096DE15EBE81A47057A72********"; + + /** 商户APIV3密钥 */ + public static String apiV3Key = "..."; + + public static OrderService service; + + public static void main(String[] args) { + // 初始化商户配置 + Config config = + new RSAAutoCertificateConfig.Builder() + .merchantId(merchantId) + // 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + .privateKeyFromPath(privateKeyPath) + .merchantSerialNumber(merchantSerialNumber) + .apiV3Key(apiV3Key) + .build(); + + // 初始化服务 + service = new OrderService.Builder().config(config).build(); + // ... 调用接口 + try { + closeOrder(); + } catch (HttpException e) { // 发送HTTP请求失败 + // 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义 + } catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500 + // 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义 + } catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败 + // 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义 + } + } + + /** 关闭订单 */ + public static void closeOrder() { + + CloseOrderRequest request = new CloseOrderRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + service.closeOrder(request); + } + + /** 商户订单号查询订单 */ + public static Transaction queryOrderByCombineOutTradeNo() { + + QueryOrderByCombineOutTradeNoRequest request = new QueryOrderByCombineOutTradeNoRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + return service.queryOrderByCombineOutTradeNo(request); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppService.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppService.java index 8c8364f7..935567cf 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppService.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppService.java @@ -19,7 +19,6 @@ import com.wechat.pay.java.core.http.*; import com.wechat.pay.java.service.ecommercecombinepayments.app.model.*; -import static com.wechat.pay.java.core.http.UrlEncoder.urlEncode; import static com.wechat.pay.java.core.util.GsonUtil.toJson; import static java.util.Objects.requireNonNull; @@ -84,40 +83,6 @@ public AppService build() { } } - /** - * 关闭订单 - * - * @param request 请求参数 - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public void closeOrder(CloseOrderRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"; - - CloseOrderRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.POST) - .url(requestPath) - .headers(headers) - .body(createRequestBody(realRequest)) - .build(); - httpClient.execute(httpRequest, null); - } - /** * APP支付下单 * @@ -149,41 +114,6 @@ public PrepayResponse prepay(PrepayRequest request) { return httpResponse.getServiceResponse(); } - /** - * 商户订单号查询订单 - * - * @param request 请求参数 - * @return Transaction - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}"; - - QueryOrderByCombineOutTradeNoRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.GET) - .url(requestPath) - .headers(headers) - .build(); - HttpResponse httpResponse = httpClient.execute(httpRequest, Transaction.class); - return httpResponse.getServiceResponse(); - } - private RequestBody createRequestBody(Object request) { return new JsonRequestBody.Builder().body(toJson(request)).build(); } diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtension.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtension.java index 90e96d96..a3db0706 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtension.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtension.java @@ -71,33 +71,6 @@ public PrepayWithRequestPaymentResponse prepayWithRequestPayment( return response; } - /** - * 商户订单号查询订单 - * - * @param request 请求参数 - * @return Transaction - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { - return appService.queryOrderByCombineOutTradeNo(request); - } - - /** - * 关闭订单 - * - * @param request 请求参数 - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public void closeOrder(CloseOrderRequest request) { - appService.closeOrder(request); - } - public static class Builder { private Config config; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java deleted file mode 100644 index 3c7db7d1..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.wechat.pay.java.service.ecommercecombinepayments.app.model; - -import com.google.gson.annotations.SerializedName; - -public class CloseSubOrder { - - /** - * 子单商户号 - */ - @SerializedName("mchid") - private String mchid; - - /** - * 子单商户订单号 - */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** - * 二级商户号 - */ - @SerializedName("sub_mchid") - private String subMchid; - - /** - * 子商户应用ID - */ - @SerializedName("sub_appid") - private String subAppid; - - public String getMchid() { - return mchid; - } - - public void setMchid(String mchid) { - this.mchid = mchid; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/QueryOrderByCombineOutTradeNoRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/QueryOrderByCombineOutTradeNoRequest.java deleted file mode 100644 index d23269ca..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/QueryOrderByCombineOutTradeNoRequest.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.app.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** QueryOrderByCombineOutTradeNoRequest */ -public class QueryOrderByCombineOutTradeNoRequest { - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - @Expose(serialize = false) - private String combineOutTradeNo; - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String outTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class QueryOrderByCombineOutTradeNoRequest {\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Transaction.java deleted file mode 100644 index fa28aa76..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Transaction.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.app.model; - -import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; - -import java.util.List; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** */ -public class Transaction { - - /** 合单商户appid 说明:合单发起方的appid */ - @SerializedName("combine_appid") - private String combineAppid; - - /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ - @SerializedName("combine_mchid") - private String combineMchid; - - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - private String combineOutTradeNo; - - /** sceneInfo */ - @SerializedName("scene_info") - private SceneInfo sceneInfo; - - /** sceneInfo */ - @SerializedName("sub_orders") - private List subOrders; - - /** 支付者信息 */ - @SerializedName("combine_payer_info") - private CombinePayerInfo combinePayerInfo; - - public String getCombineAppid() { - return combineAppid; - } - - public void setCombineAppid(String combineAppid) { - this.combineAppid = combineAppid; - } - - public String getCombineMchid() { - return combineMchid; - } - - public void setCombineMchid(String combineMchid) { - this.combineMchid = combineMchid; - } - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String combineOutTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - public SceneInfo getSceneInfo() { - return sceneInfo; - } - - public void setSceneInfo(SceneInfo sceneInfo) { - this.sceneInfo = sceneInfo; - } - - public List getSubOrders() { - return subOrders; - } - - public void setSubOrders(List subOrders) { - this.subOrders = subOrders; - } - - public CombinePayerInfo getCombinePayerInfo() { - return combinePayerInfo; - } - - public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { - this.combinePayerInfo = combinePayerInfo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Transaction {\n"); - sb.append(" combineAppid: ").append(toIndentedString(combineAppid)).append("\n"); - sb.append(" combineMchid: ").append(toIndentedString(combineMchid)).append("\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append(" sceneInfo: ").append(toIndentedString(sceneInfo)).append("\n"); - sb.append(" subOrders: ").append(toIndentedString(subOrders)).append("\n"); - sb.append(" combinePayerInfo: ").append(toIndentedString(combinePayerInfo)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/package-info.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/package-info.java index ba6c9496..aa0620bc 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/package-info.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/package-info.java @@ -1,2 +1,2 @@ -/** 服务商-APP支付API */ +/** 服务商-合单支付APP支付API */ package com.wechat.pay.java.service.ecommercecombinepayments.app; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5Service.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5Service.java index 9da38ab1..19cca04e 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5Service.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5Service.java @@ -19,7 +19,6 @@ import com.wechat.pay.java.core.http.*; import com.wechat.pay.java.service.ecommercecombinepayments.h5.model.*; -import static com.wechat.pay.java.core.http.UrlEncoder.urlEncode; import static com.wechat.pay.java.core.util.GsonUtil.toJson; import static java.util.Objects.requireNonNull; @@ -84,40 +83,6 @@ public H5Service build() { } } - /** - * 关闭订单 - * - * @param request 请求参数 - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public void closeOrder(CloseOrderRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"; - - CloseOrderRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.POST) - .url(requestPath) - .headers(headers) - .body(createRequestBody(realRequest)) - .build(); - httpClient.execute(httpRequest, null); - } - /** * H5支付下单 * @throws ServiceException 发送 @@ -149,41 +114,6 @@ public PrepayResponse prepay(PrepayRequest request) { return httpResponse.getServiceResponse(); } - /** - * 商户订单号查询订单 - * - * @param request 请求参数 - * @return Transaction - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}"; - - QueryOrderByCombineOutTradeNoRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.GET) - .url(requestPath) - .headers(headers) - .build(); - HttpResponse httpResponse = httpClient.execute(httpRequest, Transaction.class); - return httpResponse.getServiceResponse(); - } - private RequestBody createRequestBody(Object request) { return new JsonRequestBody.Builder().body(toJson(request)).build(); } diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseOrderRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseOrderRequest.java deleted file mode 100644 index 96b47d20..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseOrderRequest.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.h5.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** CloseOrderRequest */ -public class CloseOrderRequest { - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - @Expose(serialize = false) - private String combineOutTradeNo; - - /** 子单信息 最多支持子单条数:50 */ - @SerializedName("sub_orders") - private List subOrders; - - /** 合单商户appid 说明:合单发起方的appid */ - @SerializedName("combine_appid") - private String combineAppid; - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String combineOutTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - public List getSubOrders() { - return subOrders; - } - - public void setSubOrders(List subOrders) { - this.subOrders = subOrders; - } - - public String getCombineAppid() { - return combineAppid; - } - - public void setCombineAppid(String combineAppid) { - this.combineAppid = combineAppid; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CloseOrderRequest {\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append(" subOrders: ").append(toIndentedString(subOrders)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(combineAppid)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/QueryOrderByCombineOutTradeNoRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/QueryOrderByCombineOutTradeNoRequest.java deleted file mode 100644 index b99245eb..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/QueryOrderByCombineOutTradeNoRequest.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.h5.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** QueryOrderByCombineOutTradeNoRequest */ -public class QueryOrderByCombineOutTradeNoRequest { - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - @Expose(serialize = false) - private String combineOutTradeNo; - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String outTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class QueryOrderByCombineOutTradeNoRequest {\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/package-info.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/package-info.java index 899484cc..33a40131 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/package-info.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/package-info.java @@ -1,2 +1,2 @@ -/** 服务商-H5支付API */ +/** 服务商-合单支付H5支付API */ package com.wechat.pay.java.service.ecommercecombinepayments.h5; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiService.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiService.java index 8ba98372..a3cace51 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiService.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiService.java @@ -19,7 +19,6 @@ import com.wechat.pay.java.core.http.*; import com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model.*; -import static com.wechat.pay.java.core.http.UrlEncoder.urlEncode; import static com.wechat.pay.java.core.util.GsonUtil.toJson; import static java.util.Objects.requireNonNull; @@ -84,40 +83,6 @@ public JsapiService build() { } } - /** - * 关闭订单 - * - * @param request 请求参数 - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public void closeOrder(CloseOrderRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"; - - CloseOrderRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.POST) - .url(requestPath) - .headers(headers) - .body(createRequestBody(realRequest)) - .build(); - httpClient.execute(httpRequest, null); - } - /** * JSAPI支付下单 * @@ -149,41 +114,6 @@ public PrepayResponse prepay(PrepayRequest request) { return httpResponse.getServiceResponse(); } - /** - * 商户订单号查询订单 - * - * @param request 请求参数 - * @return Transaction - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}"; - - QueryOrderByCombineOutTradeNoRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.GET) - .url(requestPath) - .headers(headers) - .build(); - HttpResponse httpResponse = httpClient.execute(httpRequest, Transaction.class); - return httpResponse.getServiceResponse(); - } - private RequestBody createRequestBody(Object request) { return new JsonRequestBody.Builder().body(toJson(request)).build(); } diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtension.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtension.java index a6050ad4..5c357067 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtension.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtension.java @@ -74,33 +74,6 @@ public PrepayWithRequestPaymentResponse prepayWithRequestPayment( return response; } - /** - * 商户订单号查询订单 - * - * @param request 请求参数 - * @return Transaction - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { - return jsapiService.queryOrderByCombineOutTradeNo(request); - } - - /** - * 关闭订单 - * - * @param request 请求参数 - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public void closeOrder(CloseOrderRequest request) { - jsapiService.closeOrder(request); - } - public static class Builder { private Config config; private HttpClient httpClient; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseOrderRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseOrderRequest.java deleted file mode 100644 index 51e7e00e..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseOrderRequest.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** CloseOrderRequest */ -public class CloseOrderRequest { - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - @Expose(serialize = false) - private String combineOutTradeNo; - - /** 子单信息 最多支持子单条数:50 */ - @SerializedName("sub_orders") - private List subOrders; - - /** 合单商户appid 说明:合单发起方的appid */ - @SerializedName("combine_appid") - private String combineAppid; - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String combineOutTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - public List getSubOrders() { - return subOrders; - } - - public void setSubOrders(List subOrders) { - this.subOrders = subOrders; - } - - public String getCombineAppid() { - return combineAppid; - } - - public void setCombineAppid(String combineAppid) { - this.combineAppid = combineAppid; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CloseOrderRequest {\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append(" subOrders: ").append(toIndentedString(subOrders)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(combineAppid)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseSubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseSubOrder.java deleted file mode 100644 index 0f47103a..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseSubOrder.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; - -import com.google.gson.annotations.SerializedName; - -public class CloseSubOrder { - - /** - * 子单商户号 - */ - @SerializedName("mchid") - private String mchid; - - /** - * 子单商户订单号 - */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** - * 二级商户号 - */ - @SerializedName("sub_mchid") - private String subMchid; - - /** - * 子商户应用ID - */ - @SerializedName("sub_appid") - private String subAppid; - - public String getMchid() { - return mchid; - } - - public void setMchid(String mchid) { - this.mchid = mchid; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CombinePayerInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CombinePayerInfo.java index 63d715dd..26d9214c 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CombinePayerInfo.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CombinePayerInfo.java @@ -7,6 +7,9 @@ public class CombinePayerInfo { @SerializedName("openid") private String openid; + @SerializedName("sub_openid") + private String subOpenid; + public String getOpenid() { return openid; } @@ -15,10 +18,19 @@ public void setOpenid(String openid) { this.openid = openid; } + public String getSubOpenid() { + return subOpenid; + } + + public void setSubOpenid(String subOpenid) { + this.subOpenid = subOpenid; + } + @Override public String toString() { return "CombinePayerInfo{" + "openid='" + openid + '\'' + + "subOpenid='" + subOpenid + '\'' + '}'; } } diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java deleted file mode 100644 index d2fff21f..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; - -import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; - -import java.util.List; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** */ -public class Transaction { - - /** 合单商户appid 说明:合单发起方的appid */ - @SerializedName("combine_appid") - private String combineAppid; - - /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ - @SerializedName("combine_mchid") - private String combineMchid; - - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - private String combineOutTradeNo; - - /** sceneInfo */ - @SerializedName("scene_info") - private SceneInfo sceneInfo; - - /** sceneInfo */ - @SerializedName("sub_orders") - private List subOrders; - - /** 支付者信息 */ - @SerializedName("combine_payer_info") - private CombinePayerInfo combinePayerInfo; - - public String getCombineAppid() { - return combineAppid; - } - - public void setCombineAppid(String combineAppid) { - this.combineAppid = combineAppid; - } - - public String getCombineMchid() { - return combineMchid; - } - - public void setCombineMchid(String combineMchid) { - this.combineMchid = combineMchid; - } - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String combineOutTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - public SceneInfo getSceneInfo() { - return sceneInfo; - } - - public void setSceneInfo(SceneInfo sceneInfo) { - this.sceneInfo = sceneInfo; - } - - public List getSubOrders() { - return subOrders; - } - - public void setSubOrders(List subOrders) { - this.subOrders = subOrders; - } - - public CombinePayerInfo getCombinePayerInfo() { - return combinePayerInfo; - } - - public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { - this.combinePayerInfo = combinePayerInfo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Transaction {\n"); - sb.append(" combineAppid: ").append(toIndentedString(combineAppid)).append("\n"); - sb.append(" combineMchid: ").append(toIndentedString(combineMchid)).append("\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append(" sceneInfo: ").append(toIndentedString(sceneInfo)).append("\n"); - sb.append(" subOrders: ").append(toIndentedString(subOrders)).append("\n"); - sb.append(" combinePayerInfo: ").append(toIndentedString(combinePayerInfo)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/package-info.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/package-info.java index 7b72483e..3d877687 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/package-info.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/package-info.java @@ -1,2 +1,2 @@ -/** 服务商-JSAPI支付API */ +/** 服务商-合单支付JSAPI支付API */ package com.wechat.pay.java.service.ecommercecombinepayments.jsapi; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionPayer.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionPayer.java deleted file mode 100644 index 02691131..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionPayer.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.model; - -import com.google.gson.annotations.SerializedName; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** TransactionPayer */ -public class TransactionPayer { - /** spOpenid */ - @SerializedName("sp_openid") - private String spOpenid; - - /** subOpenid */ - @SerializedName("sub_openid") - private String subOpenid; - - public String getSpOpenid() { - return spOpenid; - } - - public void setSpOpenid(String spOpenid) { - this.spOpenid = spOpenid; - } - - public String getSubOpenid() { - return subOpenid; - } - - public void setSubOpenid(String subOpenid) { - this.subOpenid = subOpenid; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TransactionPayer {\n"); - sb.append(" spOpenid: ").append(toIndentedString(spOpenid)).append("\n"); - sb.append(" subOpenid: ").append(toIndentedString(subOpenid)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayService.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayService.java index cf58960d..9af82a4b 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayService.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayService.java @@ -19,7 +19,6 @@ import com.wechat.pay.java.core.http.*; import com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model.*; -import static com.wechat.pay.java.core.http.UrlEncoder.urlEncode; import static com.wechat.pay.java.core.util.GsonUtil.toJson; import static java.util.Objects.requireNonNull; @@ -84,40 +83,6 @@ public NativePayService build() { } } - /** - * 关闭订单 - * - * @param request 请求参数 - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public void closeOrder(CloseOrderRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"; - - CloseOrderRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.POST) - .url(requestPath) - .headers(headers) - .body(createRequestBody(realRequest)) - .build(); - httpClient.execute(httpRequest, null); - } - /** * Native支付预下单 * @@ -149,41 +114,6 @@ public PrepayResponse prepay(PrepayRequest request) { return httpResponse.getServiceResponse(); } - /** - * 商户订单号查询订单 - * - * @param request 请求参数 - * @return Transaction - * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 - * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 - * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 - * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 - */ - public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { - String requestPath = - "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}"; - - QueryOrderByCombineOutTradeNoRequest realRequest = request; - // 添加 path param - requestPath = - requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); - - if (this.hostName != null) { - requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); - } - HttpHeaders headers = new HttpHeaders(); - headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); - headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); - HttpRequest httpRequest = - new HttpRequest.Builder() - .httpMethod(HttpMethod.GET) - .url(requestPath) - .headers(headers) - .build(); - HttpResponse httpResponse = httpClient.execute(httpRequest, Transaction.class); - return httpResponse.getServiceResponse(); - } - private RequestBody createRequestBody(Object request) { return new JsonRequestBody.Builder().body(toJson(request)).build(); } diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseOrderRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseOrderRequest.java deleted file mode 100644 index 0524bbe8..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseOrderRequest.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** CloseOrderRequest */ -public class CloseOrderRequest { - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - @Expose(serialize = false) - private String combineOutTradeNo; - - /** 子单信息 最多支持子单条数:50 */ - @SerializedName("sub_orders") - private List subOrders; - - /** 合单商户appid 说明:合单发起方的appid */ - @SerializedName("combine_appid") - private String combineAppid; - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String combineOutTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - public List getSubOrders() { - return subOrders; - } - - public void setSubOrders(List subOrders) { - this.subOrders = subOrders; - } - - public String getCombineAppid() { - return combineAppid; - } - - public void setCombineAppid(String combineAppid) { - this.combineAppid = combineAppid; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CloseOrderRequest {\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append(" subOrders: ").append(toIndentedString(subOrders)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(combineAppid)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseSubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseSubOrder.java deleted file mode 100644 index 79bf7221..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseSubOrder.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; - -import com.google.gson.annotations.SerializedName; - -public class CloseSubOrder { - - /** - * 子单商户号 - */ - @SerializedName("mchid") - private String mchid; - - /** - * 子单商户订单号 - */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** - * 二级商户号 - */ - @SerializedName("sub_mchid") - private String subMchid; - - /** - * 子商户应用ID - */ - @SerializedName("sub_appid") - private String subAppid; - - public String getMchid() { - return mchid; - } - - public void setMchid(String mchid) { - this.mchid = mchid; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CombinePayerInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CombinePayerInfo.java deleted file mode 100644 index 62f7a6b8..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CombinePayerInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; - -import com.google.gson.annotations.SerializedName; - -public class CombinePayerInfo { - - @SerializedName("openid") - private String openid; - - public String getOpenid() { - return openid; - } - - public void setOpenid(String openid) { - this.openid = openid; - } - - @Override - public String toString() { - return "CombinePayerInfo{" + - "openid='" + openid + '\'' + - '}'; - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/QueryOrderByCombineOutTradeNoRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/QueryOrderByCombineOutTradeNoRequest.java deleted file mode 100644 index 7dc8cc55..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/QueryOrderByCombineOutTradeNoRequest.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** QueryOrderByCombineOutTradeNoRequest */ -public class QueryOrderByCombineOutTradeNoRequest { - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - @Expose(serialize = false) - private String combineOutTradeNo; - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String outTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class QueryOrderByCombineOutTradeNoRequest {\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Transaction.java deleted file mode 100644 index b0c9c49d..00000000 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Transaction.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2021 Tencent Inc. All rights reserved. -// -// APP支付 -// -// APP支付API -// -// API version: 1.2.3 - -// Code generated by WechatPay APIv3 Generator based on [OpenAPI -// Generator](https://openapi-generator.tech); DO NOT EDIT. - -package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; - -import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; - -import java.util.List; - -import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; - -/** */ -public class Transaction { - - /** 合单商户appid 说明:合单发起方的appid */ - @SerializedName("combine_appid") - private String combineAppid; - - /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ - @SerializedName("combine_mchid") - private String combineMchid; - - /** combineOutTradeNo 说明:合单商户订单号 */ - @SerializedName("combine_out_trade_no") - private String combineOutTradeNo; - - /** sceneInfo */ - @SerializedName("scene_info") - private SceneInfo sceneInfo; - - /** sceneInfo */ - @SerializedName("sub_orders") - private List subOrders; - - /** 支付者信息 */ - @SerializedName("combine_payer_info") - private CombinePayerInfo combinePayerInfo; - - public String getCombineAppid() { - return combineAppid; - } - - public void setCombineAppid(String combineAppid) { - this.combineAppid = combineAppid; - } - - public String getCombineMchid() { - return combineMchid; - } - - public void setCombineMchid(String combineMchid) { - this.combineMchid = combineMchid; - } - - public String getCombineOutTradeNo() { - return combineOutTradeNo; - } - - public void setCombineOutTradeNo(String combineOutTradeNo) { - this.combineOutTradeNo = combineOutTradeNo; - } - - public SceneInfo getSceneInfo() { - return sceneInfo; - } - - public void setSceneInfo(SceneInfo sceneInfo) { - this.sceneInfo = sceneInfo; - } - - public List getSubOrders() { - return subOrders; - } - - public void setSubOrders(List subOrders) { - this.subOrders = subOrders; - } - - public CombinePayerInfo getCombinePayerInfo() { - return combinePayerInfo; - } - - public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { - this.combinePayerInfo = combinePayerInfo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Transaction {\n"); - sb.append(" combineAppid: ").append(toIndentedString(combineAppid)).append("\n"); - sb.append(" combineMchid: ").append(toIndentedString(combineMchid)).append("\n"); - sb.append(" combineOutTradeNo: ").append(toIndentedString(combineOutTradeNo)).append("\n"); - sb.append(" sceneInfo: ").append(toIndentedString(sceneInfo)).append("\n"); - sb.append(" subOrders: ").append(toIndentedString(subOrders)).append("\n"); - sb.append(" combinePayerInfo: ").append(toIndentedString(combinePayerInfo)).append("\n"); - sb.append("}"); - return sb.toString(); - } -} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/package-info.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/package-info.java index 4399666e..2899093a 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/package-info.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/package-info.java @@ -1,2 +1,2 @@ -/** 服务商-Native支付API */ +/** 服务商-合单支付Native支付API */ package com.wechat.pay.java.service.ecommercecombinepayments.nativepay; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderService.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderService.java new file mode 100644 index 00000000..e800c4fa --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/OrderService.java @@ -0,0 +1,150 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.order; + +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.exception.HttpException; +import com.wechat.pay.java.core.exception.MalformedMessageException; +import com.wechat.pay.java.core.exception.ServiceException; +import com.wechat.pay.java.core.exception.ValidationException; +import com.wechat.pay.java.core.http.*; +import com.wechat.pay.java.service.ecommercecombinepayments.order.model.CloseOrderRequest; +import com.wechat.pay.java.service.ecommercecombinepayments.order.model.QueryOrderByCombineOutTradeNoRequest; +import com.wechat.pay.java.service.ecommercecombinepayments.order.model.Transaction; + +import static com.wechat.pay.java.core.http.UrlEncoder.urlEncode; +import static com.wechat.pay.java.core.util.GsonUtil.toJson; +import static java.util.Objects.requireNonNull; + +public class OrderService { + + private final HttpClient httpClient; + private final HostName hostName; + + private OrderService(HttpClient httpClient, HostName hostName) { + this.httpClient = requireNonNull(httpClient); + this.hostName = hostName; + } + + /** NativePayService构造器 */ + public static class Builder { + + private HttpClient httpClient; + private HostName hostName; + + /** + * 设置请求配置,以该配置构造默认的httpClient,若未调用httpClient()方法,则必须调用该方法 + * + * @param config 请求配置 + * @return Builder + */ + public Builder config(Config config) { + this.httpClient = new DefaultHttpClientBuilder().config(config).build(); + + return this; + } + + /** + * 设置微信支付域名,可选,默认为api.mch.weixin.qq.com + * + * @param hostName 微信支付域名 + * @return Builder + */ + public Builder hostName(HostName hostName) { + this.hostName = hostName; + return this; + } + + /** + * 设置自定义httpClient,若未调用config(),则必须调用该方法 + * + * @param httpClient httpClient + * @return Builder + */ + public Builder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * 构造服务 + * + * @return NativePayService + */ + public OrderService build() { + return new OrderService(httpClient, hostName); + } + } + + /** + * 关闭订单 + * + * @param request 请求参数 + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public void closeOrder(CloseOrderRequest request) { + String requestPath = + "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"; + + CloseOrderRequest realRequest = request; + // 添加 path param + requestPath = + requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); + + if (this.hostName != null) { + requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); + } + HttpHeaders headers = new HttpHeaders(); + headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); + headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); + HttpRequest httpRequest = + new HttpRequest.Builder() + .httpMethod(HttpMethod.POST) + .url(requestPath) + .headers(headers) + .body(createRequestBody(realRequest)) + .build(); + httpClient.execute(httpRequest, null); + } + + /** + * 商户合单订单号查询订单 + * + * @param request 请求参数 + * @return Transaction + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public Transaction queryOrderByCombineOutTradeNo(QueryOrderByCombineOutTradeNoRequest request) { + String requestPath = + "https://api.mch.weixin.qq.com/v3/combine-transactions/out-trade-no/{combine_out_trade_no}"; + + QueryOrderByCombineOutTradeNoRequest realRequest = request; + // 添加 path param + requestPath = + requestPath.replace("{" + "combine_out_trade_no" + "}", urlEncode(realRequest.getCombineOutTradeNo())); + + if (this.hostName != null) { + requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue()); + } + HttpHeaders headers = new HttpHeaders(); + headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); + headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); + HttpRequest httpRequest = + new HttpRequest.Builder() + .httpMethod(HttpMethod.GET) + .url(requestPath) + .headers(headers) + .build(); + HttpResponse httpResponse = httpClient.execute(httpRequest, Transaction.class); + return httpResponse.getServiceResponse(); + } + + private RequestBody createRequestBody(Object request) { + return new JsonRequestBody.Builder().body(toJson(request)).build(); + } + +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseOrderRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/CloseOrderRequest.java similarity index 96% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseOrderRequest.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/CloseOrderRequest.java index c7fc504d..6005363b 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseOrderRequest.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/CloseOrderRequest.java @@ -9,7 +9,7 @@ // Code generated by WechatPay APIv3 Generator based on [OpenAPI // Generator](https://openapi-generator.tech); DO NOT EDIT. -package com.wechat.pay.java.service.ecommercecombinepayments.app.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseSubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/CloseSubOrder.java similarity index 93% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseSubOrder.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/CloseSubOrder.java index 56c8d3cf..6beacb65 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseSubOrder.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/CloseSubOrder.java @@ -1,4 +1,4 @@ -package com.wechat.pay.java.service.ecommercecombinepayments.h5.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionDetail.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/PromotionDetail.java similarity index 98% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionDetail.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/PromotionDetail.java index 6e1b3f90..2d6b8ea1 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionDetail.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/PromotionDetail.java @@ -9,7 +9,7 @@ // Code generated by WechatPay APIv3 Generator based on [OpenAPI // Generator](https://openapi-generator.tech); DO NOT EDIT. -package com.wechat.pay.java.service.ecommercecombinepayments.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionGoodsDetail.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/PromotionGoodsDetail.java similarity index 96% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionGoodsDetail.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/PromotionGoodsDetail.java index 0ff80518..07f86c0e 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionGoodsDetail.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/PromotionGoodsDetail.java @@ -9,7 +9,7 @@ // Code generated by WechatPay APIv3 Generator based on [OpenAPI // Generator](https://openapi-generator.tech); DO NOT EDIT. -package com.wechat.pay.java.service.ecommercecombinepayments.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/QueryOrderByCombineOutTradeNoRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/QueryOrderByCombineOutTradeNoRequest.java similarity index 93% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/QueryOrderByCombineOutTradeNoRequest.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/QueryOrderByCombineOutTradeNoRequest.java index 368c479a..59e29c1f 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/QueryOrderByCombineOutTradeNoRequest.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/QueryOrderByCombineOutTradeNoRequest.java @@ -9,7 +9,7 @@ // Code generated by WechatPay APIv3 Generator based on [OpenAPI // Generator](https://openapi-generator.tech); DO NOT EDIT. -package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SettleInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SettleInfo.java new file mode 100644 index 00000000..7ed8442d --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SettleInfo.java @@ -0,0 +1,60 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// APP支付 +// +// APP支付API +// +// API version: 1.2.3 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI +// Generator](https://openapi-generator.tech); DO NOT EDIT. + +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; + + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** SettleInfo */ +public class SettleInfo { + /** profitSharing 说明:是否指定分账 */ + @SerializedName("profit_sharing") + private Boolean profitSharing; + + /** + * 补差金额 + * SettleInfo.profit_sharing为true时,该金额才生效。 + 注意:单笔订单最高补差金额为5000元 + */ + @SerializedName("subsidy_amount") + private Integer subsidyAmount; + + + + public Boolean getProfitSharing() { + return profitSharing; + } + + public void setProfitSharing(Boolean profitSharing) { + this.profitSharing = profitSharing; + } + + public Integer getSubsidyAmount() { + return subsidyAmount; + } + + public void setSubsidyAmount(Integer subsidyAmount) { + this.subsidyAmount = subsidyAmount; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettleInfo {\n"); + sb.append(" profitSharing: ").append(toIndentedString(profitSharing)).append("\n"); + sb.append(" subsidyAmount: ").append(toIndentedString(subsidyAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/StoreInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/StoreInfo.java new file mode 100644 index 00000000..bbfcec01 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/StoreInfo.java @@ -0,0 +1,79 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// JSAPI支付 +// +// JSAPI支付API +// +// API version: 1.2.3 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI +// Generator](https://openapi-generator.tech); DO NOT EDIT. + +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** 商户门店信息 */ +public class StoreInfo { + /** 门店编号 说明:商户侧门店编号 */ + @SerializedName("id") + private String id; + + /** 门店名称 说明:商户侧门店名称 */ + @SerializedName("name") + private String name; + + /** 地区编码 说明:地区编码,详细请见微信支付提供的文档 */ + @SerializedName("area_code") + private String areaCode; + + /** 详细地址 说明:详细的商户门店地址 */ + @SerializedName("address") + private String address; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StoreInfo {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" areaCode: ").append(toIndentedString(areaCode)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/SubOrderDetail.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SubOrderDetail.java similarity index 98% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/SubOrderDetail.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SubOrderDetail.java index bff6a41c..2080e1c1 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/SubOrderDetail.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/SubOrderDetail.java @@ -1,4 +1,4 @@ -package com.wechat.pay.java.service.ecommercecombinepayments.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/Transaction.java similarity index 86% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Transaction.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/Transaction.java index 53bba549..2cc899db 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Transaction.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/Transaction.java @@ -9,10 +9,9 @@ // Code generated by WechatPay APIv3 Generator based on [OpenAPI // Generator](https://openapi-generator.tech); DO NOT EDIT. -package com.wechat.pay.java.service.ecommercecombinepayments.h5.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; import java.util.List; @@ -35,7 +34,7 @@ public class Transaction { /** sceneInfo */ @SerializedName("scene_info") - private SceneInfo sceneInfo; + private TransactionSceneInfo sceneInfo; /** sceneInfo */ @SerializedName("sub_orders") @@ -43,7 +42,7 @@ public class Transaction { /** 支付者信息 */ @SerializedName("combine_payer_info") - private CombinePayerInfo combinePayerInfo; + private TransactionPayer combinePayerInfo; public String getCombineAppid() { return combineAppid; @@ -69,11 +68,11 @@ public void setCombineOutTradeNo(String combineOutTradeNo) { this.combineOutTradeNo = combineOutTradeNo; } - public SceneInfo getSceneInfo() { + public TransactionSceneInfo getSceneInfo() { return sceneInfo; } - public void setSceneInfo(SceneInfo sceneInfo) { + public void setSceneInfo(TransactionSceneInfo sceneInfo) { this.sceneInfo = sceneInfo; } @@ -85,11 +84,11 @@ public void setSubOrders(List subOrders) { this.subOrders = subOrders; } - public CombinePayerInfo getCombinePayerInfo() { + public TransactionPayer getCombinePayerInfo() { return combinePayerInfo; } - public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { + public void setCombinePayerInfo(TransactionPayer combinePayerInfo) { this.combinePayerInfo = combinePayerInfo; } diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionAmount.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionAmount.java similarity index 96% rename from service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionAmount.java rename to service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionAmount.java index 42125997..9b145f86 100644 --- a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionAmount.java +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionAmount.java @@ -9,7 +9,7 @@ // Code generated by WechatPay APIv3 Generator based on [OpenAPI // Generator](https://openapi-generator.tech); DO NOT EDIT. -package com.wechat.pay.java.service.ecommercecombinepayments.model; +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; import com.google.gson.annotations.SerializedName; diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionPayer.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionPayer.java new file mode 100644 index 00000000..c6ad4b7b --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionPayer.java @@ -0,0 +1,38 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// APP支付 +// +// APP支付API +// +// API version: 1.2.3 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI +// Generator](https://openapi-generator.tech); DO NOT EDIT. + +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; + +import com.google.gson.annotations.SerializedName; + + +/** TransactionPayer */ +public class TransactionPayer { + + @SerializedName("openid") + private String openid; + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + @Override + public String toString() { + return "CombinePayerInfo{" + + "openid='" + openid + '\'' + + '}'; + } + +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionSceneInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionSceneInfo.java new file mode 100644 index 00000000..23e1c274 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/model/TransactionSceneInfo.java @@ -0,0 +1,66 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// JSAPI支付 +// +// JSAPI支付API +// +// API version: 1.2.3 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI +// Generator](https://openapi-generator.tech); DO NOT EDIT. + +package com.wechat.pay.java.service.ecommercecombinepayments.order.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** 支付场景描述 */ +public class TransactionSceneInfo { + /** 用户终端IP 说明:用户终端IP */ + @SerializedName("payer_client_ip") + private String payerClientIp; + + /** 商户端设备号 说明:商户端设备号 */ + @SerializedName("device_id") + private String deviceId; + + /** storeInfo */ + @SerializedName("store_info") + private StoreInfo storeInfo; + + public String getPayerClientIp() { + return payerClientIp; + } + + public void setPayerClientIp(String payerClientIp) { + this.payerClientIp = payerClientIp; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public StoreInfo getStoreInfo() { + return storeInfo; + } + + public void setStoreInfo(StoreInfo storeInfo) { + this.storeInfo = storeInfo; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SceneInfo {\n"); + sb.append(" payerClientIp: ").append(toIndentedString(payerClientIp)).append("\n"); + sb.append(" deviceId: ").append(toIndentedString(deviceId)).append("\n"); + sb.append(" storeInfo: ").append(toIndentedString(storeInfo)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/package-info.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/package-info.java new file mode 100644 index 00000000..c9e66fa2 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/order/package-info.java @@ -0,0 +1,2 @@ +/** 服务商-合单支付公共接口 */ +package com.wechat.pay.java.service.ecommercecombinepayments.order;