IdentityParams.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class IdentityParams(object):
  6. def __init__(self):
  7. self._cert_no = None
  8. self._identity_hash = None
  9. self._sign_user_id = None
  10. self._user_name = None
  11. @property
  12. def cert_no(self):
  13. return self._cert_no
  14. @cert_no.setter
  15. def cert_no(self, value):
  16. self._cert_no = value
  17. @property
  18. def identity_hash(self):
  19. return self._identity_hash
  20. @identity_hash.setter
  21. def identity_hash(self, value):
  22. self._identity_hash = value
  23. @property
  24. def sign_user_id(self):
  25. return self._sign_user_id
  26. @sign_user_id.setter
  27. def sign_user_id(self, value):
  28. self._sign_user_id = value
  29. @property
  30. def user_name(self):
  31. return self._user_name
  32. @user_name.setter
  33. def user_name(self, value):
  34. self._user_name = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.cert_no:
  38. if hasattr(self.cert_no, 'to_alipay_dict'):
  39. params['cert_no'] = self.cert_no.to_alipay_dict()
  40. else:
  41. params['cert_no'] = self.cert_no
  42. if self.identity_hash:
  43. if hasattr(self.identity_hash, 'to_alipay_dict'):
  44. params['identity_hash'] = self.identity_hash.to_alipay_dict()
  45. else:
  46. params['identity_hash'] = self.identity_hash
  47. if self.sign_user_id:
  48. if hasattr(self.sign_user_id, 'to_alipay_dict'):
  49. params['sign_user_id'] = self.sign_user_id.to_alipay_dict()
  50. else:
  51. params['sign_user_id'] = self.sign_user_id
  52. if self.user_name:
  53. if hasattr(self.user_name, 'to_alipay_dict'):
  54. params['user_name'] = self.user_name.to_alipay_dict()
  55. else:
  56. params['user_name'] = self.user_name
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = IdentityParams()
  63. if 'cert_no' in d:
  64. o.cert_no = d['cert_no']
  65. if 'identity_hash' in d:
  66. o.identity_hash = d['identity_hash']
  67. if 'sign_user_id' in d:
  68. o.sign_user_id = d['sign_user_id']
  69. if 'user_name' in d:
  70. o.user_name = d['user_name']
  71. return o