mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
feat: 实现智慧商圈
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 其它能力-媒体上传
|
||||
*
|
||||
|
||||
@@ -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<ObjectNode> apply(MallScoreSyncRequest request) {
|
||||
WechatResponseEntity<ObjectNode> 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<ObjectNode> queryAuthStatus(MallScoreParams params) {
|
||||
WechatResponseEntity<ObjectNode> 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;
|
||||
}
|
||||
}
|
||||
@@ -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<ObjectNode> apply(PartnerMallScoreSyncRequest request) {
|
||||
WechatResponseEntity<ObjectNode> 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<ObjectNode> queryAuthStatus(PartnerMallScoreParams params) {
|
||||
WechatResponseEntity<ObjectNode> 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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商、直连商户 智慧商圈支付回调
|
||||
* <p>
|
||||
* 无需开发者判断,只有扣款成功微信才会回调此接口
|
||||
*
|
||||
* @param params the params
|
||||
* @param consumeDataConsumer the consume data consumer
|
||||
* @return the map
|
||||
* @since 1.0.14.RELEASE
|
||||
*/
|
||||
@SneakyThrows
|
||||
public Map<String, String> mallTransactionCallback(ResponseSignVerifyParams params, Consumer<MallTransactionConsumeData> 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<String, String> mallRefundCallback(ResponseSignVerifyParams params, Consumer<MallRefundConsumeData> 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"),
|
||||
|
||||
/**
|
||||
* 退款异常事件.
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<ObjectNode> queryBalance(EcommerceFundOverseaParams params) {
|
||||
WechatResponseEntity<ObjectNode> 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<ObjectNode> apply(EcommerceFundOverseaOrder order) {
|
||||
WechatResponseEntity<ObjectNode> 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<ObjectNode> queryOrder(EcommerceFundOverseaResultParams params) {
|
||||
WechatResponseEntity<ObjectNode> 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<Resource> downloadMerchantBills(PartnerProfitsharingBillParams billParams) {
|
||||
WechatResponseEntity<ObjectNode> 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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> 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user