开发者中心

简介

保准牛开放平台是为企业及渠道方量身打造的快捷投保系统,支持RSET API,SDK及渠道方嵌套页面。SDK方式代码更简洁,只需要5行代码即可进行投保。

投保流程

目前保准牛开放平台支持投保,保单查询,实时计费,佣金结算等。投保接口对于不同的渠道略有差异,详情请点击产品与服务模块查看

获取账户信息

当认证审核通过后生成唯一的appId、密钥等,申请完某一产品审核通过后生成唯一的产品token,对接的时候加入密钥等信息,详情请查阅API文档。测试环境产品token传固定值,骑行宝、兼职宝、配送宝分别传1、2、3。

API文档简介

投保API采用REST风格设计。所有接口请求地址都是可预期的以及面向资源的。使用规范的HTTP响应代码来表示请求结果的正确或错误信息。使用HTTP内置的特性,所有的API请求都会以规范友好的 JSON 对象格式返回。

投保接口

投保接口是保准牛为开发者提供的实时投保接口,通过http post请求,支持团单和个单。

请求地址

/policy/commitInsured.do

请求说明

属性 类型 约束 说明
appId String 必传 接入方应用ID,由保准牛提供
timestamp Long 必传 时间戳,调用方系统时间毫秒Long值
data String 必传 具体内容见请求数据体
sign String 必传 生成规则,MD5(appId+appSecret+timestamp+data)

请求数据体

属性 类型 大小 是否必传 说明
基本信息(policyBaseInfo)
uniqueFlag String 64 Y 唯一标识
callBackUrl String 300 N 回调url,用来回传保单id
groupInsuranceFlag int 1 Y 团个单标志,1:个单,2:团单
beginDateTime datetime Y 保险起期,格式:yyyy-MM-dd HH:mm:ss
endDateTime datetime Y 保险止期,格式:yyyy-MM-dd HH:mm:ss
sumInsured decimal 16,2 Y 保额
policyPremium decimal 16,2 Y 保费
totalSumInsured decimal 16,2 Y 总保额
totalPolicyPremium decimal 16,2 Y 总保费
productToken String 32 Y 保险产品Token,保准牛平台提供
coverageCopies int 10 Y 份数(投保人数)
投保人信息(policyApplicant)
customerName String 32 Y 投保人姓名
certificateType int 1 Y 证件类型,1身份证,2护照,3个人其他,4组织机构代码证,5营业证号,6公司其他
certificateCode String 40 Y 证件号码
customerGender int 1 N 投保人性别,0:未知,1:男性,2:女性
customerBirthday Date N 投保人生日,格式:yyyy-mm-dd
comAddress String 128 N 联系地址
mobile String 15 N 移动电话
email String 64 N 电子邮箱
registerMoney decimal 16,2 N 注册资金
customerOrganization String 1 N 组织层级,a:总部,b:分支机构,c:其他
customerRegisterTime Date N 注册日期,格式:yyyy-mm-dd
customerTotalNumber int 1 N 员工总数,1:1~19,2:20~99,3:100~999,4:1000~9999,5:其他
customerIndustryType String 1 Y 行业类别,详情
customerIndustryClassification String 2 Y 行业细分,详情
areaCode String 6 Y 区县代码,详情
customerCompanyNature String 6 Y 单位性质,详情
customerWithTheInsured int 1 Y 与被保人关系,0:本人,1:配偶,2:子女,3:父母,4:其他
被保人信息(policyAssureds)
customerName String 32 Y 被保人姓名
certificateType int 1 Y 证件类型,1身份证,2护照,3个人其他,4组织机构代码证,5营业证号,6公司其他
certificateCode String 40 Y 证件号码
customerGender int 1 N 被保人性别,0:未知,1:男性,2:女性
customerBirthday Date N 被保人生日,格式:yyyy-mm-dd
benefitWay int 1 Y 受益方式,0:其他,1:法定,2:均分,3:比例,4:顺位
mobile String 15 N 移动电话
areaCode String 6 Y 被保人区县,详情
comAddress String 200 Y 联系地址
serviceMark String 2 Y 在职标志,01:在职,02:退休,09:其他
occupationalCode String 7 Y 职业代码,详情
受益人信息(policyClaimants)
customerName String 32 Y 受益人姓名
certificateType int 1 Y 证件类型,1身份证,2护照,3个人其他,4组织机构代码证,5营业证号,6公司其他
certificateCode String 40 Y 证件号码
customerGender int 1 N 受益人性别,0:未知,1:男性,2:女性
beneficiaryBirthday Date Y 受益人生日,格式:yyyy-mm-dd
benefitRate decimal 5,2 Y 受益比例
beneficiaryOrder int 1 Y 受益人顺序,值范围:1~4
relationshipWithTheInsured int 1 Y 与被保人关系,0:自己,1:配偶,2:子女,3:父母,4:其他
电子保单信息(policyElectron)
messageFlag int 1 Y 是否短信通知,1:发送,0:不发送
electronPolicyMobile String 20 N 接收短信手机号
emailFlag int 1 Y 是否邮件通知,1:发送,0:不发送
electronPolicyEmail String 64 N 电子保单接收邮箱
returnPDFFlag 1 1 Y 返回pdf字节流(Base64),1:返回,0:不返回

