mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 05:43:46 +08:00
feat: 实现服务商商户进件-特约商户进件
- 提交申请单API - 查询申请单状态API - 通过业务申请编号查询申请状态 - 通过申请单号查询申请状态 - 修改结算账号API - 查询结算账户API
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.enumeration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超级管理员类型
|
||||||
|
*
|
||||||
|
* @since
|
||||||
|
*/
|
||||||
|
public enum ContactType {
|
||||||
|
/**
|
||||||
|
* 经营者或者法人
|
||||||
|
* <p>
|
||||||
|
* 主体为个体工商户/企业/政府机关/事业单位/社会组织
|
||||||
|
*/
|
||||||
|
LEGAL,
|
||||||
|
/**
|
||||||
|
* 经办人
|
||||||
|
*
|
||||||
|
* 经商户授权办理微信支付业务的人员
|
||||||
|
*/
|
||||||
|
SUPER
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.enumeration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金融机构类型需与营业执照/登记证书上一致,可参考选择 <a href="https://kf.qq.com/faq/220215IrMRZ3220215n6buiU.html">金融机构指引</a>。
|
||||||
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
public enum FinanceType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 银行业, 适用于商业银行、政策性银行、农村合作银行、村镇银行、开发性金融机构等
|
||||||
|
*/
|
||||||
|
BANK_AGENT,
|
||||||
|
/**
|
||||||
|
* 支付机构, 适用于非银行类支付机构
|
||||||
|
*/
|
||||||
|
PAYMENT_AGENT,
|
||||||
|
/**
|
||||||
|
* 保险业, 适用于保险、保险中介、保险代理、保险经纪等保险类业务
|
||||||
|
*/
|
||||||
|
INSURANCE,
|
||||||
|
/**
|
||||||
|
* 交易及结算类金融机构, 适用于交易所、登记结算类机构、银行卡清算机构、资金清算中心等
|
||||||
|
*/
|
||||||
|
TRADE_AND_SETTLE,
|
||||||
|
/**
|
||||||
|
* 其他金融机构, 适用于财务公司、信托公司、金融资产管理公司、金融租赁公司、汽车金融公司、贷款公司、货币经纪公司、消费金融公司、证券业、金融控股公司、股票、期货、货币兑换、小额贷款公司、金融资产管理、担保公司、商业保理公司、典当行、融资租赁公司、财经咨询等其他金融业务
|
||||||
|
*/
|
||||||
|
OTHER
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.enumeration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超级管理员证件类型
|
||||||
|
* <p>
|
||||||
|
* 当超级管理员类型是经办人时,请上传超级管理员证件类型。
|
||||||
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
public enum IdDocType {
|
||||||
|
/**
|
||||||
|
* 中国大陆居民-身份证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_IDCARD,
|
||||||
|
/**
|
||||||
|
* 其他国家或地区居民-护照
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_OVERSEA_PASSPORT,
|
||||||
|
/**
|
||||||
|
* 中国香港居民-来往内地通行证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_HONGKONG_PASSPORT,
|
||||||
|
/**
|
||||||
|
* 中国澳门居民-来往内地通行证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_MACAO_PASSPORT,
|
||||||
|
/**
|
||||||
|
* 中国台湾居民-来往大陆通行证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_TAIWAN_PASSPORT,
|
||||||
|
/**
|
||||||
|
* 外国人居留证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_FOREIGN_RESIDENT,
|
||||||
|
/**
|
||||||
|
* 港澳居民证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_HONGKONG_MACAO_RESIDENT,
|
||||||
|
/**
|
||||||
|
* 台湾居民证
|
||||||
|
*/
|
||||||
|
IDENTIFICATION_TYPE_TAIWAN_RESIDENT
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* 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.enumeration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照/登记证书、经营者/法人的证件的主体类型
|
||||||
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @see <a href="https://kf.qq.com/faq/180910IBZVnQ180910naQ77b.html">主体类型指引</a>
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
public enum SubjectType {
|
||||||
|
/**
|
||||||
|
* 个体户
|
||||||
|
* <p>
|
||||||
|
* 营业执照上的主体类型一般为个体户、个体工商户、个体经营;
|
||||||
|
*/
|
||||||
|
SUBJECT_TYPE_INDIVIDUAL,
|
||||||
|
/**
|
||||||
|
* 企业
|
||||||
|
* <p>
|
||||||
|
* 营业执照上的主体类型一般为有限公司、有限责任公司;
|
||||||
|
*/
|
||||||
|
SUBJECT_TYPE_ENTERPRISE,
|
||||||
|
/**
|
||||||
|
* 政府机关
|
||||||
|
* <p>
|
||||||
|
* 包括各级、各类政府机关,如机关党委、税务、民政、人社、工商、商务、市监等;
|
||||||
|
*/
|
||||||
|
SUBJECT_TYPE_GOVERNMENT,
|
||||||
|
/**
|
||||||
|
* 事业单位
|
||||||
|
* <p>
|
||||||
|
* 包括国内各类事业单位,如:医疗、教育、学校等单位;
|
||||||
|
*/
|
||||||
|
SUBJECT_TYPE_INSTITUTIONS,
|
||||||
|
/**
|
||||||
|
* 社会组织
|
||||||
|
* <p>
|
||||||
|
* 包括社会团体、民办非企业、基金会、基层群众性自治组织、农村集体经济组织等组织
|
||||||
|
*/
|
||||||
|
SUBJECT_TYPE_OTHERS
|
||||||
|
}
|
||||||
@@ -668,7 +668,40 @@ public enum WechatPayV3Type {
|
|||||||
*
|
*
|
||||||
* @since 1.0.13.RELEASE
|
* @since 1.0.13.RELEASE
|
||||||
*/
|
*/
|
||||||
PROFITSHARING_BILLS(HttpMethod.GET, "%s/v3/profitsharing/bills");
|
PROFITSHARING_BILLS(HttpMethod.GET, "%s/v3/profitsharing/bills"),
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
/**
|
||||||
|
* 服务商-商户进件-特约商户进件-提交申请单API.
|
||||||
|
*
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
SPEC_MCH_APPLY_PARTNER(HttpMethod.POST, "%s/v3/applyment4sub/applyment/"),
|
||||||
|
/**
|
||||||
|
* 服务商-商户进件-特约商户进件-通过业务申请编号查询申请状态API.
|
||||||
|
*
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
SPEC_MCH_APPLY_QUERY_BUSINESS_CODE(HttpMethod.GET, "%s/v3/applyment4sub/applyment/business_code/{business_code}"),
|
||||||
|
/**
|
||||||
|
* 服务商-商户进件-特约商户进件-通过申请单号查询申请状态API.
|
||||||
|
*
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
SPEC_MCH_APPLY_QUERY_APPLYMENT_ID(HttpMethod.GET, "%s/v3/applyment4sub/applyment/applyment_id/{applyment_id}"),
|
||||||
|
/**
|
||||||
|
* 服务商-商户进件-特约商户进件-修改结算账号API.
|
||||||
|
*
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
SPEC_MCH_SUB_MODIFY(HttpMethod.POST, "%s/v3/apply4sub/sub_merchants/{sub_mchid}/modify-settlement"),
|
||||||
|
/**
|
||||||
|
* 服务商-商户进件-特约商户进件-查询结算账户API.
|
||||||
|
*
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
SPEC_MCH_SUB_SETTLEMENT(HttpMethod.GET, "%s/v3/apply4sub/sub_merchants/{sub_mchid}/settlement");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Pattern.
|
* The Pattern.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -223,4 +223,15 @@ public class WechatApiProvider {
|
|||||||
public WechatPartnerProfitsharingApi partnerProfitsharingApi(String tenantId) {
|
public WechatPartnerProfitsharingApi partnerProfitsharingApi(String tenantId) {
|
||||||
return new WechatPartnerProfitsharingApi(wechatPayClient, tenantId);
|
return new WechatPartnerProfitsharingApi(wechatPayClient, tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信V3服务商-商户进件-特约商户进件
|
||||||
|
*
|
||||||
|
* @param tenantId the tenant id
|
||||||
|
* @return wechat partner special mch api
|
||||||
|
*/
|
||||||
|
public WechatPartnerSpecialMchApi partnerSpecialMchApi(String tenantId){
|
||||||
|
return new WechatPartnerSpecialMchApi(wechatPayClient, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.enumeration.WeChatServer;
|
||||||
|
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
|
||||||
|
import cn.felord.payment.wechat.v3.model.specmch.ApplymentParams;
|
||||||
|
import cn.felord.payment.wechat.v3.model.specmch.BankAccountInfo;
|
||||||
|
import cn.felord.payment.wechat.v3.model.specmch.ContactInfo;
|
||||||
|
import cn.felord.payment.wechat.v3.model.specmch.SubMchModifyParams;
|
||||||
|
import cn.felord.payment.wechat.v3.model.specmch.UboInfoListItem;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信V3服务商-商户进件-特约商户进件
|
||||||
|
* <p>
|
||||||
|
* 参见<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/open/pay/chapter7_1_1.shtml">产品介绍</a>
|
||||||
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
public class WechatPartnerSpecialMchApi extends AbstractApi {
|
||||||
|
/**
|
||||||
|
* Instantiates a new Abstract api.
|
||||||
|
*
|
||||||
|
* @param wechatPayClient the wechat pay client
|
||||||
|
* @param tenantId the tenant id
|
||||||
|
*/
|
||||||
|
public WechatPartnerSpecialMchApi(WechatPayClient wechatPayClient, String tenantId) {
|
||||||
|
super(wechatPayClient, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交申请单API
|
||||||
|
* <p>
|
||||||
|
* 服务商(银行、支付机构、电商平台不可用)使用该接口提交商家资料,帮助商家入驻成为微信支付的特约商户。
|
||||||
|
* 流程指引请看 <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/open/pay/chapter7_1_2.shtml#part-6">特约商户进件流程</a>
|
||||||
|
*
|
||||||
|
* @param params the params
|
||||||
|
* @return the wechat response entity
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> apply(ApplymentParams params) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.SPEC_MCH_APPLY_PARTNER, params)
|
||||||
|
.function((wechatPayV3Type, applymentParams) -> {
|
||||||
|
SignatureProvider signatureProvider = this.client().signatureProvider();
|
||||||
|
X509WechatCertificateInfo certificate = signatureProvider.getCertificate(this.wechatMetaBean().getTenantId());
|
||||||
|
final X509Certificate x509Certificate = certificate.getX509Certificate();
|
||||||
|
ApplymentParams applyRequestParams = this.convert(applymentParams, signatureProvider, x509Certificate);
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.toUri();
|
||||||
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
|
httpHeaders.add("Wechatpay-Serial", certificate.getWechatPaySerial());
|
||||||
|
return Post(uri, applyRequestParams, httpHeaders);
|
||||||
|
})
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过业务申请编号查询申请状态
|
||||||
|
*
|
||||||
|
* @param businessCode the business code
|
||||||
|
* @return the wechat response entity
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> queryByBusinessCode(String businessCode) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.SPEC_MCH_APPLY_QUERY_BUSINESS_CODE, businessCode)
|
||||||
|
.function((type, id) -> {
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.expand(id)
|
||||||
|
.toUri();
|
||||||
|
return Get(uri);
|
||||||
|
})
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过申请单号查询申请状态
|
||||||
|
*
|
||||||
|
* @param applymentId the applyment id
|
||||||
|
* @return the wechat response entity
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> queryByApplymentId(String applymentId) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.SPEC_MCH_APPLY_QUERY_APPLYMENT_ID, applymentId)
|
||||||
|
.function((type, id) -> {
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.expand(id)
|
||||||
|
.toUri();
|
||||||
|
return Get(uri);
|
||||||
|
})
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算账号API
|
||||||
|
* <p>
|
||||||
|
* 服务商/电商平台(不包括支付机构、银行),可使用本接口,修改其进件且已签约特约商户/二级商户的结算银行账户。
|
||||||
|
*
|
||||||
|
* @param params the params
|
||||||
|
* @return the wechat response entity
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> modify(SubMchModifyParams params) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.SPEC_MCH_SUB_MODIFY, params)
|
||||||
|
.function((type, subMchModifyParams) -> {
|
||||||
|
SignatureProvider signatureProvider = this.client().signatureProvider();
|
||||||
|
X509WechatCertificateInfo certificate = signatureProvider.getCertificate(this.wechatMetaBean().getTenantId());
|
||||||
|
final X509Certificate x509Certificate = certificate.getX509Certificate();
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.expand(subMchModifyParams.getSubMchid())
|
||||||
|
.toUri();
|
||||||
|
|
||||||
|
subMchModifyParams.setSubMchid(null);
|
||||||
|
subMchModifyParams.setAccountNumber(signatureProvider.encryptRequestMessage(subMchModifyParams.getAccountNumber(), x509Certificate));
|
||||||
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
|
httpHeaders.add("Wechatpay-Serial", certificate.getWechatPaySerial());
|
||||||
|
return Post(uri, subMchModifyParams, httpHeaders);
|
||||||
|
})
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算账户API
|
||||||
|
* <p>
|
||||||
|
* 服务商/电商平台(不包括支付机构、银行),可使用本接口,查询其进件且已签约特约商户/二级商户的结算账户信息(敏感信息掩码)。
|
||||||
|
* 该接口可用于核实是否成功修改结算账户信息、及查询系统汇款验证结果。
|
||||||
|
*
|
||||||
|
* @param subMchid the sub mchid
|
||||||
|
* @return the wechat response entity
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> querySettlement(String subMchid) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.SPEC_MCH_SUB_SETTLEMENT, subMchid)
|
||||||
|
.function((type, id) -> {
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.expand(id)
|
||||||
|
.toUri();
|
||||||
|
return Get(uri);
|
||||||
|
})
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplymentParams convert(ApplymentParams applymentParams, SignatureProvider signatureProvider, final X509Certificate x509Certificate) {
|
||||||
|
|
||||||
|
ContactInfo contactInfo = applymentParams.getContactInfo();
|
||||||
|
contactInfo.setContactName(signatureProvider.encryptRequestMessage(contactInfo.getContactName(), x509Certificate));
|
||||||
|
String contactIdNumber = contactInfo.getContactIdNumber();
|
||||||
|
if (contactIdNumber != null) {
|
||||||
|
contactInfo.setContactIdNumber(signatureProvider.encryptRequestMessage(contactIdNumber, x509Certificate));
|
||||||
|
}
|
||||||
|
String openid = contactInfo.getOpenid();
|
||||||
|
if (openid != null) {
|
||||||
|
contactInfo.setOpenid(signatureProvider.encryptRequestMessage(openid, x509Certificate));
|
||||||
|
}
|
||||||
|
contactInfo.setMobilePhone(signatureProvider.encryptRequestMessage(contactInfo.getMobilePhone(), x509Certificate));
|
||||||
|
contactInfo.setContactEmail(signatureProvider.encryptRequestMessage(contactInfo.getContactEmail(), x509Certificate));
|
||||||
|
|
||||||
|
List<UboInfoListItem> uboInfoList = applymentParams.getSubjectInfo().getUboInfoList();
|
||||||
|
if (!CollectionUtils.isEmpty(uboInfoList)) {
|
||||||
|
uboInfoList.forEach(uboInfoListItem -> {
|
||||||
|
uboInfoListItem.setUboIdDocName(signatureProvider.encryptRequestMessage(uboInfoListItem.getUboIdDocName(), x509Certificate));
|
||||||
|
uboInfoListItem.setUboIdDocNumber(signatureProvider.encryptRequestMessage(uboInfoListItem.getUboIdDocNumber(), x509Certificate));
|
||||||
|
uboInfoListItem.setUboIdDocAddress(signatureProvider.encryptRequestMessage(uboInfoListItem.getUboIdDocAddress(), x509Certificate));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
BankAccountInfo bankAccountInfo = applymentParams.getBankAccountInfo();
|
||||||
|
|
||||||
|
bankAccountInfo.setAccountName(signatureProvider.encryptRequestMessage(bankAccountInfo.getAccountName(), x509Certificate));
|
||||||
|
bankAccountInfo.setAccountNumber(signatureProvider.encryptRequestMessage(bankAccountInfo.getAccountNumber(), x509Certificate));
|
||||||
|
|
||||||
|
return applymentParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AccountCertInfo{
|
||||||
|
private String settlementCertPic;
|
||||||
|
private String relationCertPic;
|
||||||
|
private List<String> otherCertPics;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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.specmch;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
public class AdditionInfo {
|
||||||
|
private String legalPersonCommitment;
|
||||||
|
private String legalPersonVideo;
|
||||||
|
private List<String> businessAdditionPics;
|
||||||
|
private String businessAdditionMsg;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AppInfo{
|
||||||
|
private String appAppid;
|
||||||
|
private String appSubAppid;
|
||||||
|
private List<String> appPics;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplymentParams {
|
||||||
|
private String businessCode;
|
||||||
|
private ContactInfo contactInfo;
|
||||||
|
private SubjectInfo subjectInfo;
|
||||||
|
private BusinessInfo businessInfo;
|
||||||
|
private SettlementInfo settlementInfo;
|
||||||
|
private BankAccountInfo bankAccountInfo;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BankAccountInfo{
|
||||||
|
private String bankAccountType;
|
||||||
|
private String accountName;
|
||||||
|
private String accountBank;
|
||||||
|
private String bankAddressCode;
|
||||||
|
private String bankBranchId;
|
||||||
|
private String bankName;
|
||||||
|
private String accountNumber;
|
||||||
|
private AccountCertInfo accountCertInfo;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BizStoreInfo{
|
||||||
|
private String bizStoreName;
|
||||||
|
private String bizAddressCode;
|
||||||
|
private String bizStoreAddress;
|
||||||
|
private List<String> storeEntrancePic;
|
||||||
|
private List<String> indoorPic;
|
||||||
|
private String bizSubAppid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BusinessInfo{
|
||||||
|
private String merchantShortname;
|
||||||
|
private String servicePhone;
|
||||||
|
private SalesInfo salesInfo;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BusinessLicenseInfo{
|
||||||
|
private String licenseCopy;
|
||||||
|
private String licenseNumber;
|
||||||
|
private String merchantName;
|
||||||
|
private String legalPerson;
|
||||||
|
private String licenseAddress;
|
||||||
|
private LocalDate periodBegin;
|
||||||
|
private LocalDate periodEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CertificateInfo {
|
||||||
|
private String certCopy;
|
||||||
|
private String certType;
|
||||||
|
private String certNumber;
|
||||||
|
private String merchantName;
|
||||||
|
private String companyAddress;
|
||||||
|
private String legalPerson;
|
||||||
|
private LocalDate periodBegin;
|
||||||
|
private LocalDate periodEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.enumeration.IdDocType;
|
||||||
|
import cn.felord.payment.wechat.enumeration.ContactType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ContactInfo{
|
||||||
|
private ContactType contactType;
|
||||||
|
private String contactName;
|
||||||
|
private IdDocType contactIdDocType;
|
||||||
|
private String contactIdNumber;
|
||||||
|
private String contactIdDocCopy;
|
||||||
|
private String contactIdDocCopyBack;
|
||||||
|
private LocalDate contactPeriodBegin;
|
||||||
|
private LocalDate contactPeriodEnd;
|
||||||
|
private String businessAuthorizationLetter;
|
||||||
|
private String openid;
|
||||||
|
private String mobilePhone;
|
||||||
|
private String contactEmail;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.enumeration.FinanceType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FinanceInstitutionInfo{
|
||||||
|
private List<String> financeLicensePics;
|
||||||
|
private FinanceType financeType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IdCardInfo{
|
||||||
|
private String idCardCopy;
|
||||||
|
private String idCardNational;
|
||||||
|
private String idCardName;
|
||||||
|
private String idCardNumber;
|
||||||
|
private String idCardAddress;
|
||||||
|
private LocalDate cardPeriodBegin;
|
||||||
|
private LocalDate cardPeriodEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IdDocInfo {
|
||||||
|
private String idDocCopy;
|
||||||
|
private String idDocCopyBack;
|
||||||
|
private String idDocName;
|
||||||
|
private String idDocNumber;
|
||||||
|
private String idDocAddress;
|
||||||
|
private String docPeriodBegin;
|
||||||
|
private String docPeriodEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.enumeration.IdDocType;
|
||||||
|
import cn.felord.payment.wechat.enumeration.ContactType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IdentityInfo{
|
||||||
|
private ContactType idHolderType;
|
||||||
|
private IdDocType idDocType;
|
||||||
|
private String authorizeLetterCopy;
|
||||||
|
private IdCardInfo idCardInfo;
|
||||||
|
private IdDocInfo idDocInfo;
|
||||||
|
private Boolean owner;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MiniProgramInfo{
|
||||||
|
private String miniProgramAppid;
|
||||||
|
private String miniProgramSubAppid;
|
||||||
|
private List<String> miniProgramPics;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MpInfo{
|
||||||
|
private String mpAppid;
|
||||||
|
private String mpSubAppid;
|
||||||
|
private List<String> mpPics;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SalesInfo{
|
||||||
|
private List<String> salesScenesType;
|
||||||
|
private BizStoreInfo bizStoreInfo;
|
||||||
|
private MpInfo mpInfo;
|
||||||
|
private MiniProgramInfo miniProgramInfo;
|
||||||
|
private AppInfo appInfo;
|
||||||
|
private WebInfo webInfo;
|
||||||
|
private WeworkInfo weworkInfo;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SettlementInfo{
|
||||||
|
private String settlementId;
|
||||||
|
private String qualificationType;
|
||||||
|
private List<String> qualifications;
|
||||||
|
private String activitiesId;
|
||||||
|
private String activitiesRate;
|
||||||
|
private List<String> activitiesAdditions;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.14.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubMchModifyParams {
|
||||||
|
private String subMchid;
|
||||||
|
private String accountType;
|
||||||
|
private String accountBank;
|
||||||
|
private String bankAddressCode;
|
||||||
|
private String bankName;
|
||||||
|
private String bankBranchId;
|
||||||
|
private String accountNumber;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.enumeration.SubjectType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SubjectInfo{
|
||||||
|
private SubjectType subjectType;
|
||||||
|
private Boolean financeInstitution;
|
||||||
|
private BusinessLicenseInfo businessLicenseInfo;
|
||||||
|
private CertificateInfo certificateInfo;
|
||||||
|
private String certificateLetterCopy;
|
||||||
|
private FinanceInstitutionInfo financeInstitutionInfo;
|
||||||
|
private IdentityInfo identityInfo;
|
||||||
|
private List<UboInfoListItem> uboInfoList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.enumeration.IdDocType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UboInfoListItem{
|
||||||
|
private IdDocType uboIdDocType;
|
||||||
|
private String uboIdDocCopy;
|
||||||
|
private String uboIdDocCopyBack;
|
||||||
|
private String uboIdDocName;
|
||||||
|
private String uboIdDocNumber;
|
||||||
|
private String uboIdDocAddress;
|
||||||
|
private LocalDate uboPeriodBegin;
|
||||||
|
private LocalDate uboPeriodEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WebInfo{
|
||||||
|
private String domain;
|
||||||
|
private String webAuthorisation;
|
||||||
|
private String webAppid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.felord.payment.wechat.v3.model.specmch;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WeworkInfo{
|
||||||
|
private String corpId;
|
||||||
|
private String subCorpId;
|
||||||
|
private List<String> weworkPics;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user