SDK接入
<h2>文档修改记录</h2>
<table>
<thead>
<tr>
<th>修改人</th>
<th>修改日期</th>
<th>修改内容</th>
</tr>
</thead>
<tbody>
<tr>
<td>微保-李</td>
<td>2021-07-01</td>
<td>新建,包含扫码、btb/btc、对账。详情见【聚合支付api】目录</td>
</tr>
<tr>
<td>微保-李</td>
<td>2022-04-29</td>
<td>http连接池优化。vbao.properties新增httpPoolMaxTotal、httpPoolDefaultMaxPerRoute参数<br/><a href="<a href="https://platform-sdk-data.oss-cn-hzfinance.aliyuncs.com/newT3/vbao-sdk-1.1.jar">vbao-sdk-1.1.jar</a>">https://platform-sdk-data.oss-cn-hzfinance.aliyuncs.com/newT3/vbao-sdk-1.1.jar">vbao-sdk-1.1.jar</a></a>;</td>
</tr>
<tr>
<td>微保-李</td>
<td>2023-03-13</td>
<td>多商户支持优化<br/><a href="<a href="https://platform-sdk-data.oss-cn-hzfinance.aliyuncs.com/newT3/vbao-sdk-1.2.jar">vbao-sdk-1.2.jar</a>">https://platform-sdk-data.oss-cn-hzfinance.aliyuncs.com/newT3/vbao-sdk-1.2.jar">vbao-sdk-1.2.jar</a></a>;</td>
</tr>
<tr>
<td>微保-李</td>
<td>2024-09-09</td>
<td>通用请求,支持自定义请求地址<br/><a href="<a href="https://platform-sdk-data.oss-cn-hzfinance.aliyuncs.com/newT3/vbao-sdk-1.3.jar">vbao-sdk-1.3.jar</a>">https://platform-sdk-data.oss-cn-hzfinance.aliyuncs.com/newT3/vbao-sdk-1.3.jar">vbao-sdk-1.3.jar</a></a>;</td>
</tr>
</tbody>
</table>
<h3>第一步:加入第三方jar</h3>
<pre><code> &lt;dependency&gt;
&lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
&lt;artifactId&gt;httpclient&lt;/artifactId&gt;
&lt;version&gt;4.5.6&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
&lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
&lt;version&gt;2.11.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
&lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
&lt;version&gt;2.11.1&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
<h3>第二步:下载引用微保SDK,由微保提供jar包(目前可支持jdk1.7及以上)</h3>
<pre><code> &lt;!-- 使用者可点击下方jar包下载后上传至自己的私服地址 --&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.vbao.frame&lt;/groupId&gt;
&lt;artifactId&gt;vbao-sdk&lt;/artifactId&gt;
&lt;version&gt;1.3&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
<h3>第三步:使用SDK,以下示例</h3>
<pre><code>public static void main(String[] args) throws VbaoException {
Map&lt;String,String&gt; map = new HashMap&lt;&gt;();
map.put(&quot;orgCode&quot;,&quot;123123&quot;);
map.put(&quot;orderNo&quot;,&quot;123456&quot;);
// System.out.println(QrcodeInterfaceCall.create(map));
// SDK1.3及之后,可使用以下调用
System.out.println(InterfaceCall.request(map,&quot;/api/vborder/qrorder/standard/create&quot;));
}</code></pre>
<h3>接口说明</h3>
<pre><code>统一下单: QrcodeInterfaceCall.create
订单支付结果查询: QrcodeInterfaceCall.qrcodeQuery
退款: QrcodeInterfaceCall.refund
退款结果查询: QrcodeInterfaceCall.refundQuery
关单: QrcodeInterfaceCall.qrcodeClose
b2b/b2c创建订单: QrcodeInterfaceCall.btbBtcCreate
通用解析(支付结果通知、退款结果通知等): QrcodeInterfaceCall.analysisResult
analysisResult说明:对微保调用或返回的报文进行解析
SDK1.3及之后,可使用InterfaceCall.request(requestMap,url);调用</code></pre>
<h3>公共SDK配置说明</h3>
<p>1.在项目的resources目录下新增config文件夹
2.在config文件夹下新建vbao.properties文件
3.在vbao.properties配置文件中新增以下配置</p>
<pre><code>vbaoDomin=微保域名
customerNo=微保分配的商户号
signKey=微保分配的签名key
publicKey=微保分配的公钥
httpPoolMaxTotal=最大连接数。根据自己系统配置,类型为数字。默认:500
httpPoolDefaultMaxPerRoute=单个主机最大连接数。根据自己系统配置,类型为数字。默认:200</code></pre>
<p>注:</p>
<p>单商户:修改vbao.properties或通过程序初始化;</p>
<pre><code>VbaoConfig.putValue(VbaoConfig.VBAO_DOMIN,&quot;xxxxx&quot;,true);
VbaoConfig.putValue(VbaoConfig.CUSTOMER_NO,&quot;xxxxx&quot;,true);
VbaoConfig.putValue(VbaoConfig.SIGN_KEY,&quot;xxxxx&quot;,true);
VbaoConfig.putValue(VbaoConfig.PUBLIC_KEY,&quot;xxxxx&quot;,true);</code></pre>
<p>多商户:每次请求之前都需要通过putValue方法设置;SDK1.2及以上支持</p>
<pre><code>// 如不希望每次都对域名设置,则根据单商户模式增加全局标识true参数;
VbaoConfig.putValue(VbaoConfig.VBAO_DOMIN,&quot;xxxxx&quot;);
VbaoConfig.putValue(VbaoConfig.CUSTOMER_NO,&quot;xxxxx&quot;);
VbaoConfig.putValue(VbaoConfig.SIGN_KEY,&quot;xxxxx&quot;);
VbaoConfig.putValue(VbaoConfig.PUBLIC_KEY,&quot;xxxxx&quot;);</code></pre>