下载字典数据

点击下载

请求数据格式Demo

{
    "policyBaseInfo": {
        "appId": "5e32844868bd4c1ca187d75e7984830e",
        "beginDateTime": 1482818078189,
        "callBackUrl": "http://api.baidu.com/updatePolicyId?token=e10adc3949ba59abbe56e057f20f883e",
        "coverageCopies": 1,
        "endDateTime": 1482818088189,
        "groupInsuranceFlag": 1,
        "policyPremium": 100,
        "productToken": "85a9b216cc9546a684e8181eb48d883d",
        "sumInsured": 10,
        "totalPolicyPremium": 100,
        "totalSumInsured": 10,
        "uniqueFlag": "66e134c7f38c40e8be341e85d51d9783"
    },
    "policyApplicant": {
        "areaCode": "110106",
        "certificateCode": "511702198606266283",
        "certificateType": 1,
        "comAddress": "435sdfs",
        "customerName": "朱雅韶"
    },
    "policyAssureds": [
        {
            "areaCode": "110111",
            "certificateCode": "511702198209158764",
            "certificateType": 1,
            "comAddress": "53dggsf",
            "customerName": "雷沛珊",
            "occupationalCode": "2103001",
            "policyClaimants": [
                {
                    "beneficiaryOrder": 2,
                    "benefitRate": 243,
                    "certificateCode": "532628198404266675",
                    "certificateType": 1,
                    "customerName": "何春华",
                    "relationshipWithTheInsured": 2
                }
            ],
            "serviceMark": "01"
        }
    ],
    "policyElectron": {
        "emailFlag": 1,
        "messageFlag": 1,
        "returnPDFFlag": 1
    }
}

返回信息

{ "code": "1", "message": "操作成功" }

返回状态码说明

状态码 说明
1 操作成功
1001 appId不能为空
1002 appId不正确
1003 appId未启用
1004 产品密钥不能为空
1005 产品密钥未启用
1006 产品密钥不正确
1007 timestamp不能空或不正确
1008 签名值sign不能为空
1009 数据data不能为空
1010 签名验证失败
1011 被保人姓名不能为空,1011~1017状态码,校验data数据项
2001 数据格式不正确
2002 数据重复

SDK下载

点击下载

描述

为了方便开发者快速对接,可以下载SDK,目前只支持JAVA SDK

安装SDK

手动安装

将libs/下面的jar包导入工程

maven安装
mvn install:install-file -Dfile=open-platform-sdk.jar -DgroupId=com.baozhunniu 
-DartifactId=open-platform-sdk -Dversion=1.0.0  -Dpackaging=jar -DgeneratePom=true

