From f9e71b44113b8d21e7409062d8de3acbb8aa42e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=8E=E9=B9=8F?= Date: Thu, 27 Jun 2024 11:21:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=94=B6=E4=BB=98=E9=80=9A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=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 --- service/README.md | 4 + .../app/AppServiceExample.java | 77 +++++ .../app/AppServiceExtensionExample.java | 77 +++++ .../h5/H5ServiceExample.java | 77 +++++ .../jsapi/JsapiServiceExample.java | 77 +++++ .../jsapi/JsapiServiceExtensionExample.java | 82 ++++++ .../nativepay/NativePayServiceExample.java | 78 +++++ .../app/AppService.java | 190 ++++++++++++ .../app/AppServiceExtension.java | 126 ++++++++ .../app/model/Amount.java | 53 ++++ .../app/model/CloseOrderRequest.java | 70 +++++ .../app/model/CloseSubOrder.java | 62 ++++ .../app/model/CombinePayerInfo.java | 24 ++ .../app/model/PrepayRequest.java | 148 ++++++++++ .../app/model/PrepayResponse.java | 40 +++ .../PrepayWithRequestPaymentResponse.java | 100 +++++++ .../QueryOrderByCombineOutTradeNoRequest.java | 42 +++ .../app/model/SceneInfo.java | 66 +++++ .../app/model/SettleInfo.java | 60 ++++ .../app/model/StoreInfo.java | 79 +++++ .../app/model/SubOrder.java | 137 +++++++++ .../app/model/Transaction.java | 273 ++++++++++++++++++ .../app/package-info.java | 2 + .../h5/H5Service.java | 190 ++++++++++++ .../h5/model/Amount.java | 53 ++++ .../h5/model/CloseOrderRequest.java | 70 +++++ .../h5/model/CloseSubOrder.java | 62 ++++ .../h5/model/H5Info.java | 92 ++++++ .../h5/model/PrepayRequest.java | 135 +++++++++ .../h5/model/PrepayResponse.java | 40 +++ .../QueryOrderByCombineOutTradeNoRequest.java | 42 +++ .../h5/model/SceneInfo.java | 79 +++++ .../h5/model/SettleInfo.java | 60 ++++ .../h5/model/StoreInfo.java | 79 +++++ .../h5/model/SubOrder.java | 137 +++++++++ .../h5/model/Transaction.java | 273 ++++++++++++++++++ .../h5/package-info.java | 2 + .../jsapi/JsapiService.java | 190 ++++++++++++ .../jsapi/JsapiServiceExtension.java | 135 +++++++++ .../jsapi/model/Amount.java | 53 ++++ .../jsapi/model/CloseOrderRequest.java | 70 +++++ .../jsapi/model/CloseSubOrder.java | 62 ++++ .../jsapi/model/CombinePayerInfo.java | 24 ++ .../jsapi/model/PrepayRequest.java | 148 ++++++++++ .../jsapi/model/PrepayResponse.java | 40 +++ .../PrepayWithRequestPaymentResponse.java | 88 ++++++ .../QueryOrderByCombineOutTradeNoRequest.java | 42 +++ .../jsapi/model/SceneInfo.java | 66 +++++ .../jsapi/model/SettleInfo.java | 60 ++++ .../jsapi/model/StoreInfo.java | 79 +++++ .../jsapi/model/SubOrder.java | 137 +++++++++ .../jsapi/model/Transaction.java | 273 ++++++++++++++++++ .../jsapi/package-info.java | 2 + .../model/PromotionDetail.java | 190 ++++++++++++ .../model/PromotionGoodsDetail.java | 92 ++++++ .../model/TransactionAmount.java | 79 +++++ .../model/TransactionPayer.java | 53 ++++ .../nativepay/NativePayService.java | 190 ++++++++++++ .../nativepay/model/Amount.java | 53 ++++ .../nativepay/model/CloseOrderRequest.java | 70 +++++ .../nativepay/model/CloseSubOrder.java | 62 ++++ .../nativepay/model/PrepayRequest.java | 135 +++++++++ .../nativepay/model/PrepayResponse.java | 40 +++ .../QueryOrderByCombineOutTradeNoRequest.java | 42 +++ .../nativepay/model/SceneInfo.java | 66 +++++ .../nativepay/model/SettleInfo.java | 60 ++++ .../nativepay/model/StoreInfo.java | 79 +++++ .../nativepay/model/SubOrder.java | 137 +++++++++ .../nativepay/model/Transaction.java | 273 ++++++++++++++++++ .../nativepay/package-info.java | 2 + 70 files changed, 6350 insertions(+) create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExample.java create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtensionExample.java create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5ServiceExample.java create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExample.java create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtensionExample.java create mode 100644 service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayServiceExample.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppService.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtension.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Amount.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseOrderRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CombinePayerInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayResponse.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayWithRequestPaymentResponse.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/QueryOrderByCombineOutTradeNoRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SceneInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SettleInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/StoreInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Transaction.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/package-info.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5Service.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Amount.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseOrderRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseSubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/H5Info.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayResponse.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/QueryOrderByCombineOutTradeNoRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SceneInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SettleInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/StoreInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Transaction.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/package-info.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiService.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtension.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Amount.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseOrderRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseSubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CombinePayerInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayResponse.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayWithRequestPaymentResponse.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/QueryOrderByCombineOutTradeNoRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SceneInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SettleInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/StoreInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/package-info.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionDetail.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionGoodsDetail.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionAmount.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionPayer.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayService.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Amount.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseOrderRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseSubOrder.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayResponse.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/QueryOrderByCombineOutTradeNoRequest.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SceneInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SettleInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/StoreInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SubOrder.java create 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/nativepay/package-info.java diff --git a/service/README.md b/service/README.md index de4e088d..290251bb 100644 --- a/service/README.md +++ b/service/README.md @@ -31,3 +31,7 @@ | billdownload | 账单下载 |✔️|✔️| | ecommercesubsidy | 电商收付通补差 | |✔️| | ecommercerefund | 电商收付通退款 | |✔️| +| ecommercecombinepayments/app | 电商收付通 APP 支付 | | ✔️ | +| ecommercecombinepayments/jsapi | 电商收付通 JSAPI 支付 | | ✔️ | +| ecommercecombinepayments/nativepay | 电商收付通 Native 支付 | | ✔️ | +| ecommercecombinepayments/h5 | 电商收付通 H5 支付 | | ✔️ | 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 new file mode 100644 index 00000000..8e371c17 --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExample.java @@ -0,0 +1,77 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.app; + +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.app.model.*; + +/** AppService使用示例 */ +public class AppServiceExample { + + /** 商户号 */ + 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 AppService 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 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支付下单 */ + public static PrepayResponse prepay() { + PrepayRequest request = new PrepayRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + 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 new file mode 100644 index 00000000..00197460 --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtensionExample.java @@ -0,0 +1,77 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.app; + +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.app.model.*; + +public class AppServiceExtensionExample { + /** 商户号 */ + 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 AppServiceExtension 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 AppServiceExtension.Builder().config(config).build(); + try { + // ... 调用接口 + PrepayWithRequestPaymentResponse response = prepayWithRequestPayment(); + System.out.println(response); + } 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支付下单,并返回APP调起支付数据 */ + public static PrepayWithRequestPaymentResponse prepayWithRequestPayment() { + // 微信开放平台审核通过的移动应用appid + String requestPaymentAppid = "test-appid"; + PrepayRequest request = new PrepayRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + 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 new file mode 100644 index 00000000..9d43ad6c --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5ServiceExample.java @@ -0,0 +1,77 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.h5; + +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.h5.model.*; + +/** H5Service使用示例 */ +public class H5ServiceExample { + + /** 商户号 */ + 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 H5Service 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 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支付下单 */ + public static PrepayResponse prepay() { + PrepayRequest request = new PrepayRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + 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 new file mode 100644 index 00000000..2b714618 --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExample.java @@ -0,0 +1,77 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi; + +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.jsapi.model.*; + +/** JsapiService使用示例 */ +public class JsapiServiceExample { + + /** 商户号 */ + 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 JsapiService 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 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() { + PrepayRequest request = new PrepayRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + 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 new file mode 100644 index 00000000..c51c64da --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtensionExample.java @@ -0,0 +1,82 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi; + +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.jsapi.model.*; + +public class JsapiServiceExtensionExample { + + /** 商户号 */ + 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 com.wechat.pay.java.service.ecommercecombinepayments.jsapi.JsapiServiceExtension 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 JsapiServiceExtension.Builder() + .config(config) + .signType("RSA") // 不填则默认为RSA + .build(); + try { + PrepayWithRequestPaymentResponse response = prepayWithRequestPayment(); + System.out.println(response); + } 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支付下单,并返回JSAPI调起支付数据 */ + public static PrepayWithRequestPaymentResponse prepayWithRequestPayment() { + // 商户申请的公众号对应的appid,由微信支付生成,可在公众号后台查看 + String requestPaymentAppid = "test-request-payment-appid"; + PrepayRequest request = new PrepayRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + 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 new file mode 100644 index 00000000..840c1884 --- /dev/null +++ b/service/src/example/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayServiceExample.java @@ -0,0 +1,78 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.nativepay; + +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.nativepay.model.*; + +/** NativePayService使用示例 */ +public class NativePayServiceExample { + + /** 商户号 */ + 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 NativePayService 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 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支付预下单 */ + public static PrepayResponse prepay() { + PrepayRequest request = new PrepayRequest(); + // 调用request.setXxx(val)设置所需参数,具体参数可见Request定义 + // 调用接口 + 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/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 new file mode 100644 index 00000000..8c8364f7 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppService.java @@ -0,0 +1,190 @@ +// 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; + +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.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; + +/** AppService服务 */ +public class AppService { + + private final HttpClient httpClient; + private final HostName hostName; + + private AppService(HttpClient httpClient, HostName hostName) { + this.httpClient = requireNonNull(httpClient); + this.hostName = hostName; + } + + /** AppService构造器 */ + 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 AppService + */ + public AppService build() { + return new AppService(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); + } + + /** + * APP支付下单 + * + * @param request 请求参数 + * @return PrepayResponse + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public PrepayResponse prepay(PrepayRequest request) { + String requestPath = "https://api.mch.weixin.qq.com/v3/combine-transactions/app"; + PrepayRequest realRequest = request; + 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(); + HttpResponse httpResponse = + httpClient.execute(httpRequest, PrepayResponse.class); + 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 new file mode 100644 index 00000000..90e96d96 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/AppServiceExtension.java @@ -0,0 +1,126 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.app; + +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.cipher.Signer; +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.HostName; +import com.wechat.pay.java.core.http.HttpClient; +import com.wechat.pay.java.core.util.NonceUtil; +import com.wechat.pay.java.service.ecommercecombinepayments.app.model.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Instant; + +/** + * APP 支付的扩展类。 + * + *

它封装了 AppService,并提供了一个增强的 APP 下单方法 prepayWithRequestPayment。 + */ +public class AppServiceExtension { + private final Signer signer; + private final AppService appService; + private static final Logger logger = LoggerFactory.getLogger(AppServiceExtension.class); + + private AppServiceExtension(Config config, HttpClient httpClient, HostName hostName) { + this.signer = config.createSigner(); + AppService.Builder builder = new AppService.Builder().config(config); + if (httpClient != null) { + builder.httpClient(httpClient); + } + if (hostName != null) { + builder.hostName(hostName); + } + this.appService = builder.build(); + } + + /** + * APP 支付下单,并返回 APP 调起支付数据。推荐使用! + * + *

请求成功后,该方法返回预支付交易会话标识 prepay_id 和客户端 APP 调起支付所需参数。 它相比 AppService.prepay + * 更简单易用,因为无需开发者自行计算调起支付签名。 + * + * @param request 请求参数 + * @param requestPaymentAppid 商户申请的公众号对应的appid + * @return PrepayWithRequestPaymentResponse + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public PrepayWithRequestPaymentResponse prepayWithRequestPayment( + PrepayRequest request, String requestPaymentAppid) { + String prepayId = appService.prepay(request).getPrepayId(); + long timestamp = Instant.now().getEpochSecond(); + String nonceStr = NonceUtil.createNonce(32); + String message = + requestPaymentAppid + "\n" + timestamp + "\n" + nonceStr + "\n" + prepayId + "\n"; + logger.debug("Message for RequestPayment signatures is[{}]", message); + String sign = signer.sign(message).getSign(); + PrepayWithRequestPaymentResponse response = new PrepayWithRequestPaymentResponse(); + response.setAppid(requestPaymentAppid); + response.setPartnerId(request.getCombineMchid()); + response.setPrepayId(prepayId); + response.setPackageVal("Sign=WXPay"); + response.setNonceStr(nonceStr); + response.setTimestamp(String.valueOf(timestamp)); + response.setSign(sign); + 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; + + private HttpClient httpClient; + private HostName hostName; + + public Builder config(Config config) { + this.config = config; + return this; + } + + public Builder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder hostName(HostName hostName) { + this.hostName = hostName; + return this; + } + + public AppServiceExtension build() { + return new AppServiceExtension(config, httpClient, hostName); + } + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Amount.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Amount.java new file mode 100644 index 00000000..d2bcbfda --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Amount.java @@ -0,0 +1,53 @@ +// 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 static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** Amount */ +public class Amount { + /** 总金额 说明:订单总金额,单位为分 */ + @SerializedName("total") + private Integer total; + + /** 货币类型 说明:CNY:人民币,境内商户号仅支持人民币。 */ + @SerializedName("currency") + private String currency; + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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/app/model/CloseOrderRequest.java new file mode 100644 index 00000000..c7fc504d --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseOrderRequest.java @@ -0,0 +1,70 @@ +// 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 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/app/model/CloseSubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java new file mode 100644 index 00000000..3c7db7d1 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CloseSubOrder.java @@ -0,0 +1,62 @@ +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/CombinePayerInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CombinePayerInfo.java new file mode 100644 index 00000000..4d98956e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/CombinePayerInfo.java @@ -0,0 +1,24 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.app.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/app/model/PrepayRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayRequest.java new file mode 100644 index 00000000..498e81e2 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayRequest.java @@ -0,0 +1,148 @@ +// 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 java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayRequest */ +public class PrepayRequest { + + + /** 合单商户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; + + /** 子单信息 最多支持子单条数:50 */ + @SerializedName("sub_orders") + private List subOrders; + + /** 支付者信息 */ + @SerializedName("combine_payer_info") + private CombinePayerInfo combinePayerInfo; + + /** 交易起始时间 说明:交易起始时间,格式为rfc3339格式 */ + @SerializedName("time_start") + private String timeStart; + + /** 交易结束时间 说明:订单失效时间,格式为rfc3339格式 */ + @SerializedName("time_expire") + private String timeExpire; + + /** 通知地址 说明:有效性:1. HTTPS;2. 不允许携带查询串。 */ + @SerializedName("notify_url") + private String notifyUrl; + + 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; + } + + public String getTimeStart() { + return timeStart; + } + + public void setTimeStart(String timeStart) { + this.timeStart = timeStart; + } + + public String getTimeExpire() { + return timeExpire; + } + + public void setTimeExpire(String timeExpire) { + this.timeExpire = timeExpire; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayRequest {\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(" timeStart: ").append(toIndentedString(timeStart)).append("\n"); + sb.append(" timeExpire: ").append(toIndentedString(timeExpire)).append("\n"); + sb.append(" notifyUrl: ").append(toIndentedString(notifyUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayResponse.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayResponse.java new file mode 100644 index 00000000..7ac3b562 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayResponse.java @@ -0,0 +1,40 @@ +// 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 static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayResponse */ +public class PrepayResponse { + /** prepayId 说明:预支付交易会话标识 */ + @SerializedName("prepay_id") + private String prepayId; + + public String getPrepayId() { + return prepayId; + } + + public void setPrepayId(String prepayId) { + this.prepayId = prepayId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayResponse {\n"); + sb.append(" prepayId: ").append(toIndentedString(prepayId)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayWithRequestPaymentResponse.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayWithRequestPaymentResponse.java new file mode 100644 index 00000000..be6d7d55 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/PrepayWithRequestPaymentResponse.java @@ -0,0 +1,100 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.app.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class PrepayWithRequestPaymentResponse { + + @SerializedName("appid") + private String appid; + + @SerializedName("partnerid") + private String partnerId; + + @SerializedName("prepayid") + private String prepayId; + + @SerializedName("package") + private String packageVal; + + @SerializedName("noncestr") + private String nonceStr; + + @SerializedName("timestamp") + private String timestamp; + + @SerializedName("sign") + private String sign; + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getPartnerId() { + return partnerId; + } + + public void setPartnerId(String partnerId) { + this.partnerId = partnerId; + } + + public String getPrepayId() { + return prepayId; + } + + public void setPrepayId(String prepayId) { + this.prepayId = prepayId; + } + + public String getPackageVal() { + return packageVal; + } + + public void setPackageVal(String packageVal) { + this.packageVal = packageVal; + } + + public String getNonceStr() { + return nonceStr; + } + + public void setNonceStr(String nonceStr) { + this.nonceStr = nonceStr; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayWithRequestPaymentRequest {\n"); + sb.append(" appid: ").append(toIndentedString(appid)).append("\n"); + sb.append(" partnerId: ").append(toIndentedString(partnerId)).append("\n"); + sb.append(" prepayId: ").append(toIndentedString(prepayId)).append("\n"); + sb.append(" packageVal: ").append(toIndentedString(packageVal)).append("\n"); + sb.append(" nonceStr: ").append(toIndentedString(nonceStr)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" sign: ").append(toIndentedString(sign)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..d23269ca --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/QueryOrderByCombineOutTradeNoRequest.java @@ -0,0 +1,42 @@ +// 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/SceneInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SceneInfo.java new file mode 100644 index 00000000..d1073a51 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SceneInfo.java @@ -0,0 +1,66 @@ +// 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 static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** 支付场景描述 */ +public class SceneInfo { + /** 用户终端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/app/model/SettleInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SettleInfo.java new file mode 100644 index 00000000..df14c83e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/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.app.model; + + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +import com.google.gson.annotations.SerializedName; + +/** 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/app/model/StoreInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/StoreInfo.java new file mode 100644 index 00000000..7c4dc0f2 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/StoreInfo.java @@ -0,0 +1,79 @@ +// 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 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/app/model/SubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SubOrder.java new file mode 100644 index 00000000..3f640bab --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/SubOrder.java @@ -0,0 +1,137 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.app.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class SubOrder { + + /** 子商户号 说明:子单发起方商户号,必须与发起方appid有绑定关系。服务商和电商模式下,传服务商商户号。 */ + @SerializedName("mchid") + private String mchid; + + /** 附加数据 说明:附加数据 */ + @SerializedName("attach") + private String attach; + + /** amount */ + @SerializedName("amount") + private Amount amount; + + /** 子单商户订单号 */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** 订单优惠标记 说明:商品标记,代金券或立减优惠功能的参数。 */ + @SerializedName("goods_tag") + private String goodsTag; + + /** + * 二级商户号 + * 说明:二级商户商户号,由微信支付生成并下发。 + * 服务商子商户的商户号,被合单方。直连商户不用传二级商户号。 + * 注意:仅适用于电商平台,服务商*/ + @SerializedName("sub_mchid") + private String subMchid; + + /** 商品描述 说明:商品描述 */ + @SerializedName("description") + private String description; + + /** settleInfo */ + @SerializedName("settle_info") + private SettleInfo settleInfo; + + /** 子商户应用ID 说明:子商户申请的公众号appid */ + @SerializedName("sub_appid") + private String subAppid; + + public String getMchid() { + return mchid; + } + + public void setMchid(String mchid) { + this.mchid = mchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public Amount getAmount() { + return amount; + } + + public void setAmount(Amount amount) { + this.amount = amount; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public String getGoodsTag() { + return goodsTag; + } + + public void setGoodsTag(String goodsTag) { + this.goodsTag = goodsTag; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public SettleInfo getSettleInfo() { + return settleInfo; + } + + public void setSettleInfo(SettleInfo settleInfo) { + this.settleInfo = settleInfo; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubOrder {\n"); + sb.append(" mchid: ").append(toIndentedString(mchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" goodsTag: ").append(toIndentedString(goodsTag)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" settleInfo: ").append(toIndentedString(settleInfo)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).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 new file mode 100644 index 00000000..8eda8e67 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/model/Transaction.java @@ -0,0 +1,273 @@ +// 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.PromotionDetail; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; + +import java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** */ +public class Transaction { + /** amount */ + @SerializedName("amount") + private TransactionAmount amount; + + /** spAppid */ + @SerializedName("sp_appid") + private String spAppid; + + /** subAppid */ + @SerializedName("sub_appid") + private String subAppid; + + /** spMchid */ + @SerializedName("sp_mchid") + private String spMchid; + + /** subMchid */ + @SerializedName("sub_mchid") + private String subMchid; + + /** attach */ + @SerializedName("attach") + private String attach; + + /** bankType */ + @SerializedName("bank_type") + private String bankType; + + /** outTradeNo */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** payer */ + @SerializedName("payer") + private TransactionPayer payer; + + /** promotionDetail */ + @SerializedName("promotion_detail") + private List promotionDetail; + + /** successTime */ + @SerializedName("success_time") + private String successTime; + + /** tradeState */ + public enum TradeStateEnum { + @SerializedName("SUCCESS") + SUCCESS, + + @SerializedName("REFUND") + REFUND, + + @SerializedName("NOTPAY") + NOTPAY, + + @SerializedName("CLOSED") + CLOSED, + + @SerializedName("REVOKED") + REVOKED, + + @SerializedName("USERPAYING") + USERPAYING, + + @SerializedName("PAYERROR") + PAYERROR, + + @SerializedName("ACCEPT") + ACCEPT + } + + @SerializedName("trade_state") + private TradeStateEnum tradeState; + + /** tradeStateDesc */ + @SerializedName("trade_state_desc") + private String tradeStateDesc; + + /** tradeType */ + public enum TradeTypeEnum { + @SerializedName("JSAPI") + JSAPI, + + @SerializedName("NATIVE") + NATIVE, + + @SerializedName("APP") + APP, + + @SerializedName("MICROPAY") + MICROPAY, + + @SerializedName("MWEB") + MWEB, + + @SerializedName("FACEPAY") + FACEPAY + } + + @SerializedName("trade_type") + private TradeTypeEnum tradeType; + + /** transactionId */ + @SerializedName("transaction_id") + private String transactionId; + + public TransactionAmount getAmount() { + return amount; + } + + public void setAmount(TransactionAmount amount) { + this.amount = amount; + } + + public String getSpAppid() { + return spAppid; + } + + public void setSpAppid(String spAppid) { + this.spAppid = spAppid; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + public String getSpMchid() { + return spMchid; + } + + public void setSpMchid(String spMchid) { + this.spMchid = spMchid; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public TransactionPayer getPayer() { + return payer; + } + + public void setPayer(TransactionPayer payer) { + this.payer = payer; + } + + public List getPromotionDetail() { + return promotionDetail; + } + + public void setPromotionDetail(List promotionDetail) { + this.promotionDetail = promotionDetail; + } + + public String getSuccessTime() { + return successTime; + } + + public void setSuccessTime(String successTime) { + this.successTime = successTime; + } + + public TradeStateEnum getTradeState() { + return tradeState; + } + + public void setTradeState(TradeStateEnum tradeState) { + this.tradeState = tradeState; + } + + public String getTradeStateDesc() { + return tradeStateDesc; + } + + public void setTradeStateDesc(String tradeStateDesc) { + this.tradeStateDesc = tradeStateDesc; + } + + public TradeTypeEnum getTradeType() { + return tradeType; + } + + public void setTradeType(TradeTypeEnum tradeType) { + this.tradeType = tradeType; + } + + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transaction {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); + sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); + sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); + sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); + sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).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 new file mode 100644 index 00000000..ba6c9496 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/app/package-info.java @@ -0,0 +1,2 @@ +/** 服务商-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 new file mode 100644 index 00000000..9da38ab1 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/H5Service.java @@ -0,0 +1,190 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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; + +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.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; + +/** H5Service服务 */ +public class H5Service { + + private final HttpClient httpClient; + private final HostName hostName; + + private H5Service(HttpClient httpClient, HostName hostName) { + this.httpClient = requireNonNull(httpClient); + this.hostName = hostName; + } + + /** H5Service构造器 */ + 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 H5Service + */ + public H5Service build() { + return new H5Service(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); + } + + /** + * H5支付下单 + * @throws ServiceException 发送 + * + * @param request 请求参数 + * @return PrepayResponse + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public PrepayResponse prepay(PrepayRequest request) { + String requestPath = "https://api.mch.weixin.qq.com/v3/combine-transactions/h5"; + PrepayRequest realRequest = request; + 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(); + HttpResponse httpResponse = + httpClient.execute(httpRequest, PrepayResponse.class); + 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/Amount.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Amount.java new file mode 100644 index 00000000..9b8b7273 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Amount.java @@ -0,0 +1,53 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** Amount */ +public class Amount { + /** 总金额 说明:订单总金额,单位为分 */ + @SerializedName("total") + private Integer total; + + /** 货币类型 说明:CNY:人民币,境内商户号仅支持人民币。 */ + @SerializedName("currency") + private String currency; + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..96b47d20 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseOrderRequest.java @@ -0,0 +1,70 @@ +// 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/CloseSubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseSubOrder.java new file mode 100644 index 00000000..56c8d3cf --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CloseSubOrder.java @@ -0,0 +1,62 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.h5.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/h5/model/H5Info.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/H5Info.java new file mode 100644 index 00000000..2e566aa4 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/H5Info.java @@ -0,0 +1,92 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** H5Info */ +public class H5Info { + /** 场景类型 说明:场景类型 */ + @SerializedName("type") + private String type; + + /** 应用名称 说明:应用名称 */ + @SerializedName("app_name") + private String appName; + + /** 网站URL 说明:网站URL */ + @SerializedName("app_url") + private String appUrl; + + /** iOS平台BundleID 说明:iOS平台BundleID */ + @SerializedName("bundle_id") + private String bundleId; + + /** Android平台PackageName 说明:Android平台PackageName */ + @SerializedName("package_name") + private String packageName; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getAppUrl() { + return appUrl; + } + + public void setAppUrl(String appUrl) { + this.appUrl = appUrl; + } + + public String getBundleId() { + return bundleId; + } + + public void setBundleId(String bundleId) { + this.bundleId = bundleId; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class H5Info {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" appName: ").append(toIndentedString(appName)).append("\n"); + sb.append(" appUrl: ").append(toIndentedString(appUrl)).append("\n"); + sb.append(" bundleId: ").append(toIndentedString(bundleId)).append("\n"); + sb.append(" packageName: ").append(toIndentedString(packageName)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayRequest.java new file mode 100644 index 00000000..beb4457c --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayRequest.java @@ -0,0 +1,135 @@ +// 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.SerializedName; + +import java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayRequest */ +public class PrepayRequest { + + + /** 合单商户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; + + /** 子单信息 最多支持子单条数:50 */ + @SerializedName("sub_orders") + private List subOrders; + + /** 交易起始时间 说明:交易起始时间,格式为rfc3339格式 */ + @SerializedName("time_start") + private String timeStart; + + /** 交易结束时间 说明:订单失效时间,格式为rfc3339格式 */ + @SerializedName("time_expire") + private String timeExpire; + + /** 通知地址 说明:有效性:1. HTTPS;2. 不允许携带查询串。 */ + @SerializedName("notify_url") + private String notifyUrl; + + 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 String getTimeStart() { + return timeStart; + } + + public void setTimeStart(String timeStart) { + this.timeStart = timeStart; + } + + public String getTimeExpire() { + return timeExpire; + } + + public void setTimeExpire(String timeExpire) { + this.timeExpire = timeExpire; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayRequest {\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(" timeStart: ").append(toIndentedString(timeStart)).append("\n"); + sb.append(" timeExpire: ").append(toIndentedString(timeExpire)).append("\n"); + sb.append(" notifyUrl: ").append(toIndentedString(notifyUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayResponse.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayResponse.java new file mode 100644 index 00000000..97564f03 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/PrepayResponse.java @@ -0,0 +1,40 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayResponse */ +public class PrepayResponse { + /** h5Url 说明:支付跳转链接 */ + @SerializedName("h5_url") + private String h5Url; + + public String getH5Url() { + return h5Url; + } + + public void setH5Url(String h5Url) { + this.h5Url = h5Url; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayResponse {\n"); + sb.append(" h5Url: ").append(toIndentedString(h5Url)).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 new file mode 100644 index 00000000..b99245eb --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/QueryOrderByCombineOutTradeNoRequest.java @@ -0,0 +1,42 @@ +// 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/model/SceneInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SceneInfo.java new file mode 100644 index 00000000..6e1023de --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SceneInfo.java @@ -0,0 +1,79 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** 支付场景描述 */ +public class SceneInfo { + /** 用户终端IP 说明:用户终端IP */ + @SerializedName("payer_client_ip") + private String payerClientIp; + + /** 商户端设备号 说明:商户端设备号 */ + @SerializedName("device_id") + private String deviceId; + + /** storeInfo */ + @SerializedName("store_info") + private StoreInfo storeInfo; + + /** h5Info */ + @SerializedName("h5_info") + private H5Info h5Info; + + 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; + } + + public H5Info getH5Info() { + return h5Info; + } + + public void setH5Info(H5Info h5Info) { + this.h5Info = h5Info; + } + + @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(" h5Info: ").append(toIndentedString(h5Info)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SettleInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SettleInfo.java new file mode 100644 index 00000000..6d130c2e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/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.h5.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/h5/model/StoreInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/StoreInfo.java new file mode 100644 index 00000000..d8010768 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/StoreInfo.java @@ -0,0 +1,79 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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.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/h5/model/SubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SubOrder.java new file mode 100644 index 00000000..05560d11 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/SubOrder.java @@ -0,0 +1,137 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.h5.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class SubOrder { + + /** 子商户号 说明:子单发起方商户号,必须与发起方appid有绑定关系。服务商和电商模式下,传服务商商户号。 */ + @SerializedName("mchid") + private String mchid; + + /** 附加数据 说明:附加数据 */ + @SerializedName("attach") + private String attach; + + /** amount */ + @SerializedName("amount") + private Amount amount; + + /** 子单商户订单号 */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** 订单优惠标记 说明:商品标记,代金券或立减优惠功能的参数。 */ + @SerializedName("goods_tag") + private String goodsTag; + + /** + * 二级商户号 + * 说明:二级商户商户号,由微信支付生成并下发。 + * 服务商子商户的商户号,被合单方。直连商户不用传二级商户号。 + * 注意:仅适用于电商平台,服务商*/ + @SerializedName("sub_mchid") + private String subMchid; + + /** 商品描述 说明:商品描述 */ + @SerializedName("description") + private String description; + + /** settleInfo */ + @SerializedName("settle_info") + private SettleInfo settleInfo; + + /** 子商户应用ID 说明:子商户申请的公众号appid */ + @SerializedName("sub_appid") + private String subAppid; + + public String getMchid() { + return mchid; + } + + public void setMchid(String mchid) { + this.mchid = mchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public Amount getAmount() { + return amount; + } + + public void setAmount(Amount amount) { + this.amount = amount; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public String getGoodsTag() { + return goodsTag; + } + + public void setGoodsTag(String goodsTag) { + this.goodsTag = goodsTag; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public SettleInfo getSettleInfo() { + return settleInfo; + } + + public void setSettleInfo(SettleInfo settleInfo) { + this.settleInfo = settleInfo; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubOrder {\n"); + sb.append(" mchid: ").append(toIndentedString(mchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" goodsTag: ").append(toIndentedString(goodsTag)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" settleInfo: ").append(toIndentedString(settleInfo)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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/h5/model/Transaction.java new file mode 100644 index 00000000..354ee935 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Transaction.java @@ -0,0 +1,273 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// H5支付 +// +// H5支付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.SerializedName; +import com.wechat.pay.java.service.ecommercecombinepayments.model.PromotionDetail; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; + +import java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** */ +public class Transaction { + /** amount */ + @SerializedName("amount") + private TransactionAmount amount; + + /** spAppid */ + @SerializedName("sp_appid") + private String spAppid; + + /** subAppid */ + @SerializedName("sub_appid") + private String subAppid; + + /** spMchid */ + @SerializedName("sp_mchid") + private String spMchid; + + /** subMchid */ + @SerializedName("sub_mchid") + private String subMchid; + + /** attach */ + @SerializedName("attach") + private String attach; + + /** bankType */ + @SerializedName("bank_type") + private String bankType; + + /** outTradeNo */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** payer */ + @SerializedName("payer") + private TransactionPayer payer; + + /** promotionDetail */ + @SerializedName("promotion_detail") + private List promotionDetail; + + /** successTime */ + @SerializedName("success_time") + private String successTime; + + /** tradeState */ + public enum TradeStateEnum { + @SerializedName("SUCCESS") + SUCCESS, + + @SerializedName("REFUND") + REFUND, + + @SerializedName("NOTPAY") + NOTPAY, + + @SerializedName("CLOSED") + CLOSED, + + @SerializedName("REVOKED") + REVOKED, + + @SerializedName("USERPAYING") + USERPAYING, + + @SerializedName("PAYERROR") + PAYERROR, + + @SerializedName("ACCEPT") + ACCEPT + } + + @SerializedName("trade_state") + private TradeStateEnum tradeState; + + /** tradeStateDesc */ + @SerializedName("trade_state_desc") + private String tradeStateDesc; + + /** tradeType */ + public enum TradeTypeEnum { + @SerializedName("JSAPI") + JSAPI, + + @SerializedName("NATIVE") + NATIVE, + + @SerializedName("APP") + APP, + + @SerializedName("MICROPAY") + MICROPAY, + + @SerializedName("MWEB") + MWEB, + + @SerializedName("FACEPAY") + FACEPAY + } + + @SerializedName("trade_type") + private TradeTypeEnum tradeType; + + /** transactionId */ + @SerializedName("transaction_id") + private String transactionId; + + public TransactionAmount getAmount() { + return amount; + } + + public void setAmount(TransactionAmount amount) { + this.amount = amount; + } + + public String getSpAppid() { + return spAppid; + } + + public void setSpAppid(String spAppid) { + this.spAppid = spAppid; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + public String getSpMchid() { + return spMchid; + } + + public void setSpMchid(String spMchid) { + this.spMchid = spMchid; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public TransactionPayer getPayer() { + return payer; + } + + public void setPayer(TransactionPayer payer) { + this.payer = payer; + } + + public List getPromotionDetail() { + return promotionDetail; + } + + public void setPromotionDetail(List promotionDetail) { + this.promotionDetail = promotionDetail; + } + + public String getSuccessTime() { + return successTime; + } + + public void setSuccessTime(String successTime) { + this.successTime = successTime; + } + + public TradeStateEnum getTradeState() { + return tradeState; + } + + public void setTradeState(TradeStateEnum tradeState) { + this.tradeState = tradeState; + } + + public String getTradeStateDesc() { + return tradeStateDesc; + } + + public void setTradeStateDesc(String tradeStateDesc) { + this.tradeStateDesc = tradeStateDesc; + } + + public TradeTypeEnum getTradeType() { + return tradeType; + } + + public void setTradeType(TradeTypeEnum tradeType) { + this.tradeType = tradeType; + } + + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transaction {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); + sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); + sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); + sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); + sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).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 new file mode 100644 index 00000000..899484cc --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/package-info.java @@ -0,0 +1,2 @@ +/** 服务商-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 new file mode 100644 index 00000000..8ba98372 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiService.java @@ -0,0 +1,190 @@ +// 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.jsapi; + +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.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; + +/** JsapiService服务 */ +public class JsapiService { + + private final HttpClient httpClient; + private final HostName hostName; + + private JsapiService(HttpClient httpClient, HostName hostName) { + this.httpClient = requireNonNull(httpClient); + this.hostName = hostName; + } + + /** JsapiService构造器 */ + 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 JsapiService + */ + public JsapiService build() { + return new JsapiService(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); + } + + /** + * JSAPI支付下单 + * + * @param request 请求参数 + * @return PrepayResponse + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public PrepayResponse prepay(PrepayRequest request) { + String requestPath = "https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi"; + PrepayRequest realRequest = request; + 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(); + HttpResponse httpResponse = + httpClient.execute(httpRequest, PrepayResponse.class); + 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 new file mode 100644 index 00000000..a6050ad4 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/JsapiServiceExtension.java @@ -0,0 +1,135 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi; + +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.cipher.Signer; +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.HostName; +import com.wechat.pay.java.core.http.HttpClient; +import com.wechat.pay.java.core.util.NonceUtil; +import com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Instant; + +/** + * JSAPI 支付的扩展类。 + * + *

它封装了 JsapiService,并提供了一个增强的 JSAPI 下单方法 prepayWithRequestPayment。 + */ +public class JsapiServiceExtension { + private final Signer signer; + private final String signType; + private final JsapiService jsapiService; + private static final Logger logger = LoggerFactory.getLogger(JsapiServiceExtension.class); + + private JsapiServiceExtension( + Config config, HttpClient httpClient, HostName hostName, String signType) { + this.signer = config.createSigner(); + JsapiService.Builder builder = new JsapiService.Builder().config(config); + this.signType = signType; + if (httpClient != null) { + builder.httpClient(httpClient); + } + if (hostName != null) { + builder.hostName(hostName); + } + this.jsapiService = builder.build(); + } + + /** + * JSAPI 支付下单,并返回 JSAPI 调起支付数据。推荐使用! + * + *

请求成功后,该方法返回预支付交易会话标识 prepay_id 和客户端 JSAPI 调起支付所需参数。 它相比 JsapiService.prepay + * 更简单易用,因为无需开发者自行计算调起支付签名。 + * + * @param request 请求参数 商户申请的公众号对应的appid + * @param requestPaymentAppid 商户申请的公众号对应的appid + * @return PrepayWithRequestPaymentResponse + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public PrepayWithRequestPaymentResponse prepayWithRequestPayment( + PrepayRequest request, String requestPaymentAppid) { + String prepayId = jsapiService.prepay(request).getPrepayId(); + long timestamp = Instant.now().getEpochSecond(); + String nonceStr = NonceUtil.createNonce(32); + String packageVal = "prepay_id=" + prepayId; + String message = + requestPaymentAppid + "\n" + timestamp + "\n" + nonceStr + "\n" + packageVal + "\n"; + logger.debug("Message for RequestPayment signatures is[{}]", message); + String sign = signer.sign(message).getSign(); + PrepayWithRequestPaymentResponse response = new PrepayWithRequestPaymentResponse(); + response.setAppId(requestPaymentAppid); + response.setTimeStamp(String.valueOf(timestamp)); + response.setNonceStr(nonceStr); + response.setPackageVal(packageVal); + response.setSignType(signType); + response.setPaySign(sign); + 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; + private HostName hostName; + private String signType; + + public Builder config(Config config) { + this.config = config; + return this; + } + + public Builder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder hostName(HostName hostName) { + this.hostName = hostName; + return this; + } + + public Builder signType(String signType) { + this.signType = signType; + return this; + } + + public JsapiServiceExtension build() { + return new JsapiServiceExtension( + config, httpClient, hostName, signType == null ? "RSA" : signType); + } + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Amount.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Amount.java new file mode 100644 index 00000000..dba035d5 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Amount.java @@ -0,0 +1,53 @@ +// 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.jsapi.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** Amount */ +public class Amount { + /** 总金额 说明:订单总金额,单位为分 */ + @SerializedName("total") + private Integer total; + + /** 货币类型 说明:CNY:人民币,境内商户号仅支持人民币。 */ + @SerializedName("currency") + private String currency; + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..51e7e00e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseOrderRequest.java @@ -0,0 +1,70 @@ +// 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 new file mode 100644 index 00000000..0f47103a --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CloseSubOrder.java @@ -0,0 +1,62 @@ +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 new file mode 100644 index 00000000..63d715dd --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/CombinePayerInfo.java @@ -0,0 +1,24 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.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/jsapi/model/PrepayRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayRequest.java new file mode 100644 index 00000000..ed368875 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayRequest.java @@ -0,0 +1,148 @@ +// 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 java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayRequest */ +public class PrepayRequest { + + + /** 合单商户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; + + /** 子单信息 最多支持子单条数:50 */ + @SerializedName("sub_orders") + private List subOrders; + + /** 支付者信息 */ + @SerializedName("combine_payer_info") + private CombinePayerInfo combinePayerInfo; + + /** 交易起始时间 说明:交易起始时间,格式为rfc3339格式 */ + @SerializedName("time_start") + private String timeStart; + + /** 交易结束时间 说明:订单失效时间,格式为rfc3339格式 */ + @SerializedName("time_expire") + private String timeExpire; + + /** 通知地址 说明:有效性:1. HTTPS;2. 不允许携带查询串。 */ + @SerializedName("notify_url") + private String notifyUrl; + + 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; + } + + public String getTimeStart() { + return timeStart; + } + + public void setTimeStart(String timeStart) { + this.timeStart = timeStart; + } + + public String getTimeExpire() { + return timeExpire; + } + + public void setTimeExpire(String timeExpire) { + this.timeExpire = timeExpire; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayRequest {\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(" timeStart: ").append(toIndentedString(timeStart)).append("\n"); + sb.append(" timeExpire: ").append(toIndentedString(timeExpire)).append("\n"); + sb.append(" notifyUrl: ").append(toIndentedString(notifyUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayResponse.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayResponse.java new file mode 100644 index 00000000..78db6585 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayResponse.java @@ -0,0 +1,40 @@ +// 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.jsapi.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayResponse */ +public class PrepayResponse { + /** prepayId 说明:预支付交易会话标识 */ + @SerializedName("prepay_id") + private String prepayId; + + public String getPrepayId() { + return prepayId; + } + + public void setPrepayId(String prepayId) { + this.prepayId = prepayId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayResponse {\n"); + sb.append(" prepayId: ").append(toIndentedString(prepayId)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayWithRequestPaymentResponse.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayWithRequestPaymentResponse.java new file mode 100644 index 00000000..06f512a8 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/PrepayWithRequestPaymentResponse.java @@ -0,0 +1,88 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class PrepayWithRequestPaymentResponse { + + @SerializedName("appId") + private String appId; + + @SerializedName("timeStamp") + private String timestamp; + + @SerializedName("nonceStr") + private String nonceStr; + + @SerializedName("package") + private String packageVal; + + @SerializedName("signType") + private String signType; + + @SerializedName("paySign") + private String paySign; + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getTimeStamp() { + return timestamp; + } + + public void setTimeStamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getNonceStr() { + return nonceStr; + } + + public void setNonceStr(String nonceStr) { + this.nonceStr = nonceStr; + } + + public String getPackageVal() { + return packageVal; + } + + public void setPackageVal(String packageVal) { + this.packageVal = packageVal; + } + + public String getSignType() { + return signType; + } + + public void setSignType(String signType) { + this.signType = signType; + } + + public String getPaySign() { + return paySign; + } + + public void setPaySign(String paySign) { + this.paySign = paySign; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayWithRequestPaymentRequest {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" nonceStr: ").append(toIndentedString(nonceStr)).append("\n"); + sb.append(" packageVal: ").append(toIndentedString(packageVal)).append("\n"); + sb.append(" signType: ").append(toIndentedString(signType)).append("\n"); + sb.append(" paySign: ").append(toIndentedString(paySign)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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/jsapi/model/QueryOrderByCombineOutTradeNoRequest.java new file mode 100644 index 00000000..368c479a --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/QueryOrderByCombineOutTradeNoRequest.java @@ -0,0 +1,42 @@ +// 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 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/jsapi/model/SceneInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SceneInfo.java new file mode 100644 index 00000000..a4230f14 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SceneInfo.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.jsapi.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** 支付场景描述 */ +public class SceneInfo { + /** 用户终端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/jsapi/model/SettleInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SettleInfo.java new file mode 100644 index 00000000..4ad4c785 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/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.jsapi.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/jsapi/model/StoreInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/StoreInfo.java new file mode 100644 index 00000000..6ad59143 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/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.jsapi.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/jsapi/model/SubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SubOrder.java new file mode 100644 index 00000000..04282d77 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/SubOrder.java @@ -0,0 +1,137 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class SubOrder { + + /** 子商户号 说明:子单发起方商户号,必须与发起方appid有绑定关系。服务商和电商模式下,传服务商商户号。 */ + @SerializedName("mchid") + private String mchid; + + /** 附加数据 说明:附加数据 */ + @SerializedName("attach") + private String attach; + + /** amount */ + @SerializedName("amount") + private Amount amount; + + /** 子单商户订单号 */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** 订单优惠标记 说明:商品标记,代金券或立减优惠功能的参数。 */ + @SerializedName("goods_tag") + private String goodsTag; + + /** + * 二级商户号 + * 说明:二级商户商户号,由微信支付生成并下发。 + * 服务商子商户的商户号,被合单方。直连商户不用传二级商户号。 + * 注意:仅适用于电商平台,服务商*/ + @SerializedName("sub_mchid") + private String subMchid; + + /** 商品描述 说明:商品描述 */ + @SerializedName("description") + private String description; + + /** settleInfo */ + @SerializedName("settle_info") + private SettleInfo settleInfo; + + /** 子商户应用ID 说明:子商户申请的公众号appid */ + @SerializedName("sub_appid") + private String subAppid; + + public String getMchid() { + return mchid; + } + + public void setMchid(String mchid) { + this.mchid = mchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public Amount getAmount() { + return amount; + } + + public void setAmount(Amount amount) { + this.amount = amount; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public String getGoodsTag() { + return goodsTag; + } + + public void setGoodsTag(String goodsTag) { + this.goodsTag = goodsTag; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public SettleInfo getSettleInfo() { + return settleInfo; + } + + public void setSettleInfo(SettleInfo settleInfo) { + this.settleInfo = settleInfo; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubOrder {\n"); + sb.append(" mchid: ").append(toIndentedString(mchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" goodsTag: ").append(toIndentedString(goodsTag)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" settleInfo: ").append(toIndentedString(settleInfo)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..49eea249 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java @@ -0,0 +1,273 @@ +// 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.jsapi.model; + +import com.google.gson.annotations.SerializedName; +import com.wechat.pay.java.service.ecommercecombinepayments.model.PromotionDetail; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; + +import java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** */ +public class Transaction { + /** amount */ + @SerializedName("amount") + private TransactionAmount amount; + + /** spAppid */ + @SerializedName("sp_appid") + private String spAppid; + + /** subAppid */ + @SerializedName("sub_appid") + private String subAppid; + + /** spMchid */ + @SerializedName("sp_mchid") + private String spMchid; + + /** subMchid */ + @SerializedName("sub_mchid") + private String subMchid; + + /** attach */ + @SerializedName("attach") + private String attach; + + /** bankType */ + @SerializedName("bank_type") + private String bankType; + + /** outTradeNo */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** payer */ + @SerializedName("payer") + private TransactionPayer payer; + + /** promotionDetail */ + @SerializedName("promotion_detail") + private List promotionDetail; + + /** successTime */ + @SerializedName("success_time") + private String successTime; + + /** tradeState */ + public enum TradeStateEnum { + @SerializedName("SUCCESS") + SUCCESS, + + @SerializedName("REFUND") + REFUND, + + @SerializedName("NOTPAY") + NOTPAY, + + @SerializedName("CLOSED") + CLOSED, + + @SerializedName("REVOKED") + REVOKED, + + @SerializedName("USERPAYING") + USERPAYING, + + @SerializedName("PAYERROR") + PAYERROR, + + @SerializedName("ACCEPT") + ACCEPT + } + + @SerializedName("trade_state") + private TradeStateEnum tradeState; + + /** tradeStateDesc */ + @SerializedName("trade_state_desc") + private String tradeStateDesc; + + /** tradeType */ + public enum TradeTypeEnum { + @SerializedName("JSAPI") + JSAPI, + + @SerializedName("NATIVE") + NATIVE, + + @SerializedName("APP") + APP, + + @SerializedName("MICROPAY") + MICROPAY, + + @SerializedName("MWEB") + MWEB, + + @SerializedName("FACEPAY") + FACEPAY + } + + @SerializedName("trade_type") + private TradeTypeEnum tradeType; + + /** transactionId */ + @SerializedName("transaction_id") + private String transactionId; + + public TransactionAmount getAmount() { + return amount; + } + + public void setAmount(TransactionAmount amount) { + this.amount = amount; + } + + public String getSpAppid() { + return spAppid; + } + + public void setSpAppid(String spAppid) { + this.spAppid = spAppid; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + public String getSpMchid() { + return spMchid; + } + + public void setSpMchid(String spMchid) { + this.spMchid = spMchid; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public TransactionPayer getPayer() { + return payer; + } + + public void setPayer(TransactionPayer payer) { + this.payer = payer; + } + + public List getPromotionDetail() { + return promotionDetail; + } + + public void setPromotionDetail(List promotionDetail) { + this.promotionDetail = promotionDetail; + } + + public String getSuccessTime() { + return successTime; + } + + public void setSuccessTime(String successTime) { + this.successTime = successTime; + } + + public TradeStateEnum getTradeState() { + return tradeState; + } + + public void setTradeState(TradeStateEnum tradeState) { + this.tradeState = tradeState; + } + + public String getTradeStateDesc() { + return tradeStateDesc; + } + + public void setTradeStateDesc(String tradeStateDesc) { + this.tradeStateDesc = tradeStateDesc; + } + + public TradeTypeEnum getTradeType() { + return tradeType; + } + + public void setTradeType(TradeTypeEnum tradeType) { + this.tradeType = tradeType; + } + + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transaction {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); + sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); + sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); + sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); + sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).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 new file mode 100644 index 00000000..7b72483e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/package-info.java @@ -0,0 +1,2 @@ +/** 服务商-JSAPI支付API */ +package com.wechat.pay.java.service.ecommercecombinepayments.jsapi; 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/model/PromotionDetail.java new file mode 100644 index 00000000..6e1b3f90 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionDetail.java @@ -0,0 +1,190 @@ +// 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 java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PromotionDetail */ +public class PromotionDetail { + /** 券ID 说明:券ID */ + @SerializedName("coupon_id") + private String couponId; + + /** 优惠名称 说明:优惠名称 */ + @SerializedName("name") + private String name; + + /** GLOBAL:全场代金券;SINGLE:单品优惠 */ + public enum ScopeEnum { + @SerializedName("GLOBAL") + GLOBAL, + + @SerializedName("SINGLE") + SINGLE + } + + @SerializedName("scope") + private ScopeEnum scope; + + /** CASH:充值;NOCASH:预充值。 */ + public enum TypeEnum { + @SerializedName("CASH") + CASH, + + @SerializedName("NOCASH") + NOCASH + } + + @SerializedName("type") + private TypeEnum type; + + /** 优惠券面额 说明:优惠券面额 */ + @SerializedName("amount") + private Integer amount; + + /** 活动ID 说明:活动ID,批次ID */ + @SerializedName("stock_id") + private String stockId; + + /** 微信出资 说明:单位为分 */ + @SerializedName("wechatpay_contribute") + private Integer wechatpayContribute; + + /** 商户出资 说明:单位为分 */ + @SerializedName("merchant_contribute") + private Integer merchantContribute; + + /** 其他出资 说明:单位为分 */ + @SerializedName("other_contribute") + private Integer otherContribute; + + /** 优惠币种 说明:CNY:人民币,境内商户号仅支持人民币。 */ + @SerializedName("currency") + private String currency; + + /** 单品列表 说明: */ + @SerializedName("goods_detail") + private List goodsDetail; + + public String getCouponId() { + return couponId; + } + + public void setCouponId(String couponId) { + this.couponId = couponId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ScopeEnum getScope() { + return scope; + } + + public void setScope(ScopeEnum scope) { + this.scope = scope; + } + + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getStockId() { + return stockId; + } + + public void setStockId(String stockId) { + this.stockId = stockId; + } + + public Integer getWechatpayContribute() { + return wechatpayContribute; + } + + public void setWechatpayContribute(Integer wechatpayContribute) { + this.wechatpayContribute = wechatpayContribute; + } + + public Integer getMerchantContribute() { + return merchantContribute; + } + + public void setMerchantContribute(Integer merchantContribute) { + this.merchantContribute = merchantContribute; + } + + public Integer getOtherContribute() { + return otherContribute; + } + + public void setOtherContribute(Integer otherContribute) { + this.otherContribute = otherContribute; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public List getGoodsDetail() { + return goodsDetail; + } + + public void setGoodsDetail(List goodsDetail) { + this.goodsDetail = goodsDetail; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromotionDetail {\n"); + sb.append(" couponId: ").append(toIndentedString(couponId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" stockId: ").append(toIndentedString(stockId)).append("\n"); + sb.append(" wechatpayContribute: ") + .append(toIndentedString(wechatpayContribute)) + .append("\n"); + sb.append(" merchantContribute: ").append(toIndentedString(merchantContribute)).append("\n"); + sb.append(" otherContribute: ").append(toIndentedString(otherContribute)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" goodsDetail: ").append(toIndentedString(goodsDetail)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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/model/PromotionGoodsDetail.java new file mode 100644 index 00000000..0ff80518 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/PromotionGoodsDetail.java @@ -0,0 +1,92 @@ +// 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; + +/** PromotionGoodsDetail */ +public class PromotionGoodsDetail { + /** 商品编码 说明:商品编码 */ + @SerializedName("goods_id") + private String goodsId; + + /** 商品数量 说明:商品数量 */ + @SerializedName("quantity") + private Integer quantity; + + /** 商品价格 说明:商品价格 */ + @SerializedName("unit_price") + private Integer unitPrice; + + /** 商品优惠金额 说明:商品优惠金额 */ + @SerializedName("discount_amount") + private Integer discountAmount; + + /** 商品备注 说明:商品备注 */ + @SerializedName("goods_remark") + private String goodsRemark; + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Integer getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(Integer unitPrice) { + this.unitPrice = unitPrice; + } + + public Integer getDiscountAmount() { + return discountAmount; + } + + public void setDiscountAmount(Integer discountAmount) { + this.discountAmount = discountAmount; + } + + public String getGoodsRemark() { + return goodsRemark; + } + + public void setGoodsRemark(String goodsRemark) { + this.goodsRemark = goodsRemark; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromotionGoodsDetail {\n"); + sb.append(" goodsId: ").append(toIndentedString(goodsId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" unitPrice: ").append(toIndentedString(unitPrice)).append("\n"); + sb.append(" discountAmount: ").append(toIndentedString(discountAmount)).append("\n"); + sb.append(" goodsRemark: ").append(toIndentedString(goodsRemark)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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/model/TransactionAmount.java new file mode 100644 index 00000000..58954966 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionAmount.java @@ -0,0 +1,79 @@ +// 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; + +/** TransactionAmount */ +public class TransactionAmount { + /** currency */ + @SerializedName("currency") + private String currency; + + /** payerCurrency */ + @SerializedName("payer_currency") + private String payerCurrency; + + /** payerTotal */ + @SerializedName("payer_total") + private Integer payerTotal; + + /** total */ + @SerializedName("total") + private Integer total; + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getPayerCurrency() { + return payerCurrency; + } + + public void setPayerCurrency(String payerCurrency) { + this.payerCurrency = payerCurrency; + } + + public Integer getPayerTotal() { + return payerTotal; + } + + public void setPayerTotal(Integer payerTotal) { + this.payerTotal = payerTotal; + } + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransactionAmount {\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" payerCurrency: ").append(toIndentedString(payerCurrency)).append("\n"); + sb.append(" payerTotal: ").append(toIndentedString(payerTotal)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..02691131 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/TransactionPayer.java @@ -0,0 +1,53 @@ +// 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 new file mode 100644 index 00000000..cf58960d --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/NativePayService.java @@ -0,0 +1,190 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// Native支付 +// +// Native支付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; + +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.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; + +/** NativePayService服务 */ +public class NativePayService { + + private final HttpClient httpClient; + private final HostName hostName; + + private NativePayService(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 NativePayService build() { + return new NativePayService(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); + } + + /** + * Native支付预下单 + * + * @param request 请求参数 + * @return PrepayResponse + * @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。 + * @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。 + * @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。 + * @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。 + */ + public PrepayResponse prepay(PrepayRequest request) { + String requestPath = "https://api.mch.weixin.qq.com/v3/combine-transactions/native"; + PrepayRequest realRequest = request; + 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(); + HttpResponse httpResponse = + httpClient.execute(httpRequest, PrepayResponse.class); + 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/Amount.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Amount.java new file mode 100644 index 00000000..d75e31f3 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Amount.java @@ -0,0 +1,53 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// Native支付 +// +// Native支付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 static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** Amount */ +public class Amount { + /** 总金额 说明:订单总金额,单位为分 */ + @SerializedName("total") + private Integer total; + + /** 货币类型 说明:CNY:人民币,境内商户号仅支持人民币。 */ + @SerializedName("currency") + private String currency; + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..0524bbe8 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseOrderRequest.java @@ -0,0 +1,70 @@ +// 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 new file mode 100644 index 00000000..79bf7221 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CloseSubOrder.java @@ -0,0 +1,62 @@ +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/PrepayRequest.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayRequest.java new file mode 100644 index 00000000..ee36b579 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayRequest.java @@ -0,0 +1,135 @@ +// 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 java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayRequest */ +public class PrepayRequest { + + + /** 合单商户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; + + /** 子单信息 最多支持子单条数:50 */ + @SerializedName("sub_orders") + private List subOrders; + + /** 交易起始时间 说明:交易起始时间,格式为rfc3339格式 */ + @SerializedName("time_start") + private String timeStart; + + /** 交易结束时间 说明:订单失效时间,格式为rfc3339格式 */ + @SerializedName("time_expire") + private String timeExpire; + + /** 通知地址 说明:有效性:1. HTTPS;2. 不允许携带查询串。 */ + @SerializedName("notify_url") + private String notifyUrl; + + 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 String getTimeStart() { + return timeStart; + } + + public void setTimeStart(String timeStart) { + this.timeStart = timeStart; + } + + public String getTimeExpire() { + return timeExpire; + } + + public void setTimeExpire(String timeExpire) { + this.timeExpire = timeExpire; + } + + public String getNotifyUrl() { + return notifyUrl; + } + + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayRequest {\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(" timeStart: ").append(toIndentedString(timeStart)).append("\n"); + sb.append(" timeExpire: ").append(toIndentedString(timeExpire)).append("\n"); + sb.append(" notifyUrl: ").append(toIndentedString(notifyUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} diff --git a/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayResponse.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayResponse.java new file mode 100644 index 00000000..3896a801 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/PrepayResponse.java @@ -0,0 +1,40 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// Native支付 +// +// Native支付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 static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** PrepayResponse */ +public class PrepayResponse { + /** codeUrl 说明:二维码链接 */ + @SerializedName("code_url") + private String codeUrl; + + public String getCodeUrl() { + return codeUrl; + } + + public void setCodeUrl(String codeUrl) { + this.codeUrl = codeUrl; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrepayResponse {\n"); + sb.append(" codeUrl: ").append(toIndentedString(codeUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 new file mode 100644 index 00000000..7dc8cc55 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/QueryOrderByCombineOutTradeNoRequest.java @@ -0,0 +1,42 @@ +// 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/SceneInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SceneInfo.java new file mode 100644 index 00000000..d76e42f3 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SceneInfo.java @@ -0,0 +1,66 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// Native支付 +// +// Native支付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 static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** 支付场景描述 */ +public class SceneInfo { + /** 用户终端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/nativepay/model/SettleInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SettleInfo.java new file mode 100644 index 00000000..c9ca8a6e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/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.nativepay.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/nativepay/model/StoreInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/StoreInfo.java new file mode 100644 index 00000000..d63abbd2 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/StoreInfo.java @@ -0,0 +1,79 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// Native支付 +// +// Native支付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 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/nativepay/model/SubOrder.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SubOrder.java new file mode 100644 index 00000000..0aafd62c --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/SubOrder.java @@ -0,0 +1,137 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; + +import com.google.gson.annotations.SerializedName; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class SubOrder { + + /** 子商户号 说明:子单发起方商户号,必须与发起方appid有绑定关系。服务商和电商模式下,传服务商商户号。 */ + @SerializedName("mchid") + private String mchid; + + /** 附加数据 说明:附加数据 */ + @SerializedName("attach") + private String attach; + + /** amount */ + @SerializedName("amount") + private Amount amount; + + /** 子单商户订单号 */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** 订单优惠标记 说明:商品标记,代金券或立减优惠功能的参数。 */ + @SerializedName("goods_tag") + private String goodsTag; + + /** + * 二级商户号 + * 说明:二级商户商户号,由微信支付生成并下发。 + * 服务商子商户的商户号,被合单方。直连商户不用传二级商户号。 + * 注意:仅适用于电商平台,服务商*/ + @SerializedName("sub_mchid") + private String subMchid; + + /** 商品描述 说明:商品描述 */ + @SerializedName("description") + private String description; + + /** settleInfo */ + @SerializedName("settle_info") + private SettleInfo settleInfo; + + /** 子商户应用ID 说明:子商户申请的公众号appid */ + @SerializedName("sub_appid") + private String subAppid; + + public String getMchid() { + return mchid; + } + + public void setMchid(String mchid) { + this.mchid = mchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public Amount getAmount() { + return amount; + } + + public void setAmount(Amount amount) { + this.amount = amount; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public String getGoodsTag() { + return goodsTag; + } + + public void setGoodsTag(String goodsTag) { + this.goodsTag = goodsTag; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public SettleInfo getSettleInfo() { + return settleInfo; + } + + public void setSettleInfo(SettleInfo settleInfo) { + this.settleInfo = settleInfo; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubOrder {\n"); + sb.append(" mchid: ").append(toIndentedString(mchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" goodsTag: ").append(toIndentedString(goodsTag)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" settleInfo: ").append(toIndentedString(settleInfo)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).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 new file mode 100644 index 00000000..0aba6b81 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Transaction.java @@ -0,0 +1,273 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// Native支付 +// +// Native支付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.PromotionDetail; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; +import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; + +import java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +/** */ +public class Transaction { + /** amount */ + @SerializedName("amount") + private TransactionAmount amount; + + /** spAppid */ + @SerializedName("sp_appid") + private String spAppid; + + /** subAppid */ + @SerializedName("sub_appid") + private String subAppid; + + /** spMchid */ + @SerializedName("sp_mchid") + private String spMchid; + + /** subMchid */ + @SerializedName("sub_mchid") + private String subMchid; + + /** attach */ + @SerializedName("attach") + private String attach; + + /** bankType */ + @SerializedName("bank_type") + private String bankType; + + /** outTradeNo */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** payer */ + @SerializedName("payer") + private TransactionPayer payer; + + /** promotionDetail */ + @SerializedName("promotion_detail") + private List promotionDetail; + + /** successTime */ + @SerializedName("success_time") + private String successTime; + + /** tradeState */ + public enum TradeStateEnum { + @SerializedName("SUCCESS") + SUCCESS, + + @SerializedName("REFUND") + REFUND, + + @SerializedName("NOTPAY") + NOTPAY, + + @SerializedName("CLOSED") + CLOSED, + + @SerializedName("REVOKED") + REVOKED, + + @SerializedName("USERPAYING") + USERPAYING, + + @SerializedName("PAYERROR") + PAYERROR, + + @SerializedName("ACCEPT") + ACCEPT + } + + @SerializedName("trade_state") + private TradeStateEnum tradeState; + + /** tradeStateDesc */ + @SerializedName("trade_state_desc") + private String tradeStateDesc; + + /** tradeType */ + public enum TradeTypeEnum { + @SerializedName("JSAPI") + JSAPI, + + @SerializedName("NATIVE") + NATIVE, + + @SerializedName("APP") + APP, + + @SerializedName("MICROPAY") + MICROPAY, + + @SerializedName("MWEB") + MWEB, + + @SerializedName("FACEPAY") + FACEPAY + } + + @SerializedName("trade_type") + private TradeTypeEnum tradeType; + + /** transactionId */ + @SerializedName("transaction_id") + private String transactionId; + + public TransactionAmount getAmount() { + return amount; + } + + public void setAmount(TransactionAmount amount) { + this.amount = amount; + } + + public String getSpAppid() { + return spAppid; + } + + public void setSpAppid(String spAppid) { + this.spAppid = spAppid; + } + + public String getSubAppid() { + return subAppid; + } + + public void setSubAppid(String subAppid) { + this.subAppid = subAppid; + } + + public String getSpMchid() { + return spMchid; + } + + public void setSpMchid(String spMchid) { + this.spMchid = spMchid; + } + + public String getSubMchid() { + return subMchid; + } + + public void setSubMchid(String subMchid) { + this.subMchid = subMchid; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getOutTradeNo() { + return outTradeNo; + } + + public void setOutTradeNo(String outTradeNo) { + this.outTradeNo = outTradeNo; + } + + public TransactionPayer getPayer() { + return payer; + } + + public void setPayer(TransactionPayer payer) { + this.payer = payer; + } + + public List getPromotionDetail() { + return promotionDetail; + } + + public void setPromotionDetail(List promotionDetail) { + this.promotionDetail = promotionDetail; + } + + public String getSuccessTime() { + return successTime; + } + + public void setSuccessTime(String successTime) { + this.successTime = successTime; + } + + public TradeStateEnum getTradeState() { + return tradeState; + } + + public void setTradeState(TradeStateEnum tradeState) { + this.tradeState = tradeState; + } + + public String getTradeStateDesc() { + return tradeStateDesc; + } + + public void setTradeStateDesc(String tradeStateDesc) { + this.tradeStateDesc = tradeStateDesc; + } + + public TradeTypeEnum getTradeType() { + return tradeType; + } + + public void setTradeType(TradeTypeEnum tradeType) { + this.tradeType = tradeType; + } + + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transaction {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); + sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); + sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); + sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); + sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); + sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).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 new file mode 100644 index 00000000..4399666e --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/package-info.java @@ -0,0 +1,2 @@ +/** 服务商-Native支付API */ +package com.wechat.pay.java.service.ecommercecombinepayments.nativepay; From a8ee364bd45f8cc92db9e77a93bbdf575f0284e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=8E=E9=B9=8F?= Date: Thu, 27 Jun 2024 12:57:29 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=94=B6=E4=BB=98=E9=80=9A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=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/model/Transaction.java | 262 ++++------------- .../h5/model/CombinePayerInfo.java | 24 ++ .../h5/model/Transaction.java | 266 ++++-------------- .../jsapi/model/Transaction.java | 266 ++++-------------- .../model/SubOrderDetail.java | 234 +++++++++++++++ .../nativepay/model/CombinePayerInfo.java | 24 ++ .../nativepay/model/Transaction.java | 266 ++++-------------- 7 files changed, 484 insertions(+), 858 deletions(-) create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CombinePayerInfo.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/SubOrderDetail.java create mode 100644 service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CombinePayerInfo.java 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 index 8eda8e67..fa28aa76 100644 --- 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 @@ -12,9 +12,7 @@ package com.wechat.pay.java.service.ecommercecombinepayments.app.model; import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.PromotionDetail; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; +import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; import java.util.List; @@ -22,251 +20,89 @@ /** */ public class Transaction { - /** amount */ - @SerializedName("amount") - private TransactionAmount amount; - /** spAppid */ - @SerializedName("sp_appid") - private String spAppid; + /** 合单商户appid 说明:合单发起方的appid */ + @SerializedName("combine_appid") + private String combineAppid; - /** subAppid */ - @SerializedName("sub_appid") - private String subAppid; + /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ + @SerializedName("combine_mchid") + private String combineMchid; - /** spMchid */ - @SerializedName("sp_mchid") - private String spMchid; + /** combineOutTradeNo 说明:合单商户订单号 */ + @SerializedName("combine_out_trade_no") + private String combineOutTradeNo; - /** subMchid */ - @SerializedName("sub_mchid") - private String subMchid; + /** sceneInfo */ + @SerializedName("scene_info") + private SceneInfo sceneInfo; - /** attach */ - @SerializedName("attach") - private String attach; + /** sceneInfo */ + @SerializedName("sub_orders") + private List subOrders; - /** bankType */ - @SerializedName("bank_type") - private String bankType; + /** 支付者信息 */ + @SerializedName("combine_payer_info") + private CombinePayerInfo combinePayerInfo; - /** outTradeNo */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** payer */ - @SerializedName("payer") - private TransactionPayer payer; - - /** promotionDetail */ - @SerializedName("promotion_detail") - private List promotionDetail; - - /** successTime */ - @SerializedName("success_time") - private String successTime; - - /** tradeState */ - public enum TradeStateEnum { - @SerializedName("SUCCESS") - SUCCESS, - - @SerializedName("REFUND") - REFUND, - - @SerializedName("NOTPAY") - NOTPAY, - - @SerializedName("CLOSED") - CLOSED, - - @SerializedName("REVOKED") - REVOKED, - - @SerializedName("USERPAYING") - USERPAYING, - - @SerializedName("PAYERROR") - PAYERROR, - - @SerializedName("ACCEPT") - ACCEPT - } - - @SerializedName("trade_state") - private TradeStateEnum tradeState; - - /** tradeStateDesc */ - @SerializedName("trade_state_desc") - private String tradeStateDesc; - - /** tradeType */ - public enum TradeTypeEnum { - @SerializedName("JSAPI") - JSAPI, - - @SerializedName("NATIVE") - NATIVE, - - @SerializedName("APP") - APP, - - @SerializedName("MICROPAY") - MICROPAY, - - @SerializedName("MWEB") - MWEB, - - @SerializedName("FACEPAY") - FACEPAY - } - - @SerializedName("trade_type") - private TradeTypeEnum tradeType; - - /** transactionId */ - @SerializedName("transaction_id") - private String transactionId; - - public TransactionAmount getAmount() { - return amount; - } - - public void setAmount(TransactionAmount amount) { - this.amount = amount; - } - - public String getSpAppid() { - return spAppid; - } - - public void setSpAppid(String spAppid) { - this.spAppid = spAppid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } - - public String getSpMchid() { - return spMchid; - } - - public void setSpMchid(String spMchid) { - this.spMchid = spMchid; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getAttach() { - return attach; - } - - public void setAttach(String attach) { - this.attach = attach; - } - - public String getBankType() { - return bankType; - } - - public void setBankType(String bankType) { - this.bankType = bankType; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public TransactionPayer getPayer() { - return payer; - } - - public void setPayer(TransactionPayer payer) { - this.payer = payer; - } - - public List getPromotionDetail() { - return promotionDetail; + public String getCombineAppid() { + return combineAppid; } - public void setPromotionDetail(List promotionDetail) { - this.promotionDetail = promotionDetail; + public void setCombineAppid(String combineAppid) { + this.combineAppid = combineAppid; } - public String getSuccessTime() { - return successTime; + public String getCombineMchid() { + return combineMchid; } - public void setSuccessTime(String successTime) { - this.successTime = successTime; + public void setCombineMchid(String combineMchid) { + this.combineMchid = combineMchid; } - public TradeStateEnum getTradeState() { - return tradeState; + public String getCombineOutTradeNo() { + return combineOutTradeNo; } - public void setTradeState(TradeStateEnum tradeState) { - this.tradeState = tradeState; + public void setCombineOutTradeNo(String combineOutTradeNo) { + this.combineOutTradeNo = combineOutTradeNo; } - public String getTradeStateDesc() { - return tradeStateDesc; + public SceneInfo getSceneInfo() { + return sceneInfo; } - public void setTradeStateDesc(String tradeStateDesc) { - this.tradeStateDesc = tradeStateDesc; + public void setSceneInfo(SceneInfo sceneInfo) { + this.sceneInfo = sceneInfo; } - public TradeTypeEnum getTradeType() { - return tradeType; + public List getSubOrders() { + return subOrders; } - public void setTradeType(TradeTypeEnum tradeType) { - this.tradeType = tradeType; + public void setSubOrders(List subOrders) { + this.subOrders = subOrders; } - public String getTransactionId() { - return transactionId; + public CombinePayerInfo getCombinePayerInfo() { + return combinePayerInfo; } - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; + public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { + this.combinePayerInfo = combinePayerInfo; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Transaction {\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); - sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); - sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); - sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); - sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); - sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); - sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); - sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); - sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); - sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); - sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); - sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); - sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\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/h5/model/CombinePayerInfo.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CombinePayerInfo.java new file mode 100644 index 00000000..5185e642 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/CombinePayerInfo.java @@ -0,0 +1,24 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.h5.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/h5/model/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/h5/model/Transaction.java index 354ee935..53bba549 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/h5/model/Transaction.java @@ -1,8 +1,8 @@ // Copyright 2021 Tencent Inc. All rights reserved. // -// H5支付 +// APP支付 // -// H5支付API +// APP支付API // // API version: 1.2.3 @@ -12,9 +12,7 @@ package com.wechat.pay.java.service.ecommercecombinepayments.h5.model; import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.PromotionDetail; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; +import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; import java.util.List; @@ -22,251 +20,89 @@ /** */ public class Transaction { - /** amount */ - @SerializedName("amount") - private TransactionAmount amount; - /** spAppid */ - @SerializedName("sp_appid") - private String spAppid; + /** 合单商户appid 说明:合单发起方的appid */ + @SerializedName("combine_appid") + private String combineAppid; - /** subAppid */ - @SerializedName("sub_appid") - private String subAppid; + /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ + @SerializedName("combine_mchid") + private String combineMchid; - /** spMchid */ - @SerializedName("sp_mchid") - private String spMchid; + /** combineOutTradeNo 说明:合单商户订单号 */ + @SerializedName("combine_out_trade_no") + private String combineOutTradeNo; - /** subMchid */ - @SerializedName("sub_mchid") - private String subMchid; + /** sceneInfo */ + @SerializedName("scene_info") + private SceneInfo sceneInfo; - /** attach */ - @SerializedName("attach") - private String attach; + /** sceneInfo */ + @SerializedName("sub_orders") + private List subOrders; - /** bankType */ - @SerializedName("bank_type") - private String bankType; + /** 支付者信息 */ + @SerializedName("combine_payer_info") + private CombinePayerInfo combinePayerInfo; - /** outTradeNo */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** payer */ - @SerializedName("payer") - private TransactionPayer payer; - - /** promotionDetail */ - @SerializedName("promotion_detail") - private List promotionDetail; - - /** successTime */ - @SerializedName("success_time") - private String successTime; - - /** tradeState */ - public enum TradeStateEnum { - @SerializedName("SUCCESS") - SUCCESS, - - @SerializedName("REFUND") - REFUND, - - @SerializedName("NOTPAY") - NOTPAY, - - @SerializedName("CLOSED") - CLOSED, - - @SerializedName("REVOKED") - REVOKED, - - @SerializedName("USERPAYING") - USERPAYING, - - @SerializedName("PAYERROR") - PAYERROR, - - @SerializedName("ACCEPT") - ACCEPT - } - - @SerializedName("trade_state") - private TradeStateEnum tradeState; - - /** tradeStateDesc */ - @SerializedName("trade_state_desc") - private String tradeStateDesc; - - /** tradeType */ - public enum TradeTypeEnum { - @SerializedName("JSAPI") - JSAPI, - - @SerializedName("NATIVE") - NATIVE, - - @SerializedName("APP") - APP, - - @SerializedName("MICROPAY") - MICROPAY, - - @SerializedName("MWEB") - MWEB, - - @SerializedName("FACEPAY") - FACEPAY - } - - @SerializedName("trade_type") - private TradeTypeEnum tradeType; - - /** transactionId */ - @SerializedName("transaction_id") - private String transactionId; - - public TransactionAmount getAmount() { - return amount; - } - - public void setAmount(TransactionAmount amount) { - this.amount = amount; - } - - public String getSpAppid() { - return spAppid; - } - - public void setSpAppid(String spAppid) { - this.spAppid = spAppid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } - - public String getSpMchid() { - return spMchid; - } - - public void setSpMchid(String spMchid) { - this.spMchid = spMchid; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getAttach() { - return attach; - } - - public void setAttach(String attach) { - this.attach = attach; - } - - public String getBankType() { - return bankType; - } - - public void setBankType(String bankType) { - this.bankType = bankType; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public TransactionPayer getPayer() { - return payer; - } - - public void setPayer(TransactionPayer payer) { - this.payer = payer; - } - - public List getPromotionDetail() { - return promotionDetail; + public String getCombineAppid() { + return combineAppid; } - public void setPromotionDetail(List promotionDetail) { - this.promotionDetail = promotionDetail; + public void setCombineAppid(String combineAppid) { + this.combineAppid = combineAppid; } - public String getSuccessTime() { - return successTime; + public String getCombineMchid() { + return combineMchid; } - public void setSuccessTime(String successTime) { - this.successTime = successTime; + public void setCombineMchid(String combineMchid) { + this.combineMchid = combineMchid; } - public TradeStateEnum getTradeState() { - return tradeState; + public String getCombineOutTradeNo() { + return combineOutTradeNo; } - public void setTradeState(TradeStateEnum tradeState) { - this.tradeState = tradeState; + public void setCombineOutTradeNo(String combineOutTradeNo) { + this.combineOutTradeNo = combineOutTradeNo; } - public String getTradeStateDesc() { - return tradeStateDesc; + public SceneInfo getSceneInfo() { + return sceneInfo; } - public void setTradeStateDesc(String tradeStateDesc) { - this.tradeStateDesc = tradeStateDesc; + public void setSceneInfo(SceneInfo sceneInfo) { + this.sceneInfo = sceneInfo; } - public TradeTypeEnum getTradeType() { - return tradeType; + public List getSubOrders() { + return subOrders; } - public void setTradeType(TradeTypeEnum tradeType) { - this.tradeType = tradeType; + public void setSubOrders(List subOrders) { + this.subOrders = subOrders; } - public String getTransactionId() { - return transactionId; + public CombinePayerInfo getCombinePayerInfo() { + return combinePayerInfo; } - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; + public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { + this.combinePayerInfo = combinePayerInfo; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Transaction {\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); - sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); - sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); - sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); - sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); - sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); - sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); - sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); - sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); - sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); - sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); - sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); - sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\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/model/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/jsapi/model/Transaction.java index 49eea249..d2fff21f 100644 --- 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 @@ -1,8 +1,8 @@ // Copyright 2021 Tencent Inc. All rights reserved. // -// JSAPI支付 +// APP支付 // -// JSAPI支付API +// APP支付API // // API version: 1.2.3 @@ -12,9 +12,7 @@ package com.wechat.pay.java.service.ecommercecombinepayments.jsapi.model; import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.PromotionDetail; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; +import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; import java.util.List; @@ -22,251 +20,89 @@ /** */ public class Transaction { - /** amount */ - @SerializedName("amount") - private TransactionAmount amount; - /** spAppid */ - @SerializedName("sp_appid") - private String spAppid; + /** 合单商户appid 说明:合单发起方的appid */ + @SerializedName("combine_appid") + private String combineAppid; - /** subAppid */ - @SerializedName("sub_appid") - private String subAppid; + /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ + @SerializedName("combine_mchid") + private String combineMchid; - /** spMchid */ - @SerializedName("sp_mchid") - private String spMchid; + /** combineOutTradeNo 说明:合单商户订单号 */ + @SerializedName("combine_out_trade_no") + private String combineOutTradeNo; - /** subMchid */ - @SerializedName("sub_mchid") - private String subMchid; + /** sceneInfo */ + @SerializedName("scene_info") + private SceneInfo sceneInfo; - /** attach */ - @SerializedName("attach") - private String attach; + /** sceneInfo */ + @SerializedName("sub_orders") + private List subOrders; - /** bankType */ - @SerializedName("bank_type") - private String bankType; + /** 支付者信息 */ + @SerializedName("combine_payer_info") + private CombinePayerInfo combinePayerInfo; - /** outTradeNo */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** payer */ - @SerializedName("payer") - private TransactionPayer payer; - - /** promotionDetail */ - @SerializedName("promotion_detail") - private List promotionDetail; - - /** successTime */ - @SerializedName("success_time") - private String successTime; - - /** tradeState */ - public enum TradeStateEnum { - @SerializedName("SUCCESS") - SUCCESS, - - @SerializedName("REFUND") - REFUND, - - @SerializedName("NOTPAY") - NOTPAY, - - @SerializedName("CLOSED") - CLOSED, - - @SerializedName("REVOKED") - REVOKED, - - @SerializedName("USERPAYING") - USERPAYING, - - @SerializedName("PAYERROR") - PAYERROR, - - @SerializedName("ACCEPT") - ACCEPT - } - - @SerializedName("trade_state") - private TradeStateEnum tradeState; - - /** tradeStateDesc */ - @SerializedName("trade_state_desc") - private String tradeStateDesc; - - /** tradeType */ - public enum TradeTypeEnum { - @SerializedName("JSAPI") - JSAPI, - - @SerializedName("NATIVE") - NATIVE, - - @SerializedName("APP") - APP, - - @SerializedName("MICROPAY") - MICROPAY, - - @SerializedName("MWEB") - MWEB, - - @SerializedName("FACEPAY") - FACEPAY - } - - @SerializedName("trade_type") - private TradeTypeEnum tradeType; - - /** transactionId */ - @SerializedName("transaction_id") - private String transactionId; - - public TransactionAmount getAmount() { - return amount; - } - - public void setAmount(TransactionAmount amount) { - this.amount = amount; - } - - public String getSpAppid() { - return spAppid; - } - - public void setSpAppid(String spAppid) { - this.spAppid = spAppid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } - - public String getSpMchid() { - return spMchid; - } - - public void setSpMchid(String spMchid) { - this.spMchid = spMchid; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getAttach() { - return attach; - } - - public void setAttach(String attach) { - this.attach = attach; - } - - public String getBankType() { - return bankType; - } - - public void setBankType(String bankType) { - this.bankType = bankType; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public TransactionPayer getPayer() { - return payer; - } - - public void setPayer(TransactionPayer payer) { - this.payer = payer; - } - - public List getPromotionDetail() { - return promotionDetail; + public String getCombineAppid() { + return combineAppid; } - public void setPromotionDetail(List promotionDetail) { - this.promotionDetail = promotionDetail; + public void setCombineAppid(String combineAppid) { + this.combineAppid = combineAppid; } - public String getSuccessTime() { - return successTime; + public String getCombineMchid() { + return combineMchid; } - public void setSuccessTime(String successTime) { - this.successTime = successTime; + public void setCombineMchid(String combineMchid) { + this.combineMchid = combineMchid; } - public TradeStateEnum getTradeState() { - return tradeState; + public String getCombineOutTradeNo() { + return combineOutTradeNo; } - public void setTradeState(TradeStateEnum tradeState) { - this.tradeState = tradeState; + public void setCombineOutTradeNo(String combineOutTradeNo) { + this.combineOutTradeNo = combineOutTradeNo; } - public String getTradeStateDesc() { - return tradeStateDesc; + public SceneInfo getSceneInfo() { + return sceneInfo; } - public void setTradeStateDesc(String tradeStateDesc) { - this.tradeStateDesc = tradeStateDesc; + public void setSceneInfo(SceneInfo sceneInfo) { + this.sceneInfo = sceneInfo; } - public TradeTypeEnum getTradeType() { - return tradeType; + public List getSubOrders() { + return subOrders; } - public void setTradeType(TradeTypeEnum tradeType) { - this.tradeType = tradeType; + public void setSubOrders(List subOrders) { + this.subOrders = subOrders; } - public String getTransactionId() { - return transactionId; + public CombinePayerInfo getCombinePayerInfo() { + return combinePayerInfo; } - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; + public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { + this.combinePayerInfo = combinePayerInfo; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Transaction {\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); - sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); - sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); - sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); - sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); - sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); - sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); - sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); - sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); - sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); - sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); - sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); - sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\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/model/SubOrderDetail.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/SubOrderDetail.java new file mode 100644 index 00000000..bff6a41c --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/model/SubOrderDetail.java @@ -0,0 +1,234 @@ +package com.wechat.pay.java.service.ecommercecombinepayments.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +import static com.wechat.pay.java.core.util.StringUtil.toIndentedString; + +public class SubOrderDetail { + + /** 子商户号 说明:子单发起方商户号,必须与发起方appid有绑定关系。服务商和电商模式下,传服务商商户号。 */ + @SerializedName("mchid") + private String mchid; + + /** tradeType */ + public enum TradeTypeEnum { + @SerializedName("JSAPI") + JSAPI, + + @SerializedName("NATIVE") + NATIVE, + + @SerializedName("APP") + APP, + + @SerializedName("MICROPAY") + MICROPAY, + + @SerializedName("MWEB") + MWEB, + + @SerializedName("FACEPAY") + FACEPAY + } + + @SerializedName("trade_type") + private TradeTypeEnum tradeType; + + /** tradeState */ + public enum TradeStateEnum { + @SerializedName("SUCCESS") + SUCCESS, + + @SerializedName("REFUND") + REFUND, + + @SerializedName("NOTPAY") + NOTPAY, + + @SerializedName("CLOSED") + CLOSED, + + @SerializedName("REVOKED") + REVOKED, + + @SerializedName("USERPAYING") + USERPAYING, + + @SerializedName("PAYERROR") + PAYERROR, + + @SerializedName("ACCEPT") + ACCEPT + } + + @SerializedName("trade_state") + private TradeStateEnum tradeState; + + /** bankType */ + @SerializedName("bank_type") + private String bankType; + + /** attach */ + @SerializedName("attach") + private String attach; + + /** successTime */ + @SerializedName("success_time") + private String successTime; + + /** transactionId */ + @SerializedName("transaction_id") + private String transactionId; + + /** outTradeNo */ + @SerializedName("out_trade_no") + private String outTradeNo; + + /** subMchid */ + @SerializedName("sub_mchid") + private String subMchid; + + /** subAppid */ + @SerializedName("sub_appid") + private String subAppid; + + /** subOpenid */ + @SerializedName("sub_openid") + private String subOpenid; + + /** amount */ + @SerializedName("amount") + private TransactionAmount amount; + + /** promotionDetail */ + @SerializedName("promotion_detail") + private List promotionDetail; + + public String getMchid() { + return mchid; + } + + public void setMchid(String mchid) { + this.mchid = mchid; + } + + public TradeTypeEnum getTradeType() { + return tradeType; + } + + public void setTradeType(TradeTypeEnum tradeType) { + this.tradeType = tradeType; + } + + public TradeStateEnum getTradeState() { + return tradeState; + } + + public void setTradeState(TradeStateEnum tradeState) { + this.tradeState = tradeState; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getAttach() { + return attach; + } + + public void setAttach(String attach) { + this.attach = attach; + } + + public String getSuccessTime() { + return successTime; + } + + public void setSuccessTime(String successTime) { + this.successTime = successTime; + } + + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + 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; + } + + public String getSubOpenid() { + return subOpenid; + } + + public void setSubOpenid(String subOpenid) { + this.subOpenid = subOpenid; + } + + public TransactionAmount getAmount() { + return amount; + } + + public void setAmount(TransactionAmount amount) { + this.amount = amount; + } + + public List getPromotionDetail() { + return promotionDetail; + } + + public void setPromotionDetail(List promotionDetail) { + this.promotionDetail = promotionDetail; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubOrderDetail {\n"); + sb.append(" mchid: ").append(toIndentedString(mchid)).append("\n"); + sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); + sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); + sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); + sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); + sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); + sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); + sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); + sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); + sb.append(" subOpenid: ").append(toIndentedString(subOpenid)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} 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 new file mode 100644 index 00000000..62f7a6b8 --- /dev/null +++ b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/CombinePayerInfo.java @@ -0,0 +1,24 @@ +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/Transaction.java b/service/src/main/java/com/wechat/pay/java/service/ecommercecombinepayments/nativepay/model/Transaction.java index 0aba6b81..b0c9c49d 100644 --- 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 @@ -1,8 +1,8 @@ // Copyright 2021 Tencent Inc. All rights reserved. // -// Native支付 +// APP支付 // -// Native支付API +// APP支付API // // API version: 1.2.3 @@ -12,9 +12,7 @@ package com.wechat.pay.java.service.ecommercecombinepayments.nativepay.model; import com.google.gson.annotations.SerializedName; -import com.wechat.pay.java.service.ecommercecombinepayments.model.PromotionDetail; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionAmount; -import com.wechat.pay.java.service.ecommercecombinepayments.model.TransactionPayer; +import com.wechat.pay.java.service.ecommercecombinepayments.model.SubOrderDetail; import java.util.List; @@ -22,251 +20,89 @@ /** */ public class Transaction { - /** amount */ - @SerializedName("amount") - private TransactionAmount amount; - /** spAppid */ - @SerializedName("sp_appid") - private String spAppid; + /** 合单商户appid 说明:合单发起方的appid */ + @SerializedName("combine_appid") + private String combineAppid; - /** subAppid */ - @SerializedName("sub_appid") - private String subAppid; + /** 合单商户号 说明:合单发起方商户号,服务商和电商模式下,传服务商商户号。*/ + @SerializedName("combine_mchid") + private String combineMchid; - /** spMchid */ - @SerializedName("sp_mchid") - private String spMchid; + /** combineOutTradeNo 说明:合单商户订单号 */ + @SerializedName("combine_out_trade_no") + private String combineOutTradeNo; - /** subMchid */ - @SerializedName("sub_mchid") - private String subMchid; + /** sceneInfo */ + @SerializedName("scene_info") + private SceneInfo sceneInfo; - /** attach */ - @SerializedName("attach") - private String attach; + /** sceneInfo */ + @SerializedName("sub_orders") + private List subOrders; - /** bankType */ - @SerializedName("bank_type") - private String bankType; + /** 支付者信息 */ + @SerializedName("combine_payer_info") + private CombinePayerInfo combinePayerInfo; - /** outTradeNo */ - @SerializedName("out_trade_no") - private String outTradeNo; - - /** payer */ - @SerializedName("payer") - private TransactionPayer payer; - - /** promotionDetail */ - @SerializedName("promotion_detail") - private List promotionDetail; - - /** successTime */ - @SerializedName("success_time") - private String successTime; - - /** tradeState */ - public enum TradeStateEnum { - @SerializedName("SUCCESS") - SUCCESS, - - @SerializedName("REFUND") - REFUND, - - @SerializedName("NOTPAY") - NOTPAY, - - @SerializedName("CLOSED") - CLOSED, - - @SerializedName("REVOKED") - REVOKED, - - @SerializedName("USERPAYING") - USERPAYING, - - @SerializedName("PAYERROR") - PAYERROR, - - @SerializedName("ACCEPT") - ACCEPT - } - - @SerializedName("trade_state") - private TradeStateEnum tradeState; - - /** tradeStateDesc */ - @SerializedName("trade_state_desc") - private String tradeStateDesc; - - /** tradeType */ - public enum TradeTypeEnum { - @SerializedName("JSAPI") - JSAPI, - - @SerializedName("NATIVE") - NATIVE, - - @SerializedName("APP") - APP, - - @SerializedName("MICROPAY") - MICROPAY, - - @SerializedName("MWEB") - MWEB, - - @SerializedName("FACEPAY") - FACEPAY - } - - @SerializedName("trade_type") - private TradeTypeEnum tradeType; - - /** transactionId */ - @SerializedName("transaction_id") - private String transactionId; - - public TransactionAmount getAmount() { - return amount; - } - - public void setAmount(TransactionAmount amount) { - this.amount = amount; - } - - public String getSpAppid() { - return spAppid; - } - - public void setSpAppid(String spAppid) { - this.spAppid = spAppid; - } - - public String getSubAppid() { - return subAppid; - } - - public void setSubAppid(String subAppid) { - this.subAppid = subAppid; - } - - public String getSpMchid() { - return spMchid; - } - - public void setSpMchid(String spMchid) { - this.spMchid = spMchid; - } - - public String getSubMchid() { - return subMchid; - } - - public void setSubMchid(String subMchid) { - this.subMchid = subMchid; - } - - public String getAttach() { - return attach; - } - - public void setAttach(String attach) { - this.attach = attach; - } - - public String getBankType() { - return bankType; - } - - public void setBankType(String bankType) { - this.bankType = bankType; - } - - public String getOutTradeNo() { - return outTradeNo; - } - - public void setOutTradeNo(String outTradeNo) { - this.outTradeNo = outTradeNo; - } - - public TransactionPayer getPayer() { - return payer; - } - - public void setPayer(TransactionPayer payer) { - this.payer = payer; - } - - public List getPromotionDetail() { - return promotionDetail; + public String getCombineAppid() { + return combineAppid; } - public void setPromotionDetail(List promotionDetail) { - this.promotionDetail = promotionDetail; + public void setCombineAppid(String combineAppid) { + this.combineAppid = combineAppid; } - public String getSuccessTime() { - return successTime; + public String getCombineMchid() { + return combineMchid; } - public void setSuccessTime(String successTime) { - this.successTime = successTime; + public void setCombineMchid(String combineMchid) { + this.combineMchid = combineMchid; } - public TradeStateEnum getTradeState() { - return tradeState; + public String getCombineOutTradeNo() { + return combineOutTradeNo; } - public void setTradeState(TradeStateEnum tradeState) { - this.tradeState = tradeState; + public void setCombineOutTradeNo(String combineOutTradeNo) { + this.combineOutTradeNo = combineOutTradeNo; } - public String getTradeStateDesc() { - return tradeStateDesc; + public SceneInfo getSceneInfo() { + return sceneInfo; } - public void setTradeStateDesc(String tradeStateDesc) { - this.tradeStateDesc = tradeStateDesc; + public void setSceneInfo(SceneInfo sceneInfo) { + this.sceneInfo = sceneInfo; } - public TradeTypeEnum getTradeType() { - return tradeType; + public List getSubOrders() { + return subOrders; } - public void setTradeType(TradeTypeEnum tradeType) { - this.tradeType = tradeType; + public void setSubOrders(List subOrders) { + this.subOrders = subOrders; } - public String getTransactionId() { - return transactionId; + public CombinePayerInfo getCombinePayerInfo() { + return combinePayerInfo; } - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; + public void setCombinePayerInfo(CombinePayerInfo combinePayerInfo) { + this.combinePayerInfo = combinePayerInfo; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Transaction {\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" spAppid: ").append(toIndentedString(spAppid)).append("\n"); - sb.append(" subAppid: ").append(toIndentedString(subAppid)).append("\n"); - sb.append(" spMchid: ").append(toIndentedString(spMchid)).append("\n"); - sb.append(" subMchid: ").append(toIndentedString(subMchid)).append("\n"); - sb.append(" attach: ").append(toIndentedString(attach)).append("\n"); - sb.append(" bankType: ").append(toIndentedString(bankType)).append("\n"); - sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n"); - sb.append(" payer: ").append(toIndentedString(payer)).append("\n"); - sb.append(" promotionDetail: ").append(toIndentedString(promotionDetail)).append("\n"); - sb.append(" successTime: ").append(toIndentedString(successTime)).append("\n"); - sb.append(" tradeState: ").append(toIndentedString(tradeState)).append("\n"); - sb.append(" tradeStateDesc: ").append(toIndentedString(tradeStateDesc)).append("\n"); - sb.append(" tradeType: ").append(toIndentedString(tradeType)).append("\n"); - sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\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(); } From 0f2af2664a10c5e1b7b008fdb44035cc904246f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=8E=E9=B9=8F?= Date: Thu, 27 Jun 2024 17:57:35 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=94=B6=E4=BB=98=E9=80=9A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=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 --- .../model/TransactionAmount.java | 57 +++++-------------- 1 file changed, 13 insertions(+), 44 deletions(-) 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/model/TransactionAmount.java index 58954966..48eed528 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/model/TransactionAmount.java @@ -17,62 +17,31 @@ /** TransactionAmount */ public class TransactionAmount { - /** currency */ + + /** 标价金额 */ + @SerializedName("total_amount") + private Integer totalAmount; + + /** 标价币种 */ @SerializedName("currency") private String currency; - /** payerCurrency */ + /** 现金支付金额 */ + @SerializedName("payer_amount") + private Integer payerAmount; + + /** 现金支付币种 */ @SerializedName("payer_currency") private String payerCurrency; - /** payerTotal */ - @SerializedName("payer_total") - private Integer payerTotal; - - /** total */ - @SerializedName("total") - private Integer total; - - public String getCurrency() { - return currency; - } - - public void setCurrency(String currency) { - this.currency = currency; - } - - public String getPayerCurrency() { - return payerCurrency; - } - - public void setPayerCurrency(String payerCurrency) { - this.payerCurrency = payerCurrency; - } - - public Integer getPayerTotal() { - return payerTotal; - } - - public void setPayerTotal(Integer payerTotal) { - this.payerTotal = payerTotal; - } - - public Integer getTotal() { - return total; - } - - public void setTotal(Integer total) { - this.total = total; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TransactionAmount {\n"); + sb.append(" totalAmount: ").append(toIndentedString(totalAmount)).append("\n"); sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" payerAmount: ").append(toIndentedString(payerAmount)).append("\n"); sb.append(" payerCurrency: ").append(toIndentedString(payerCurrency)).append("\n"); - sb.append(" payerTotal: ").append(toIndentedString(payerTotal)).append("\n"); - sb.append(" total: ").append(toIndentedString(total)).append("\n"); sb.append("}"); return sb.toString(); } From 7ab7bea63b98ab65f39258ceb5a0c9bb5af51ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=9D=8E=E9=B9=8F?= Date: Thu, 27 Jun 2024 18:07:13 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=94=B6=E4=BB=98=E9=80=9A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=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 --- .../model/TransactionAmount.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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/model/TransactionAmount.java index 48eed528..42125997 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/model/TransactionAmount.java @@ -34,6 +34,38 @@ public class TransactionAmount { @SerializedName("payer_currency") private String payerCurrency; + public Integer getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(Integer totalAmount) { + this.totalAmount = totalAmount; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public Integer getPayerAmount() { + return payerAmount; + } + + public void setPayerAmount(Integer payerAmount) { + this.payerAmount = payerAmount; + } + + public String getPayerCurrency() { + return payerCurrency; + } + + public void setPayerCurrency(String payerCurrency) { + this.payerCurrency = payerCurrency; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); 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 5/5] =?UTF-8?q?=E6=94=B6=E4=BB=98=E9=80=9A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=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;