Api.py 4.1 KB

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