Api.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. 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. "signOrder": signOrder,
  45. "templates": templates,
  46. "notifyUrl": notifyUrl
  47. }
  48. #请求地址
  49. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  50. return Result
  51. # 添加签署方 https://{host}/contract/addSigner
  52. def addSigner(inputData):
  53. # 从输入数据中获取调用接口
  54. contractNo = inputData["contractNo"]
  55. account = inputData["account"]
  56. signStrategyList = inputData["signStrategyList"]
  57. appId = inputData["appId"]
  58. appKey = inputData["appKey"]
  59. apiUrl = inputData["apiUrl"]
  60. # 组装参数
  61. reqBodyData = [{
  62. "contractNo": contractNo,
  63. "account": account,
  64. "signStrategyList": signStrategyList
  65. }]
  66. #请求地址
  67. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  68. return Result
  69. # 下载合同 https://{host}/contract/downloadContract
  70. def downloadContract(inputData):
  71. # 从输入数据中获取调用接口
  72. contractNo = inputData["contractNo"]
  73. downloadFileType = inputData["downloadFileType"]
  74. appId = inputData["appId"]
  75. appKey = inputData["appKey"]
  76. apiUrl = inputData["apiUrl"]
  77. # 组装参数
  78. reqBodyData = {
  79. "contractNo": contractNo,
  80. "downloadFileType": downloadFileType
  81. }
  82. #请求地址
  83. Result = HttpUtils.HttpUtils.doPOST(apiUrl, reqBodyData, appId, appKey)
  84. return Result