SignTask.py 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.Principal import Principal
  6. class SignTask(object):
  7. def __init__(self):
  8. self._biz_data = None
  9. self._biz_id = None
  10. self._cb_type = None
  11. self._cb_url = None
  12. self._cert_sign_type = None
  13. self._enter_type = None
  14. self._principal_list = None
  15. self._signer_type = None
  16. self._task_expire = None
  17. @property
  18. def biz_data(self):
  19. return self._biz_data
  20. @biz_data.setter
  21. def biz_data(self, value):
  22. self._biz_data = value
  23. @property
  24. def biz_id(self):
  25. return self._biz_id
  26. @biz_id.setter
  27. def biz_id(self, value):
  28. self._biz_id = value
  29. @property
  30. def cb_type(self):
  31. return self._cb_type
  32. @cb_type.setter
  33. def cb_type(self, value):
  34. self._cb_type = value
  35. @property
  36. def cb_url(self):
  37. return self._cb_url
  38. @cb_url.setter
  39. def cb_url(self, value):
  40. self._cb_url = value
  41. @property
  42. def cert_sign_type(self):
  43. return self._cert_sign_type
  44. @cert_sign_type.setter
  45. def cert_sign_type(self, value):
  46. self._cert_sign_type = value
  47. @property
  48. def enter_type(self):
  49. return self._enter_type
  50. @enter_type.setter
  51. def enter_type(self, value):
  52. self._enter_type = value
  53. @property
  54. def principal_list(self):
  55. return self._principal_list
  56. @principal_list.setter
  57. def principal_list(self, value):
  58. if isinstance(value, list):
  59. self._principal_list = list()
  60. for i in value:
  61. if isinstance(i, Principal):
  62. self._principal_list.append(i)
  63. else:
  64. self._principal_list.append(Principal.from_alipay_dict(i))
  65. @property
  66. def signer_type(self):
  67. return self._signer_type
  68. @signer_type.setter
  69. def signer_type(self, value):
  70. self._signer_type = value
  71. @property
  72. def task_expire(self):
  73. return self._task_expire
  74. @task_expire.setter
  75. def task_expire(self, value):
  76. self._task_expire = value
  77. def to_alipay_dict(self):
  78. params = dict()
  79. if self.biz_data:
  80. if hasattr(self.biz_data, 'to_alipay_dict'):
  81. params['biz_data'] = self.biz_data.to_alipay_dict()
  82. else:
  83. params['biz_data'] = self.biz_data
  84. if self.biz_id:
  85. if hasattr(self.biz_id, 'to_alipay_dict'):
  86. params['biz_id'] = self.biz_id.to_alipay_dict()
  87. else:
  88. params['biz_id'] = self.biz_id
  89. if self.cb_type:
  90. if hasattr(self.cb_type, 'to_alipay_dict'):
  91. params['cb_type'] = self.cb_type.to_alipay_dict()
  92. else:
  93. params['cb_type'] = self.cb_type
  94. if self.cb_url:
  95. if hasattr(self.cb_url, 'to_alipay_dict'):
  96. params['cb_url'] = self.cb_url.to_alipay_dict()
  97. else:
  98. params['cb_url'] = self.cb_url
  99. if self.cert_sign_type:
  100. if hasattr(self.cert_sign_type, 'to_alipay_dict'):
  101. params['cert_sign_type'] = self.cert_sign_type.to_alipay_dict()
  102. else:
  103. params['cert_sign_type'] = self.cert_sign_type
  104. if self.enter_type:
  105. if hasattr(self.enter_type, 'to_alipay_dict'):
  106. params['enter_type'] = self.enter_type.to_alipay_dict()
  107. else:
  108. params['enter_type'] = self.enter_type
  109. if self.principal_list:
  110. if isinstance(self.principal_list, list):
  111. for i in range(0, len(self.principal_list)):
  112. element = self.principal_list[i]
  113. if hasattr(element, 'to_alipay_dict'):
  114. self.principal_list[i] = element.to_alipay_dict()
  115. if hasattr(self.principal_list, 'to_alipay_dict'):
  116. params['principal_list'] = self.principal_list.to_alipay_dict()
  117. else:
  118. params['principal_list'] = self.principal_list
  119. if self.signer_type:
  120. if hasattr(self.signer_type, 'to_alipay_dict'):
  121. params['signer_type'] = self.signer_type.to_alipay_dict()
  122. else:
  123. params['signer_type'] = self.signer_type
  124. if self.task_expire:
  125. if hasattr(self.task_expire, 'to_alipay_dict'):
  126. params['task_expire'] = self.task_expire.to_alipay_dict()
  127. else:
  128. params['task_expire'] = self.task_expire
  129. return params
  130. @staticmethod
  131. def from_alipay_dict(d):
  132. if not d:
  133. return None
  134. o = SignTask()
  135. if 'biz_data' in d:
  136. o.biz_data = d['biz_data']
  137. if 'biz_id' in d:
  138. o.biz_id = d['biz_id']
  139. if 'cb_type' in d:
  140. o.cb_type = d['cb_type']
  141. if 'cb_url' in d:
  142. o.cb_url = d['cb_url']
  143. if 'cert_sign_type' in d:
  144. o.cert_sign_type = d['cert_sign_type']
  145. if 'enter_type' in d:
  146. o.enter_type = d['enter_type']
  147. if 'principal_list' in d:
  148. o.principal_list = d['principal_list']
  149. if 'signer_type' in d:
  150. o.signer_type = d['signer_type']
  151. if 'task_expire' in d:
  152. o.task_expire = d['task_expire']
  153. return o