🆕 #2696 【微信支付】银行组件添加省市列表查询及支行列表查询的接口

This commit is contained in:
英狐
2022-06-14 02:30:33 +00:00
committed by binarywang
parent 1f3f133772
commit a21a622936
8 changed files with 1109 additions and 156 deletions

View File

@@ -1,7 +1,6 @@
package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.bank.BankAccountResult;
import com.github.binarywang.wxpay.bean.bank.BankingResult;
import com.github.binarywang.wxpay.bean.bank.*;
import com.github.binarywang.wxpay.exception.WxPayException;
/**
@@ -64,4 +63,59 @@ public interface BankService {
* @throws WxPayException .
*/
BankingResult corporateBanking(Integer offset, Integer limit) throws WxPayException;
/**
* <pre>
*
* 查询省份列表API
* 通过本接口获取省份列表数据(不包含中国港澳台地区),可用于省份下的城市数据查询
*
* 请求方式GETHTTPS
* 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces">https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces</a>
*
* 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_4.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_4.shtml</a>
* </pre>
*
* @return ProvincesResult 省份列表信息
* @throws WxPayException .
*/
ProvincesResult areasProvinces() throws WxPayException;
/**
* <pre>
*
* 查询城市列表API
* 通过本接口根据省份编码获取省份下的城市列表信息,不包含中国港澳台地区城市信息,可用于支行数据过滤查询
*
* 请求方式GETHTTPS
* 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces/{province_code}/cities">https://api.mch.weixin.qq.com/v3/capital/capitallhh/areas/provinces/{province_code}/cities</a>
*
* 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml</a>
* </pre>
*
* @return CitiesResult 城市列表信息
* @throws WxPayException .
*/
CitiesResult areasCities(Integer provinceCode) throws WxPayException;
/**
* <pre>
*
* 查询支行列表API
* 本接口可以用于根据银行别名编码(仅支持需要填写支行的银行别名编码)和城市编码过滤查询支行列表数据
*
* 请求方式GETHTTPS
* 请求地址:<a href="https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/{bank_alias_code}/branches">https://api.mch.weixin.qq.com/v3/capital/capitallhh/banks/{bank_alias_code}/branches</a>
*
* 文档地址:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter11_2_5.shtml</a>
* </pre>
*
* @param bankAliasCode 银行别名的编码查询支行接口仅支持需要填写支行的银行别名编码。示例值1000006247
* @param cityCode 城市编码唯一标识一座城市用于结合银行别名编码查询支行列表。示例值536
* @param offset 非负整数表示该次请求资源的起始位置从0开始计数。调用方选填默认为0。offset为20limit为100时查询第21-120条数据
* @param limit 非0非负的整数该次请求可返回的最大资源条数。示例值200
* @return BankBranchesResult 城市列表信息
* @throws WxPayException .
*/
BankBranchesResult bankBranches(String bankAliasCode, Integer cityCode, Integer offset, Integer limit) throws WxPayException;
}

View File

@@ -22,7 +22,7 @@ public interface EcommerceService {
* <pre>
* 二级商户进件API
* 接口地址: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_1.shtml
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_1_8.shtml
*
* </pre>
*

View File

@@ -1,7 +1,6 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.bank.BankAccountResult;
import com.github.binarywang.wxpay.bean.bank.BankingResult;
import com.github.binarywang.wxpay.bean.bank.*;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.BankService;
import com.github.binarywang.wxpay.service.WxPayService;
@@ -43,4 +42,27 @@ public class BankServiceImpl implements BankService {
String response = payService.getV3(url);
return GSON.fromJson(response, BankingResult.class);
}
@Override
public ProvincesResult areasProvinces() throws WxPayException {
String url = String.format("%s/v3/capital/capitallhh/areas/provinces", this.payService.getPayBaseUrl());
String response = payService.getV3WithWechatPaySerial(url);
return GSON.fromJson(response, ProvincesResult.class);
}
@Override
public CitiesResult areasCities(Integer provinceCode) throws WxPayException {
String url = String.format("%s/v3/capital/capitallhh/areas/provinces/%s/cities", this.payService.getPayBaseUrl(), provinceCode);
String response = payService.getV3WithWechatPaySerial(url);
return GSON.fromJson(response, CitiesResult.class);
}
@Override
public BankBranchesResult bankBranches(String bankAliasCode, Integer cityCode, Integer offset, Integer limit) throws WxPayException {
offset = offset == null ? 0 : offset;
limit = limit == null ? 200 : limit;
String url = String.format("%s/v3/capital/capitallhh/banks/%s/branches?city_code=%s&offset=%s&limit=%s", this.payService.getPayBaseUrl(), bankAliasCode, cityCode, offset, limit);
String response = payService.getV3(url);
return GSON.fromJson(response, BankBranchesResult.class);
}
}