对接代码Demo

   /**
     * 调用保准牛-投保接口
     * 
     * @param policyVo
     * @return
     */
    @PostMapping(value = "/policyInsured")
    @ResponseBody
    public String policyInsured(@RequestBody PolicyVo policyVo) {

        String url = "http://testgw.bznins.com/policy/commitInsured.do";
        String appId = "5e32844868bd4c1ca187d75e7984830e";
        String appSecret = "b200d647f2f54077b0beddaa79f8c013";
        String productToken = "85a9b216cc9546a684e8181eb48d883d";

        PolicyBaseInfo baseInfo = policyVo.getPolicyBaseInfo();
        baseInfo.setAppId(appId);
        baseInfo.setProductToken(productToken);

        String result = null;
        try {
            LOGGER.info("policyVo:" + policyVo);
            result = InsuredClient.sendPolicyInsured(url, appId, appSecret, policyVo);
        } catch (UnsupportedEncodingException e) {

        }
        return result;
    }

    /**
     * 调用保准牛-投保接口
     * 
     * @param args
     */
    public static void main(String[] args) {

        String url = "http://testgw.bznins.com/policy/commitInsured.do";
        String appId = "5e32844868bd4c1ca187d75e7984830e";
        String appSecret = "b200d647f2f54077b0beddaa79f8c013";
        String productToken = "85a9b216cc9546a684e8181eb48d883d";

        PolicyVo policyVo = new PolicyVo();
        // 基本信息
        PolicyBaseInfo policyBaseInfo = new PolicyBaseInfo();
        policyBaseInfo.setAppId(appId);
        policyBaseInfo.setCallBackUrl(
                "http://api.baidu.com/updatePolicyId?token=e10adc3949ba59abbe56e057f20f883e");
        policyBaseInfo.setUniqueFlag(UUIDUtil.getUUID());
        policyBaseInfo.setGroupInsuranceFlag(1);
        policyBaseInfo.setBeginDateTime(new Date(System.currentTimeMillis() - 10000));
        policyBaseInfo.setEndDateTime(new Date());
        policyBaseInfo.setSumInsured(new BigDecimal(10));
        policyBaseInfo.setPolicyPremium(new BigDecimal(100));
        policyBaseInfo.setTotalSumInsured(new BigDecimal(10));
        policyBaseInfo.setTotalPolicyPremium(new BigDecimal(100));
        policyBaseInfo.setProductToken(productToken);
        policyBaseInfo.setCoverageCopies(1);
        policyVo.setPolicyBaseInfo(policyBaseInfo);

        // 投保人
        PolicyApplicant policyApplicant = new PolicyApplicant();
        policyApplicant.setCustomerName("朱雅韶");
        policyApplicant.setCertificateType(1);
        policyApplicant.setCertificateCode("511702198606266283");
        policyApplicant.setAreaCode("110106");
        policyApplicant.setComAddress("435sdfs");
        policyVo.setPolicyApplicant(policyApplicant);

        // 被保人
        List policyAssureds = new ArrayList<>();
        PolicyAssured policyAssured = new PolicyAssured();
        policyAssured.setCustomerName("雷沛珊");
        policyAssured.setCertificateType(1);
        policyAssured.setCertificateCode("511702198209158764");
        policyAssured.setAreaCode("110111");
        policyAssured.setComAddress("53dggsf");
        policyAssured.setServiceMark("01");
        policyAssured.setOccupationalCode("2103001");

        // 受益人
        List policyClaimants = new ArrayList<>();
        PolicyClaimant policyClaimant = new PolicyClaimant();
        policyClaimant.setCustomerName("何春华");
        policyClaimant.setCertificateType(1);
        policyClaimant.setCertificateCode("532628198404266675");
        policyClaimant.setBenefitRate(new BigDecimal("243"));
        policyClaimant.setBeneficiaryOrder(2);
        policyClaimant.setRelationshipWithTheInsured(2);
        policyClaimants.add(policyClaimant);
        policyAssured.setPolicyClaimants(policyClaimants);
        policyAssureds.add(policyAssured);
        policyVo.setPolicyAssureds(policyAssureds);

        // 电子保单
        PolicyElectron policyElectron = new PolicyElectron();
        policyElectron.setMessageFlag(1);
        policyElectron.setEmailFlag(1);
        policyVo.setPolicyElectron(policyElectron);

        try {
            String result = InsuredClient.sendPolicyInsured(url, appId, appSecret, policyVo);
            System.out.println(result);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }