| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- # -*- coding: UTF-8 -*-
- import esigntool
- import requests
- from esigntool import esign_run_print_outer
- # 套餐服务API - 套餐购买 - 购买类
- config = esigntool.Config() # 初始化配置类
- # 获取购买e签宝套餐链接
- @esign_run_print_outer
- def getBuyOrgOrderUrl(orgId, PsnId):
- """
- :param orgId:购买方企业账号
- :param PsnId:购买方企业经办人账号
- :return:请求响应
- """
- api_path = "/v3/orders/org-place-order-url"
- method = esigntool.httpMethodEnum.POST
- body = {
- "orgId": orgId, # 机构账号ID(购买方orgId)
- "transactorPsnId": PsnId, # 经办人个人账号ID(购买操作个人psnId)
- "redirectUrl": "https://www.baidu.com",
- "notifyUrl": "https://www.esign.cn/1",
- "customBizNum": "1111111" # 自定义编号
- }
- if orgId == "" or PsnId == "":
- print("请设置企业账号ID和经办人账号ID")
- exit()
- # 签名并构造签名鉴权json请求头
- json_headers = esigntool.buildSignJsonHeader(config.appId, config.scert, method, api_path, body=body)
- # 发起请求
- resp = requests.request(method, config.host + api_path, json=body, headers=json_headers)
- print(resp.text)
- return resp.text
- if __name__ == '__main__':
- if config.appId == "" or config.scert == "":
- print("请设置应用Appid和应用Secret")
- exit()
- orgId = "" # 请输入企业帐号ID
- PsnId = "" # 请输入个人帐号ID
- getBuyOrgOrderUrl(orgId, PsnId) # 获取购买e签宝套餐链接
|