银行卡二要素真实性查询

验证用户的银行卡号、持卡人姓名是否真实。

示例代码:

private static String host = "https://bank.market.alicloudapi.com";

private static String path = "/bank2";

private static String method = "GET";

private static String appcode = "8783cf8695154a3e8fc77b51fbe2****";

/*
 * checkIsValid
 * @description:根据银行账号和持卡人姓名验证银行卡的真实性
 * @author 李阳
 * @date 2018/12/12
 * @params [account, name]
 * @return java.lang.String
 */
public static String checkIsValid(String account, String name) throws Exception {
    Map<String, String> headers = new HashMap<String, String>();
    //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
    headers.put("Authorization", "APPCODE " + appcode);
    Map<String, String> querys = new HashMap<String, String>();

    //持卡人姓名
    querys.put("acct_name", name);

    //卡号
    querys.put("acct_pan", account);

    //是否返回银行所在区域
    querys.put("needBelongArea", "true");

    /**
     * 重要提示如下:
     * HttpUtils请从
     * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
     * 下载
     *
     * 相应的依赖请参照
     * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
     */
    HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
    //获取response的body
    return EntityUtils.toString(response.getEntity());
}

 

正常返回结果:

78f51a7ad020efb34b5dc35b5b9e8908967.jpg

 

异常结果:

66ed55b9ed820d3b51a1669db1e3c534b55.jpg

 

结果参数:

75d84641d9b8e895dafae33be9028961639.jpg
911e0e037a042a47cf32742417967b338be.jpg

参考:
https://market.aliyun.com/products/56928004/cmapi012976.html?spm=5176.730005.productlist.d_cmapi012976.9c5c35247n8dJ1&innerSource=search_%E9%93%B6%E8%A1%8C%E5%8D%A1#sku=yuncode697600007

https://www.showapi.com/api/lookPoint/1072

转载于:https://my.oschina.net/kevin2kelly/blog/2987591

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值