# 电子签章示例
# 服务场景描述
电子签章服务通过调用设置印章、上传合同、添加签署人、签署合同以及合同归档等API功能的调用,满足用户电子签章需求。如图所示:
# 服务调用流程
# 1.本服务调用依赖以下API:
设置印章 可通过三方方式设置印章:
[上传合同] 目前支持两种方式:
1、先上传,再创建合同。分两步:
[合同签署] 签署人收到合同签署通知之后,需要进行合同签署。合同签署支持两种签署方式:
# 2.服务调用前置条件:
创建应用,获取appkey、appsecret;
获取服务调用token;
开通服务,scope授权通过;
以上步骤可参考前置准备
实名认证 使用电子签章服务,签署人必须完成实名认证并申请数字证书操作。 以上步骤可参考实名认证
# 3.具体调用步骤
step1:设置印章
以自定义印章为例(accountId为实名认证账户ID):
# 调用自定义印章接口:
curl -X POST "https://apigate.glodon.com/b-trust-test/api/v2/esignature/seal/" -H \
"accept: application/json;charset=UTF-8" -H "authorization: Bearer cn-3a9e951a-14ea-452a-9768-306beb5e89d1" -H \
"Content-Type: application/json" -d "{ \"accountId\": \"acct97713983829573632\", \"imageData\": \"iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAeKSURBVGhD1Zp1qBVPFMe/79mtYGC3ohjYga34bFFUFBtbEUwQAwwM7EDBwMcTFLG7/rADEzFQVOxnK3br+e33nhn36s97d/cpPv3AsHNmZvfO2TNzZubshZDr10X69BGBIzLFxPzdyfZz4ECR27dDKkBu3RLJmNGt/NdS5swhZWKkXz/B4sUI0aYNUKkS8OmTyn8rqVIBp08DGzeqPGCAo5LVrG3bkIn+KVq00L7HxkqsquRAS/xr1Kih169fEYuYGBWCDifnZjx4ABw7Buzdawr/MLbPjg6uRby4dAkYORIYOxbo2xeoWBEoVQqoWRNo2BD48ME0TCa+ubPx483Ai0BCguspwlP9+iIXL5pGfxj2mX1wdPBvkS5dgKZNgbg4U+Bw4oQOq9KlTUFAODyPHFEPdOAAMHcuMGwY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remark\": \"备注\"}"
# 接口调用返回:
{
"code": "10000",
"data": {
"sealId": "seal120910075962327040" //印章id
},
"message": "成功"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
step2:上传合同
以上传并同时创建为例:
# 调用上传并创建合同接口:
curl -X POST "https://apigate.glodon.com/b-trust-test/api/v2/esignature/contract/uploadAndCreate?accountId=acct97713983829573632&contractTitle=XX%E5%90%88%E5%90%8C" -H \
"accept: */*" -H "authorization: Bearer cn-3a9e951a-14ea-452a-9768-306beb5e89d1" -H \
"Content-Type: multipart/form-data" -F "file=@ISCC_2018.pdf;type=application/pdf"
# 接口调用返回:
{
"code":"10000",
"data":{
"contractId":"ctct120914438076235776" //生成的合同id
},
"message":"成功"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
step3:添加签署人
# 调用添加签署者接口:
curl -X POST "https://apigate.glodon.com/b-trust-test/api/v2/esignature/contract/signers" -H \
"accept: application/json;charset=UTF-8" -H "authorization: Bearer cn-3a9e951a-14ea-452a-9768-306beb5e89d1" -H \
"Content-Type: application/json" -d "{ \"contractId\": \"ctct120914438076235776\", \"signers\": [ { \"accountId\": \"acct97713983829573632\", \"signPositionType\": 1, \
\"positionContent\": \"1,30,49\", \"signForm\": 1 } ]}"
# 接口调用返回:
{
"code":"10000",
"data":{
"contractId":"ctct120914438076235776",
"signers":[
{
"accountId":"acct97713983829573632",
"signerId":"sgnr120915537315233792" //生成的签署者id
}
]
},
"message":"成功"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
step4:启动签署
# 调用启动合同签署流程接口:
curl -X POST "https://apigate.glodon.com/b-trust-test/api/v2/esignature/contract/start" -H \
"accept: application/json;charset=UTF-8" -H "authorization: Bearer cn-3a9e951a-14ea-452a-9768-306beb5e89d1" -H \
"Content-Type: application/json" -d "{ \"contractId\": \"ctct120914438076235776\"}"
# 接口调用返回:
{
"code": "10000",
"data": null,
"message": "成功"
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
step5:签署合同 以手动签署为例:
# 调用获取手动签署地址接口:
curl -X POST "https://apigate.glodon.com/b-trust-test/api/v2/esignature/contract/sign/url" -H \
"accept: application/json;charset=UTF-8" -H "authorization: Bearer cn-3a9e951a-14ea-452a-9768-306beb5e89d1" -H \
"Content-Type: application/json" -d "{ \"signerId\": \"sgnr120915537315233792\", \"sealId\": \"seal120910075962327040\", \"returnUrl\": \"http:///114.115.148.211:8900/swagger-ui.html\", \
\"remark\": \"备注\"}"
# 接口调用返回:
{
"code":"10000",
"data":{
"accountId":"acct97713983829573632",
"signer":"sgnr120915537315233792",
//生成合同手动签署url
"url":"http://sdktestapiserver.fadada.com:8888/sdk_server/get_sign_page?app_id=402558×tamp=20200529160406&v=2.0&contract_id=ctct120914438076235776&customer_id=A8EFDCD0DF1B2B03F706E0F1932F54AA&person_id=&transaction_id=sgnr120915537315233792&sign_locations=%5B%7B%22pagenum%22%3A1%2C%22x%22%3A30.0%2C%22y%22%3A49.0%7D%5D¬ify_url=http://114.115.216.139:8900/api/v2/esignature/contract/notify&return_url=http:///114.115.148.211:8900/swagger-ui.html&client_url=http://114.115.216.139:8900&signature_id=4730263&is_mobile=null&is_close=&get_image_by_browser=&ver_call_way=&show_signature=&sms_template=&token=&is_verify=null&verify_way=null&msg_digest=NEJCQjQ2M0NBMUM3NDBDODAxMThDMUVEQTg0QjJCNDNENDBERUYzMg=="
},
"message":"成功"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
获取合同手动签署url地址后,在浏览器中打开,执行参照上面第二点手动签署页面。签署页面如下图:
step6:签署归档
# 调用合同归档接口:
curl -X POST "https://apigate.glodon.com/b-trust-test/api/v2/esignature/contract/evidence" -H \
"accept: application/json;charset=UTF-8" -H "authorization: Bearer cn-3a9e951a-14ea-452a-9768-306beb5e89d1" -H \
"Content-Type: application/json" -d "{ \"contractId\": \"ctct120914438076235776\"}"
# 接口调用返回:
{
"code": "10000",
"data": {
"czId": "czid120919064355799040" //存证id
},
"message": "成功"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13