diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java index 3ebb78a..3ff61a3 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java @@ -954,8 +954,44 @@ public enum WechatPayV3Type { * * @since 1.0.14.RELEASE */ - ECOMMERCE_FUND_FLOW_BILL(HttpMethod.GET, "%s/v3/ecommerce/bill/fundflowbill") - ; + ECOMMERCE_FUND_FLOW_BILL(HttpMethod.GET, "%s/v3/ecommerce/bill/fundflowbill"), + /** + * 行业方案-电商收付通-跨境付款-查询订单剩余可出境余额API. + * + * @since 1.0.14.RELEASE + */ + ECOMMERCE_FUND_OVERSEA_BALANCE(HttpMethod.GET, "%s/v3/funds-to-oversea/transactions/{transaction_id}/available_abroad_amounts"), + /** + * 行业方案-电商收付通-跨境付款-申请资金出境API. + * + * @since 1.0.14.RELEASE + */ + ECOMMERCE_FUND_OVERSEA_ORDERS(HttpMethod.POST, "%s/v3/funds-to-oversea/orders"), + /** + * 行业方案-电商收付通-跨境付款-查询出境结果API. + * + * @since 1.0.14.RELEASE + */ + ECOMMERCE_FUND_OVERSEA_ORDERS_RESULT(HttpMethod.GET, "%s/v3/funds-to-oversea/orders/{out_order_id}"), + /** + * 行业方案-电商收付通-跨境付款-获取购付汇账单文件下载链接API. + * + * @since 1.0.14.RELEASE + */ + ECOMMERCE_FUND_OVERSEA_BILLS(HttpMethod.GET, "%s/v3/funds-to-oversea/bill-download-url"), +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** + * 智慧商圈-商圈积分同步API + * + * @since 1.0.14.RELEASE + */ + MALL_SCORE_SYNC(HttpMethod.POST, "%s/v3/businesscircle/points/notify"), + /** + * 智慧商圈-商圈积分同步API + * + * @since 1.0.14.RELEASE + */ + MALL_SCORE_RESULT(HttpMethod.GET, "%s/v3/businesscircle/user-authorizations/{openid}"); /** * The Pattern. diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java index 8001486..29dd179 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java @@ -271,6 +271,28 @@ public class WechatApiProvider { return new WechatEcommerceApi(wechatPayClient, tenantId); } + /** + * 服务商智慧商圈 + * + * @param tenantId the tenant id + * @return the wechat business circle api + * @since 1.0.14.RELEASE + */ + public WechatPartnerBusinessCircleApi partnerBusinessCircleApi(String tenantId) { + return new WechatPartnerBusinessCircleApi(wechatPayClient, tenantId); + } + + /** + * 直连商户智慧商圈 + * + * @param tenantId the tenant id + * @return the wechat business circle api + * @since 1.0.14.RELEASE + */ + public WechatBusinessCircleApi businessCircleApi(String tenantId) { + return new WechatBusinessCircleApi(wechatPayClient, tenantId); + } + /** * 其它能力-媒体上传 * diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatBusinessCircleApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatBusinessCircleApi.java new file mode 100644 index 0000000..2af1019 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatBusinessCircleApi.java @@ -0,0 +1,87 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3; + +import cn.felord.payment.wechat.enumeration.WeChatServer; +import cn.felord.payment.wechat.enumeration.WechatPayV3Type; +import cn.felord.payment.wechat.v3.model.busicircle.MallScoreParams; +import cn.felord.payment.wechat.v3.model.busicircle.MallScoreSyncRequest; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.springframework.web.util.UriComponentsBuilder; + +import java.net.URI; + +/** + * 直连商户智慧商圈 + * + * @author felord.cn + * @since 1.0.14.RELEASE + */ +public class WechatBusinessCircleApi extends AbstractApi { + /** + * Instantiates a new Abstract api. + * + * @param wechatPayClient the wechat pay client + * @param tenantId the tenant id + */ + public WechatBusinessCircleApi(WechatPayClient wechatPayClient, String tenantId) { + super(wechatPayClient, tenantId); + } + + /** + * 商圈积分同步API + * + * @param request the request + * @return the wechat response entity + */ + public WechatResponseEntity apply(MallScoreSyncRequest request) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.MALL_SCORE_SYNC, request) + .function((wechatPayV3Type, mallScoreSyncRequest) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA)) + .build() + .toUri(); + return Post(uri, mallScoreSyncRequest); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } + + /** + * 商圈积分授权查询API + * + * @param params the params + * @return the wechat response entity + */ + public WechatResponseEntity queryAuthStatus(MallScoreParams params) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.MALL_SCORE_RESULT, params) + .function((type, mallScoreParams) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) + .queryParam("appid", mallScoreParams.getAppid()) + .build() + .expand(mallScoreParams.getOpenid()) + .toUri(); + return Get(uri); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPartnerBusinessCircleApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPartnerBusinessCircleApi.java new file mode 100644 index 0000000..7574dfb --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPartnerBusinessCircleApi.java @@ -0,0 +1,88 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3; + +import cn.felord.payment.wechat.enumeration.WeChatServer; +import cn.felord.payment.wechat.enumeration.WechatPayV3Type; +import cn.felord.payment.wechat.v3.model.busicircle.PartnerMallScoreParams; +import cn.felord.payment.wechat.v3.model.busicircle.PartnerMallScoreSyncRequest; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.springframework.web.util.UriComponentsBuilder; + +import java.net.URI; + +/** + * 服务商智慧商圈 + * + * @author felord.cn + * @since 1.0.14.RELEASE + */ +public class WechatPartnerBusinessCircleApi extends AbstractApi { + /** + * Instantiates a new Abstract api. + * + * @param wechatPayClient the wechat pay client + * @param tenantId the tenant id + */ + public WechatPartnerBusinessCircleApi(WechatPayClient wechatPayClient, String tenantId) { + super(wechatPayClient, tenantId); + } + + /** + * 商圈积分同步API + * + * @param request the request + * @return the wechat response entity + */ + public WechatResponseEntity apply(PartnerMallScoreSyncRequest request) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.MALL_SCORE_SYNC, request) + .function((wechatPayV3Type, mallScoreSyncRequest) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA)) + .build() + .toUri(); + return Post(uri, mallScoreSyncRequest); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } + + /** + * 商圈积分授权查询API + * + * @param params the params + * @return the wechat response entity + */ + public WechatResponseEntity queryAuthStatus(PartnerMallScoreParams params) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.MALL_SCORE_RESULT, params) + .function((type, mallScoreParams) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) + .queryParam("sub_mchid", mallScoreParams.getSubMchid()) + .queryParam("appid", mallScoreParams.getAppid()) + .build() + .expand(mallScoreParams.getOpenid()) + .toUri(); + return Get(uri); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java index 845e85e..00f70aa 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatPayCallback.java @@ -18,13 +18,9 @@ package cn.felord.payment.wechat.v3; import cn.felord.payment.PayException; -import cn.felord.payment.wechat.v3.model.CallbackParams; -import cn.felord.payment.wechat.v3.model.CouponConsumeData; -import cn.felord.payment.wechat.v3.model.PartnerRefundConsumeData; -import cn.felord.payment.wechat.v3.model.ProfitSharingConsumeData; -import cn.felord.payment.wechat.v3.model.RefundConsumeData; -import cn.felord.payment.wechat.v3.model.ResponseSignVerifyParams; -import cn.felord.payment.wechat.v3.model.TransactionConsumeData; +import cn.felord.payment.wechat.v3.model.*; +import cn.felord.payment.wechat.v3.model.busicircle.MallRefundConsumeData; +import cn.felord.payment.wechat.v3.model.busicircle.MallTransactionConsumeData; import cn.felord.payment.wechat.v3.model.busifavor.BusiFavorReceiveConsumeData; import cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData; import cn.felord.payment.wechat.v3.model.discountcard.DiscountCardAcceptedConsumeData; @@ -449,6 +445,39 @@ public class WechatPayCallback { return response(); } + /** + * 服务商、直连商户 智慧商圈支付回调 + *

+ * 无需开发者判断,只有扣款成功微信才会回调此接口 + * + * @param params the params + * @param consumeDataConsumer the consume data consumer + * @return the map + * @since 1.0.14.RELEASE + */ + @SneakyThrows + public Map mallTransactionCallback(ResponseSignVerifyParams params, Consumer consumeDataConsumer) { + String data = this.callback(params, EventType.MALL_TRANSACTION_SUCCESS); + MallTransactionConsumeData consumeData = MAPPER.readValue(data, MallTransactionConsumeData.class); + consumeDataConsumer.accept(consumeData); + return response(); + } + + /** + * 服务商、直连商户 智慧商圈退款回调 + * + * @param params the params + * @param consumeDataConsumer the consume data consumer + * @return the map + * @since 1.0.14.RELEASE + */ + @SneakyThrows + public Map mallRefundCallback(ResponseSignVerifyParams params, Consumer consumeDataConsumer) { + String data = this.callback(params, EventType.MALL_REFUND_SUCCESS); + MallRefundConsumeData consumeData = MAPPER.readValue(data, MallRefundConsumeData.class); + consumeDataConsumer.accept(consumeData); + return response(); + } /** * Callback. * @@ -599,6 +628,12 @@ public class WechatPayCallback { * @since 1.0.0.RELEASE */ TRANSACTION_SUCCESS("TRANSACTION.SUCCESS"), + /** + * 智慧商圈支付 + * + * @since 1.0.14.RELEASE + */ + MALL_TRANSACTION_SUCCESS("MALL_TRANSACTION.SUCCESS"), /** * 支付分停车支付失败通知 */ @@ -614,6 +649,12 @@ public class WechatPayCallback { * @since 1.0.6.RELEASE */ REFUND_SUCCESS("REFUND.SUCCESS"), + /** + * 智慧商圈退款成功事件. + * + * @since 1.0.14.RELEASE + */ + MALL_REFUND_SUCCESS("MALL_REFUND.SUCCESS"), /** * 退款异常事件. diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ApplymentApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ApplymentApi.java index 504211b..fde3656 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ApplymentApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ApplymentApi.java @@ -25,7 +25,7 @@ import cn.felord.payment.wechat.v3.WechatPartnerSpecialMchApi; import cn.felord.payment.wechat.v3.WechatPayClient; import cn.felord.payment.wechat.v3.WechatResponseEntity; import cn.felord.payment.wechat.v3.X509WechatCertificateInfo; -import cn.felord.payment.wechat.v3.model.ecommerce.AccountInfo; +import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceAccountInfo; import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceApplymentParams; import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceContactInfo; import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceIdCardInfo; @@ -45,7 +45,7 @@ import java.security.cert.X509Certificate; * @author felord.cn * @since 1.0.14.RELEASE */ -class ApplymentApi extends AbstractApi { +public class ApplymentApi extends AbstractApi { private final WechatPartnerSpecialMchApi wechatPartnerSpecialMchApi; @@ -178,7 +178,7 @@ class ApplymentApi extends AbstractApi { docInfo.setIdDocNumber(signatureProvider.encryptRequestMessage(docInfo.getIdDocNumber(), x509Certificate)); } } - AccountInfo accountInfo = applymentParams.getAccountInfo(); + EcommerceAccountInfo accountInfo = applymentParams.getAccountInfo(); if (accountInfo != null) { accountInfo.setAccountName(signatureProvider.encryptRequestMessage(accountInfo.getAccountName(), x509Certificate)); accountInfo.setAccountNumber(signatureProvider.encryptRequestMessage(accountInfo.getAccountNumber(), x509Certificate)); diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/BalanceApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/BalanceApi.java index d9e0f5e..ead3604 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/BalanceApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/BalanceApi.java @@ -37,7 +37,7 @@ import java.time.format.DateTimeFormatter; * @author felord.cn * @since 1.0.14.RELEASE */ -class BalanceApi extends AbstractApi { +public class BalanceApi extends AbstractApi { /** * Instantiates a new Abstract api. * diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/DownloadApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/DownloadApi.java index 00c89ce..9afa820 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/DownloadApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/DownloadApi.java @@ -46,7 +46,7 @@ import java.util.Optional; * @author felord.cn * @since 1.0.14.RELEASE */ -class DownloadApi extends AbstractApi { +public class DownloadApi extends AbstractApi { private final WechatPartnerProfitsharingApi wechatPartnerProfitsharingApi; /** diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/FundOverseaApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/FundOverseaApi.java new file mode 100644 index 0000000..82a4d6e --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/FundOverseaApi.java @@ -0,0 +1,147 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.ecommerce; + +import cn.felord.payment.wechat.enumeration.WeChatServer; +import cn.felord.payment.wechat.enumeration.WechatPayV3Type; +import cn.felord.payment.wechat.v3.AbstractApi; +import cn.felord.payment.wechat.v3.WechatPayClient; +import cn.felord.payment.wechat.v3.WechatResponseEntity; +import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceFundOverseaOrder; +import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceFundOverseaParams; +import cn.felord.payment.wechat.v3.model.ecommerce.EcommerceFundOverseaResultParams; +import cn.felord.payment.wechat.v3.model.profitsharing.PartnerProfitsharingBillParams; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.springframework.core.io.Resource; +import org.springframework.http.ResponseEntity; +import org.springframework.web.util.UriComponentsBuilder; + +import java.net.URI; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * 电商收付通跨境付款 + * + * @author felord.cn + * @since 1.0.14.RELEASE + */ +public class FundOverseaApi extends AbstractApi { + /** + * Instantiates a new Abstract api. + * + * @param wechatPayClient the wechat pay client + * @param tenantId the tenant id + */ + FundOverseaApi(WechatPayClient wechatPayClient, String tenantId) { + super(wechatPayClient, tenantId); + } + + /** + * 查询订单剩余可出境余额API + * + * @param params the params + * @return the wechat response entity + */ + public WechatResponseEntity queryBalance(EcommerceFundOverseaParams params) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.ECOMMERCE_FUND_OVERSEA_BALANCE, params) + .function((type, fundOverseaParams) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) + .queryParam("sub_mchid", fundOverseaParams.getSubMchid()) + .build() + .expand(fundOverseaParams.getTransactionId()) + .toUri(); + return Get(uri); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } + + /** + * 申请资金出境API + * + * @param order the order + * @return the wechat response entity + */ + public WechatResponseEntity apply(EcommerceFundOverseaOrder order) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.ECOMMERCE_FUND_OVERSEA_ORDERS, order) + .function((wechatPayV3Type, overseaOrder) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA)) + .build() + .toUri(); + return Post(uri, overseaOrder); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } + + /** + * 查询出境结果API + * + * @param params the params + * @return the wechat response entity + */ + public WechatResponseEntity queryOrder(EcommerceFundOverseaResultParams params) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.ECOMMERCE_FUND_OVERSEA_ORDERS_RESULT, params) + .function((type, overseaResultParams) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) + .queryParam("sub_mchid", overseaResultParams.getSubMchid()) + .queryParam("transaction_id", overseaResultParams.getTransactionId()) + .build() + .expand(overseaResultParams.getOutOrderId()) + .toUri(); + return Get(uri); + }) + .consumer(wechatResponseEntity::convert) + .request(); + return wechatResponseEntity; + } + + /** + * 获取购付汇账单文件下载链接API + * + * @param billParams the bill params + * @return the response entity + */ + public ResponseEntity downloadMerchantBills(PartnerProfitsharingBillParams billParams) { + WechatResponseEntity wechatResponseEntity = new WechatResponseEntity<>(); + this.client().withType(WechatPayV3Type.ECOMMERCE_FUND_OVERSEA_BILLS, billParams) + .function(((wechatPayV3Type, params) -> { + URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA)) + .queryParam("bill_date", params.getBillDate().format(DateTimeFormatter.ISO_DATE)) + .queryParam("sub_mchid", params.getSubMchid()) + .build() + .toUri(); + return Get(uri); + })).consumer(wechatResponseEntity::convert) + .request(); + String downloadUrl = Objects.requireNonNull(wechatResponseEntity.getBody()) + .get("download_url") + .asText(); + + String ext = ".gzip"; + String filename = "fundoverseabill-" + billParams.getBillDate().toString() + ext; + return this.downloadBillResponse(downloadUrl, filename); + } + +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ProfitsharingApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ProfitsharingApi.java index d8caaf1..50e70c8 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ProfitsharingApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/ProfitsharingApi.java @@ -52,7 +52,7 @@ import java.util.List; * @author felord.cn * @since 1.0.14.RELEASE */ -class ProfitsharingApi extends AbstractApi { +public class ProfitsharingApi extends AbstractApi { /** * Instantiates a new Abstract api. * diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/RefundsApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/RefundsApi.java index bce6888..8505a19 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/RefundsApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/RefundsApi.java @@ -38,7 +38,7 @@ import java.util.Collections; * @author felord.cn * @since 1.0.14.RELEASE */ -class RefundsApi extends AbstractApi { +public class RefundsApi extends AbstractApi { /** * Instantiates a new Abstract api. * diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/SubsidiesApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/SubsidiesApi.java index 660968b..0a79685 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/SubsidiesApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/SubsidiesApi.java @@ -36,7 +36,7 @@ import java.net.URI; * @author felord.cn * @since 1.0.14.RELEASE */ -class SubsidiesApi extends AbstractApi { +public class SubsidiesApi extends AbstractApi { /** * Instantiates a new Abstract api. * diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WechatEcommerceApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WechatEcommerceApi.java index eea8ecb..fdc138e 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WechatEcommerceApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WechatEcommerceApi.java @@ -114,6 +114,15 @@ public class WechatEcommerceApi { return new WithDrawApi(this.wechatPayClient, this.tenantId); } + /** + * 跨境付款 + * + * @return the oversea api + */ + public FundOverseaApi overseaApi() { + return new FundOverseaApi(this.wechatPayClient, this.tenantId); + } + /** * 下载账单 * @@ -122,4 +131,5 @@ public class WechatEcommerceApi { public DownloadApi download() { return new DownloadApi(this.wechatPayClient, this.tenantId); } + } diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WithDrawApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WithDrawApi.java index ea1b288..0a5587c 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WithDrawApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ecommerce/WithDrawApi.java @@ -53,7 +53,7 @@ public class WithDrawApi extends AbstractApi { * @param wechatPayClient the wechat pay client * @param tenantId the tenant id */ - public WithDrawApi(WechatPayClient wechatPayClient, String tenantId) { + WithDrawApi(WechatPayClient wechatPayClient, String tenantId) { super(wechatPayClient, tenantId); } diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallRefundConsumeData.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallRefundConsumeData.java new file mode 100644 index 0000000..6efa839 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallRefundConsumeData.java @@ -0,0 +1,42 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.busicircle; + +import lombok.Data; + +import java.time.OffsetDateTime; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class MallRefundConsumeData { + private String mchid; + private String merchantName; + private String shopName; + private String shopNumber; + private String appid; + private String openid; + private OffsetDateTime refundTime; + private Integer payAmount; + private Integer refundAmount; + private String transactionId; + private String refundId; + +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallScoreParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallScoreParams.java new file mode 100644 index 0000000..a1fab94 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallScoreParams.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.busicircle; + +import lombok.Data; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class MallScoreParams { + private String appid; + private String openid; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallScoreSyncRequest.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallScoreSyncRequest.java new file mode 100644 index 0000000..846e584 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallScoreSyncRequest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.busicircle; + +import lombok.Data; + +import java.time.OffsetDateTime; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class MallScoreSyncRequest { + private String transactionId; + private String appid; + private String openid; + private Boolean earnPoints; + private Integer increasedPoints; + private OffsetDateTime pointsUpdateTime; + private Integer totalPoints; + private String noPointsRemarks; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallTransactionConsumeData.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallTransactionConsumeData.java new file mode 100644 index 0000000..d7fc6d4 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/MallTransactionConsumeData.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.busicircle; + +import lombok.Data; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class MallTransactionConsumeData { + private String mchid; + private String merchantName; + private String shopName; + private String shopNumber; + private String appid; + private String openid; + private Integer amount; + private String timeEnd; + private String transactionId; + private String commitTag; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/PartnerMallScoreParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/PartnerMallScoreParams.java new file mode 100644 index 0000000..a572a29 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/PartnerMallScoreParams.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.busicircle; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class PartnerMallScoreParams extends MallScoreParams { + private String subMchid; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/PartnerMallScoreSyncRequest.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/PartnerMallScoreSyncRequest.java new file mode 100644 index 0000000..1a4a68f --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busicircle/PartnerMallScoreSyncRequest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.busicircle; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class PartnerMallScoreSyncRequest extends MallScoreSyncRequest{ + private String subMchid; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/AccountInfo.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceAccountInfo.java similarity index 96% rename from payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/AccountInfo.java rename to payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceAccountInfo.java index 78a6118..642505c 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/AccountInfo.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceAccountInfo.java @@ -25,7 +25,7 @@ import lombok.Data; * @since 1.0.14.RELEASE */ @Data -public class AccountInfo{ +public class EcommerceAccountInfo { private String bankAccountType; private String accountBank; private String accountName; diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceApplymentParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceApplymentParams.java index 2783aed..8edad97 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceApplymentParams.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceApplymentParams.java @@ -41,7 +41,7 @@ public class EcommerceApplymentParams{ private Boolean owner; private UboInfo uboInfo; private Boolean needAccountInfo; - private AccountInfo accountInfo; + private EcommerceAccountInfo accountInfo; private EcommerceContactInfo contactInfo; private SalesSceneInfo salesSceneInfo; private EcommerceSettlementInfo settlementInfo; diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaOrder.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaOrder.java new file mode 100644 index 0000000..eb8108c --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaOrder.java @@ -0,0 +1,80 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.ecommerce; + +import lombok.Data; + +import java.util.List; + +/** + * The type Ecommerce fun oversea order. + * + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class EcommerceFundOverseaOrder { + private String outOrderId; + private String subMchid; + private String transactionId; + private Integer amount; + private String foreignCurrency; + private List goodsInfo; + private SellerInfo sellerInfo; + private ExpressInfo expressInfo; + private PayeeInfo payeeInfo; + + + /** + * The type Goods info. + */ + @Data + public static class GoodsInfo { + private String goodsName; + private String goodsCategory; + private Integer goodsUnitPrice; + private Integer goodsQuantity; + } + + /** + * The type Seller info. + */ + @Data + public static class SellerInfo { + private String overseaBusinessName; + private String overseaShopName; + private String sellerId; + } + + /** + * The type Express info. + */ + @Data + public static class ExpressInfo { + private String courierNumber; + private String expressCompanyName; + } + + /** + * The type Payee info. + */ + @Data + public static class PayeeInfo { + private String payeeId; + } +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaParams.java new file mode 100644 index 0000000..3e6d933 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaParams.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.ecommerce; + +import lombok.Data; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class EcommerceFundOverseaParams { + private String subMchid; + private String transactionId; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaResultParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaResultParams.java new file mode 100644 index 0000000..efea013 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceFundOverseaResultParams.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019-2022 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cn.felord.payment.wechat.v3.model.ecommerce; + +import lombok.Data; + +/** + * @author felord.cn + * @since 1.0.14.RELEASE + */ +@Data +public class EcommerceFundOverseaResultParams { + private String outOrderId; + private String subMchid; + private String transactionId; +}