mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
feat: 新增商户申请获取支付分对账单API
This commit is contained in:
@@ -242,6 +242,12 @@ public enum WechatPayV3Type {
|
||||
* @since 1.0.2.RELEASE
|
||||
*/
|
||||
PAY_SCORE_SYNC_USER_SERVICE_ORDER(HttpMethod.POST, "%s/v3/payscore/serviceorder/{out_order_no}/sync"),
|
||||
/**
|
||||
* 商户申请获取对账单API
|
||||
*
|
||||
* @since 1.0.13.RELEASE
|
||||
*/
|
||||
PAY_SCORE_MERCHANT_BILL(HttpMethod.GET, "%s/v3/payscore/merchant-bill"),
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package cn.felord.payment.wechat.v3;
|
||||
|
||||
import cn.felord.payment.wechat.WechatPayProperties;
|
||||
import cn.felord.payment.wechat.enumeration.TarType;
|
||||
import cn.felord.payment.wechat.enumeration.WeChatServer;
|
||||
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
|
||||
import cn.felord.payment.wechat.v3.model.payscore.*;
|
||||
@@ -29,6 +30,8 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -466,4 +469,36 @@ public class WechatPayScoreApi extends AbstractApi {
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商户申请获取对账单API
|
||||
* <p>
|
||||
* 商户可以调用此接口获取对账单文件的下载链接,并在有效期内请求下载链接可以下载对账单文件。详细参考文档 <a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_29.shtml">商户申请获取对账单API</a>
|
||||
* <p>
|
||||
* 返回的下载链接可调用{@link #downloadBillResponse(String, String)}下载文件,文件需要解密。
|
||||
*
|
||||
* @param billParams the bill params
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.13.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> downloadMerchantBills(PayScoreBillParams billParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PAY_SCORE_MERCHANT_BILL, billParams)
|
||||
.function(((wechatPayV3Type, params) -> {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
LocalDate billDate = params.getBillDate();
|
||||
queryParams.add("bill_date", billDate.format(DateTimeFormatter.ISO_DATE));
|
||||
queryParams.add("tar_type", TarType.GZIP.name());
|
||||
queryParams.add("encryption_algorithm", "AEAD_AES_256_GCM");
|
||||
queryParams.add("service_id",billParams.getServiceId());
|
||||
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.queryParams(queryParams)
|
||||
.build()
|
||||
.toUri();
|
||||
return Get(uri);
|
||||
})).consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,18 +17,24 @@
|
||||
package cn.felord.payment.wechat.v3;
|
||||
|
||||
import cn.felord.payment.wechat.WechatPayProperties;
|
||||
import cn.felord.payment.wechat.enumeration.TarType;
|
||||
import cn.felord.payment.wechat.enumeration.WeChatServer;
|
||||
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
|
||||
import cn.felord.payment.wechat.v3.model.profitsharing.*;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2019-2021 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.payscore;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 直连商户-商户申请获取对账单API参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.13.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PayScoreBillParams {
|
||||
|
||||
/**
|
||||
* 账单日期,必传。
|
||||
* <p>
|
||||
* 格式yyyy-MM-DD,仅支持三个月内的账单下载申请。
|
||||
*/
|
||||
private LocalDate billDate;
|
||||
/**
|
||||
* 支付分服务ID,必传。
|
||||
*/
|
||||
private String serviceId;
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import java.time.LocalDate;
|
||||
* 直连商户-申请分账账单API参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.12.RELEASE
|
||||
* @since 1.0.13.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class ProfitsharingBillParams {
|
||||
|
||||
Reference in New Issue
Block a user