JAVA - 银行卡认证

文档地址:https://market.cloud.tencent.com/products/6211#spec=1.00%E5%85%83%2F3%E6%AC%A1

代码展示:


       //调第三方接口进行银行卡认证
            Map map = new HashMap();
            //银行卡号
            map.put("bankCard",cardBag1.getCardNumber());
            //姓名
            map.put("name",user.getRealName());
            // 身份证
            map.put("idNumber",user.getIdentityCard());
            //银行卡绑定手机
            map.put("mobile",cardBag.getMobile());
            boolean flag = getAuthenticationResult(map);
//调用银行卡认证
    public boolean getAuthenticationResult(Map map) {
        boolean flag = false;;
        //固定配置(调用服务)
        map.put("serviceCode","X24");
        String host = "service-o5izlicm-1255327000.ap-guangzhou.apigateway.myqcloud.com";
        String path = "/bankCardFour";
        String url = "http://service-o5izlicm-1255327000.ap-guangzhou.apigateway.myqcloud.com/release";
        url = url + path;
        String postDate = JSON.toJSONString(map);
        String result = SignAndSend.sendPosts(url,host, secretId, secretKey,postDate);
        System.out.println("sendPosts : "+result);
        JSONObject jsonObject = JSONObject.parseObject(result);
        String code = (String) jsonObject.get("code");
        if (code.equals("200")){  //
            JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
            String key = (String) jsonObject1.get("key");
            //核对一致标识(0000:一致;9998:不一致)
            if (key.equals("0000")){  //核对一致
                flag = true;
            }
        }
        return flag;
    }

 工具类参考 :JAVA-银行卡归属地查询

你可能感兴趣的:(java)