Api.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #coding=utf-8
  2. import HttpUtils
  3. # 添加用户 https://{host}/user/addPersonalUser
  4. def addPerson(inputData):
  5. # 从输入数据中获取调用接口
  6. account = inputData["account"]
  7. name = inputData["name"]
  8. mobile = inputData["mobile"]
  9. idCard = inputData["idCard"]
  10. idCardType = inputData["idCardType"]
  11. appId = inputData["appId"]
  12. appKey = inputData["appKey"]
  13. apiUrl = inputData["apiUrl"]
  14. # 组装参数
  15. reqBodyData = {
  16. "account": account,
  17. "idCard": idCard,
  18. "idCardType": idCardType,
  19. "identifyMobile": mobile,
  20. "identifyType": 2,
  21. "mobile": mobile,
  22. "name": name,
  23. "isNotice": 1
  24. }
  25. #请求地址
  26. # url = "https://prev.asign.cn/user/addPersonalUser"
  27. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  28. return Result
  29. # 上传待签署文件 https://{host}/contract/createContract
  30. def createContract(inputData):
  31. # 从输入数据中获取调用接口
  32. contractNo = inputData["contractNo"]
  33. contractName = inputData["contractName"]
  34. validityTime = inputData["validityTime"]
  35. signOrder = inputData["signOrder"]
  36. templates = inputData["templates"]
  37. notifyUrl = inputData["notifyUrl"]
  38. appId = inputData["appId"]
  39. appKey = inputData["appKey"]
  40. apiUrl = inputData["apiUrl"]
  41. # 组装参数
  42. reqBodyData = {
  43. "contractNo": contractNo,
  44. "contractName": contractName,
  45. "validityTime": validityTime,
  46. "signOrder": signOrder,
  47. "templates": templates,
  48. "notifyUrl": notifyUrl
  49. }
  50. #请求地址
  51. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  52. return Result
  53. # 添加签署方 https://{host}/contract/addSigner
  54. def addSigner(inputData):
  55. # 从输入数据中获取调用接口
  56. contractNo = inputData["contractNo"]
  57. account = inputData["account"]
  58. signType = inputData["signType"]
  59. signStrategyList = inputData["signStrategyList"]
  60. validateType = inputData["validateType"]
  61. appId = inputData["appId"]
  62. appKey = inputData["appKey"]
  63. apiUrl = inputData["apiUrl"]
  64. # 组装参数
  65. reqBodyData = [{
  66. "contractNo": contractNo,
  67. "account": account,
  68. "signType": signType,
  69. "validateType": validateType,
  70. "signStrategyList": signStrategyList
  71. }]
  72. #请求地址
  73. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  74. return Result
  75. # 下载合同 https://{host}/contract/downloadContract
  76. def downloadContract(inputData):
  77. # 从输入数据中获取调用接口
  78. contractNo = inputData["contractNo"]
  79. # downloadFileType = inputData["downloadFileType"]
  80. appId = inputData["appId"]
  81. appKey = inputData["appKey"]
  82. apiUrl = inputData["apiUrl"]
  83. # 组装参数
  84. reqBodyData = {
  85. "contractNo": contractNo
  86. # "downloadFileType": downloadFileType
  87. }
  88. #请求地址
  89. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  90. return Result
  91. # 查询合同状态 https://{host}/contract/status
  92. def contractStatus(inputData):
  93. # 从输入数据中获取调用接口
  94. contractNo = inputData["contractNo"]
  95. appId = inputData["appId"]
  96. appKey = inputData["appKey"]
  97. apiUrl = inputData["apiUrl"]
  98. # 组装参数
  99. reqBodyData = {
  100. "contractNo": contractNo
  101. }
  102. #请求地址
  103. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  104. return Result
  105. # 个人意愿核身认证 https://{host}/auth/person/willFace
  106. def willFace(inputData):
  107. # 从输入数据中获取调用接口
  108. realName = inputData["realName"]
  109. idCardNo = inputData["idCardNo"]
  110. question = inputData["question"]
  111. answer = inputData["answer"]
  112. redirectUrl = inputData["redirectUrl"]
  113. appId = inputData["appId"]
  114. appKey = inputData["appKey"]
  115. apiUrl = inputData["apiUrl"]
  116. # 组装参数
  117. reqBodyData = {
  118. "realName": realName,
  119. "idCardNo": idCardNo,
  120. "question": question,
  121. "answer": answer,
  122. "redirectUrl": redirectUrl,
  123. }
  124. #请求地址
  125. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  126. return Result