签署合同
1 签署公章
请求地址:/v2/contract/companysign
请求方法:POST
请求格式:application/json;charset=UTF-8
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 签署方名称,若以子公司身份签署,需要传递子公司全名 |
sealId | String | 否 | 印章ID,若指定了签署位置,可直接在此传递印章ID,同时若下方签署位置参数中无印章ID,会从此处获取 |
stampers | Stamper | 否 | 指定签署位置 |
Stamper(签署位置):
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
type | String | 是 | 签署类型:COMPANY(公章), TIMESTAMP(时间戳),ACROSS_PAGE(骑缝章) |
documentId | String | 是 | 合同文档ID |
sealId | String | 否 | 印章ID |
keyword | String | 否 | 关键字 |
keywordIndex | Integer | 否 | 关键字索引:1代表第1个关键字, 0代表所有关键字,-1代表倒数第1个关键字;默认为1 |
page | Integer | 否 | 坐标页码,0代表所有 |
offsetX | Decimal | 否 | 横坐标/关键字偏移量 |
offsetY | Decimal | 否 | 纵坐标/关键字偏移量 |
返回参数:
参数 | 类型 | 描述 |
---|---|---|
code | Integer | 响应码 |
message | String | 响应消息 |
响应码(全局响应码请查看文档末“全局响应码”):
响应码 | 描述 |
---|---|
1106 | INVALID_STAMPER_TYPE,无效的签章类型;签署公章支持的签章类型如下: COMPANY(公章),TIMESTAMP(时间戳),ACROSS_PAGE(骑缝章)。 |
1107 | NOT SIGN STEP,未挨到签署; 未挨到公司签署公章或者没有签署公章节点。 |
1109 | SIGN PAGE BEYOND,签署页码超出文档页数; 签署位置中的页码超出文档页数。 |
1201 | SEAL NOT FOUND,找不到印章 |
请求示例:
Http示例
POST /v2/contract/companysign HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的TimeStamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Content-Type: application/json
{
"contractId": "2591540368898105360",
"bizId": null,
"stampers": [
{
"type": "COMPANY",
"documentId": "2591542337725374704",
"sealId": "2566229349702860958",
"offsetX": "0.2",
"offsetY": "-0.2",
"keyword": "劳动",
"keywordIndex": "2"
},
{
"type": "TIMESTAMP",
"documentId": "2591542337725374704",
"sealId": "2566229349702860958",
"offsetX": "0.5",
"offsetY": "0.5",
"page": "1"
},
{
"type": "ACROSS_PAGE",
"documentId": "2591542337725374704",
"sealId": "2566229349702860958",
"offsetY": "0.5"
}
]
}
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 签署公章
SignParam param = new SignParam();
param.setContractId(2589394742435041330L);
ContractSignCompanyRequest request = new ContractSignCompanyRequest(param);
String response = sdkClient.service(request);
SdkResponse<Object> responseObj = JSONUtils.toQysResponse(response);
if(responseObj.getCode() == 0) {
logger.info("公章签署成功");
} else {
logger.info("公章签署失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
}
C#示例
// 初始化sdkClient
string serverUrl = "http://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
// 组装签署请求
ContractSignCompanyRequest request = new ContractSignCompanyRequest();
request.ContractId = "2589012016299597907";
// 公章签署位置
Stamper stamper1 = new Stamper();
stamper1.Type = "COMPANY";
stamper1.DocumentId = "2589013696294510740";
stamper1.OffsetX = 0.0;
stamper1.OffsetY = 0.01;
stamper1.Keyword = "核对人";
stamper1.SealId = "2566547701649482059";
request.AddStampers(stamper1);
// 时间戳签署位置
Stamper stamper3 = new Stamper();
stamper3.Type = "TIMESTAMP";
stamper3.DocumentId = "2589013696294510740";
stamper3.OffsetX = 0.0;
stamper3.OffsetY = 0.01;
stamper3.Keyword = "核对单位盖章";
request.AddStampers(stamper3);
// 公章签署位置
Stamper stamper2 = new Stamper();
stamper2.Type = "COMPANY";
stamper2.DocumentId = "2589013696294510740";
stamper2.OffsetX = 0.2;
stamper2.OffsetY = 0.4;
stamper2.Page = 1;
stamper2.SealId = "2566547701649482059";
request.AddStampers(stamper2);
// 骑缝章签署位置
Stamper stamper4 = new Stamper();
stamper4.Type = "ACROSS_PAGE";
stamper4.DocumentId = "2589013583094440075";
stamper4.OffsetY = 0.4;
stamper4.SealId = "2566547701649482059";
request.AddStampers(stamper4);
string response = null;
try
response = client.Service(request);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// 解析返回内容
SdkResponse<Object> responseObject = HttpJsonConvert.DeserializeResponse<Object>(response);
Console.WriteLine(HttpJsonConvert.SerializeObject(responseObject));
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$contractCompanySignRequest = new ContractCompanySignRequest();
$contractCompanySignRequest->setContractId('2590758386643734529');
$contractCompanySignRequest->setBizId("1111111");
/\*\*公章签署\*\*/
$stamper1 = new Stamper();
$stamper1->setType('COMPANY');
$stamper1->setDocumentId('2590764888637018192');
$stamper1->setSealId('2555244623418466517');
$stamper1->setKeyword('劳动');
$stamper1->setKeywordIndex('2');
$stamper1->setOffsetX('0.2');
$stamper1->setOffsetY('-0.2');
/\*\*时间戳签署\*\*/
$stamper2 = new Stamper();
$stamper2->setType('TIMESTAMP');
$stamper2->setDocumentId('2590764888637018192');
$stamper2->setPage('1');
$stamper2->setOffsetX('0.5');
$stamper2->setOffsetY('0.5');
/\*\*骑缝章签署\*\*/
$stamper3 = new Stamper();
$stamper3->setType('ACROSS_PAGE');
$stamper3->setDocumentId('2590764888637018192');
$stamper3->setSealId('2555244623418466517');
$stamper3->setOffsetY('0.5');
$stampers = array();
array_push($stampers, $stamper1);
array_push($stampers, $stamper2);
$contractCompanySignRequest->setStampers($stampers);
$result = $sdkClient->service($contractCompanySignRequest);
print_r($result);
return $result;
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
seal_signParam = SignParam()
seal_signParam.set_contractId(draft_contractid)
# 指定签署位置 - 公章签署位置
seal_companyStamper = Stamper()
seal_companyStamper.set_documentId(file_documentId)
seal_companyStamper.set_sealId('2490828768980361630')
seal_companyStamper.set_type('COMPANY')
seal_companyStamper.set_offsetX(0.3)
seal_companyStamper.set_offsetY(0.5)
seal_companyStamper.set_page(1)
# 指定签署位置 - 时间戳签署位置
time_companyStamper = Stamper()
time_companyStamper.set_documentId(file_documentId)
time_companyStamper.set_type('TIMESTAMP')
time_companyStamper.set_offsetX(0.5)
time_companyStamper.set_offsetY(0.3)
time_companyStamper.set_page(1)
# 指定签署位置 - 骑缝章签署位置(文档页数大于1页才会生效)
acrosspage_companyStamper = Stamper()
acrosspage_companyStamper.set_documentId(file_documentId)
acrosspage_companyStamper.set_sealId('2490828768980361630')
acrosspage_companyStamper.set_type('ACROSS_PAGE')
acrosspage_companyStamper.set_offsetY(0.7)
seal_signParam.set_stampers([seal_companyStamper, time_companyStamper, acrosspage_companyStamper])
sealsign_response = sdkClient.request(ContractSignCompanyRequest(seal_signParam))
# 解析返回参数
sealsign_mapper = json.loads(sealsign_response)
if sealsign_mapper['code'] != 0:
raise Exception('公章签署失败,失败原因:', sealsign_mapper['message'])
print('公章签署成功')
2 签署法人章
请求地址:/v2/contract/legalpersonsign
请求方法:POST
请求格式:application/json;charset=UTF-8
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 签署方名称,若以子公司身份签署,需要传递子公司全名 |
stampers | Stamper | 否 | 指定签署位置 |
Stamper(签署位置):
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
type | String | 是 | 签署类型: LP(法人章),TIMESTAMP(时间戳) |
documentId | String | 是 | 合同文档ID |
keyword | String | 否 | 关键字 |
keywordIndex | Integer | 否 | 关键字索引:1代表第1个关键字, 0代码所有关键字,-1代表倒数第1个关键字;默认为1 |
page | Integer | 否 | 坐标页码,0代表所有 |
offsetX | Decimal | 否 | 横坐标/关键字偏移量 |
offsetY | Decimal | 否 | 纵坐标/关键字偏移量 |
返回参数:
参数 | 类型 | 描述 |
---|---|---|
code | Integer | 响应码 |
message | String | 响应消息 |
响应码(全局响应码请查看文档末“全局响应码”):
响应码 | 描述 |
---|---|
1106 | INVALID_STAMPER_TYPE,无效的签章类型;签署法人章支持的签章类型如下: LP(法人章),TIMESTAMP(时间戳)。 |
1107 | NOT SIGN STEP,未挨到签署; 未挨到公司签署法人章或者没有签署法人章节点。 |
1109 | SIGN PAGE BEYOND,签署页码超出文档页数; 签署位置中的页码超出文档页数。 |
1201 | SEAL NOT FOUND,找不到法人章; 请确保在契约锁已维护法人章。 |
请求示例:
Http示例
POST /v2/contract/legalpersonsign HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的TimeStamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Content-Type: application/json
{
"contractId": "2591540368898105360",
"bizId": null,
"stampers": [
{
"type": "LP",
"documentId": "2591542337725374704",
"offsetX": "0.1",
"offsetY": "-0.1",
"keyword": "劳动",
"keywordIndex": "2"
},
{
"type": "LP",
"documentId": "2591542337725374704",
"offsetX": "0.5",
"offsetY": "0.5",
"page": "1"
}
]
}
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 签署法人章
SignParam param = new SignParam();
param.setContractId(2589394742435041330L);
ContractSignLpRequest request = new ContractSignLpRequest(param);
String response = sdkClient.service(request);
SdkResponse<Object> responseObj = JSONUtils.toQysResponse(response);
if(responseObj.getCode() == 0) {
logger.info("法人章签署成功");
} else {
logger.info("法人章签署失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
}
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
ContractSignLPRequest request = new ContractSignLPRequest();
request.ContractId = "2589012016299597907";
//法人章签署位置
Stamper stamper1 = new Stamper();
stamper1.Type = "LP";
stamper1.DocumentId = "2589013696294510740";
stamper1.OffsetX = 0.06;
stamper1.OffsetY = 0.01;
stamper1.Keyword = "核对人";
request.AddStampers(stamper1);
//时间戳签署位置
Stamper stamper3 = new Stamper();
stamper3.Type = "TIMESTAMP";
stamper3.DocumentId = "2589013696294510740";
stamper3.OffsetX = 0.06;
stamper3.OffsetY = 0.01;
stamper3.Keyword = "核对单位盖章";
request.AddStampers(stamper3);
//法人章签署位置
Stamper stamper2 = new Stamper();
stamper2.Type = "LP";
stamper2.DocumentId = "2589013583094440075";
stamper2.OffsetX = 0.2;
stamper2.OffsetY = 0.4;
stamper2.Page = 1;
request.AddStampers(stamper2);
string response = null;
try
{
response = client.Service(request);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// 解析返回内容
SdkResponse<Object> responseObject = HttpJsonConvert.DeserializeResponse<Object>(response);
Console.WriteLine(HttpJsonConvert.SerializeObject(responseObject));
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$contractLpSignRequest = new ContractLpSignRequest();
$contractLpSignRequest->setContractId('2590804900506210559');
$contractLpSignRequest->setBizId("1111111");
/\*\*关键字定位\*\*/
$stamper1 = new Stamper();
$stamper1->setType('LP');
$stamper1->setDocumentId('2590805031263637783');
$stamper1->setKeyword('劳动');
$stamper1->setKeywordIndex('2');
$stamper1->setOffsetX('0.1');
$stamper1->setOffsetY('-0.1');
/\*\*坐标定位\*\*/
$stamper2 = new Stamper();
$stamper2->setType('LP');
$stamper2->setDocumentId('2590805031263637783');
$stamper2->setPage('1');
$stamper2->setOffsetX('0.5');
$stamper2->setOffsetY('0.5');
$stampers = array();
array_push($stampers, $stamper1);
array_push($stampers, $stamper2);
$contractLpSignRequest->setStampers($stampers);
$result = $sdkClient->service($contractLpSignRequest);
print_r($result);
return $result;
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret
lp_signParam = SignParam()
lp_signParam.set_contractId(draft_contractid)
# 指定签署位置 - 法人章
seal_lpStamper = Stamper()
seal_lpStamper.set_documentId(file_documentId)
seal_lpStamper.set_type('LP')
seal_lpStamper.set_offsetX(0.6)
seal_lpStamper.set_offsetY(0.1)
seal_lpStamper.set_page(1)
# 指定签署位置 - 时间戳
time_lpStamper = Stamper()
time_lpStamper.set_documentId(file_documentId)
time_lpStamper.set_type('TIMESTAMP')
time_lpStamper.set_offsetY(0.9)
time_lpStamper.set_offsetX(0.8)
time_lpStamper.set_page(1)
lp_signParam.set_stampers([seal_lpStamper, time_lpStamper])
lp_response = sdkClient.request(ContractSignLpRequest(lp_signParam))
# 解析返回数据
lp_mapper = json.loads(lp_response)
if lp_mapper['code'] != 0:
raise Exception('法人章签署失败,失败原因:', lp_mapper['message'])
print('法人章签署完成')
3 审批
请求地址:/v2/contract/employeeaudit
请求方法:POST
请求格式:application/json;charset=UTF-8
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 签署方名称,若以子公司身份签署,需要传递子公司全名 |
pass | Bolean | 是 | 审批是否通过 |
comment | String | 否 | 审批意见 |
返回参数:
参数 | 类型 | 描述 |
---|---|---|
code | Integer | 响应码 |
message | String | 响应消息 |
响应码(全局响应码请查看文档末“全局响应码”):
响应码 | 描述 |
---|---|
1107 | NOT SIGN STEP,未挨到签署; 未挨到员工审批,或者没有员工审批节点。 |
请求示例:
Http示例
POST /v2/contract/employeeaudit HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的TimeStamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Content-Type: application/json
{
"contractId": "2591540368898105360",
"bizId": null,
"pass": true,
"comment": "同意"
}
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 审批
ContractAuditRequest request = new ContractAuditRequest(contractId, true, "审批通过");
String response = sdkClient.service(request);
SdkResponse<Object> responseObj = JSONUtils.toQysResponse(response);
if(responseObj.getCode() == 0) {
logger.info("审批成功");
} else {
logger.info("请求失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
}
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
// 组装员工审批请求
ContractAuditRequest request = new ContractAuditRequest("2589012016299597907",true, "审批通过");
string response = null;
try
{
response = client.Service(request);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// 解析返回内容
SdkResponse<Object> responseObject = HttpJsonConvert.DeserializeResponse<Object>(response);
if (!responseObject.Code.Equals(0))
{
throw new Exception("员工审批失败,失败原因:" + responseObject.Message);
}
Console.WriteLine(“员工审批成功”);
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$contractAuditRequest = new ContractAuditRequest();
$contractAuditRequest->setContractId('2590804900506210559');
$contractAuditRequest->setPass(true);
$contractAuditRequest->setComment('同意');
$result = $sdkClient->service($contractAuditRequest);
print_r($result);
return $result;
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
# 合同审批
audit_response = sdkClient.request(ContractAuditRequest(draft_contractid, True, '符合要求,审核通过'))
# 解析返回数据
audit_mapper = json.loads(audit_response)
if audit_mapper['code'] != 0:
raise Exception('审批合同失败,失败原因:', audit_mapper['message'])
print('合同审批成功')
4 合同催签
请求地址:/v2/contract/notice
请求方法:POST
请求格式:application/json;charset=UTF-8
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 子公司名称,若使用业务ID催签,且合同是以子公司身份创建的,则需要传递该值,用于确定合同主体 |
signatoryId | String | 否 | 签署方ID |
返回参数:
参数 | 类型 | 描述 |
---|---|---|
code | Integer | 响应码 |
message | String | 响应消息 |
请求示例:
Http示例
POST /v2/contract/notice HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的TimeStamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Content-Type: application/json
{
"contractId": "2591540368898105360",
"bizId": "123456789",
"signatoryId": "2591540371314024472"
}
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 合同催签
ContractNoticeRequest request = new ContractNoticeRequest(contractId);
String response = sdkClient.service(request);
SdkResponse responseObj = JSONUtils.toQysResponse(response);
if(responseObj.getCode() == 0) {
logger.info("合同催签成功");
} else {
logger.info("请求失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
}
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
ContractNoticeRequest request = new ContractNoticeRequest();
request.ContractId = "2588924049895063561";
string response = null;
try
{
response = client.Service(request);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// 解析返回内容
SdkResponse<Object> responseObject = HttpJsonConvert.DeserializeResponse<Object>(response);
if (!responseObject.Code.Equals(0))
{
throw new Exception("合同催签失败,失败原因:" + responseObject.Message);
}
Console.WriteLine(“合同催签成功”);
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$contractNoticeRequest = new ContractNoticeRequest();
$contractNoticeRequest->setContractId('2590804900506210559');
$contractNoticeRequest->setBizId('123456789');
$contractNoticeRequest->setSignatoryId('2590804962716127509');
$result = $sdkClient->service($contractNoticeRequest);
print_r($result);
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
# 签署通知
notice_request = ContractNoticeRequest()
notice_request.set_contractId('2589643804158468448')
notice_response = sdkClient.request(notice_request)
print('发送签署通知成功:\n', str(notice_response), '\n')
5 撤回/作废合同
描述:调用此接口撤回/作废合同。
合同是“草稿”状态时,删除合同; 合同是“签署中”状态时,撤回合同,合同变为“已撤回”状态; 合同是“已完成”状态时,作废合同(作废合同需要所有签署方签署作废文件后,作废完成),同时在作废文件上签署发起方公章。
请求地址:/v2/contract/invalid
请求方法:POST
请求格式:application/json;charset=UTF-8
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 子公司名称,若使用业务ID撤回作废合同,且合同是以子公司身份创建的,则需要传递该值,用于确定合同主体 |
sealId | String | 否 | 印章ID,发起方签署作废文件时指定的印章,作废合同时使用。当发起方未签署时必须传。若发起方已签署,不传则默认取发起方印章ID |
reason | String | 否 | 撤回/作废原因 |
deleteDoc | Boolean | 否 | 作废完成后是否删除合同文件,默认false |
返回参数:
参数 | 类型 | 描述 |
---|---|---|
code | Integer | 响应码 |
message | String | 响应消息 |
响应码(全局响应码请查看文档末“全局响应码”):
响应码 | 描述 |
---|---|
1101 | INVALID CONTRACT STATUS,无效的合同状态;以下是支持的合同状态及对应操作: DRAFT(草稿):删除合同; FILLING(填参中),SIGNING(签署中):撤回合同; COMPLETE(已完成):发起作废、并签署发起方。 |
请求示例:
Http示例
POST /v2/contract/invalid HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的TimeStamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Content-Type: application/json
{
"contractId": "2591540368898105360",
"bizId": "123456789",
"sealId": "2589678690921123947",
"reason": "作废",
"deleteDoc": false
}
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// “签署中”状态下撤回合同
ContractInvalidRequest request = new ContractInvalidRequest(2589413512234848660L, "撤回合同");
String response = sdkClient.service(request);
SdkResponse responseObj = JSONUtils.toQysResponse(response);
if(responseObj.getCode() == 0) {
logger.info("合同撤回成功");
} else {
logger.info("请求失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
}
// “已完成”状态下请求作废合同,同时发起方签署作废合同
// ContractInvalidRequest request = new ContractInvalidRequest(2589382258757710050L, null, "请求作废合同", false);
// String response = sdkClient.service(request);
// SdkResponse responseObj = JSONUtils.toQysResponse(response);
// if(responseObj.getCode() == 0) {
// logger.info("合同作废请求成功");
// } else {
// logger.info("请求失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
// }
// “草稿”状态下删除合同
// ContractInvalidRequest request = new ContractInvalidRequest(2589382258757710050L);
// String response = sdkClient.service(request);
// SdkResponse responseObj = JSONUtils.toQysResponse(response);
// if(responseObj.getCode() == 0) {
// logger.info("合同删除请求成功");
// } else {
// logger.info("请求失败,错误码:{},错误信息:{}", responseObj.getCode(), responseObj.getMessage());
// }
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
//“签署中”状态下撤回合同,“已完成”状态下请求作废合同,同时发起方签署作废合同
// “草稿”状态下删除合同
ContractInvalidRequest request = new ContractInvalidRequest();
request.ContractId = "2588924049895063561";
request.Reason = "不符合预期";
string response = null;
try
{
response = client.Service(request);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// 解析返回内容
SdkResponse<Object> responseObject = HttpJsonConvert.DeserializeResponse<Object>(response);
if (!responseObject.Code.Equals(0))
{
throw new Exception("合同撤回,作废失败,失败原因:" + responseObject.Message);
}
Console.WriteLine(“合同撤回,作废成功”);
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$contractInvalidRequest = new ContractInvalidRequest();
$contractInvalidRequest->setContractId('2590804900506210559');
$contractInvalidRequest->setBizId('123456789');
$contractInvalidRequest->setSealId('2589678690921123947');
$contractInvalidRequest->setReason('作废');
$contractInvalidRequest->setDeleteDoc(false);
$result = $sdkClient->service($contractInvalidRequest);
print_r($result);
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
# “签署中”状态下撤回合同,“已完成”状态下请求作废合同,同时发起方签署作废合同
# “草稿”状态下删除合同
invalid_request = ContractInvalidRequest()
invalid_request.set_contractId('2589643804158468448')
invalid_request.set_reason('python invalid')
invalid_response = sdkClient.request(invalid_request)
print('作废成功:\n', str(invalid_response), '\n')