AntlawSignOperator.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class AntlawSignOperator(object):
  6. def __init__(self):
  7. self._cert_type = None
  8. self._operator_cert_no = None
  9. self._operator_name = None
  10. self._operator_uid = None
  11. self._sign_operator_type = None
  12. @property
  13. def cert_type(self):
  14. return self._cert_type
  15. @cert_type.setter
  16. def cert_type(self, value):
  17. self._cert_type = value
  18. @property
  19. def operator_cert_no(self):
  20. return self._operator_cert_no
  21. @operator_cert_no.setter
  22. def operator_cert_no(self, value):
  23. self._operator_cert_no = value
  24. @property
  25. def operator_name(self):
  26. return self._operator_name
  27. @operator_name.setter
  28. def operator_name(self, value):
  29. self._operator_name = value
  30. @property
  31. def operator_uid(self):
  32. return self._operator_uid
  33. @operator_uid.setter
  34. def operator_uid(self, value):
  35. self._operator_uid = value
  36. @property
  37. def sign_operator_type(self):
  38. return self._sign_operator_type
  39. @sign_operator_type.setter
  40. def sign_operator_type(self, value):
  41. self._sign_operator_type = value
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.cert_type:
  45. if hasattr(self.cert_type, 'to_alipay_dict'):
  46. params['cert_type'] = self.cert_type.to_alipay_dict()
  47. else:
  48. params['cert_type'] = self.cert_type
  49. if self.operator_cert_no:
  50. if hasattr(self.operator_cert_no, 'to_alipay_dict'):
  51. params['operator_cert_no'] = self.operator_cert_no.to_alipay_dict()
  52. else:
  53. params['operator_cert_no'] = self.operator_cert_no
  54. if self.operator_name:
  55. if hasattr(self.operator_name, 'to_alipay_dict'):
  56. params['operator_name'] = self.operator_name.to_alipay_dict()
  57. else:
  58. params['operator_name'] = self.operator_name
  59. if self.operator_uid:
  60. if hasattr(self.operator_uid, 'to_alipay_dict'):
  61. params['operator_uid'] = self.operator_uid.to_alipay_dict()
  62. else:
  63. params['operator_uid'] = self.operator_uid
  64. if self.sign_operator_type:
  65. if hasattr(self.sign_operator_type, 'to_alipay_dict'):
  66. params['sign_operator_type'] = self.sign_operator_type.to_alipay_dict()
  67. else:
  68. params['sign_operator_type'] = self.sign_operator_type
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = AntlawSignOperator()
  75. if 'cert_type' in d:
  76. o.cert_type = d['cert_type']
  77. if 'operator_cert_no' in d:
  78. o.operator_cert_no = d['operator_cert_no']
  79. if 'operator_name' in d:
  80. o.operator_name = d['operator_name']
  81. if 'operator_uid' in d:
  82. o.operator_uid = d['operator_uid']
  83. if 'sign_operator_type' in d:
  84. o.sign_operator_type = d['sign_operator_type']
  85. return o