Api.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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": 1,
  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. appId = inputData["appId"]
  61. appKey = inputData["appKey"]
  62. apiUrl = inputData["apiUrl"]
  63. # 组装参数
  64. reqBodyData = [{
  65. "contractNo": contractNo,
  66. "account": account,
  67. "signType": signType,
  68. "signStrategyList": signStrategyList
  69. }]
  70. #请求地址
  71. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  72. return Result
  73. # 下载合同 https://{host}/contract/downloadContract
  74. def downloadContract(inputData):
  75. # 从输入数据中获取调用接口
  76. contractNo = inputData["contractNo"]
  77. # downloadFileType = inputData["downloadFileType"]
  78. appId = inputData["appId"]
  79. appKey = inputData["appKey"]
  80. apiUrl = inputData["apiUrl"]
  81. # 组装参数
  82. reqBodyData = {
  83. "contractNo": contractNo
  84. # "downloadFileType": downloadFileType
  85. }
  86. #请求地址
  87. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  88. return Result